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


Java ServerListPingEvent.setMaxPlayers方法代码示例

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


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

示例1: 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

示例2: 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

示例3: onPing

import org.bukkit.event.server.ServerListPingEvent; //导入方法依赖的package包/类
@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);
}
}
 
开发者ID:Kamilkime,项目名称:KSlots,代码行数:39,代码来源:ServerListPingListener.java

示例4: onServerListPing

import org.bukkit.event.server.ServerListPingEvent; //导入方法依赖的package包/类
@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);
	}
}
 
开发者ID:freundTech,项目名称:OneSlotServer,代码行数:28,代码来源:PlayerListener.java

示例5: onServerPing

import org.bukkit.event.server.ServerListPingEvent; //导入方法依赖的package包/类
@EventHandler
public void onServerPing( ServerListPingEvent e ) {
    e.setMaxPlayers( 2 );
    e.setMotd( WitchHunter.getCurrentGameState().getMotd() );
}
 
开发者ID:GrosserRaudi,项目名称:Devathlon,代码行数:6,代码来源:ServerListPingListener.java

示例6: onServerListPing

import org.bukkit.event.server.ServerListPingEvent; //导入方法依赖的package包/类
/**
 * Triggered when a client retrieves server infos for the server list.
 * @param e
 */
@EventHandler
public void onServerListPing(ServerListPingEvent e)
{
	e.setMaxPlayers(plugin.getMaxPlayers());
}
 
开发者ID:Elarcis,项目名称:Scapegoat,代码行数:10,代码来源:GameState.java

示例7: onServerListPing

import org.bukkit.event.server.ServerListPingEvent; //导入方法依赖的package包/类
@EventHandler
public void onServerListPing(final ServerListPingEvent event) {
    if (bukkit.getCore() == null) return; // Too early, we haven't finished initializing yet
    StatusResponse response = bukkit.getCore().createRequest(event.getAddress()).createResponse(
            bukkit.getCore().getStatus(), new ResponseFetcher() {
                @Override
                public Integer getOnlinePlayers() {
                    return event.getNumPlayers();
                }

                @Override
                public Integer getMaxPlayers() {
                    return event.getMaxPlayers();
                }

                @Override
                public int getProtocolVersion() {
                    return -1;
                }
            });

    // Description
    String message = response.getDescription();
    if (message != null)
        event.setMotd(message);

    // Max players
    Integer max = response.getMaxPlayers();
    if (max != null)
        event.setMaxPlayers(max);

    // Favicon
    FaviconSource favicon = response.getFavicon();
    if (favicon != null) {
        CachedServerIcon icon = bukkit.getFavicon(favicon);
        if (icon != null)
            try {
                event.setServerIcon(icon);
            } catch (UnsupportedOperationException ignored) {}
    }
}
 
开发者ID:Minecrell,项目名称:ServerListPlus,代码行数:42,代码来源:BukkitEventHandler.java

示例8: serverMotd

import org.bukkit.event.server.ServerListPingEvent; //导入方法依赖的package包/类
@EventHandler (priority = EventPriority.NORMAL)
public void serverMotd(final ServerListPingEvent evt) {
	evt.setMotd(ChatColor.translateAlternateColorCodes('&', this.plugin.getConfig().getString("motd")));
	// max players is 69
	evt.setMaxPlayers(maxPlayer);
}
 
开发者ID:Jsawrus,项目名称:Masters,代码行数:7,代码来源:serverHandler.java


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