TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/command/Command_vanish.java
Telesphoreo e294ef8312 Reimplement vanish command
- SuperVanish has a wack permission system, and it didn't work in some rare circumstances. Added back TFMs vanish with the SuperVanish API
- Fixed the permission nodes so admins can see other admins, like how it was in TFM
2020-08-13 14:34:03 -05:00

44 lines
1.4 KiB
Java

package me.totalfreedom.totalfreedommod.command;
import de.myzelyam.api.vanish.VanishAPI;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Hide yourself from other players", usage = "/<command> [-s]", aliases = "v,ev,evanish")
public class Command_vanish extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length == 0)
{
if (!VanishAPI.isInvisible(playerSender))
{
VanishAPI.hidePlayer(playerSender);
}
else
{
VanishAPI.showPlayer(playerSender);
}
}
else if (args[0].equalsIgnoreCase("-s") || args[0].equalsIgnoreCase("-v"))
{
if (!VanishAPI.isInvisible(playerSender))
{
VanishAPI.getPlugin().getVisibilityChanger().hidePlayer(playerSender, null, true);
}
else
{
VanishAPI.getPlugin().getVisibilityChanger().showPlayer(playerSender, null, true);
}
}
else
{
return false;
}
return true;
}
}