From 7593fbda9e0c7c6eecaf13ab71ac5df135e6ca79 Mon Sep 17 00:00:00 2001 From: speedxx <43330808+speedxx@users.noreply.github.com> Date: Wed, 22 Jul 2020 17:40:58 -0400 Subject: [PATCH] revamp vanish --- .../totalfreedommod/LoginProcess.java | 18 ++-- .../totalfreedommod/TotalFreedomMod.java | 2 + .../totalfreedommod/VanishHandler.java | 83 +++++++++++++++++++ .../totalfreedommod/admin/AdminList.java | 9 +- .../totalfreedommod/command/Command_deop.java | 4 +- .../command/Command_invis.java | 5 +- .../totalfreedommod/command/Command_list.java | 7 +- .../command/Command_nickfilter.java | 6 +- .../totalfreedommod/command/Command_op.java | 5 +- .../command/Command_potion.java | 5 +- .../totalfreedommod/command/Command_tag.java | 4 +- .../command/Command_vanish.java | 47 ++++++++--- .../command/Command_whohas.java | 4 +- .../command/FreedomCommand.java | 9 +- .../totalfreedommod/discord/Discord.java | 11 ++- .../httpd/module/Module_list.java | 6 +- .../httpd/module/Module_players.java | 4 +- .../totalfreedommod/rank/RankManager.java | 7 +- .../totalfreedommod/util/FUtil.java | 7 +- 19 files changed, 183 insertions(+), 60 deletions(-) create mode 100644 src/main/java/me/totalfreedom/totalfreedommod/VanishHandler.java diff --git a/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java b/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java index 119912b5..f921bd71 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java @@ -31,7 +31,7 @@ public class LoginProcess extends FreedomService public static final Pattern USERNAME_REGEX = Pattern.compile("^[\\w\\d_]{3,20}$"); public List TELEPORT_ON_JOIN = new ArrayList<>(); public List CLEAR_ON_JOIN = new ArrayList<>(); - // + @Getter @Setter private static boolean lockdownEnabled = false; @@ -188,7 +188,7 @@ public class LoginProcess extends FreedomService final Player player = event.getPlayer(); final FPlayer fPlayer = plugin.pl.getPlayer(player); final PlayerData playerData = plugin.pl.getData(player); - + player.sendTitle(FUtil.colorize(ConfigEntry.SERVER_LOGIN_TITLE.getString()), FUtil.colorize(ConfigEntry.SERVER_LOGIN_SUBTITLE.getString()), 20, 100, 60); player.setOp(true); @@ -226,14 +226,6 @@ public class LoginProcess extends FreedomService player.setPlayerListFooter(FUtil.colorize(ConfigEntry.SERVER_TABLIST_FOOTER.getString()).replace("\\n", "\n")); } - for (Player p : plugin.al.vanished) - { - if (!plugin.al.isAdmin(player)) - { - player.hidePlayer(plugin, p); - } - } - if (!plugin.al.isAdmin(player)) { String tag = playerData.getTag(); @@ -241,6 +233,7 @@ public class LoginProcess extends FreedomService { fPlayer.setTag(FUtil.colorize(tag)); } + int noteCount = playerData.getNotes().size(); if (noteCount != 0) { @@ -274,7 +267,6 @@ public class LoginProcess extends FreedomService FUtil.playerMsg(player, "Warning: Server is currenty in lockdown-mode, new players will not be able to join!", ChatColor.RED); } } - }.runTaskLater(plugin, 20L * 1L); + }.runTaskLater(plugin, 20L); } - -} +} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java index 2e51f398..c888872d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java @@ -135,6 +135,7 @@ public class TotalFreedomMod extends JavaPlugin public SignBlocker snp; public EntityWiper ew; public Sitter st; + public VanishHandler vh; //public HubWorldRestrictions hwr; // @@ -243,6 +244,7 @@ public class TotalFreedomMod extends JavaPlugin snp = new SignBlocker(); ew = new EntityWiper(); st = new Sitter(); + vh = new VanishHandler(); // Single admin utils cs = new CommandSpy(); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/VanishHandler.java b/src/main/java/me/totalfreedom/totalfreedommod/VanishHandler.java new file mode 100644 index 00000000..7d1e586d --- /dev/null +++ b/src/main/java/me/totalfreedom/totalfreedommod/VanishHandler.java @@ -0,0 +1,83 @@ +package me.totalfreedom.totalfreedommod; + +import me.totalfreedom.totalfreedommod.util.FLog; +import net.md_5.bungee.api.ChatMessageType; +import net.md_5.bungee.api.chat.TextComponent; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.scheduler.BukkitRunnable; + +public class VanishHandler extends FreedomService +{ + + @Override + public void onStart() + { + } + + @Override + public void onStop() + { + } + + @EventHandler(priority = EventPriority.HIGH) + public void onPlayerJoin(PlayerJoinEvent event) + { + Player player = event.getPlayer(); + + for (Player p : server.getOnlinePlayers()) + { + if (!plugin.al.isAdmin(player) && plugin.al.isVanished(p.getName())) + { + player.hidePlayer(plugin, p); + } + } + + for (Player p : server.getOnlinePlayers()) + { + if (!plugin.al.isAdmin(p) && plugin.al.isVanished(player.getName())) + { + p.hidePlayer(plugin, player); + } + } + + if (plugin.al.isVanished(player.getName())) + { + plugin.esb.setVanished(player.getName(), true); + FLog.info(player.getName() + " joined while still vanished."); + plugin.al.messageAllAdmins(ChatColor.YELLOW + player.getName() + " has joined silently."); + event.setJoinMessage(null); + + new BukkitRunnable() + { + @Override + public void run() + { + if (!plugin.al.isVanished(player.getName())) + { + this.cancel(); + } + + player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(ChatColor.GOLD + "You are hidden from other players.")); + } + }.runTaskTimer(plugin, 0L, 4L); + } + } + + @EventHandler + public void onPlayerLeave(PlayerQuitEvent event) + { + Player player = event.getPlayer(); + + if (plugin.al.isVanished(player.getName())) + { + event.setQuitMessage(null); + FLog.info(player.getName() + " left while still vanished."); + plugin.al.messageAllAdmins(ChatColor.YELLOW + player.getName() + " has left silently."); + } + } +} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java b/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java index 1ee13ca7..8d2f5b54 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java @@ -31,7 +31,7 @@ public class AdminList extends FreedomService private final Map ipTable = Maps.newHashMap(); public final List verifiedNoAdmins = new ArrayList<>(); public final Map> verifiedNoAdminIps = Maps.newHashMap(); - public static ArrayList vanished = new ArrayList<>(); + public static List vanished = new ArrayList<>(); @Override public void onStart() @@ -362,4 +362,9 @@ public class AdminList extends FreedomService updateTables(); } -} + + public boolean isVanished(String player) + { + return vanished.contains(player); + } +} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deop.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deop.java index 29eda479..474d639f 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deop.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deop.java @@ -36,7 +36,7 @@ public class Command_deop 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)) + if (player.isOp() && !AdminList.vanished.contains(player.getName())) { matchedPlayerNames.add(player.getName()); player.setOp(false); @@ -59,4 +59,4 @@ public class Command_deop extends FreedomCommand return true; } -} +} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invis.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invis.java index b2156e87..f89113d5 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invis.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invis.java @@ -16,6 +16,7 @@ import org.bukkit.potion.PotionEffectType; @CommandParameters(description = "Shows (optionally clears) invisible players", usage = "/ [clear]") public class Command_invis extends FreedomCommand { + @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { @@ -42,7 +43,7 @@ public class Command_invis extends FreedomCommand for (Player player : server.getOnlinePlayers()) { - if (player.hasPotionEffect(PotionEffectType.INVISIBILITY) && !plugin.al.vanished.contains(player)) + if (player.hasPotionEffect(PotionEffectType.INVISIBILITY) && !plugin.al.isVanished(player.getName())) { players.add(player.getName()); if (clear && !plugin.al.isAdmin(player)) @@ -75,4 +76,4 @@ public class Command_invis extends FreedomCommand return Collections.emptyList(); } -} +} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java index 64b6ac07..4bced067 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java @@ -18,6 +18,7 @@ import org.bukkit.entity.Player; @CommandParameters(description = "Lists the real names of all online players.", usage = "/ [-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) @@ -108,11 +109,11 @@ public class Command_list extends FreedomCommand { continue; } - if (listFilter == ListFilter.ADMINS && AdminList.vanished.contains(p)) + if (listFilter == ListFilter.ADMINS && AdminList.vanished.contains(p.getName())) { continue; } - if (listFilter == ListFilter.VANISHED_ADMINS && !AdminList.vanished.contains(p)) + if (listFilter == ListFilter.VANISHED_ADMINS && !AdminList.vanished.contains(p.getName())) { continue; } @@ -124,7 +125,7 @@ public class Command_list extends FreedomCommand { continue; } - if (listFilter == ListFilter.PLAYERS && AdminList.vanished.contains(p)) + if (listFilter == ListFilter.PLAYERS && AdminList.vanished.contains(p.getName())) { continue; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickfilter.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickfilter.java index a2e9b021..16d5375a 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickfilter.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickfilter.java @@ -41,11 +41,11 @@ public class Command_nickfilter extends FreedomCommand player = getPlayerByDisplayName(displayName); - if (player == null || plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender)) + if (player == null || plugin.al.isVanished(player.getName()) && !plugin.al.isAdmin(sender)) { player = getPlayerByDisplayNameAlt(displayName); - if (player == null || !plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender)) + if (player == null || !plugin.al.isVanished(player.getName()) && !plugin.al.isAdmin(sender)) { sender.sendMessage(ChatColor.GRAY + "Can't find player by nickname: " + displayName); return true; @@ -120,4 +120,4 @@ public class Command_nickfilter extends FreedomCommand return minEditMatch; } -} +} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_op.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_op.java index 8b60beab..3d97ee36 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_op.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_op.java @@ -14,6 +14,7 @@ import org.bukkit.entity.Player; @CommandParameters(description = "OP a player", usage = "/ ") public class Command_op extends FreedomCommand { + @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { @@ -36,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)) + if (!player.isOp() && !AdminList.vanished.contains(player.getName())) { matchedPlayerNames.add(player.getName()); player.setOp(true); @@ -59,4 +60,4 @@ public class Command_op extends FreedomCommand return true; } -} +} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java index 0af3b7d3..72eab67c 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java @@ -106,7 +106,7 @@ public class Command_potion extends FreedomCommand { target = getPlayer(args[4]); - if (target == null || plugin.al.vanished.contains(target) && !plugin.al.isAdmin(sender)) + if (target == null || plugin.al.isVanished(target.getName()) && !plugin.al.isAdmin(sender)) { msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED); return true; @@ -244,5 +244,4 @@ public class Command_potion extends FreedomCommand } return types; } - -} +} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java index 0293767c..244cbed8 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java @@ -48,7 +48,7 @@ public class Command_tag extends FreedomCommand for (final Player player : server.getOnlinePlayers()) { - if (plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender)) + if (plugin.al.isVanished(player.getName()) && !plugin.al.isAdmin(sender)) { continue; } @@ -269,4 +269,4 @@ public class Command_tag extends FreedomCommand playerData.setTag(tag); plugin.pl.save(playerData); } -} +} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_vanish.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_vanish.java index 5017fdbe..82728e7b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_vanish.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_vanish.java @@ -1,16 +1,18 @@ package me.totalfreedom.totalfreedommod.command; -import me.totalfreedom.totalfreedommod.admin.Admin; 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) @@ -23,7 +25,6 @@ public class Command_vanish extends FreedomCommand Displayable display = plugin.rm.getDisplay(playerSender); String displayName = display.getColor() + playerSender.getName(); String tag = display.getColoredTag(); - Admin admin = plugin.al.getAdmin(playerSender); boolean silent = false; if (args.length > 0) { @@ -32,22 +33,30 @@ public class Command_vanish extends FreedomCommand silent = true; } } - if (plugin.al.vanished.contains(playerSender)) + + if (plugin.al.isVanished(playerSender.getName())) { - msg(ChatColor.GOLD + "You have been unvanished."); - if (!silent) + 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)) @@ -61,16 +70,33 @@ public class Command_vanish extends FreedomCommand } plugin.esb.setVanished(playerSender.getName(), false); playerSender.setPlayerListName(StringUtils.substring(displayName, 0, 16)); - plugin.al.vanished.remove(playerSender); + plugin.al.vanished.remove(playerSender.getName()); } else { - msg("You have been vanished.", ChatColor.GOLD); - if (!silent) + 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()) { @@ -85,9 +111,10 @@ public class Command_vanish extends FreedomCommand } } } + plugin.esb.setVanished(playerSender.getName(), true); - plugin.al.vanished.add(playerSender); + plugin.al.vanished.add(playerSender.getName()); } return true; } -} +} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java index c0f5e599..cdd2754b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java @@ -40,7 +40,7 @@ public class Command_whohas extends FreedomCommand for (final Player player : server.getOnlinePlayers()) { - if (!plugin.al.isAdmin(sender) && plugin.al.vanished.contains(player)) + if (!plugin.al.isAdmin(sender) && plugin.al.isVanished(player.getName())) { continue; } @@ -94,4 +94,4 @@ public class Command_whohas extends FreedomCommand return Collections.emptyList(); } -} +} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java b/src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java index 0b1e3dba..f0c188b9 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java @@ -303,9 +303,12 @@ public abstract class FreedomCommand implements CommandExecutor, TabCompleter protected Player getPlayer(String name, Boolean nullVanished) { Player player = Bukkit.getPlayer(name); - if (nullVanished && plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender)) + if (player != null) { - return null; + if (nullVanished && plugin.al.isVanished(player.getName()) && !plugin.al.isAdmin(sender)) + { + return null; + } } return player; } @@ -341,4 +344,4 @@ public abstract class FreedomCommand implements CommandExecutor, TabCompleter return null; } } -} +} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java b/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java index 60ea9537..5076e395 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/discord/Discord.java @@ -49,6 +49,7 @@ import org.bukkit.event.player.PlayerQuitEvent; public class Discord extends FreedomService { + public static HashMap LINK_CODES = new HashMap<>(); public static HashMap VERIFICATION_CODES = new HashMap<>(); public ScheduledThreadPoolExecutor RATELIMIT_EXECUTOR; @@ -253,13 +254,19 @@ public class Discord extends FreedomService @EventHandler(priority = EventPriority.MONITOR) public void onPlayerJoin(PlayerJoinEvent event) { - messageChatChannel("**" + deformat(event.getPlayer().getName()) + " joined the server" + "**"); + if (!plugin.al.isVanished(event.getPlayer().getName())) + { + messageChatChannel("**" + deformat(event.getPlayer().getName()) + " joined the server" + "**"); + } } @EventHandler(priority = EventPriority.MONITOR) public void onPlayerLeave(PlayerQuitEvent event) { - messageChatChannel("**" + deformat(event.getPlayer().getName()) + " left the server" + "**"); + if (!plugin.al.isVanished(event.getPlayer().getName())) + { + messageChatChannel("**" + deformat(event.getPlayer().getName()) + " left the server" + "**"); + } } @EventHandler(priority = EventPriority.MONITOR) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_list.java b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_list.java index c2e05c43..c4bcf502 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_list.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_list.java @@ -40,7 +40,7 @@ public class Module_list extends HTTPDModule for (Player player : Bukkit.getOnlinePlayers()) { - if (plugin.al.vanished.contains(player)) + if (plugin.al.isVanished(player.getName())) { continue; } @@ -128,7 +128,7 @@ public class Module_list extends HTTPDModule for (Player player : onlinePlayers) { - if (plugin.al.vanished.contains(player)) + if (plugin.al.isVanished(player.getName())) { continue; } @@ -167,4 +167,4 @@ public class Module_list extends HTTPDModule { return "Total Freedom - Online Players"; } -} +} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_players.java b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_players.java index fcd9a89d..effa05b5 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_players.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_players.java @@ -36,7 +36,7 @@ public class Module_players extends HTTPDModule // All online players for (Player player : Bukkit.getOnlinePlayers()) { - if (!plugin.al.vanished.contains(player)) + if (!plugin.al.isVanished(player.getName())) { players.add(player.getName()); if (plugin.al.isAdmin(player) && !plugin.al.isAdminImpostor(player)) @@ -85,4 +85,4 @@ public class Module_players extends HTTPDModule response.addHeader("Access-Control-Allow-Origin", "*"); return response; } -} +} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java b/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java index 7345f900..284bcdb8 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java @@ -250,7 +250,10 @@ public class RankManager extends FreedomService // Broadcast login message if (isAdmin || FUtil.isDeveloper(player.getName()) || plugin.pl.getData(player).isMasterBuilder() || plugin.pl.getData(player).isDonator()) { - FUtil.bcastMsg(craftLoginMessage(player, null)); + if (!plugin.al.isVanished(player.getName())) + { + FUtil.bcastMsg(craftLoginMessage(player, null)); + } } // Set display @@ -312,4 +315,4 @@ public class RankManager extends FreedomService team.addPlayer(player); } } -} +} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java index 93bc511e..f4bcc836 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java @@ -52,10 +52,9 @@ public class FUtil { private static final Random RANDOM = new Random(); - // public static final String SAVED_FLAGS_FILENAME = "savedflags.dat"; // See https://github.com/TotalFreedom/License - None of the listed names may be removed. - public static final List DEVELOPERS = Arrays.asList("Madgeek1450", "Prozza", "WickedGamingUK", "Wild1145", "aggelosQQ", "scripthead", "supernt", "Telesphoreo", "CoolJWB"); + public static final List DEVELOPERS = Arrays.asList("Madgeek1450", "Prozza", "WickedGamingUK", "Wild1145", "aggelosQQ", "scripthead", "supernt"); public static String DATE_STORAGE_FORMAT = "EEE, d MMM yyyy HH:mm:ss Z"; public static final Map CHAT_COLOR_NAMES = new HashMap<>(); public static final List CHAT_COLOR_POOL = Arrays.asList( @@ -146,7 +145,7 @@ public class FUtil List names = new ArrayList<>(); for (Player player : Bukkit.getOnlinePlayers()) { - if (!TotalFreedomMod.plugin().al.vanished.contains(player)) + if (!TotalFreedomMod.plugin().al.isVanished(player.getName())) { names.add(player.getName()); } @@ -814,4 +813,4 @@ public class FUtil String id; String name; } -} +} \ No newline at end of file