Java 类org.bukkit.event.server.ServerListPingEvent 实例源码

项目:ColorMOTD    文件:MotdListener.java   
@EventHandler(ignoreCancelled = true)
public void onMotd(ServerListPingEvent event) {
    MotdProvider provider = service.getProvider();
    if (provider != null && provider.isEnabled()) {
        String motd = provider.provideMotd();
        if (motd != null) {
            event.setMotd(motd);
        }

        MotdServerIcon serverIcon = provider.provideServerIcon();
        if (serverIcon != null) {
            event.setServerIcon(BukkitMotdServerIcon.wrap(serverIcon)
                    .toCachedServerIcon());
        }
    }
}
项目:FlexMC    文件:ClientRequestStatusListener.java   
@Override
public void handle( ConnectionHandler connectionHandler, MessageC00RequestStatus message ) {
    JsonObject version = new JsonObject();
    version.addProperty( "name", "1.12.1" );
    version.addProperty( "protocol", 338 );
    JsonObject players = new JsonObject();
    FlexServer server = Flex.getServer();
    ServerListPingEvent event = EventFactory.call( new ServerListPingEvent( connectionHandler.getSocketAddress().getAddress(), server.getConfig().getServerName(), server.getPlayerManager().getOnlinePlayers().size(), server.getConfig().getMaxPlayers() ) );
    players.addProperty( "max", event.getMaxPlayers() );
    players.addProperty( "online", event.getNumPlayers() );
    JsonObject description = new JsonObject();
    description.addProperty( "text", event.getMotd() );
    JsonObject o = new JsonObject();
    o.add( "version", version );
    o.add( "players", players );
    o.add( "description", description );

    connectionHandler.sendMessage( new MessageS00ResponseStatus( Flex.getGson().toJson( o ) ) );

}
项目:GamePlate    文件:MotdModule.java   
@EventHandler(priority = EventPriority.LOWEST)
public void onServerListPing(ServerListPingEvent event) {
    String name = GameHandler.getGameHandler().getMatch().getCurrentMap().getMap().getName();
    ChatColor color = ChatColor.GRAY;
    switch (GameHandler.getGameHandler().getMatch().getMatchState()) {
        case ENDED:
            color = ChatColor.AQUA;
            break;
        case PLAYING:
            color = ChatColor.GOLD;
            break;
        case STARTING:
            color = ChatColor.GREEN;
            break;
    }
    event.setMotd(color + "\u00BB " + ChatColor.AQUA + name + color + " \u00AB" +
            (!Config.motd.equals("") ? "\n" + ChatColor.translateAlternateColorCodes('`', Config.motd) : ""));

}
项目:BetterShards    文件:MercuryManager.java   
public static void initializeChannelsAndPing() {
    registerMercuryChannels();
    Bukkit.getScheduler().runTaskTimer(BetterShardsPlugin.getInstance(), new Runnable() {

        @Override
        public void run() {
            InetAddress address = null;
            try {
                address = InetAddress.getByName("127.0.0.1");
            } catch (UnknownHostException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            ServerListPingEvent event = new ServerListPingEvent(address, Bukkit.getMotd(), Bukkit.getOnlinePlayers().size(),
                    Bukkit.getMaxPlayers());
            Bukkit.getPluginManager().callEvent(event);
            sendPlayerCount(event.getMaxPlayers());
        }

    }, 100, 100);
}
项目:EpicSpleef    文件:ServerListPingListener.java   
@EventHandler
public void onServerListPing(ServerListPingEvent event) {
    FileConfiguration config = SpleefMain.getInstance().getBungeeConfigAccessor().getConfig();
    if (config.getBoolean("supportBungeecord")) {
        if (config.getBoolean("epicSpleefBungee.enabled")) {
            String name = config.getString("instantJoinLobbyOrArena");
            for (SpleefArena arena : SpleefArena.getSpleefArenas()) {
                if (arena.getName().equals(name)) {
                    String[] lines = arena.getSignText();
                    for (int i = 0; i < lines.length; i++) {
                        if (lines[i] == null) {
                            lines[i] = "";
                        }
                        lines[i] = lines[i].replace("=!=", "");
                    }
                    event.setMotd(lines[0] + "=!=" + lines[1] + "=!=" + lines[2] + "=!=" + lines[3]);
                    return;
                }
            }
        }
    }
}
项目:Cardinal-Plus    文件:MOTD.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void onServerListPing(ServerListPingEvent event) {
    try {
        String name = match.getLoadedMap().getName();
        if (match.getState() == MatchState.ENDED) {
            event.setMotd(ChatColor.RED + "\u00BB " + ChatColor.AQUA + name + ChatColor.RED + " \u00AB");
        } else if (match.getState() == MatchState.PLAYING) {
            event.setMotd(ChatColor.GOLD + "\u00BB " + ChatColor.AQUA + name + ChatColor.GOLD + " \u00AB");
        } else if (match.getState() == MatchState.STARTING) {
            event.setMotd(ChatColor.GREEN + "\u00BB " + ChatColor.AQUA + name + ChatColor.GREEN + " \u00AB");
        } else {
            event.setMotd(ChatColor.GRAY + "\u00BB " + ChatColor.AQUA + name + ChatColor.GRAY + " \u00AB");
        }
    } catch (NullPointerException ex) {

    }
}
项目:CanaryBukkit    文件:CanaryServerListener.java   
@HookHandler(priority = Priority.CRITICAL)
public void onServerListPing(final ServerListPingHook hook) {
    server.getPluginManager().callEvent(
            new ServerListPingEvent(hook.getRequesterAddress(), hook.getMotd().getFullText(), hook
                    .getCurrentPlayers(), hook.getMaxPlayers()) {
                @Override
                public void setMotd(String motd) {
                    super.setMotd(motd);
                    hook.setMotd(motd);
                }

                @Override
                public void setMaxPlayers(int maxPlayers) {
                    super.setMaxPlayers(maxPlayers);
                    hook.setMaxPlayers(maxPlayers);
                }

                @Override
                public void setServerIcon(CachedServerIcon icon) throws IllegalArgumentException,
                        UnsupportedOperationException {
                    super.setServerIcon(icon);
                }
            });
}
项目:ConnectionInfo    文件:ConnectionHandler.java   
@Deprecated
@SuppressWarnings("unused")
public void serverListPing(ServerListPingEvent event){
    if(this.logServerPings && false){
        String msg = "";
        if (loggingMethods.contains(LoggingMethod.SINGLE_FILE)){

        }
        if (loggingMethods.contains(LoggingMethod.UUID_FILES)){

        }
        if (loggingMethods.contains(LoggingMethod.MYSQL)){
            dbl.scheduleSQLExecution(new SQL("INSERT INTO " + ci.getConfig().getString("Database.Connection_log_table_name") + " (hostname, count) VALUES ('" + event.getAddress() + "', ##AUTO##);", ci.getConfig().getString("Database.Connection_log_table_name"), new Timestamp(UnitConverter.getCurrentTimestamp())));
        }
        if (loggingMethods.contains(LoggingMethod.MINECRAFT_LOG)){
            ci.log.info(msg);
        }
    }
}
项目:EpicSpleef    文件:ServerListPingListener.java   
@EventHandler
public void onServerListPing(ServerListPingEvent event) {
    FileConfiguration config = SpleefMain.getInstance().getBungeeConfigAccessor().getConfig();
    if (config.getBoolean("supportBungeecord")) {
        if (config.getBoolean("epicSpleefBungee.enabled")) {
            String name = config.getString("instantJoinLobbyOrArena");
            for (SpleefArena arena : SpleefArena.getSpleefArenas()) {
                if (arena.getName().equals(name)) {
                    String[] lines = arena.getSignText();
                    for (int i = 0; i < lines.length; i++) {
                        if (lines[i] == null) {
                            lines[i] = "";
                        }
                        lines[i] = lines[i].replace("=!=", "");
                    }
                    event.setMotd(lines[0] + "=!=" + lines[1] + "=!=" + lines[2] + "=!=" + lines[3]);
                    return;
                }
            }
        }
    }
}
项目:TatsuCraftMod    文件:TFM_ServerListener.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void onServerPing(ServerListPingEvent event)
{
    event.setMotd(TFM_Util.randomChatColor() + "Tatsu" + TFM_Util.randomChatColor() + "Craft " + ChatColor.DARK_GRAY + "-" + TFM_Util.randomChatColor() + " Bukkit v" + TFM_ServerInterface.getVersion());

    if (TFM_ServerInterface.isIPBanned(event.getAddress().getHostAddress()))
    {
        event.setMotd(ChatColor.RED + "You are banned.");
    }
    else if (TFM_ConfigEntry.ADMIN_ONLY_MODE.getBoolean())
    {
        event.setMotd(ChatColor.RED + "Server is in admin mode.");
    }
    else if (Bukkit.hasWhitelist())
    {
        event.setMotd(ChatColor.RED + "Whitelist enabled.");
    }
    else if (Bukkit.getOnlinePlayers().length >= Bukkit.getMaxPlayers())
    {
        event.setMotd(ChatColor.RED + "Server is full.");
    }
}
项目:Scapegoat    文件:Running.java   
@Override
@EventHandler
public void onServerListPing(ServerListPingEvent e)
{
    super.onServerListPing(e);

    if (plugin.isInMaintenanceMode())
    {
        e.setMotd(ChatColor.YELLOW + "En maintenance...");
        return;
    }

    String motd = ScapegoatPlugin.SCAPEGOAT_COLOR + "Bouc-�missaire" + ChatColor.RESET + " | " + ChatColor.DARK_RED
            + "Partie en cours.";
    e.setMotd(motd);
}
项目:CardinalPGM    文件:MOTD.java   
@EventHandler(priority = EventPriority.LOWEST)
public void onServerListPing(ServerListPingEvent event) {
    String name = match.getLoadedMap().getName();
    ChatColor color = ChatColor.GRAY;
    switch (match.getState()) {
        case ENDED:
            color = ChatColor.AQUA;
            break;
        case PLAYING:
            color = ChatColor.GOLD;
            break;
        case STARTING:
            color = ChatColor.GREEN;
            break;
    }
    event.setMotd(color + "\u00BB " + ChatColor.AQUA + name + color + " \u00AB" +
            (!Config.motdMessage.equals("") ? "\n" + ChatColor.translateAlternateColorCodes('`', Config.motdMessage) : ""));

}
项目:xEssentials_old_Source    文件:motd.java   
@EventHandler
public void setMotd(ServerListPingEvent e) {
    if(xEssentialsMemory.motdEnabled) {
        e.setMotd(ChatColor.translateAlternateColorCodes('&', xEssentialsMemory.motdMessage));  
    } else if(xEssentialsMemory.motdRandom) {
        if(it.hasNext()) {
            e.setMotd(ChatColor.translateAlternateColorCodes('&', it.next()));
        } else {
            while(it.hasPrevious()) {
                it.previous();
            }
            if(it.hasNext()) {
                e.setMotd(ChatColor.translateAlternateColorCodes('&', it.next()));
            }
        }
    }
}
项目:MotdManager-Reloaded    文件:ServerListener.java   
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onServerListPing(final ServerListPingEvent event){
    String debugmsg = "Get ping from " + event.getAddress().getHostAddress() + "!";

    final String motd = plugin.formatting(chooseMsg());
    if (motd != null) {
        event.setMotd(motd);
        debugmsg += " Motd: '" + motd + "'";
    }
    if (plugin.getConfigs().getUseFakeMaxPlayers()){
        event.setMaxPlayers(plugin.getConfigs().getFakeMaxPlayers());
        debugmsg += " FakeMaxPlayers: '" + plugin.getConfigs().getFakeMaxPlayers() + "'";
    }

    plugin.debug(debugmsg);
}
项目:AdvancedServerListIcons    文件:AdvancedServerListIconsSpigot.java   
@EventHandler
public void onServerListPing(ServerListPingEvent event) {
    UUID uuid = getDatabaseManager().getPlayerUUID(event.getAddress().getHostAddress());
    if (uuid != null) {
        OfflinePlayer player = Bukkit.getOfflinePlayer(uuid);
        try {
            event.setServerIcon(Bukkit.loadServerIcon(getImageHandler().getImageForUser(player.getUniqueId(), player.getName())));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
项目:OpenRPG    文件:PingHandler.java   
@EventHandler
public void handlePing(ServerListPingEvent event) {
    if (Main.getInstance().hasAddress(event.getAddress())) {
        OpenPlayerData data = DataManager.getInstance().getPlayerData(Main.getInstance().fromAddress(event.getAddress()));

        if (data.getName() == null) {
            event.setMotd(colorize("&aCome and play!"));
        } else {
            event.setMotd(colorize("&aWelcome, &e" + data.getName() + "&a!\n&6Level: &c" + data.getLevel() + " &7|&e " + data.getRegion().getName()));
        }
    } else {
        event.setMotd(colorize("&aCome and play!"));
    }
}
项目:SkyWarsReloaded    文件:PingListener.java   
@EventHandler
  public void onPing(final ServerListPingEvent serverListPingEvent) {
if (SkyWarsReloaded.get().loadingEnded()) {
          if (SkyWarsReloaded.getGC().getGames().size() > 0) {
            Game game = SkyWarsReloaded.getGC().getGame(1);
              serverListPingEvent.setMotd(game.getState().toString() + ":" + game.getPlayers().size() + ":" + game.getNumberOfSpawns() + ":" + game.getMapName());
          } else {
              serverListPingEvent.setMotd(GameState.ENDING.toString() + ":" + 0 + ":" + 0 + ":" + "null");
          }
} else {
              serverListPingEvent.setMotd(GameState.ENDING.toString() + ":" + 0 + ":" + 0 + ":" + "null");
      }
  }
项目:mczone    文件:Events.java   
@EventHandler
public void onServerPingEvent(ServerListPingEvent event) {
    if (State.PRE) {
        event.setMotd(ChatColor.GREEN + "" + Utils.getPlayers().length + "/" + Bukkit.getMaxPlayers() + " ready to play!");
    }
    else {
        event.setMotd(Utils.getPlayers().length + " players remaining...");
    }
}
项目:mczone    文件:ConnectEvents.java   
@EventHandler
public void onServerPing(ServerListPingEvent event) {
    if (Scheduler.getState() == State.PREP) {
        event.setMotd("Game starting soon!");
    }
    else {
        event.setMotd(Game.getTributes().size() + " tributes remaining");
    }
}
项目:Kineticraft    文件:Parties.java   
@EventHandler @SneakyThrows // Sets the server icon to special party icons.
public void onPing(ServerListPingEvent evt) {
    if (!isPartyTime())
        return;
    File f = new File("./icons/" + getParty().getName() + ".png");
    if (f.exists())
        evt.setServerIcon(Bukkit.loadServerIcon(f));
}
项目:ZentrelaCore    文件:MotdManager.java   
@EventHandler
public void onServerListPing(ServerListPingEvent event) {
    if (SakiCore.TEST_REALM) {
        event.setMotd(TEST_REALM_MOTD);
        return;
    }
    if (motd != null) {
        if (translatedMotd == null) { // shouldn't ever happen but just in case
            translatedMotd = ChatColor.translateAlternateColorCodes('&', motd);
        }
        event.setMotd(translatedMotd);
    } else {
        event.setMotd(DEFAULT_MOTD);
    }
}
项目:MundoSK    文件:MiscMundo.java   
private static void loadServerListPing() {
    Registration.registerEvent("Server List Ping", SimpleEvent.class, ServerListPingEvent.class, "[[(server|player)] list] ping")
            .document("Server List Ping", "1.8", "Called when a Minecraft client pings the server to show information in the server list.");
    Registration.registerExpression(ExprAmountOfPlayers.class, Number.class, ExpressionType.SIMPLE, "(shown|sent) (0¦amount of|1¦max [amount of]) players")
            .document("Shown Amount of Players", "1.8", "An expression, used in the Server List Ping event, for the amount of players currently online "
                    + "or max amount of players allowed that was shown by your server to the pinging client.");
    Registration.registerExpression(ExprMotd.class, String.class, ExpressionType.SIMPLE, "(shown|sent) motd")
            .document("Shown MOTD", "1.8", "An expression, used in the Server List Ping event, for the MOTD shown by your server to the pinging client.");
    Registration.registerExpression(ExprIP.class, String.class, ExpressionType.SIMPLE, "pinger's ip", "ip of pinger")
            .document("IP of Pinger", "1.8", "An expression, used in the Server List Ping event, for the IP of the pinging client.");
}
项目:MundoSK    文件:ExprIP.java   
@Override
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
    if (!ScriptLoader.isCurrentEvent(ServerListPingEvent.class)) {
        Skript.error("The 'pinger's ip' expression can only be used in a server list ping event!");
    }
    return true;
}
项目:MundoSK    文件:ExprMotd.java   
@Override
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
    if (!ScriptLoader.isCurrentEvent(ServerListPingEvent.class)) {
        Skript.error("The 'shown motd' expression can only be used in a server list ping event!");
    }
    return true;
}
项目:MundoSK    文件:ExprMotd.java   
@Override
public void change(Event event, Object[] delta, Changer.ChangeMode mode) {
    String value;
    if (mode == Changer.ChangeMode.SET) {
        value = (String) delta[0];
    } else if (mode == Changer.ChangeMode.RESET) {
        value = Bukkit.getServer().getMotd();
    } else {
        throw new IllegalArgumentException();
    }
    ((ServerListPingEvent) event).setMotd(value);
}
项目:MundoSK    文件:ExprAmountOfPlayers.java   
@Override
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
    max = parseResult.mark == 1;
    if (!ScriptLoader.isCurrentEvent(ServerListPingEvent.class)) {
        Skript.error("The '" + toString() + "' expression can only be used in a server list ping event!");
    }
    return true;
}
项目:MundoSK    文件:ExprAmountOfPlayers.java   
@Override
public void change(Event event, Object[] delta, Changer.ChangeMode mode) {
    if (!max) {
        throw new IllegalStateException();
    }
    int value;
    if (mode == Changer.ChangeMode.SET) {
        value = ((Number) delta[0]).intValue();
    } else if (mode == Changer.ChangeMode.RESET) {
        value = Bukkit.getServer().getMaxPlayers();
    } else {
        throw new IllegalArgumentException();
    }
    ((ServerListPingEvent) event).setMaxPlayers(value);
}
项目:NationZ    文件:ConnectionListener.java   
@EventHandler
public void onPing(ServerListPingEvent e) {
    String first = "       " + NationZ.title + ChatColor.DARK_GRAY + " - " + ChatColor.GRAY + "A unique Real-Time Clan-MMORPG";
    String second = ChatColor.DARK_GRAY + " » " + ChatColor.RED + "Next Season: " + ChatColor.YELLOW + FC.getMainCfg().getString("season.next");
    e.setMotd(first + "\n" + second);
    e.setMaxPlayers(2400);
}
项目:AudioConnect    文件:VerifyRequestEventListener.java   
@EventHandler(priority = EventPriority.HIGHEST)
private void onServerPing(ServerListPingEvent event) {
    String encodedVerifyCode = verifyCodeSupplier.get();
    if (encodedVerifyCode != null) {
        event.setMotd(encodedVerifyCode + ChatColor.RESET + event.getMotd());
    }
}
项目:PhantomAdmin    文件:PAEventHandler.java   
@EventHandler(ignoreCancelled = true)
void onServerListPing(ServerListPingEvent event)
{
    Iterator<Player> players = event.iterator();
    while(players.hasNext())
    {
        Player player = players.next();
        if(PhantomAdmin.instance.isInvisible(player))
        {
            players.remove();
        }
    }
}
项目:AnnihilationPro    文件:GameListeners.java   
@EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled=true)
public void pingServer(ServerListPingEvent event)
{
    if(GameVars.useMOTD())
    {
        if(Game.getGameMap() == null || Game.getGameMap().getCurrentPhase() < 1)
            event.setMotd("In Lobby");
        else event.setMotd("Phase "+Game.getGameMap().getCurrentPhase());
    }
}
项目:WhiteEggCore    文件:Debug.java   
@EventHandler
public void onPing(ServerListPingEvent event) {
    if (icon == null) {
        return;
    }
    event.setServerIcon(icon);
}
项目:KSlots    文件:ServerListPingListener.java   
@EventHandler
    public void onPing(ServerListPingEvent e){
        if(KSlots.enableSlotChange){
            if(KSlots.enablePlusChange){
                if(KSlots.enableNormalChange){
                    KSlots.enableNormalChange = false;
                    KSlots.enablePlusChange = true;
                    KSlots.pl.getConfig().set("normalNumChange.enable", false);
                    KSlots.pl.getConfig().set("plusChange.enable", true);
                    KSlots.pl.saveConfig();
}
                if(e.getNumPlayers() < KSlots.numUntilChange){
                    e.setMaxPlayers(KSlots.numUntilChange);
}
                else{
                    e.setMaxPlayers(e.getNumPlayers() + KSlots.numToAdd);
}
}
            if(KSlots.enableNormalChange){
                if(KSlots.enablePlusChange){
                    KSlots.enableNormalChange = true;
                    KSlots.enablePlusChange = false;
                    KSlots.pl.getConfig().set("normalNumChange.enable", true);
                    KSlots.pl.getConfig().set("plusChange.enable", false);
                    KSlots.pl.saveConfig();
}
                e.setMaxPlayers(KSlots.normalNumSlots);
}
}
        if(KSlots.enableMotdChange){
            Random r = new Random();
            int id = r.nextInt(KSlots.customMotds.size());
            String motd1 = KSlots.customMotds.get(id);
            String motd2 = ChatColor.translateAlternateColorCodes('&', motd1);
            String motd3 = ChatColor.translateAlternateColorCodes('$', motd2);
            e.setMotd(motd3);
}
}
项目:ExtremeSurvival    文件:PingListListener.java   
@EventHandler
void onPing(ServerListPingEvent e){
    if(Main.getES().getBorder().isRunning()){
        e.setMotd(ChatColor.BOLD+" "+ChatColor.RED+"Na serwerze trwa czystka! Trzeba czekac!");
    }else{
        int sec = (int) (Main.getES().getBorder().whenPurge()/1000);
        e.setMotd(ChatColor.BOLD+" "+ChatColor.GREEN+"Czystka za "+Main.formatIntoHHMMSS(sec)+" sekund!");
    }

}
项目:OneSlotServer    文件:PlayerListener.java   
@EventHandler
public void onServerListPing(ServerListPingEvent event) {
    event.setMaxPlayers(1);

    Iterator<Player> players = event.iterator();

    Player player;
    while(players.hasNext()) {
        player = players.next();
        if(plugin.activePlayer == null || !plugin.activePlayer.player.getUniqueId().equals(player.getUniqueId())) { 
            players.remove();
        }
    }

    if(plugin.activePlayer != null) {
        long waitleft = (plugin.activePlayer.timeleft - (new Date().getTime()/1000 - plugin.activePlayer.joinedAt)) * 1000;
        Date date = new Date(waitleft);
        String timestring = minutesWait.format(date);

        event.setMotd("A player is currently playing. Please wait " + timestring + " more minutes.");
        event.setServerIcon(iconFull);
    }
    else {
        event.setMotd("Nobody is playing. You can join the server.");
        event.setServerIcon(iconEmpty);
    }
}
项目:AceOfSpadesMiniGame    文件:ServerListEvent.java   
@EventHandler
void ListaSerwerowEvent(ServerListPingEvent e){
    Game.getInstance();
    if(Game.CheckArenaState()== ArenaMode.LOBBY){
        int roznicaLudzi = e.getMaxPlayers()-e.getNumPlayers();
        e.setMotd("§2|| AoS ||§6 Czekamy na "+roznicaLudzi+" graczy");
    }
    if(Game.CheckArenaState()== ArenaMode.INGAME){
        e.setMotd("§2|| AoS ||§6 Serwer podczas gry!");
    }
    if(Game.CheckArenaState()== ArenaMode.COUNTING){
        e.setMotd("§2|| AoS ||§6 Odliczanie do startu gry "+Countdown.getCountdownTime());
    }

}
项目:BungeeSigns    文件:PingScheduler.java   
@EventHandler
public void onEvent(BungeeSignsPingEvent e)
{
    if(!e.isCancelled())
    {
        for(ServerInfo server : e.getServers())
        {
            if(!server.isLocal())
            {
                pingAsync(server);
            }
            else
            {
                final String status = server.getMotd();
                ServerListPingEvent ping = new ServerListPingEvent(new InetSocketAddress(Bukkit.getIp(), Bukkit.getPort()).getAddress(), Bukkit.getMotd(), Bukkit.getOnlinePlayers().length, Bukkit.getMaxPlayers());
                Bukkit.getPluginManager().callEvent(ping);
                server.setProtocol(getBukkitVersion());
                server.setMotd(ping.getMotd());
                server.setPlayerCount(ping.getNumPlayers());
                server.setMaxPlayers(ping.getMaxPlayers());
                server.setPingStart(System.currentTimeMillis());
                server.setPingEnd(System.currentTimeMillis());
                server.setOnline(true);

                if(!server.getMotd().equals(status))
                {
                    ServerChangeStatusEvent sevent = new ServerChangeStatusEvent(server, server.getMotd());
                    BungeeSigns.getInstance().callSyncEvent(sevent);
                }
            }
        }
    }
}
项目:Scapegoat    文件:Waiting.java   
@Override
@EventHandler
public void onServerListPing(ServerListPingEvent e)
{
    super.onServerListPing(e);

    if (plugin.isInMaintenanceMode())
    {
        e.setMotd(ChatColor.YELLOW + "En maintenance...");
        return;
    }

    String motd = ScapegoatPlugin.SCAPEGOAT_COLOR + "Bouc-�missaire"
            + ChatColor.RESET + " | ";

    int minutes = secondsLeft / 60;
    int seconds = secondsLeft % 60;

    if (countdown)
        motd += "D�but dans " + ChatColor.DARK_RED + minutes + "m" + seconds + ChatColor.RESET + ".";
    else
    {
        int required = plugin.getPlayersRequired() - SGOnline.getPlayerCount();
        motd += "" + ChatColor.DARK_RED + required + ChatColor.RESET
                + " joueur" + (required > 1 ? "s" : "") + " requis.";
    }

    e.setMotd(motd);
}
项目:ShankShock-Core    文件:ServerListener.java   
@EventHandler(priority = EventPriority.HIGH)
public void onServerListPing(ServerListPingEvent e) {

    if (plugin.debug) {
        e.setMotd("Debug mode!");
        return;
    }
    e.setMotd(plugin.globalConfig.getValue("motd"));
}
项目:Rixor    文件:PlayerEvents.java   
@EventHandler
public void onServerListPing(ServerListPingEvent event) {
    Map map = Rixor.getRotation().getSlot().getMap();

    ChatColor color = ChatColor.GRAY;

    String team = "";
    if(!Rixor.isPublic())
        //team = ChatColor.GRAY + "Server Owner: (" + ChatColor.GOLD + Rixor.getTeam() + ChatColor.GRAY + ")";

    event.setMotd(color + " " + Characters.raquo + " " + ChatColor.AQUA + map.getName() + color + " " + Characters.laquo + " " + "\n");
}