當前位置: 首頁>>代碼示例>>Java>>正文


Java ServerListPingEvent.setMotd方法代碼示例

本文整理匯總了Java中org.bukkit.event.server.ServerListPingEvent.setMotd方法的典型用法代碼示例。如果您正苦於以下問題:Java ServerListPingEvent.setMotd方法的具體用法?Java ServerListPingEvent.setMotd怎麽用?Java ServerListPingEvent.setMotd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.event.server.ServerListPingEvent的用法示例。


在下文中一共展示了ServerListPingEvent.setMotd方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onMotd

import org.bukkit.event.server.ServerListPingEvent; //導入方法依賴的package包/類
@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());
        }
    }
}
 
開發者ID:andylizi,項目名稱:ColorMOTD,代碼行數:17,代碼來源:MotdListener.java

示例2: onServerListPing

import org.bukkit.event.server.ServerListPingEvent; //導入方法依賴的package包/類
@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) : ""));

}
 
開發者ID:Minehut,項目名稱:GamePlate,代碼行數:20,代碼來源:MotdModule.java

示例3: onServerListPing

import org.bukkit.event.server.ServerListPingEvent; //導入方法依賴的package包/類
@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;
				}
			}
		}
	}
}
 
開發者ID:BtoBastian,項目名稱:EpicSpleef,代碼行數:23,代碼來源:ServerListPingListener.java

示例4: onServerListPing

import org.bukkit.event.server.ServerListPingEvent; //導入方法依賴的package包/類
@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) {

    }
}
 
開發者ID:dentmaged,項目名稱:Cardinal-Plus,代碼行數:18,代碼來源:MOTD.java

示例5: onServerPing

import org.bukkit.event.server.ServerListPingEvent; //導入方法依賴的package包/類
@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.");
    }
}
 
開發者ID:Yoshi41023,項目名稱:TatsuCraftMod,代碼行數:23,代碼來源:TFM_ServerListener.java

示例6: onServerListPing

import org.bukkit.event.server.ServerListPingEvent; //導入方法依賴的package包/類
@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);
}
 
開發者ID:Elarcis,項目名稱:Scapegoat,代碼行數:17,代碼來源:Running.java

示例7: onServerListPing

import org.bukkit.event.server.ServerListPingEvent; //導入方法依賴的package包/類
@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) : ""));

}
 
開發者ID:twizmwazin,項目名稱:CardinalPGM,代碼行數:20,代碼來源:MOTD.java

示例8: setMotd

import org.bukkit.event.server.ServerListPingEvent; //導入方法依賴的package包/類
@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()));
			}
		}
	}
}
 
開發者ID:xize,項目名稱:xEssentials_old_Source,代碼行數:18,代碼來源:motd.java

示例9: onServerListPing

import org.bukkit.event.server.ServerListPingEvent; //導入方法依賴的package包/類
@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);
}
 
開發者ID:ThunderGemios10,項目名稱:MotdManager-Reloaded,代碼行數:17,代碼來源:ServerListener.java

示例10: handlePing

import org.bukkit.event.server.ServerListPingEvent; //導入方法依賴的package包/類
@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!"));
    }
}
 
開發者ID:Dragovorn,項目名稱:OpenRPG,代碼行數:15,代碼來源:PingHandler.java

示例11: onPing

import org.bukkit.event.server.ServerListPingEvent; //導入方法依賴的package包/類
@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");
      }
  }
 
開發者ID:smessie,項目名稱:SkyWarsReloaded,代碼行數:14,代碼來源:PingListener.java

示例12: onServerPingEvent

import org.bukkit.event.server.ServerListPingEvent; //導入方法依賴的package包/類
@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...");
	}
}
 
開發者ID:thekeenant,項目名稱:mczone,代碼行數:10,代碼來源:Events.java

示例13: onServerPing

import org.bukkit.event.server.ServerListPingEvent; //導入方法依賴的package包/類
@EventHandler
public void onServerPing(ServerListPingEvent event) {
	if (Scheduler.getState() == State.PREP) {
		event.setMotd("Game starting soon!");
	}
	else {
		event.setMotd(Game.getTributes().size() + " tributes remaining");
	}
}
 
開發者ID:thekeenant,項目名稱:mczone,代碼行數:10,代碼來源:ConnectEvents.java

示例14: onServerListPing

import org.bukkit.event.server.ServerListPingEvent; //導入方法依賴的package包/類
@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);
    }
}
 
開發者ID:edasaki,項目名稱:ZentrelaCore,代碼行數:16,代碼來源:MotdManager.java

示例15: onPing

import org.bukkit.event.server.ServerListPingEvent; //導入方法依賴的package包/類
@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);
}
 
開發者ID:crazyhorse961,項目名稱:NationZ,代碼行數:8,代碼來源:ConnectionListener.java


注:本文中的org.bukkit.event.server.ServerListPingEvent.setMotd方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。