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


Java Bukkit.getMaxPlayers方法代码示例

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


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

示例1: Kraken

import org.bukkit.Bukkit; //导入方法依赖的package包/类
public Kraken() {
    if (Bukkit.getMaxPlayers() < 60) {
        throw new NumberFormatException("Player limit must be at least 60!");
    }

    instance = this;

    new BukkitRunnable() {
        @Override
        public void run() {
            for (Player player : Bukkit.getOnlinePlayers()) {
                checkPlayer(player);
            }
        }
    }.runTaskLaterAsynchronously(PracticePlugin.getInstance(), 4L);

    Bukkit.getPluginManager().registerEvents(this, PracticePlugin.getInstance());
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:19,代码来源:Kraken.java

示例2: replace

import org.bukkit.Bukkit; //导入方法依赖的package包/类
public String replace(String text){
	// most shitty way
	String[] values = { p.getName(), p.getDisplayName(), GetTime(), Bukkit.getOnlinePlayers().size() + "", Bukkit.getMaxPlayers() + "", 
			p.getHealth() + "", p.getAddress().getAddress().toString(), Math.round(p.getLocation().getX()) + " " + Math.round(p.getLocation().getY()) + " " + Math.round(p.getLocation().getBlockZ()) };
	
	int count = 0;
	for(String text1 : placeholders){
		text = text.replace(text1, values[count]);
		count++;
	}
	
	return text;
	
}
 
开发者ID:TheIndra55,项目名称:SpigotBoard,代码行数:15,代码来源:PlaceholderUtils.java

示例3: parse

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Override
public @Nullable FreeForAllModule parse(MapModuleContext context, Logger logger, Document doc) throws InvalidXMLException {
    Element elPlayers = doc.getRootElement().getChild("players");

    if(context.hasModule(TeamModule.class)) {
        if(elPlayers != null) throw new InvalidXMLException("Cannot combine <players> and <teams>", elPlayers);
        return null;
    } else {
        int minPlayers = Config.minimumPlayers();
        int maxPlayers = Bukkit.getMaxPlayers();
        int maxOverfill = maxPlayers;
        org.bukkit.scoreboard.Team.OptionStatus nameTagVisibility = org.bukkit.scoreboard.Team.OptionStatus.ALWAYS;
        boolean colors = false;

        if(elPlayers != null) {
            minPlayers = XMLUtils.parseNumber(elPlayers.getAttribute("min"), Integer.class, minPlayers);
            maxPlayers = XMLUtils.parseNumber(elPlayers.getAttribute("max"), Integer.class, maxPlayers);
            maxOverfill = XMLUtils.parseNumber(elPlayers.getAttribute("max-overfill"), Integer.class, maxOverfill);

            nameTagVisibility = XMLUtils.parseNameTagVisibility(elPlayers, "show-name-tags").optional(nameTagVisibility);
            colors = XMLUtils.parseBoolean(elPlayers.getAttribute("colors"), colors);
        }

        if(minPlayers > maxPlayers) {
            throw new InvalidXMLException("min players (" + minPlayers + ") cannot be greater than max players (" + maxPlayers + ")", elPlayers);
        }

        return new FreeForAllModule(new FreeForAllOptions(minPlayers, maxPlayers, maxOverfill, nameTagVisibility, colors));
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:31,代码来源:FreeForAllModule.java

示例4: checkLogin

import org.bukkit.Bukkit; //导入方法依赖的package包/类
private BiTuple<String, PlayerLoginEvent.Result> checkLogin( String name, UUID uuid ) {
    if( Bukkit.getIPBans().contains( this.getIpAddress() ) ) {
        return new BiTuple<>( "Your IP Address has been banned from the server", PlayerLoginEvent.Result.KICK_BANNED );
    }
    if( Bukkit.getOnlinePlayers().size() >= Bukkit.getMaxPlayers() ) {
        return new BiTuple<>( "The server is full", PlayerLoginEvent.Result.KICK_FULL );
    }

    return new BiTuple<>( null, PlayerLoginEvent.Result.ALLOWED );
}
 
开发者ID:lukas81298,项目名称:FlexMC,代码行数:11,代码来源:ConnectionHandler.java

示例5: getMaxPlayers

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Override
protected int getMaxPlayers() {
    return Bukkit.getMaxPlayers();
}
 
开发者ID:games647,项目名称:Minefana,代码行数:5,代码来源:BukkitPlayerCollector.java

示例6: run

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Override
public void run() {
	if (TIME % 20 == 0) {
        Kit.load();
	}
	
	TOTAL_TIME += 1;
	if (Bukkit.getOnlinePlayers().length > 1)
	    TIME -= 1;
	
	if (TOTAL_TIME > 900 && Bukkit.getOnlinePlayers().length <= 3) {
	    Bukkit.shutdown();
	}
	
	if (Bukkit.getOnlinePlayers().length==Bukkit.getMaxPlayers() && TIME >= 15) {
		TIME = 10;
	}
	
	if (TIME==0) {
		boolean start = true;
		for (Team team : Team.list) {
			if (team.getMembers().size() <= 2) {
				start = false;
				break;
			}
		}
		if (start) {
		    Bukkit.getScheduler().scheduleSyncDelayedTask(Walls.instance, new Runnable() {
                   @Override
                   public void run() {
                       Walls.prep();
                   }
		    });
		}
		else {
			Chat.server("&cWe need 2 players per team in order to start the game!");
			TIME = Config.getInt("pre-time");
			return;
		}
		return;
	}
	
	if (TIME % 20 == 0 || TIME <= 10)
		Chat.server("&eGame beginning in &4" + Chat.time(TIME) + "&e!");	
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:46,代码来源:PreTask.java

示例7: execute

import org.bukkit.Bukkit; //导入方法依赖的package包/类
@Override
public boolean execute(CommandSender sender, String[] args) throws CommandException {
    if (!(sender instanceof Player)) {
        throw new CommandException("Only players can use this command!");
    }
    Player player = (Player) sender;
    int online = Bukkit.getOnlinePlayers().size();
    int max = Bukkit.getMaxPlayers();
    try {
        player.sendMessage(ChatColor.GOLD + "There are " + ChatColor.RED + online + ChatColor.GOLD + " players online out of " + ChatColor.RED + max + ChatColor.GOLD + " players!");
        ArrayList<Player> p = new ArrayList<>();
        p.addAll(Bukkit.getOnlinePlayers());
        StringBuilder sb = new StringBuilder();
        player.sendMessage(ChatColor.GOLD + "Online Players:");
        for (int i = 0; i < p.size(); i++) {
            if (RankManager.getRankId(p.get(i)) == 3) {//Admin
                sb.append(ChatColor.translateAlternateColorCodes('&', RankManager.getRankPrefix(p.get(i)) + " " + ChatColor.WHITE + p.get(i).getName()));
                sb.append(ChatColor.GOLD + ", ");
            }
        }
        for (int i = 0; i < p.size(); i++) {
            if (RankManager.getRankId(p.get(i)) == 8) {//Dev
                sb.append(ChatColor.translateAlternateColorCodes('&', RankManager.getRankPrefix(p.get(i)) + " " + ChatColor.WHITE + p.get(i).getName()));
                sb.append(ChatColor.GOLD + ", ");
            }
        }
        for (int i = 0; i < p.size(); i++) {
            if (RankManager.getRankId(p.get(i)) == 11) {//SrMod
                sb.append(ChatColor.translateAlternateColorCodes('&', RankManager.getRankPrefix(p.get(i)) + " " + ChatColor.WHITE + p.get(i).getName()));
                sb.append(ChatColor.GOLD + ", ");
            }
        }
        for (int i = 0; i < p.size(); i++) {
            if (RankManager.getRankId(p.get(i)) == 5) {//Mod
                sb.append(ChatColor.translateAlternateColorCodes('&', RankManager.getRankPrefix(p.get(i)) + " " + ChatColor.WHITE + p.get(i).getName()));
                sb.append(ChatColor.GOLD + ", ");
            }
        }
        for (int i = 0; i < p.size(); i++) {
            if (RankManager.getRankId(p.get(i)) == 10) {//JrMod
                sb.append(ChatColor.translateAlternateColorCodes('&', RankManager.getRankPrefix(p.get(i)) + " " + ChatColor.WHITE + p.get(i).getName()));
                sb.append(ChatColor.GOLD + ", ");
            }
        }
        for (int i = 0; i < p.size(); i++) {
            if (RankManager.getRankId(p.get(i)) == 4) {//Builder
                sb.append(ChatColor.translateAlternateColorCodes('&', RankManager.getRankPrefix(p.get(i)) + " " + ChatColor.WHITE + p.get(i).getName()));
                sb.append(ChatColor.GOLD + ", ");
            }
        }
        for (int i = 0; i < p.size(); i++) {
            if (RankManager.getRankId(p.get(i)) == 0) {//Default
                sb.append(ChatColor.WHITE + p.get(i).getName());
                sb.append(ChatColor.GOLD + ", ");
            }
        }
        sb.deleteCharAt(sb.length() - 2);//Removes last comma
        player.sendMessage(sb.toString());
    } catch (SQLException e) {
        e.printStackTrace();
    }
    return true;
}
 
开发者ID:Warvale,项目名称:Locked,代码行数:64,代码来源:WhoCommand.java


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