mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-11 13:33:54 +00:00
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
This commit is contained in:
@ -12,7 +12,6 @@ import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
@CommandParameters(description = "Check your permissions", usage = "/<command> [prefix | reload]")
|
||||
public class Command_permissions extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
|
@ -0,0 +1,44 @@
|
||||
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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user