本文整理了Java中org.bukkit.Server.getBanList()
方法的一些代码示例,展示了Server.getBanList()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.getBanList()
方法的具体详情如下:
包路径:org.bukkit.Server
类名称:Server
方法名:getBanList
[英]Gets a ban list for the supplied type.
Bans by name are no longer supported and this method will return null when trying to request them. The replacement is bans by UUID.
[中]获取所提供类型的禁止列表。
不再支持按名称进行的禁止,在尝试请求时,此方法将返回null。取而代之的是UUID的禁令。
代码示例来源:origin: Bukkit/Bukkit
/**
* @see Server#getBanList(BanList.Type)
*/
public static BanList getBanList(BanList.Type type){
return server.getBanList(type);
}
代码示例来源:origin: GlowstoneMC/Glowstone
/**
* Handles post-hooks for a player login, including the name and IP banlists, whitelist policy
* and occupancy limit.
*
* @param player the login
* @param hostname the hostname that was used to connect to the server
* @return the completed event
*/
public PlayerLoginEvent onPlayerLogin(GlowPlayer player, String hostname) {
Server server = player.getServer();
InetAddress address = player.getAddress().getAddress();
String addressString = address.getHostAddress();
PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, address);
BanList nameBans = server.getBanList(Type.NAME);
BanList ipBans = server.getBanList(Type.IP);
if (nameBans.isBanned(player.getName())) {
event.disallow(Result.KICK_BANNED,
Kick.BANNED.get(nameBans.getBanEntry(player.getName()).getReason()));
} else if (ipBans.isBanned(addressString)) {
event.disallow(Result.KICK_BANNED,
Kick.BANNED.get(ipBans.getBanEntry(addressString).getReason()));
} else if (checkWhitelisted(player, event)
&& server.getOnlinePlayers().size() >= server.getMaxPlayers()) {
event.disallow(Result.KICK_FULL, Kick.FULL.get(server.getMaxPlayers()));
}
return callEvent(event);
}
代码示例来源:origin: SpigotMC/Spigot-API
/**
* @see Server#getBanList(BanList.Type)
*/
public static BanList getBanList(BanList.Type type){
return server.getBanList(type);
}
代码示例来源:origin: EngineHub/CommandHelper
@Override
public void banName(String name, String reason, String source) {
s.getBanList(BanList.Type.NAME).addBan(name, reason, null, source);
}
代码示例来源:origin: EngineHub/CommandHelper
@Override
public void unbanName(String name) {
s.getBanList(BanList.Type.NAME).pardon(name);
}
代码示例来源:origin: BigScary/GriefPrevention
static void banPlayer(Player player, String reason, String source)
{
if(GriefPrevention.instance.config_ban_useCommand)
{
Bukkit.getServer().dispatchCommand(
Bukkit.getConsoleSender(),
GriefPrevention.instance.config_ban_commandFormat.replace("%name%", player.getName()).replace("%reason%", reason));
}
else
{
BanList bans = Bukkit.getServer().getBanList(Type.NAME);
bans.addBan(player.getName(), reason, null, source);
//kick
if(player.isOnline())
{
player.kickPlayer(reason);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!