本文整理了Java中org.bukkit.command.Command.testPermissionSilent()
方法的一些代码示例,展示了Command.testPermissionSilent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Command.testPermissionSilent()
方法的具体详情如下:
包路径:org.bukkit.command.Command
类名称:Command
方法名:testPermissionSilent
[英]Tests the given CommandSender to see if they can perform this command.
No error is sent to the sender.
[中]测试给定的CommandSender以查看它们是否可以执行此命令。
不会向发件人发送任何错误。
代码示例来源:origin: Bukkit/Bukkit
/**
* Tests the given {@link CommandSender} to see if they can perform this
* command.
* <p>
* If they do not have permission, they will be informed that they cannot
* do this.
*
* @param target User to test
* @return true if they can use it, otherwise false
*/
public boolean testPermission(CommandSender target) {
if (testPermissionSilent(target)) {
return true;
}
if (permissionMessage == null) {
target.sendMessage(ChatColor.RED + "I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error.");
} else if (permissionMessage.length() != 0) {
for (String line : permissionMessage.replace("<permission>", permission).split("\n")) {
target.sendMessage(line);
}
}
return false;
}
代码示例来源:origin: Bukkit/Bukkit
public boolean canSee(CommandSender sender) {
if (!command.isRegistered() && !(command instanceof VanillaCommand)) {
// Unregistered commands should not show up in the help (ignore VanillaCommands)
return false;
}
if (sender instanceof ConsoleCommandSender) {
return true;
}
if (amendedPermission != null) {
return sender.hasPermission(amendedPermission);
} else {
return command.testPermissionSilent(sender);
}
}
}
代码示例来源:origin: Bukkit/Bukkit
Command command = commandEntry.getValue();
if (!command.testPermissionSilent(sender)) {
continue;
if (!target.testPermissionSilent(sender)) {
return null;
代码示例来源:origin: EngineHub/WorldEdit
return super.testPermissionSilent(sender);
代码示例来源:origin: EngineHub/CommandHelper
@Override
public boolean testPermissionSilent(MCCommandSender target) {
return cmd.testPermissionSilent(((BukkitMCCommandSender) target)._CommandSender());
}
代码示例来源:origin: OvercastNetwork/sk89q-command-framework
@SuppressWarnings("unchecked")
@Override
public boolean testPermissionSilent(CommandSender sender) {
if (permissions == null || permissions.length == 0) {
return true;
}
if (registeredWith instanceof CommandsManager<?>) {
try {
for (String permission : permissions) {
if (((CommandsManager<CommandSender>) registeredWith).hasPermission(sender, permission)) {
return true;
}
}
return false;
} catch (Throwable ignore) {
}
}
return super.testPermissionSilent(sender);
}
}
代码示例来源:origin: SpigotMC/Spigot-API
/**
* Tests the given {@link CommandSender} to see if they can perform this
* command.
* <p>
* If they do not have permission, they will be informed that they cannot
* do this.
*
* @param target User to test
* @return true if they can use it, otherwise false
*/
public boolean testPermission(CommandSender target) {
if (testPermissionSilent(target)) {
return true;
}
if (permissionMessage == null) {
target.sendMessage(ChatColor.RED + "I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error.");
} else if (permissionMessage.length() != 0) {
for (String line : permissionMessage.replace("<permission>", permission).split("\n")) {
target.sendMessage(line);
}
}
return false;
}
代码示例来源:origin: SpigotMC/Spigot-API
public boolean canSee(CommandSender sender) {
if (!command.isRegistered() && !(command instanceof VanillaCommand)) {
// Unregistered commands should not show up in the help (ignore VanillaCommands)
return false;
}
if (sender instanceof ConsoleCommandSender) {
return true;
}
if (amendedPermission != null) {
return sender.hasPermission(amendedPermission);
} else {
return command.testPermissionSilent(sender);
}
}
}
代码示例来源:origin: SpigotMC/Spigot-API
Command command = commandEntry.getValue();
if (!command.testPermissionSilent(sender)) {
continue;
if (!target.testPermissionSilent(sender)) {
return null;
内容来源于网络,如有侵权,请联系作者删除!