本文整理汇总了Java中cn.nukkit.permission.BanList类的典型用法代码示例。如果您正苦于以下问题:Java BanList类的具体用法?Java BanList怎么用?Java BanList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BanList类属于cn.nukkit.permission包,在下文中一共展示了BanList类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNameBans
import cn.nukkit.permission.BanList; //导入依赖的package包/类
public BanList getNameBans() {
return this.banByName;
}
示例2: getIPBans
import cn.nukkit.permission.BanList; //导入依赖的package包/类
public BanList getIPBans() {
return this.banByIP;
}
示例3: execute
import cn.nukkit.permission.BanList; //导入依赖的package包/类
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
if (!this.testPermission(sender)) {
return true;
}
BanList list;
boolean ips = false;
if (args.length > 0) {
switch (args[0].toLowerCase()) {
case "ips":
list = sender.getServer().getIPBans();
ips = true;
break;
case "players":
list = sender.getServer().getNameBans();
break;
default:
sender.sendMessage(new TranslationContainer("commands.generic.usage", this.usageMessage));
return false;
}
} else {
list = sender.getServer().getNameBans();
}
StringBuilder builder = new StringBuilder();
Iterator<BanEntry> itr = list.getEntires().values().iterator();
while (itr.hasNext()) {
builder.append(itr.next().getName());
if (itr.hasNext()) {
builder.append(", ");
}
}
if (ips) {
sender.sendMessage(new TranslationContainer("commands.banlist.ips", String.valueOf(list.getEntires().size())));
} else {
sender.sendMessage(new TranslationContainer("commands.banlist.players", String.valueOf(list.getEntires().size())));
}
sender.sendMessage(builder.toString());
return true;
}
示例4: execute
import cn.nukkit.permission.BanList; //导入依赖的package包/类
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
if (!this.testPermission(sender)) {
return true;
}
BanList list;
String arg;
if (args.length > 0) {
arg = args[0].toLowerCase();
if ("ips".equals(arg)) {
list = sender.getServer().getIPBans();
} else if ("players".equals(arg)) {
list = sender.getServer().getNameBans();
} else {
sender.sendMessage(new TranslationContainer("commands.generic.usage", this.usageMessage));
return false;
}
} else {
list = sender.getServer().getNameBans();
arg = "players";
}
String message = "";
LinkedHashMap<String, BanEntry> entries = list.getEntires();
for (BanEntry entry : entries.values()) {
message += entry.getName() + ", ";
}
if ("ips".equals(arg)) {
sender.sendMessage(new TranslationContainer("commands.banlist.ips", String.valueOf(entries.size())));
} else {
sender.sendMessage(new TranslationContainer("commands.banlist.players", String.valueOf(entries.size())));
}
if (message.length() > 0) {
message = message.substring(0, message.length() - 2);
}
sender.sendMessage(message);
return true;
}
示例5: getNameBans
import cn.nukkit.permission.BanList; //导入依赖的package包/类
/**
* 名前Banされた人のリストを取得します。
* @return BanList 名前Banリスト
*/
public BanList getNameBans() {
return this.banByName;
}
示例6: getIPBans
import cn.nukkit.permission.BanList; //导入依赖的package包/类
/**
* IPBanされた人のリストを取得します。
* @return BanList IPBanリスト
*/
public BanList getIPBans() {
return this.banByIP;
}