mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-11 13:33:54 +00:00
[WIP / DO NOT USE ON PRODUCTION!!] Begin implementing support for SuperVanish and fix bugs
- Update dependencies in pom.xml - Replace TotalFreedomMod's vanish system with SuperVanish. It's widely supported by many major plugins and does a better job vanishing players - Fixed a typo in the SQL command for creating admin tables, where the table would not be created on a clean install of TFM - Update bStats Metrics to latest version - Remove the VanishHandler - Sync the permissions.yml from whats on the server. Entries for Essentials and SuperVanish will be added soon KNOWN BUG: - Plugins override TFM commands (e.g. Essentials takes over /list instead of giving it to TFM). I noticed that there is a semicolon before every TFM command. (:/ban, :/list), which is the actual TFM command. I have no idea where / how this bug came from. Urgently needs to be fixed.
This commit is contained in:
@ -22,7 +22,6 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Bans the specified player.", usage = "/<command> <username> [reason] [-nrb | -q]", aliases = "gtfo")
|
||||
public class Command_ban extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
|
@ -31,12 +31,12 @@ public class Command_deop extends FreedomCommand
|
||||
final String targetName = args[0].toLowerCase();
|
||||
|
||||
final List<String> matchedPlayerNames = new ArrayList<>();
|
||||
for (final Player player : server.getOnlinePlayers())
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName)
|
||||
|| player.getName().contains(targetName) || player.getDisplayName().contains(targetName))
|
||||
{
|
||||
if (player.isOp() && !AdminList.vanished.contains(player.getName()))
|
||||
if (player.isOp() && plugin.al.isVanished(player))
|
||||
{
|
||||
matchedPlayerNames.add(player.getName());
|
||||
player.setOp(false);
|
||||
|
@ -43,7 +43,7 @@ public class Command_invis extends FreedomCommand
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY) && !plugin.al.isVanished(player.getName()))
|
||||
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY) && !plugin.al.isVanished(player))
|
||||
{
|
||||
players.add(player.getName());
|
||||
if (clear && !plugin.al.isAdmin(player))
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import de.myzelyam.api.vanish.VanishAPI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
@ -18,7 +19,7 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-a | -i | -f | -v]", aliases = "who,lsit")
|
||||
public class Command_list extends FreedomCommand
|
||||
{
|
||||
|
||||
|
||||
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole)
|
||||
{
|
||||
if (args.length > 1)
|
||||
@ -96,7 +97,7 @@ public class Command_list extends FreedomCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().size() - AdminList.vanished.size())
|
||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().size() - VanishAPI.getInvisiblePlayers().size())
|
||||
.append(ChatColor.BLUE)
|
||||
.append(" out of a maximum ")
|
||||
.append(ChatColor.RED)
|
||||
@ -109,11 +110,11 @@ public class Command_list extends FreedomCommand
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.ADMINS && AdminList.vanished.contains(p.getName()))
|
||||
if (listFilter == ListFilter.ADMINS && plugin.al.isVanished(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.VANISHED_ADMINS && !AdminList.vanished.contains(p.getName()))
|
||||
if (listFilter == ListFilter.VANISHED_ADMINS && !plugin.al.isVanished(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -125,7 +126,7 @@ public class Command_list extends FreedomCommand
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.PLAYERS && AdminList.vanished.contains(p.getName()))
|
||||
if (listFilter == ListFilter.PLAYERS && plugin.al.isVanished(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -41,11 +41,11 @@ public class Command_nickfilter extends FreedomCommand
|
||||
|
||||
player = getPlayerByDisplayName(displayName);
|
||||
|
||||
if (player == null || plugin.al.isVanished(player.getName()) && !plugin.al.isAdmin(sender))
|
||||
if (player == null || plugin.al.isVanished(player) && !plugin.al.isAdmin(sender))
|
||||
{
|
||||
player = getPlayerByDisplayNameAlt(displayName);
|
||||
|
||||
if (player == null || !plugin.al.isVanished(player.getName()) && !plugin.al.isAdmin(sender))
|
||||
if (player == null || !plugin.al.isVanished(player) && !plugin.al.isAdmin(sender))
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Can't find player by nickname: " + displayName);
|
||||
return true;
|
||||
|
@ -37,7 +37,7 @@ public class Command_op extends FreedomCommand
|
||||
if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName)
|
||||
|| player.getName().contains(targetName) || player.getDisplayName().contains(targetName))
|
||||
{
|
||||
if (!player.isOp() && !AdminList.vanished.contains(player.getName()))
|
||||
if (!player.isOp() && !plugin.al.isVanished(player))
|
||||
{
|
||||
matchedPlayerNames.add(player.getName());
|
||||
player.setOp(true);
|
||||
|
@ -104,7 +104,7 @@ public class Command_potion extends FreedomCommand
|
||||
{
|
||||
target = getPlayer(args[4]);
|
||||
|
||||
if (target == null || plugin.al.isVanished(target.getName()) && !plugin.al.isAdmin(sender))
|
||||
if (target == null || plugin.al.isVanished(target) && !plugin.al.isAdmin(sender))
|
||||
{
|
||||
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
|
@ -48,7 +48,7 @@ public class Command_tag extends FreedomCommand
|
||||
|
||||
for (final Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (plugin.al.isVanished(player.getName()) && !plugin.al.isAdmin(sender))
|
||||
if (plugin.al.isVanished(player) && !plugin.al.isAdmin(sender))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -1,120 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import static me.totalfreedom.totalfreedommod.util.FUtil.playerMsg;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Vanish/unvanish yourself.", usage = "/<command> [-s[ilent]]", aliases = "v")
|
||||
public class Command_vanish extends FreedomCommand
|
||||
{
|
||||
|
||||
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole)
|
||||
{
|
||||
Displayable display = plugin.rm.getDisplay(playerSender);
|
||||
String displayName = display.getColor() + playerSender.getName();
|
||||
String tag = display.getColoredTag();
|
||||
boolean silent = false;
|
||||
if (args.length > 0)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("-s") || args[0].equalsIgnoreCase("-silent"))
|
||||
{
|
||||
silent = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.al.isVanished(playerSender.getName()))
|
||||
{
|
||||
if (silent)
|
||||
{
|
||||
msg(ChatColor.GOLD + "Silently unvanished.");
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("You have unvanished.", ChatColor.GOLD);
|
||||
FUtil.bcastMsg(plugin.rm.craftLoginMessage(playerSender, null));
|
||||
FUtil.bcastMsg(playerSender.getName() + " joined the game.", ChatColor.YELLOW);
|
||||
plugin.dc.messageChatChannel("**" + playerSender.getName() + " joined the server" + "**");
|
||||
}
|
||||
|
||||
PlayerData playerData = plugin.pl.getData(playerSender);
|
||||
if (playerData.getTag() != null)
|
||||
{
|
||||
tag = FUtil.colorize(playerData.getTag());
|
||||
}
|
||||
|
||||
plugin.pl.getData(playerSender).setTag(tag);
|
||||
FLog.info(playerSender.getName() + " is no longer vanished.");
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (plugin.al.isAdmin(player))
|
||||
{
|
||||
playerMsg(player, ChatColor.YELLOW + sender.getName() + " has unvanished and is now visible to everyone.");
|
||||
}
|
||||
if (!plugin.al.isAdmin(player))
|
||||
{
|
||||
player.showPlayer(plugin, playerSender);
|
||||
}
|
||||
}
|
||||
plugin.esb.setVanished(playerSender.getName(), false);
|
||||
playerSender.setPlayerListName(StringUtils.substring(displayName, 0, 16));
|
||||
plugin.al.vanished.remove(playerSender.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (plugin.al.isVanished(playerSender.getName()))
|
||||
{
|
||||
playerSender.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(ChatColor.GOLD + "You are hidden from other players."));
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(plugin, 0L, 4L);
|
||||
|
||||
if (silent)
|
||||
{
|
||||
msg("Silently vanished.", ChatColor.GOLD);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg ("You have vanished.", ChatColor.GOLD);
|
||||
FUtil.bcastMsg(playerSender.getName() + " left the game.", ChatColor.YELLOW);
|
||||
plugin.dc.messageChatChannel("**" + playerSender.getName() + " left the server" + "**");
|
||||
}
|
||||
|
||||
FLog.info(playerSender.getName() + " is now vanished.");
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
{
|
||||
if (plugin.al.isAdmin(player))
|
||||
{
|
||||
playerMsg(player, ChatColor.YELLOW + sender.getName() + " has vanished and is now only visible to admins.");
|
||||
}
|
||||
if (!plugin.al.isAdmin(player))
|
||||
{
|
||||
player.hidePlayer(plugin, playerSender);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugin.esb.setVanished(playerSender.getName(), true);
|
||||
plugin.al.vanished.add(playerSender.getName());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -40,7 +40,7 @@ public class Command_whohas extends FreedomCommand
|
||||
|
||||
for (final Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (!plugin.al.isAdmin(sender) && plugin.al.isVanished(player.getName()))
|
||||
if (!plugin.al.isAdmin(sender) && plugin.al.isVanished(player))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ public abstract class FreedomCommand implements CommandExecutor, TabCompleter
|
||||
Player player = Bukkit.getPlayer(name);
|
||||
if (player != null)
|
||||
{
|
||||
if (nullVanished && plugin.al.isVanished(player.getName()) && !plugin.al.isAdmin(sender))
|
||||
if (nullVanished && plugin.al.isVanished(player) && !plugin.al.isAdmin(sender))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user