当前位置: 首页>>代码示例>>Java>>正文


Java Server.getPort方法代码示例

本文整理汇总了Java中cn.nukkit.Server.getPort方法的典型用法代码示例。如果您正苦于以下问题:Java Server.getPort方法的具体用法?Java Server.getPort怎么用?Java Server.getPort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cn.nukkit.Server的用法示例。


在下文中一共展示了Server.getPort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: QueryRegenerateEvent

import cn.nukkit.Server; //导入方法依赖的package包/类
public QueryRegenerateEvent(Server server, int timeout) {
    this.timeout = timeout;
    this.serverName = server.getMotd();
    this.listPlugins = (boolean) server.getConfig("settings.query-plugins", true);
    this.plugins = server.getPluginManager().getPlugins().values().toArray(new Plugin[server.getPluginManager().getPlugins().values().size()]);
    List<Player> players = new ArrayList<>();
    for (Player player : server.getOnlinePlayers().values()) {
        if (player.isOnline()) {
            players.add(player);
        }
    }
    this.players = players.toArray(new Player[players.size()]);

    this.gameType = (server.getGamemode() & 0x01) == 0 ? "SMP" : "CMP";
    this.version = server.getVersion();
    this.server_engine = server.getName() + " " + server.getNukkitVersion();
    this.map = server.getDefaultLevel() == null ? "unknown" : server.getDefaultLevel().getName();
    this.numPlayers = this.players.length;
    this.maxPlayers = server.getMaxPlayers();
    this.whitelist = server.hasWhitelist() ? "on" : "off";
    this.port = server.getPort();
    this.ip = server.getIp();
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:24,代码来源:QueryRegenerateEvent.java

示例2: QueryRegenerateEvent

import cn.nukkit.Server; //导入方法依赖的package包/类
public QueryRegenerateEvent(Server server, int timeout) {
    this.timeout = timeout;
    this.serverName = server.getMotd();
    this.listPlugins = (boolean) server.getConfig("settings.query-plugins", true);
    this.plugins = server.getPluginManager().getPlugins().values().toArray(new Plugin[server.getPluginManager().getPlugins().values().size()]);
    List<Player> players = new ArrayList<>();
    for (Player player : server.getOnlinePlayers().values()) {
        if (player.isOnline()) {
            players.add(player);
        }
    }
    this.players = players.toArray(new Player[players.size()]);

    this.gameType = (server.getDefaultGamemode() & 0x01) == 0 ? "SMP" : "CMP";
    this.version = server.getVersion();
    this.server_engine = server.getName() + " " + server.getNukkitVersion();
    this.map = server.getDefaultLevel() == null ? "unknown" : server.getDefaultLevel().getName();
    this.numPlayers = this.players.length;
    this.maxPlayers = server.getMaxPlayers();
    this.whitelist = server.hasWhitelist() ? "on" : "off";
    this.port = server.getPort();
    this.ip = server.getIp();
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:24,代码来源:QueryRegenerateEvent.java


注:本文中的cn.nukkit.Server.getPort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。