diff --git a/src/main/java/pl/sloudpl/simplevanish/Command.java b/src/main/java/pl/sloudpl/simplevanish/Command.java index 5bf1ad1..f002597 100644 --- a/src/main/java/pl/sloudpl/simplevanish/Command.java +++ b/src/main/java/pl/sloudpl/simplevanish/Command.java @@ -14,53 +14,51 @@ public Command(SimpleVanish m){ plugin = m; m.getCommand("vanish").setExecutor(this); + m.getCommand("v").setExecutor(this); } @Override public boolean onCommand(CommandSender sender, org.bukkit.command.Command command, String label, String[] args) { - if (command.getName().equalsIgnoreCase("v") || command.getName().equalsIgnoreCase("vanish")){ + if (sender instanceof Player) { - if (sender instanceof Player) { + Player p = (Player) sender; - Player p = (Player) sender; + if (p.hasPermission("sloudpl.vanish") || p.isOp()) { - if (p.hasPermission("sloudpl.vanish") || p.isOp()) { + if (plugin.invisible.contains(p)) { - if (plugin.invisible.contains(p)) { + for (Player players : Bukkit.getOnlinePlayers()) { - for (Player players : Bukkit.getOnlinePlayers()) { + players.showPlayer(p); - players.showPlayer(p); - - } - plugin.invisible.remove(p); - p.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("vanish.show"))); - - } else if (!plugin.invisible.contains(p)) { + } + plugin.invisible.remove(p); + p.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("vanish.show"))); - for (Player players : Bukkit.getOnlinePlayers()) { + } else if (!plugin.invisible.contains(p)) { - players.hidePlayer(p); + for (Player players : Bukkit.getOnlinePlayers()) { - } - plugin.invisible.add(p); - p.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("vanish.hide"))); + players.hidePlayer(p); } - - } else { - - p.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("vanish.nopermission"))); + plugin.invisible.add(p); + p.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("vanish.hide"))); } } else { - sender.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("vanish.console"))); + p.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("vanish.nopermission"))); } + + } else { + + sender.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("vanish.console"))); + } return false; diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 5488e0d..4a522db 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,5 +1,5 @@ vanish: - show: '&aYou are now visible' - hide: '&cYou are invisible' + show: '&cYou are now visible' + hide: '&aYou are invisible' nopermission: '&4You don`t have permission to use this command' console: '&4You need to be a player to use this command' \ No newline at end of file