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:
Telesphoreo 2020-08-13 14:34:03 -05:00
parent 541abb1ba8
commit e294ef8312
7 changed files with 48 additions and 11 deletions

View File

@ -35,6 +35,7 @@ public class VanishBridge extends FreedomService
}
else
{
plugin.al.messageAllAdmins(ChatColor.GOLD + player.getName() + " unvanished and is now visible to all players.");
FUtil.bcastMsg(plugin.rm.craftLoginMessage(event.getPlayer(), null));
plugin.dc.messageChatChannel("**" + player.getName() + " joined the server" + "**");
}
@ -53,7 +54,7 @@ public class VanishBridge extends FreedomService
Player player = event.getPlayer();
if (event.isSilent())
{
plugin.al.messageAllAdmins(ChatColor.GOLD + player.getName() + " silently vanished.");
plugin.al.messageAllAdmins(ChatColor.GOLD + player.getName() + " vanished and is now only visible to admins.");
}
else
{

View File

@ -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)
{

View File

@ -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;
}
}

View File

@ -15,7 +15,6 @@ import org.bukkit.configuration.file.YamlConfiguration;
public class PermissionConfig extends FreedomService
{
public static final String PERMISSIONS_FILENAME = "permissions.yml";
//
private final EnumMap<PermissionEntry, Object> entries;
@ -60,13 +59,11 @@ public class PermissionConfig extends FreedomService
@Override
public void onStart()
{
}
@Override
public void onStop()
{
}
public void load()
@ -167,7 +164,6 @@ public class PermissionConfig extends FreedomService
public static class PermissionDefaults
{
private YamlConfiguration defaults = null;
private PermissionDefaults(InputStream defaultConfig)
@ -190,5 +186,4 @@ public class PermissionConfig extends FreedomService
return defaults.get(path);
}
}
}

View File

@ -17,7 +17,6 @@ import org.bukkit.permissions.PermissionAttachmentInfo;
public class PermissionManager extends FreedomService
{
public Map<Displayable, List<String>> permissions = Maps.newHashMap();
public Map<Player, PermissionAttachment> attachments = Maps.newHashMap();
@ -35,7 +34,6 @@ public class PermissionManager extends FreedomService
public void loadPermissionNodes()
{
FLog.info("Loading permission nodes...");
permissions.clear();

View File

@ -211,7 +211,7 @@ super_admins:
- "essentials.tphere"
- "essentials.tpo"
- "essentials.tpohere"
- "sv.use"
- "sv.see"
- "sv.toggleitems"
# Telnet Admin permission nodes

View File

@ -2,6 +2,6 @@ name: TotalFreedomMod
main: me.totalfreedom.totalfreedommod.TotalFreedomMod
version: ${project.version}
description: Plugin for the Total Freedom server.
loadbefore: [BukkitTelnet, Essentials, LibsDisguises, WorldEdit, WorldGuard, WorldGuardExtraFlags, TFGuilds]
loadbefore: [BukkitTelnet, Essentials, LibsDisguises, WorldEdit, WorldGuard, WorldGuardExtraFlags, TFGuilds, SuperVanish, PremiumVanish]
authors: [Madgeek1450, Prozza]
api-version: 1.16