Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
Fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
SloudPL committed Mar 19, 2023
1 parent 0ea1aac commit 425325f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 25 deletions.
44 changes: 21 additions & 23 deletions src/main/java/pl/sloudpl/simplevanish/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -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'

0 comments on commit 425325f

Please sign in to comment.