[英]Vanish Plugin Minecraft
我制作了一个消失插件,但我无法制作它,因此服务器管理员可以在该人消失时看到他们。 我想这样做,如果他们得到许可,他们可以看到人们消失了。
public class VanishCommand implements CommandExecutor {
VanishPlugin plugin;
public VanishCommand(VanishPlugin plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player p = (Player) sender;
if (p.hasPermission("vanish.vanish")) {
if (sender instanceof Player) {
Player player = (Player) sender;
if (plugin.invisible_list.contains(player)) {
for (Player people : Bukkit.getOnlinePlayers()) {
people.showPlayer(plugin, player);
}
plugin.invisible_list.remove(player);
player.sendMessage("§cYou Are Now Un Vanished§r");
} else if (!plugin.invisible_list.contains(player)) {
for (Player people : Bukkit.getOnlinePlayers()) {
people.hidePlayer(plugin, player);
}
plugin.invisible_list.add(player);
player.sendMessage("§aYou Are Now Vanished!§r");
}
}
}
return true;
}
}
for (Player people : Bukkit.getOnlinePlayers()) {
people.hidePlayer(plugin, player);
}
这个代码片段是问题所在。 如果其他玩家有权查看该玩家,您必须添加一个 if 查询。 例如以下代码:
for (Player people : Bukkit.getOnlinePlayers()) {
if(!people.hasPermission("xyz.vanish"){
people.hidePlayer(plugin, player);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.