From da80f1b69e6f6eeb9bf4f36cbebfc44f02c449d6 Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Sat, 15 Aug 2020 17:41:23 -0500 Subject: [PATCH] Revert "Merge branch 'development' of https://github.com/TFPatches/TotalFreedomMod into development" This reverts commit 4407e9e6ec7c39b0f45138ab381ae3c57395f6b0, reversing changes made to e4c9ea656ee799c3820bf6feb5861dcfba1d64bb. --- pom.xml | 4 +- .../me/totalfreedom/totalfreedommod/AMP.java | 8 +- .../totalfreedommod/AntiSpam.java | 4 +- .../totalfreedommod/ChatManager.java | 62 ++- .../totalfreedommod/CommandSpy.java | 4 +- .../totalfreedommod/LoginProcess.java | 20 +- .../totalfreedommod/Monitors.java | 2 +- .../totalfreedom/totalfreedommod/Muter.java | 4 +- .../totalfreedommod/ProtectArea.java | 392 ++++++++++++++++++ .../totalfreedom/totalfreedommod/Reddit.java | 12 +- .../totalfreedommod/ServerPing.java | 4 +- .../totalfreedommod/TotalFreedomMod.java | 20 +- .../{staff => admin}/ActivityLog.java | 6 +- .../{staff => admin}/ActivityLogEntry.java | 2 +- .../StaffMember.java => admin/Admin.java} | 18 +- .../totalfreedommod/admin/AdminList.java | 370 +++++++++++++++++ .../totalfreedommod/banning/BanManager.java | 2 +- .../totalfreedommod/blocking/EditBlocker.java | 4 +- .../blocking/EventBlocker.java | 2 +- .../blocking/InteractBlocker.java | 4 +- .../totalfreedommod/blocking/PVPBlocker.java | 2 +- .../blocking/command/CommandBlocker.java | 2 +- .../blocking/command/CommandBlockerRank.java | 8 +- .../bridge/BukkitTelnetBridge.java | 30 +- .../bridge/LibsDisguisesBridge.java | 4 +- .../totalfreedommod/caging/Cager.java | 2 +- ..._staffchat.java => Command_adminchat.java} | 13 +- ..._staffinfo.java => Command_admininfo.java} | 12 +- ..._staffmode.java => Command_adminmode.java} | 20 +- ...taffworld.java => Command_adminworld.java} | 22 +- .../command/Command_adventure.java | 4 +- .../command/Command_aeclear.java | 4 +- .../totalfreedommod/command/Command_amp.java | 22 +- .../command/Command_announce.java | 2 +- .../command/Command_autoclear.java | 2 +- .../command/Command_autotp.java | 2 +- .../totalfreedommod/command/Command_ban.java | 4 +- .../command/Command_banip.java | 4 +- .../command/Command_banlist.java | 4 +- .../command/Command_banname.java | 4 +- .../command/Command_blockcmd.java | 16 +- .../command/Command_blockedit.java | 14 +- .../command/Command_blockpvp.java | 14 +- .../command/Command_blockredstone.java | 8 +- .../totalfreedommod/command/Command_cage.java | 10 +- .../totalfreedommod/command/Command_cake.java | 2 +- .../command/Command_cartsit.java | 2 +- .../command/Command_clearchat.java | 6 +- .../command/Command_cleardiscordqueue.java | 2 +- .../command/Command_clearinventory.java | 6 +- .../command/Command_cmdspy.java | 14 +- .../command/Command_consolesay.java | 2 +- .../command/Command_cookie.java | 2 +- .../command/Command_creative.java | 4 +- .../command/Command_curse.java | 4 +- .../command/Command_denick.java | 4 +- .../totalfreedommod/command/Command_deop.java | 6 +- .../command/Command_deopall.java | 4 +- .../command/Command_disguisetoggle.java | 4 +- .../command/Command_donator.java | 2 +- .../totalfreedommod/command/Command_doom.java | 24 +- .../command/Command_entitywipe.java | 4 +- .../command/Command_expel.java | 2 +- .../command/Command_explode.java | 4 +- .../command/Command_explosivearrows.java | 2 +- .../command/Command_findip.java | 2 +- .../command/Command_forcekill.java | 2 +- .../command/Command_freeze.java | 12 +- .../command/Command_fuckoff.java | 2 +- .../command/Command_health.java | 2 +- .../command/Command_hubworld.java | 4 +- .../command/Command_indefban.java | 2 +- .../command/Command_invis.java | 10 +- .../command/Command_invsee.java | 6 +- .../command/Command_jumppads.java | 2 +- .../totalfreedommod/command/Command_kick.java | 6 +- .../command/Command_kicknoob.java | 10 +- .../command/Command_lastcmd.java | 2 +- .../command/Command_linkdiscord.java | 2 +- .../totalfreedommod/command/Command_list.java | 70 +++- .../command/Command_lockup.java | 10 +- .../totalfreedommod/command/Command_logs.java | 2 +- .../command/Command_makeopregion.java | 2 +- .../command/Command_manageshop.java | 2 +- .../command/Command_manuallyverify.java | 4 +- .../command/Command_massmurder.java | 2 +- .../command/Command_masterbuilderworld.java | 4 +- .../command/Command_mbconfig.java | 6 +- .../command/Command_moblimiter.java | 2 +- .../command/Command_mobpurge.java | 4 +- .../totalfreedommod/command/Command_mute.java | 14 +- ...mand_mystaff.java => Command_myadmin.java} | 80 ++-- .../command/Command_nickclean.java | 6 +- .../command/Command_nickfilter.java | 4 +- .../command/Command_notes.java | 2 +- .../totalfreedommod/command/Command_op.java | 4 +- .../command/Command_opall.java | 2 +- .../totalfreedommod/command/Command_opme.java | 2 +- .../totalfreedommod/command/Command_ops.java | 4 +- .../command/Command_orbit.java | 4 +- .../command/Command_permissions.java | 2 +- .../command/Command_playtime.java | 4 +- .../command/Command_plugincontrol.java | 4 +- .../command/Command_potion.java | 20 +- .../command/Command_potionspy.java | 24 +- .../command/Command_protectarea.java | 104 +++++ .../command/Command_purgeall.java | 4 +- .../command/Command_rawsay.java | 2 +- .../command/Command_reactionbar.java | 2 +- .../command/Command_report.java | 4 +- .../totalfreedommod/command/Command_ride.java | 2 +- .../totalfreedommod/command/Command_ro.java | 10 +- .../totalfreedommod/command/Command_rock.java | 2 +- ...nd_slconfig.java => Command_saconfig.java} | 148 +++---- .../totalfreedommod/command/Command_say.java | 2 +- .../command/Command_scare.java | 4 +- .../command/Command_serverstats.java | 2 +- .../command/Command_setlimit.java | 4 +- .../command/Command_setspawnworld.java | 8 +- .../command/Command_settotalvotes.java | 2 +- .../command/Command_smite.java | 2 +- .../command/Command_spectate.java | 2 +- .../command/Command_spectator.java | 2 +- .../totalfreedommod/command/Command_stop.java | 2 +- .../command/Command_survival.java | 4 +- .../totalfreedommod/command/Command_tag.java | 16 +- .../command/Command_tagnyan.java | 4 +- .../command/Command_tagrainbow.java | 2 +- .../totalfreedommod/command/Command_tban.java | 6 +- .../command/Command_tempban.java | 4 +- .../command/Command_toggle.java | 6 +- .../command/Command_togglechat.java | 4 +- .../command/Command_totalfreedommod.java | 2 +- .../command/Command_trail.java | 2 +- .../command/Command_unban.java | 4 +- .../command/Command_unbanip.java | 4 +- .../command/Command_unbanname.java | 4 +- .../command/Command_unblockcmd.java | 4 +- .../command/Command_uncage.java | 4 +- .../command/Command_undisguiseall.java | 4 +- .../command/Command_unlinkdiscord.java | 2 +- .../command/Command_unmute.java | 4 +- .../command/Command_vanish.java | 44 -- ...ostaff.java => Command_verifynoadmin.java} | 28 +- .../totalfreedommod/command/Command_warn.java | 8 +- .../command/Command_whitelist.java | 22 +- .../command/Command_whohas.java | 8 +- .../command/Command_wildcard.java | 2 +- .../command/Command_wipecoreprotectdata.java | 4 +- .../command/Command_wipeflatlands.java | 2 +- .../command/Command_wipepunishments.java | 6 +- .../command/Command_wiperegions.java | 4 +- .../command/Command_wipeuserdata.java | 6 +- .../command/Command_wipewarps.java | 4 +- .../command/FreedomCommand.java | 22 +- .../totalfreedommod/config/ConfigEntry.java | 26 +- .../totalfreedommod/discord/Discord.java | 79 ++-- .../discord/DiscordToMinecraftListener.java | 12 +- .../discord/PrivateMessageListener.java | 8 +- .../totalfreedommod/freeze/FreezeData.java | 4 +- .../totalfreedommod/freeze/Freezer.java | 2 +- .../totalfreedommod/httpd/HTTPDaemon.java | 4 +- .../httpd/module/Module_activitylog.java | 6 +- .../{Module_staff.java => Module_admins.java} | 8 +- .../httpd/module/Module_bans.java | 4 +- .../httpd/module/Module_indefbans.java | 4 +- .../httpd/module/Module_list.java | 42 +- .../httpd/module/Module_logfile.java | 4 +- .../httpd/module/Module_players.java | 18 +- .../httpd/module/Module_punishments.java | 4 +- .../httpd/module/Module_schematic.java | 6 +- .../permissions/PermissionEntry.java | 6 +- .../permissions/PermissionManager.java | 28 +- .../totalfreedommod/player/FPlayer.java | 4 +- .../totalfreedommod/player/PlayerList.java | 40 +- .../totalfreedommod/rank/Rank.java | 30 +- .../totalfreedommod/rank/RankManager.java | 62 +-- .../totalfreedommod/sql/SQLite.java | 65 +-- .../totalfreedommod/staff/StaffList.java | 370 ----------------- .../totalfreedommod/util/FSync.java | 2 +- .../totalfreedommod/util/FUtil.java | 6 +- .../{StaffWorld.java => AdminWorld.java} | 10 +- .../totalfreedommod/world/WorldManager.java | 12 +- .../world/WorldRestrictions.java | 4 +- src/main/resources/config.yml | 52 ++- src/main/resources/permissions.yml | 12 +- 186 files changed, 1828 insertions(+), 1275 deletions(-) create mode 100644 src/main/java/me/totalfreedom/totalfreedommod/ProtectArea.java rename src/main/java/me/totalfreedom/totalfreedommod/{staff => admin}/ActivityLog.java (97%) rename src/main/java/me/totalfreedom/totalfreedommod/{staff => admin}/ActivityLogEntry.java (98%) rename src/main/java/me/totalfreedom/totalfreedommod/{staff/StaffMember.java => admin/Admin.java} (91%) create mode 100644 src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java rename src/main/java/me/totalfreedom/totalfreedommod/command/{Command_staffchat.java => Command_adminchat.java} (69%) rename src/main/java/me/totalfreedom/totalfreedommod/command/{Command_staffinfo.java => Command_admininfo.java} (72%) rename src/main/java/me/totalfreedom/totalfreedommod/command/{Command_staffmode.java => Command_adminmode.java} (70%) rename src/main/java/me/totalfreedom/totalfreedommod/command/{Command_staffworld.java => Command_adminworld.java} (88%) rename src/main/java/me/totalfreedom/totalfreedommod/command/{Command_mystaff.java => Command_myadmin.java} (76%) create mode 100644 src/main/java/me/totalfreedom/totalfreedommod/command/Command_protectarea.java rename src/main/java/me/totalfreedom/totalfreedommod/command/{Command_slconfig.java => Command_saconfig.java} (58%) delete mode 100644 src/main/java/me/totalfreedom/totalfreedommod/command/Command_vanish.java rename src/main/java/me/totalfreedom/totalfreedommod/command/{Command_verifynostaff.java => Command_verifynoadmin.java} (71%) rename src/main/java/me/totalfreedom/totalfreedommod/httpd/module/{Module_staff.java => Module_admins.java} (85%) delete mode 100644 src/main/java/me/totalfreedom/totalfreedommod/staff/StaffList.java rename src/main/java/me/totalfreedom/totalfreedommod/world/{StaffWorld.java => AdminWorld.java} (95%) diff --git a/pom.xml b/pom.xml index 2fadd7ff..da9c2b15 100644 --- a/pom.xml +++ b/pom.xml @@ -236,9 +236,9 @@ - com.github.TFPatches + com.github.speedxx TFGuilds - ad93b9ed00 + master provided diff --git a/src/main/java/me/totalfreedom/totalfreedommod/AMP.java b/src/main/java/me/totalfreedom/totalfreedommod/AMP.java index 8f78ef22..32b0fc45 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/AMP.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/AMP.java @@ -5,7 +5,7 @@ import java.util.Arrays; import java.util.List; import joptsimple.internal.Strings; import lombok.Getter; -import me.totalfreedom.totalfreedommod.staff.StaffMember; +import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FLog; @@ -103,16 +103,16 @@ public class AMP extends FreedomService FLog.info("Logged out of AMP"); } - public void updateAccountStatus(StaffMember staffMember) + public void updateAccountStatus(Admin admin) { - String username = staffMember.getAmpUsername(); + String username = admin.getAmpUsername(); if (username == null || !enabled) { return; } - if (!staffMember.isActive() || staffMember.getRank() != Rank.ADMIN) + if (!admin.isActive() || admin.getRank() != Rank.SENIOR_ADMIN) { FLog.debug("Disabling amp acc"); setAccountEnabled(username, false); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/AntiSpam.java b/src/main/java/me/totalfreedom/totalfreedommod/AntiSpam.java index af015222..54764e87 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/AntiSpam.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/AntiSpam.java @@ -62,7 +62,7 @@ public class AntiSpam extends FreedomService { final Player player = event.getPlayer(); - if (plugin.sl.isStaff(player)) + if (plugin.al.isAdmin(player)) { return; } @@ -109,7 +109,7 @@ public class AntiSpam extends FreedomService return; } - if (plugin.sl.isStaff(player)) + if (plugin.al.isAdmin(player)) { return; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java b/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java index 723f6316..079ef884 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java @@ -1,7 +1,7 @@ package me.totalfreedom.totalfreedommod; import com.google.common.base.Strings; -import me.totalfreedom.totalfreedommod.staff.StaffMember; +import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.player.PlayerData; @@ -65,7 +65,7 @@ public class ChatManager extends FreedomService return; } - if (!ConfigEntry.TOGGLE_CHAT.getBoolean() && !plugin.sl.isStaff(player)) + if (!ConfigEntry.TOGGLE_CHAT.getBoolean() && !plugin.al.isAdmin(player)) { event.setCancelled(true); playerMsg(player, "Chat is currently disabled.", org.bukkit.ChatColor.RED); @@ -123,7 +123,7 @@ public class ChatManager extends FreedomService } // Check for mentions - Boolean mentionEveryone = ChatColor.stripColor(message).toLowerCase().contains("@everyone") && plugin.sl.isStaff(player); + Boolean mentionEveryone = ChatColor.stripColor(message).toLowerCase().contains("@everyone") && plugin.al.isAdmin(player); for (Player p : server.getOnlinePlayers()) { if (ChatColor.stripColor(message).toLowerCase().contains("@" + p.getName().toLowerCase()) || mentionEveryone) @@ -136,44 +136,76 @@ public class ChatManager extends FreedomService event.setFormat(format); // Send to discord - if (!ConfigEntry.STAFF_ONLY_MODE.getBoolean() && !Bukkit.hasWhitelist() && !plugin.pl.getPlayer(player).isMuted() && !plugin.tfg.inGuildChat(player)) + if (!ConfigEntry.ADMIN_ONLY_MODE.getBoolean() && !Bukkit.hasWhitelist() && !plugin.pl.getPlayer(player).isMuted() && !plugin.tfg.inGuildChat(player)) { plugin.dc.messageChatChannel(plugin.dc.deformat(player.getName()) + " \u00BB " + ChatColor.stripColor(message)); } } - public ChatColor getColor(Displayable display) + public ChatColor getColor(Admin admin, Displayable display) { ChatColor color = display.getColor(); + if (admin.getOldTags()) + { + + if (color.equals(ChatColor.AQUA)) + { + color = ChatColor.GOLD; + } + else if (color.equals(ChatColor.GOLD)) + { + color = ChatColor.LIGHT_PURPLE; + } + else if (color.equals(ChatColor.DARK_RED)) + { + color = ChatColor.BLUE; + } + } return color; } - public String getColoredTag(Displayable display) + public String getColoredTag(Admin admin, Displayable display) { ChatColor color = display.getColor(); + if (admin.getOldTags()) + { + + if (color.equals(ChatColor.AQUA)) + { + color = ChatColor.GOLD; + } + else if (color.equals(ChatColor.GOLD)) + { + color = ChatColor.LIGHT_PURPLE; + } + else if (color.equals(ChatColor.DARK_RED)) + { + color = ChatColor.BLUE; + } + } return color + display.getAbbr(); } - public void staffChat(CommandSender sender, String message) + public void adminChat(CommandSender sender, String message) { Displayable display = plugin.rm.getDisplay(sender); - FLog.info("[STAFF] " + sender.getName() + " " + display.getTag() + ": " + message, true); + FLog.info("[ADMIN] " + sender.getName() + " " + display.getTag() + ": " + message, true); for (Player player : server.getOnlinePlayers()) { - if (plugin.sl.isStaff(player)) + if (plugin.al.isAdmin(player)) { - StaffMember staffMember = plugin.sl.getAdmin(player); - if (!Strings.isNullOrEmpty(staffMember.getAcFormat())) + Admin admin = plugin.al.getAdmin(player); + if (!Strings.isNullOrEmpty(admin.getAcFormat())) { - String format = staffMember.getAcFormat(); - ChatColor color = getColor(display); + String format = admin.getAcFormat(); + ChatColor color = getColor(admin, display); String msg = format.replace("%name%", sender.getName()).replace("%rank%", display.getAbbr()).replace("%rankcolor%", color.toString()).replace("%msg%", message); player.sendMessage(FUtil.colorize(msg)); } else { - player.sendMessage("[" + ChatColor.AQUA + "STAFF" + ChatColor.WHITE + "] " + ChatColor.DARK_RED + sender.getName() + ChatColor.DARK_GRAY + " [" + getColoredTag(display) + ChatColor.DARK_GRAY + "]" + ChatColor.WHITE + ": " + ChatColor.GOLD + FUtil.colorize(message)); + player.sendMessage("[" + ChatColor.AQUA + "ADMIN" + ChatColor.WHITE + "] " + ChatColor.DARK_RED + sender.getName() + ChatColor.DARK_GRAY + " [" + getColoredTag(admin, display) + ChatColor.DARK_GRAY + "]" + ChatColor.WHITE + ": " + ChatColor.GOLD + FUtil.colorize(message)); } } } @@ -183,7 +215,7 @@ public class ChatManager extends FreedomService { for (Player player : server.getOnlinePlayers()) { - if (plugin.sl.isStaff(player)) + if (plugin.al.isAdmin(player)) { playerMsg(player, ChatColor.RED + "[REPORTS] " + ChatColor.GOLD + reporter.getName() + " has reported " + reported.getName() + " for " + report); FLog.info("[REPORTS] " + reporter.getName() + " has reported " + reported.getName() + " for " + report); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/CommandSpy.java b/src/main/java/me/totalfreedom/totalfreedommod/CommandSpy.java index 5bc0ddc0..4da218d3 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/CommandSpy.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/CommandSpy.java @@ -23,9 +23,9 @@ public class CommandSpy extends FreedomService { for (Player player : server.getOnlinePlayers()) { - if (plugin.sl.isStaff(player) && plugin.sl.getAdmin(player).getCommandSpy()) + if (plugin.al.isAdmin(player) && plugin.al.getAdmin(player).getCommandSpy()) { - if (plugin.sl.isStaff(event.getPlayer()) && !plugin.sl.isAdmin(player)) + if (plugin.al.isAdmin(event.getPlayer()) && !plugin.al.isSeniorAdmin(player)) { continue; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java b/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java index 55da8cb3..f921bd71 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java @@ -53,7 +53,7 @@ public class LoginProcess extends FreedomService public void onPlayerPreLogin(AsyncPlayerPreLoginEvent event) { final String ip = event.getAddress().getHostAddress().trim(); - final boolean isAdmin = plugin.sl.getEntryByIp(ip) != null; + final boolean isAdmin = plugin.al.getEntryByIp(ip) != null; // Check if the player is already online for (Player onlinePlayer : server.getOnlinePlayers()) @@ -114,7 +114,7 @@ public class LoginProcess extends FreedomService } // Check if player is admin - final boolean isAdmin = plugin.sl.getEntryByIp(ip) != null; + final boolean isAdmin = plugin.al.getEntryByIp(ip) != null; // Validation below this point if (isAdmin) // Player is admin @@ -127,7 +127,7 @@ public class LoginProcess extends FreedomService { for (Player onlinePlayer : server.getOnlinePlayers()) { - if (!plugin.sl.isStaff(onlinePlayer)) + if (!plugin.al.isAdmin(onlinePlayer)) { onlinePlayer.kickPlayer("You have been kicked to free up room for an admin."); count--; @@ -149,7 +149,7 @@ public class LoginProcess extends FreedomService return; } - // Player is not a staff member + // Player is not an admin // Server full check if (server.getOnlinePlayers().size() >= server.getMaxPlayers()) { @@ -157,8 +157,8 @@ public class LoginProcess extends FreedomService return; } - // Staff-only mode - if (ConfigEntry.STAFF_ONLY_MODE.getBoolean()) + // Admin-only mode + if (ConfigEntry.ADMIN_ONLY_MODE.getBoolean()) { event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Server is temporarily open to admins only."); return; @@ -226,7 +226,7 @@ public class LoginProcess extends FreedomService player.setPlayerListFooter(FUtil.colorize(ConfigEntry.SERVER_TABLIST_FOOTER.getString()).replace("\\n", "\n")); } - if (!plugin.sl.isStaff(player)) + if (!plugin.al.isAdmin(player)) { String tag = playerData.getTag(); if (tag != null) @@ -244,7 +244,7 @@ public class LoginProcess extends FreedomService FLog.info(noteMessage); for (Player p : server.getOnlinePlayers()) { - if (plugin.sl.isAdminImpostor(p)) + if (plugin.al.isAdminImpostor(p)) { notice.send(p); } @@ -257,9 +257,9 @@ public class LoginProcess extends FreedomService @Override public void run() { - if (ConfigEntry.STAFF_ONLY_MODE.getBoolean()) + if (ConfigEntry.ADMIN_ONLY_MODE.getBoolean()) { - player.sendMessage(ChatColor.RED + "Server is currently closed to non-staff."); + player.sendMessage(ChatColor.RED + "Server is currently closed to non-admins."); } if (lockdownEnabled) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/Monitors.java b/src/main/java/me/totalfreedom/totalfreedommod/Monitors.java index 2842332f..a74ee0aa 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/Monitors.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/Monitors.java @@ -34,7 +34,7 @@ public class Monitors extends FreedomService { for (Player player : recentlyThrownPotions.keySet()) { - if (plugin.sl.isStaff(player) && plugin.sl.getAdmin(player).getPotionSpy()) + if (plugin.al.isAdmin(player) && plugin.al.getAdmin(player).getPotionSpy()) { List playerThrownPotions = recentlyThrownPotions.get(player); ThrownPotion latestThrownPotion = playerThrownPotions.get(playerThrownPotions.size() - 1); // Get most recently thrown potion for the position. diff --git a/src/main/java/me/totalfreedom/totalfreedommod/Muter.java b/src/main/java/me/totalfreedom/totalfreedommod/Muter.java index 203d3e77..97891bef 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/Muter.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/Muter.java @@ -45,7 +45,7 @@ public class Muter extends FreedomService return; } - if (plugin.sl.isStaffSync(player)) + if (plugin.al.isAdminSync(player)) { fPlayer.setMuted(false); MUTED_PLAYERS.remove(player.getName()); @@ -70,7 +70,7 @@ public class Muter extends FreedomService } String message = event.getMessage(); - if (plugin.sl.isStaff(player)) + if (plugin.al.isAdmin(player)) { fPlayer.setMuted(false); return; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ProtectArea.java b/src/main/java/me/totalfreedom/totalfreedommod/ProtectArea.java new file mode 100644 index 00000000..9dbcde21 --- /dev/null +++ b/src/main/java/me/totalfreedom/totalfreedommod/ProtectArea.java @@ -0,0 +1,392 @@ +package me.totalfreedom.totalfreedommod; + +import com.google.common.collect.Maps; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import me.totalfreedom.totalfreedommod.config.ConfigEntry; +import me.totalfreedom.totalfreedommod.util.FLog; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.util.Vector; + +public class ProtectArea extends FreedomService +{ + + public static final String DATA_FILENAME = "protectedareas.dat"; + public static final double MAX_RADIUS = 50.0; + // + private final Map areas = Maps.newHashMap(); + + @Override + public void onStart() + { + if (!ConfigEntry.PROTECTAREA_ENABLED.getBoolean()) + { + return; + } + + File input = new File(plugin.getDataFolder(), DATA_FILENAME); + try + { + if (input.exists()) + { + FileInputStream fis = new FileInputStream(input); + ObjectInputStream ois = new ObjectInputStream(fis); + areas.clear(); + areas.putAll((HashMap)ois.readObject()); + ois.close(); + fis.close(); + } + } + catch (Exception ex) + { + input.delete(); + FLog.severe(ex); + } + + cleanProtectedAreas(); + } + + @Override + public void onStop() + { + save(); + } + + public void save() + { + try + { + FileOutputStream fos = new FileOutputStream(new File(plugin.getDataFolder(), DATA_FILENAME)); + ObjectOutputStream oos = new ObjectOutputStream(fos); + oos.writeObject(areas); + oos.close(); + fos.close(); + } + catch (Exception ex) + { + FLog.severe(ex); + } + } + + @EventHandler(priority = EventPriority.NORMAL) + public void onBlockBreak(BlockBreakEvent event) + { + if (!ConfigEntry.PROTECTAREA_ENABLED.getBoolean()) + { + return; + } + + final Player player = event.getPlayer(); + if (plugin.al.isAdmin(player)) + { + return; + } + + final Location location = event.getBlock().getLocation(); + + if (isInProtectedArea(location)) + { + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.NORMAL) + public void onBlockPlace(BlockPlaceEvent event) + { + if (!ConfigEntry.PROTECTAREA_ENABLED.getBoolean()) + { + return; + } + + final Player player = event.getPlayer(); + if (plugin.al.isAdmin(player)) + { + return; + } + + final Location location = event.getBlock().getLocation(); + + if (isInProtectedArea(location)) + { + event.setCancelled(true); + } + } + + public boolean isInProtectedArea(final Location modifyLocation) + { + boolean doSave = false; + boolean inProtectedArea = false; + + final Iterator> it = areas.entrySet().iterator(); + + while (it.hasNext()) + { + final SerializableProtectedRegion region = it.next().getValue(); + + Location regionCenter = null; + try + { + regionCenter = region.getLocation(); + } + catch (SerializableProtectedRegion.CantFindWorldException ex) + { + it.remove(); + doSave = true; + continue; + } + + if (regionCenter != null) + { + if (modifyLocation.getWorld() == regionCenter.getWorld()) + { + final double regionRadius = region.getRadius(); + if (modifyLocation.distanceSquared(regionCenter) <= (regionRadius * regionRadius)) + { + inProtectedArea = true; + break; + } + } + } + } + + if (doSave) + { + save(); + } + + return inProtectedArea; + } + + public boolean isInProtectedArea(final Vector min, final Vector max, final String worldName) + { + boolean doSave = false; + boolean inProtectedArea = false; + + final Iterator> it = areas.entrySet().iterator(); + + while (it.hasNext()) + { + final SerializableProtectedRegion region = it.next().getValue(); + + Location regionCenter = null; + try + { + regionCenter = region.getLocation(); + } + catch (SerializableProtectedRegion.CantFindWorldException ex) + { + it.remove(); + doSave = true; + continue; + } + + if (regionCenter != null) + { + if (worldName.equals(regionCenter.getWorld().getName())) + { + if (cubeIntersectsSphere(min, max, regionCenter.toVector(), region.getRadius())) + { + inProtectedArea = true; + break; + } + } + } + } + + if (doSave) + { + save(); + } + + return inProtectedArea; + } + + private boolean cubeIntersectsSphere(Vector min, Vector max, Vector sphere, double radius) + { + double d = square(radius); + + if (sphere.getX() < min.getX()) + { + d -= square(sphere.getX() - min.getX()); + } + else if (sphere.getX() > max.getX()) + { + d -= square(sphere.getX() - max.getX()); + } + if (sphere.getY() < min.getY()) + { + d -= square(sphere.getY() - min.getY()); + } + else if (sphere.getY() > max.getY()) + { + d -= square(sphere.getY() - max.getY()); + } + if (sphere.getZ() < min.getZ()) + { + d -= square(sphere.getZ() - min.getZ()); + } + else if (sphere.getZ() > max.getZ()) + { + d -= square(sphere.getZ() - max.getZ()); + } + + return d > 0; + } + + private double square(double v) + { + return v * v; + } + + public void addProtectedArea(String label, Location location, double radius) + { + areas.put(label.toLowerCase(), new SerializableProtectedRegion(location, radius)); + save(); + } + + public void removeProtectedArea(String label) + { + areas.remove(label.toLowerCase()); + save(); + } + + public void clearProtectedAreas() + { + clearProtectedAreas(true); + } + + public void clearProtectedAreas(boolean createSpawnpointProtectedAreas) + { + areas.clear(); + + if (createSpawnpointProtectedAreas) + { + autoAddSpawnpoints(); + } + + save(); + } + + public void cleanProtectedAreas() + { + boolean doSave = false; + + final Iterator> it = areas.entrySet().iterator(); + + while (it.hasNext()) + { + try + { + it.next().getValue().getLocation(); + } + catch (SerializableProtectedRegion.CantFindWorldException ex) + { + it.remove(); + doSave = true; + } + } + + if (doSave) + { + save(); + } + } + + public Set getProtectedAreaLabels() + { + return areas.keySet(); + } + + public void autoAddSpawnpoints() + { + if (!ConfigEntry.PROTECTAREA_ENABLED.getBoolean()) + { + return; + } + + if (ConfigEntry.PROTECTAREA_SPAWNPOINTS.getBoolean()) + { + for (World world : Bukkit.getWorlds()) + { + addProtectedArea("spawn_" + world.getName(), world.getSpawnLocation(), ConfigEntry.PROTECTAREA_RADIUS.getDouble()); + } + } + } + + public static class SerializableProtectedRegion implements Serializable + { + + private static final long serialVersionUID = 213123517828282L; + private final double x, y, z; + private final double radius; + private final String worldName; + private final UUID worldUUID; + private transient Location location = null; + + public SerializableProtectedRegion(final Location location, final double radius) + { + this.x = location.getX(); + this.y = location.getY(); + this.z = location.getZ(); + this.radius = radius; + this.worldName = location.getWorld().getName(); + this.worldUUID = location.getWorld().getUID(); + this.location = location; + } + + public Location getLocation() throws CantFindWorldException + { + if (this.location == null) + { + World world = Bukkit.getWorld(this.worldUUID); + + if (world == null) + { + world = Bukkit.getWorld(this.worldName); + } + + if (world == null) + { + throw new CantFindWorldException("Can't find world " + this.worldName + ", UUID: " + this.worldUUID.toString()); + } + + location = new Location(world, x, y, z); + } + return this.location; + } + + public double getRadius() + { + return radius; + } + + public class CantFindWorldException extends Exception + { + + private static final long serialVersionUID = 1L; + + public CantFindWorldException(String string) + { + super(string); + } + } + + } + +} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/Reddit.java b/src/main/java/me/totalfreedom/totalfreedommod/Reddit.java index c82b3d4b..6f34f053 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/Reddit.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/Reddit.java @@ -203,9 +203,9 @@ public class Reddit extends FreedomService flairList.put(Title.EXECUTIVE, ConfigEntry.REDDIT_EXECUTIVE_FLAIR_ID.getString()); flairList.put(Title.ASSISTANT_EXECUTIVE, ConfigEntry.REDDIT_ASSISTANT_EXECUTIVE_FLAIR_ID.getString()); flairList.put(Title.DEVELOPER, ConfigEntry.REDDIT_DEVELOPER_FLAIR_ID.getString()); - flairList.put(Rank.ADMIN, ConfigEntry.REDDIT_ADMIN_FLAIR_ID.getString()); - flairList.put(Rank.MOD, ConfigEntry.REDDIT_MOD_FLAIR_ID.getString()); - flairList.put(Rank.TRIAL_MOD, ConfigEntry.REDDIT_TRIAL_MOD_FLAIR_ID.getString()); + flairList.put(Rank.SENIOR_ADMIN, ConfigEntry.REDDIT_SENIOR_FLAIR_ID.getString()); + flairList.put(Rank.TELNET_ADMIN, ConfigEntry.REDDIT_TELNET_FLAIR_ID.getString()); + flairList.put(Rank.SUPER_ADMIN, ConfigEntry.REDDIT_SUPER_FLAIR_ID.getString()); flairList.put(Title.MASTER_BUILDER, ConfigEntry.REDDIT_MASTER_BUILDER_FLAIR_ID.getString()); flairList.put(Title.DONATOR, ConfigEntry.REDDIT_DONATOR_FLAIR_ID.getString()); @@ -214,9 +214,9 @@ public class Reddit extends FreedomService flairNameList.put(Title.EXECUTIVE, "Executive"); flairNameList.put(Title.ASSISTANT_EXECUTIVE, "Assistant Executive"); flairNameList.put(Title.DEVELOPER, "Developer"); - flairNameList.put(Rank.ADMIN, "Admin"); - flairNameList.put(Rank.MOD, "Mod"); - flairNameList.put(Rank.TRIAL_MOD, "Trial Mod"); + flairNameList.put(Rank.SENIOR_ADMIN, "Senior Admin"); + flairNameList.put(Rank.TELNET_ADMIN, "Telnet Admin"); + flairNameList.put(Rank.SUPER_ADMIN, "Super Admin"); flairNameList.put(Title.MASTER_BUILDER, "Master Builder"); flairNameList.put(Title.DONATOR, "Premium"); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ServerPing.java b/src/main/java/me/totalfreedom/totalfreedommod/ServerPing.java index e87f8005..a5a91ab8 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/ServerPing.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/ServerPing.java @@ -30,9 +30,9 @@ public class ServerPing extends FreedomService return; } - if (ConfigEntry.STAFF_ONLY_MODE.getBoolean()) + if (ConfigEntry.ADMIN_ONLY_MODE.getBoolean()) { - event.setMotd(FUtil.colorize(ConfigEntry.SERVER_STAFFMODE_MOTD.getString())); + event.setMotd(FUtil.colorize(ConfigEntry.SERVER_ADMINMODE_MOTD.getString())); return; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java index a7d66ff1..4760a4a3 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java @@ -3,8 +3,8 @@ package me.totalfreedom.totalfreedommod; import java.io.File; import java.io.InputStream; import java.util.Properties; -import me.totalfreedom.totalfreedommod.staff.ActivityLog; -import me.totalfreedom.totalfreedommod.staff.StaffList; +import me.totalfreedom.totalfreedommod.admin.ActivityLog; +import me.totalfreedom.totalfreedommod.admin.AdminList; import me.totalfreedom.totalfreedommod.banning.BanManager; import me.totalfreedom.totalfreedommod.banning.IndefiniteBanList; import me.totalfreedom.totalfreedommod.blocking.BlockBlocker; @@ -55,6 +55,7 @@ import org.bukkit.Bukkit; import org.bukkit.generator.ChunkGenerator; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scheduler.BukkitRunnable; import org.spigotmc.SpigotConfig; public class TotalFreedomMod extends JavaPlugin @@ -85,7 +86,7 @@ public class TotalFreedomMod extends JavaPlugin public SavedFlags sf; public WorldManager wm; public LogViewer lv; - public StaffList sl; + public AdminList al; public ActivityLog acl; public RankManager rm; public CommandBlocker cb; @@ -108,6 +109,7 @@ public class TotalFreedomMod extends JavaPlugin public BanManager bm; public IndefiniteBanList im; public PermissionManager pem; + public ProtectArea pa; public Reddit rd; public GameRuleHandler gr; public CommandSpy cs; @@ -204,7 +206,7 @@ public class TotalFreedomMod extends JavaPlugin wm = new WorldManager(); lv = new LogViewer(); sql = new SQLite(); - sl = new StaffList(); + al = new AdminList(); acl = new ActivityLog(); rm = new RankManager(); cb = new CommandBlocker(); @@ -227,6 +229,7 @@ public class TotalFreedomMod extends JavaPlugin bm = new BanManager(); im = new IndefiniteBanList(); pem = new PermissionManager(); + pa = new ProtectArea(); rd = new Reddit(); gr = new GameRuleHandler(); snp = new SignBlocker(); @@ -281,6 +284,15 @@ public class TotalFreedomMod extends JavaPlugin // Metrics @ https://bstats.org/plugin/bukkit/TotalFreedomMod/2966 new Metrics(this, 2966); + // Add spawnpoints later - https://github.com/TotalFreedom/TotalFreedomMod/issues/438 + new BukkitRunnable() + { + @Override + public void run() + { + plugin.pa.autoAddSpawnpoints(); + } + }.runTaskLater(plugin, 60L); // little workaround to stop spigot from autorestarting - causing AMP to detach from process. SpigotConfig.config.set("settings.restart-on-crash", false); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/staff/ActivityLog.java b/src/main/java/me/totalfreedom/totalfreedommod/admin/ActivityLog.java similarity index 97% rename from src/main/java/me/totalfreedom/totalfreedommod/staff/ActivityLog.java rename to src/main/java/me/totalfreedom/totalfreedommod/admin/ActivityLog.java index 565d4051..41ab9505 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/staff/ActivityLog.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/admin/ActivityLog.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.staff; +package me.totalfreedom.totalfreedommod.admin; import com.google.common.collect.Maps; import java.util.Map; @@ -167,7 +167,7 @@ public class ActivityLog extends FreedomService public void onPlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); - if (plugin.sl.isStaff(player)) + if (plugin.al.isAdmin(player)) { getActivityLog(event.getPlayer()).addLogin(); plugin.acl.save(); @@ -179,7 +179,7 @@ public class ActivityLog extends FreedomService public void onPlayerQuit(PlayerQuitEvent event) { Player player = event.getPlayer(); - if (plugin.sl.isStaff(player)) + if (plugin.al.isAdmin(player)) { getActivityLog(event.getPlayer()).addLogout(); plugin.acl.save(); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/staff/ActivityLogEntry.java b/src/main/java/me/totalfreedom/totalfreedommod/admin/ActivityLogEntry.java similarity index 98% rename from src/main/java/me/totalfreedom/totalfreedommod/staff/ActivityLogEntry.java rename to src/main/java/me/totalfreedom/totalfreedommod/admin/ActivityLogEntry.java index 56302845..7904e35f 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/staff/ActivityLogEntry.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/admin/ActivityLogEntry.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.staff; +package me.totalfreedom.totalfreedommod.admin; import com.google.common.collect.Lists; import java.time.Instant; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/staff/StaffMember.java b/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java similarity index 91% rename from src/main/java/me/totalfreedom/totalfreedommod/staff/StaffMember.java rename to src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java index 41d80d42..86b3d6f2 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/staff/StaffMember.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.staff; +package me.totalfreedom.totalfreedommod.admin; import java.sql.ResultSet; import java.sql.SQLException; @@ -17,7 +17,7 @@ import me.totalfreedom.totalfreedommod.util.FUtil; import org.apache.commons.lang.StringUtils; import org.bukkit.entity.Player; -public class StaffMember +public class Admin { @Getter @@ -27,7 +27,7 @@ public class StaffMember private boolean active = true; @Getter @Setter - private Rank rank = Rank.TRIAL_MOD; + private Rank rank = Rank.SUPER_ADMIN; @Getter private final List ips = new ArrayList<>(); @Getter @@ -47,15 +47,18 @@ public class StaffMember private String acFormat = null; @Getter @Setter + private Boolean oldTags = false; + @Getter + @Setter private String ampUsername = null; - public StaffMember(Player player) + public Admin(Player player) { this.name = player.getName(); this.ips.add(FUtil.getIp(player)); } - public StaffMember(ResultSet resultSet) + public Admin(ResultSet resultSet) { try { @@ -69,6 +72,7 @@ public class StaffMember this.commandSpy = resultSet.getBoolean("command_spy"); this.potionSpy = resultSet.getBoolean("potion_spy"); this.acFormat = resultSet.getString("ac_format"); + this.oldTags = resultSet.getBoolean("old_tags"); this.ampUsername = resultSet.getString("amp_username"); } catch (SQLException e) @@ -90,6 +94,7 @@ public class StaffMember .append("- Is Active: ").append(active).append("\n") .append("- Potion Spy: ").append(potionSpy).append("\n") .append("- Admin Chat Format: ").append(acFormat).append("\n") + .append("- Old Tags: ").append(oldTags).append("\n") .append("- AMP Username: ").append(ampUsername).append("\n"); return output.toString(); @@ -108,6 +113,7 @@ public class StaffMember put("command_spy", commandSpy); put("potion_spy", potionSpy); put("ac_format", acFormat); + put("old_tags", oldTags); put("amp_username", ampUsername); }}; return map; @@ -156,7 +162,7 @@ public class StaffMember if (!active) { - if (getRank().isAtLeast(Rank.MOD)) + if (getRank().isAtLeast(Rank.TELNET_ADMIN)) { if (plugin.btb != null) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java b/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java new file mode 100644 index 00000000..8d2f5b54 --- /dev/null +++ b/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java @@ -0,0 +1,370 @@ +package me.totalfreedom.totalfreedommod.admin; + +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import lombok.Getter; +import me.totalfreedom.totalfreedommod.FreedomService; +import me.totalfreedom.totalfreedommod.config.ConfigEntry; +import me.totalfreedom.totalfreedommod.rank.Rank; +import me.totalfreedom.totalfreedommod.util.FLog; +import me.totalfreedom.totalfreedommod.util.FUtil; +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class AdminList extends FreedomService +{ + @Getter + private final Set allAdmins = Sets.newHashSet(); // Includes disabled admins + // Only active admins below + @Getter + private final Set activeAdmins = Sets.newHashSet(); + private final Map nameTable = Maps.newHashMap(); + private final Map ipTable = Maps.newHashMap(); + public final List verifiedNoAdmins = new ArrayList<>(); + public final Map> verifiedNoAdminIps = Maps.newHashMap(); + public static List vanished = new ArrayList<>(); + + @Override + public void onStart() + { + load(); + deactivateOldEntries(false); + } + + @Override + public void onStop() + { + } + + public void load() + { + allAdmins.clear(); + try + { + ResultSet adminSet = plugin.sql.getAdminList(); + { + while (adminSet.next()) + { + Admin admin = new Admin(adminSet); + allAdmins.add(admin); + } + } + } + catch (SQLException e) + { + FLog.severe("Failed to load adminlist: " + e.getMessage()); + } + + updateTables(); + FLog.info("Loaded " + allAdmins.size() + " admins (" + nameTable.size() + " active, " + ipTable.size() + " IPs)"); + } + + public void messageAllAdmins(String message) + { + for (Player player : server.getOnlinePlayers()) + { + if (isAdmin(player)) + { + player.sendMessage(message); + } + } + } + + public synchronized boolean isAdminSync(CommandSender sender) + { + return isAdmin(sender); + } + + public List getActiveAdminNames() + { + List names = new ArrayList(); + for (Admin admin : activeAdmins) + { + names.add(admin.getName()); + } + return names; + } + + public boolean isAdmin(CommandSender sender) + { + if (!(sender instanceof Player)) + { + return true; + } + + Admin admin = getAdmin((Player)sender); + + return admin != null && admin.isActive(); + } + + public boolean isTelnetAdmin(CommandSender sender) + { + Admin admin = getAdmin(sender); + if (admin == null) + { + return false; + } + + return admin.getRank().ordinal() >= Rank.TELNET_ADMIN.ordinal(); + } + + public boolean isSeniorAdmin(CommandSender sender) + { + Admin admin = getAdmin(sender); + if (admin == null) + { + return false; + } + + return admin.getRank().ordinal() >= Rank.SENIOR_ADMIN.ordinal(); + } + + public Admin getAdmin(CommandSender sender) + { + if (sender instanceof Player) + { + return getAdmin((Player)sender); + } + + return getEntryByName(sender.getName()); + } + + public Admin getAdmin(Player player) + { + // Find admin + String ip = FUtil.getIp(player); + Admin admin = getEntryByName(player.getName()); + + // Admin by name + if (admin != null) + { + // Check if we're in online mode, + // Or the players IP is in the admin entry + if (Bukkit.getOnlineMode() || admin.getIps().contains(ip)) + { + if (!admin.getIps().contains(ip)) + { + // Add the new IP if we have to + admin.addIp(ip); + save(admin); + updateTables(); + } + return admin; + } + } + + // Admin by ip + admin = getEntryByIp(ip); + if (admin != null) + { + // Set the new username + String oldName = admin.getName(); + admin.setName(player.getName()); + plugin.sql.updateAdminName(oldName, admin.getName()); + updateTables(); + } + + return null; + } + + public Admin getEntryByName(String name) + { + return nameTable.get(name.toLowerCase()); + } + + public Admin getEntryByIp(String ip) + { + return ipTable.get(ip); + } + + public Admin getEntryByIpFuzzy(String needleIp) + { + final Admin directAdmin = getEntryByIp(needleIp); + if (directAdmin != null) + { + return directAdmin; + } + + for (String ip : ipTable.keySet()) + { + if (FUtil.fuzzyIpMatch(needleIp, ip, 3)) + { + return ipTable.get(ip); + } + } + + return null; + } + + public void updateLastLogin(Player player) + { + final Admin admin = getAdmin(player); + if (admin == null) + { + return; + } + + admin.setLastLogin(new Date()); + admin.setName(player.getName()); + save(admin); + } + + public boolean isAdminImpostor(Player player) + { + return getEntryByName(player.getName()) != null && !isAdmin(player) && !isVerifiedAdmin(player); + } + + public boolean isVerifiedAdmin(Player player) + { + return verifiedNoAdmins.contains(player.getName()) && verifiedNoAdminIps.get(player.getName()).contains(FUtil.getIp(player)); + } + + public boolean isIdentityMatched(Player player) + { + if (Bukkit.getOnlineMode()) + { + return true; + } + + Admin admin = getAdmin(player); + return admin == null ? false : admin.getName().equalsIgnoreCase(player.getName()); + } + + public boolean addAdmin(Admin admin) + { + if (!admin.isValid()) + { + logger.warning("Could not add admin: " + admin.getName() + " Admin is missing details!"); + return false; + } + + // Store admin, update views + allAdmins.add(admin); + updateTables(); + + // Save admin + plugin.sql.addAdmin(admin); + + return true; + } + + public boolean removeAdmin(Admin admin) + { + if (admin.getRank().isAtLeast(Rank.TELNET_ADMIN)) + { + if (plugin.btb != null) + { + plugin.btb.killTelnetSessions(admin.getName()); + } + } + + // Remove admin, update views + if (!allAdmins.remove(admin)) + { + return false; + } + updateTables(); + + // Unsave admin + plugin.sql.removeAdmin(admin); + + return true; + } + + public void updateTables() + { + activeAdmins.clear(); + nameTable.clear(); + ipTable.clear(); + + for (Admin admin : allAdmins) + { + if (!admin.isActive()) + { + continue; + } + + activeAdmins.add(admin); + nameTable.put(admin.getName().toLowerCase(), admin); + + for (String ip : admin.getIps()) + { + ipTable.put(ip, admin); + } + + } + } + + public Set getAdminNames() + { + return nameTable.keySet(); + } + + public Set getAdminIps() + { + return ipTable.keySet(); + } + + public void save(Admin admin) + { + try + { + ResultSet currentSave = plugin.sql.getAdminByName(admin.getName()); + for (Map.Entry entry : admin.toSQLStorable().entrySet()) + { + Object storedValue = plugin.sql.getValue(currentSave, entry.getKey(), entry.getValue()); + if (storedValue != null && !storedValue.equals(entry.getValue()) || storedValue == null && entry.getValue() != null || entry.getValue() == null) + { + plugin.sql.setAdminValue(admin, entry.getKey(), entry.getValue()); + } + } + } + catch (SQLException e) + { + FLog.severe("Failed to save admin: " + e.getMessage()); + } + } + + public void deactivateOldEntries(boolean verbose) + { + for (Admin admin : allAdmins) + { + if (!admin.isActive() || admin.getRank().isAtLeast(Rank.SENIOR_ADMIN)) + { + continue; + } + + final Date lastLogin = admin.getLastLogin(); + final long lastLoginHours = TimeUnit.HOURS.convert(new Date().getTime() - lastLogin.getTime(), TimeUnit.MILLISECONDS); + + if (lastLoginHours < ConfigEntry.ADMINLIST_CLEAN_THESHOLD_HOURS.getInteger()) + { + continue; + } + + if (verbose) + { + FUtil.adminAction("TotalFreedomMod", "Deactivating admin " + admin.getName() + ", inactive for " + lastLoginHours + " hours", true); + } + + admin.setActive(false); + save(admin); + } + + 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/banning/BanManager.java b/src/main/java/me/totalfreedom/totalfreedommod/banning/BanManager.java index c07a3979..31292a97 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/banning/BanManager.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/banning/BanManager.java @@ -271,7 +271,7 @@ public class BanManager extends FreedomService final Player player = event.getPlayer(); final PlayerData data = plugin.pl.getData(player); - if (!plugin.sl.isStaff(player)) + if (!plugin.al.isAdmin(player)) { return; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/EditBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/EditBlocker.java index a27c4248..0a7217e0 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/EditBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/EditBlocker.java @@ -30,7 +30,7 @@ public class EditBlocker extends FreedomService return; } - if (plugin.sl.isStaffSync(event.getPlayer())) + if (plugin.al.isAdminSync(event.getPlayer())) { fPlayer.setEditBlocked(false); return; @@ -49,7 +49,7 @@ public class EditBlocker extends FreedomService return; } - if (plugin.sl.isStaffSync(event.getPlayer())) + if (plugin.al.isAdminSync(event.getPlayer())) { fPlayer.setEditBlocked(false); return; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java index 0e774701..fb792036 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java @@ -148,7 +148,7 @@ public class EventBlocker extends FreedomService @EventHandler(priority = EventPriority.NORMAL) public void onPlayerDropItem(PlayerDropItemEvent event) { - if (!plugin.sl.isStaff(event.getPlayer())) + if (!plugin.al.isAdmin(event.getPlayer())) { event.setCancelled(true); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java index b2dfadb2..b7df3bbe 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java @@ -90,7 +90,7 @@ public class InteractBlocker extends FreedomService { case WATER_BUCKET: { - if (plugin.sl.isStaff(player) || ConfigEntry.ALLOW_WATER_PLACE.getBoolean()) + if (plugin.al.isAdmin(player) || ConfigEntry.ALLOW_WATER_PLACE.getBoolean()) { break; } @@ -103,7 +103,7 @@ public class InteractBlocker extends FreedomService case LAVA_BUCKET: { - if (plugin.sl.isStaff(player) || ConfigEntry.ALLOW_LAVA_PLACE.getBoolean()) + if (plugin.al.isAdmin(player) || ConfigEntry.ALLOW_LAVA_PLACE.getBoolean()) { break; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/PVPBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/PVPBlocker.java index de388454..b6efd382 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/PVPBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/PVPBlocker.java @@ -61,7 +61,7 @@ public class PVPBlocker extends FreedomService } } - if (player != null & !plugin.sl.isStaff(player)) + if (player != null & !plugin.al.isAdmin(player)) { if (player.getGameMode() == GameMode.CREATIVE) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlocker.java index 0f19a90e..9e893180 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlocker.java @@ -171,7 +171,7 @@ public class CommandBlocker extends FreedomService for (String part : commandParts) { - if (command.startsWith("/") && !plugin.sl.isStaff(sender) && (part.contains("#copy") || part.contains("#clipboard"))) + if (command.startsWith("/") && !plugin.al.isAdmin(sender) && (part.contains("#copy") || part.contains("#clipboard"))) { FUtil.playerMsg(sender, "WorldEdit copy variables are disabled."); return true; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlockerRank.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlockerRank.java index 91a145cf..84f7b6eb 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlockerRank.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlockerRank.java @@ -1,7 +1,7 @@ package me.totalfreedom.totalfreedommod.blocking.command; import me.totalfreedom.totalfreedommod.TotalFreedomMod; -import me.totalfreedom.totalfreedommod.staff.StaffMember; +import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.rank.Rank; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -40,10 +40,10 @@ public enum CommandBlockerRank return TELNET; } - StaffMember staffMember = TotalFreedomMod.plugin().sl.getAdmin(sender); - if (staffMember != null) + Admin admin = TotalFreedomMod.plugin().al.getAdmin(sender); + if (admin != null) { - if (staffMember.getRank() == Rank.ADMIN) + if (admin.getRank() == Rank.SENIOR_ADMIN) { return SENIOR; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/bridge/BukkitTelnetBridge.java b/src/main/java/me/totalfreedom/totalfreedommod/bridge/BukkitTelnetBridge.java index d8c3d397..607ad49d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/bridge/BukkitTelnetBridge.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/bridge/BukkitTelnetBridge.java @@ -10,7 +10,7 @@ import me.totalfreedom.bukkittelnet.api.TelnetPreLoginEvent; import me.totalfreedom.bukkittelnet.api.TelnetRequestDataTagsEvent; import me.totalfreedom.bukkittelnet.session.ClientSession; import me.totalfreedom.totalfreedommod.FreedomService; -import me.totalfreedom.totalfreedommod.staff.StaffMember; +import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FLog; import org.bukkit.entity.Player; @@ -43,15 +43,15 @@ public class BukkitTelnetBridge extends FreedomService return; } - final StaffMember staffMember = plugin.sl.getEntryByIpFuzzy(ip); + final Admin admin = plugin.al.getEntryByIpFuzzy(ip); - if (staffMember == null || !staffMember.isActive() || !staffMember.getRank().hasConsoleVariant()) + if (admin == null || !admin.isActive() || !admin.getRank().hasConsoleVariant()) { return; } event.setBypassPassword(true); - event.setName(staffMember.getName()); + event.setName(admin.getName()); } @EventHandler(priority = EventPriority.NORMAL) @@ -77,14 +77,14 @@ public class BukkitTelnetBridge extends FreedomService boolean isTelnetAdmin = false; boolean isSeniorAdmin = false; - final StaffMember staffMember = plugin.sl.getAdmin(player); - if (staffMember != null) + final Admin admin = plugin.al.getAdmin(player); + if (admin != null) { - boolean active = staffMember.isActive(); + boolean active = admin.isActive(); isAdmin = active; - isSeniorAdmin = active && staffMember.getRank() == Rank.ADMIN; - isTelnetAdmin = active && (isSeniorAdmin || staffMember.getRank() == Rank.MOD); + isSeniorAdmin = active && admin.getRank() == Rank.SENIOR_ADMIN; + isTelnetAdmin = active && (isSeniorAdmin || admin.getRank() == Rank.TELNET_ADMIN); } playerTags.put("tfm.admin.isAdmin", isAdmin); @@ -121,22 +121,22 @@ public class BukkitTelnetBridge extends FreedomService return bukkitTelnetPlugin; } - public List getConnectedAdmins() + public List getConnectedAdmins() { - List staffMembers = new ArrayList<>(); + List admins = new ArrayList<>(); final BukkitTelnet telnet = getBukkitTelnetPlugin(); if (telnet != null) { for (ClientSession session : telnet.appender.getSessions()) { - StaffMember staffMember = plugin.sl.getEntryByName(session.getUserName().toLowerCase()); - if (staffMember != null && !staffMembers.contains(staffMember)) + Admin admin = plugin.al.getEntryByName(session.getUserName().toLowerCase()); + if (admin != null && !admins.contains(admin)) { - staffMembers.add(staffMember); + admins.add(admin); } } } - return staffMembers; + return admins; } public void killTelnetSessions(final String name) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/bridge/LibsDisguisesBridge.java b/src/main/java/me/totalfreedom/totalfreedommod/bridge/LibsDisguisesBridge.java index bf3cdca0..fd9df426 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/bridge/LibsDisguisesBridge.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/bridge/LibsDisguisesBridge.java @@ -63,7 +63,7 @@ public class LibsDisguisesBridge extends FreedomService return null; } - public void undisguiseAll(boolean staff) + public void undisguiseAll(boolean admins) { try { @@ -78,7 +78,7 @@ public class LibsDisguisesBridge extends FreedomService { if (DisguiseAPI.isDisguised(player)) { - if (!staff && plugin.sl.isStaff(player)) + if (!admins && plugin.al.isAdmin(player)) { continue; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/caging/Cager.java b/src/main/java/me/totalfreedom/totalfreedommod/caging/Cager.java index 504d9f72..f006955c 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/caging/Cager.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/caging/Cager.java @@ -31,7 +31,7 @@ public class Cager extends FreedomService { Player player = event.getPlayer(); if (player == null - || plugin.sl.isStaff(player)) + || plugin.al.isAdmin(player)) { return; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_staffchat.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminchat.java similarity index 69% rename from src/main/java/me/totalfreedom/totalfreedommod/command/Command_staffchat.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminchat.java index 2d47ccf4..20431c73 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_staffchat.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminchat.java @@ -7,9 +7,12 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) -@CommandParameters(description = "Talk privately with other staff on the server.", usage = "/ [message]", aliases = "o,sc") -public class Command_staffchat extends FreedomCommand +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) +@CommandParameters( + description = "Talk privately with other administrators on the server.", + usage = "/ [message...]", + aliases = "o,ac") +public class Command_adminchat extends FreedomCommand { @Override @@ -25,11 +28,11 @@ public class Command_staffchat extends FreedomCommand FPlayer userinfo = plugin.pl.getPlayer(playerSender); userinfo.setAdminChat(!userinfo.inAdminChat()); - msg("Toggled your staff chat " + (userinfo.inAdminChat() ? "on" : "off") + "."); + msg("Toggled your admin chat " + (userinfo.inAdminChat() ? "on" : "off") + "."); } else { - plugin.cm.staffChat(sender, StringUtils.join(args, " ")); + plugin.cm.adminChat(sender, StringUtils.join(args, " ")); } return true; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_staffinfo.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_admininfo.java similarity index 72% rename from src/main/java/me/totalfreedom/totalfreedommod/command/Command_staffinfo.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_admininfo.java index 8284a31b..f3f05af6 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_staffinfo.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_admininfo.java @@ -11,22 +11,22 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @CommandPermissions(level = Rank.OP, source = SourceType.BOTH) -@CommandParameters(description = "Information on how to apply for admin.", usage = "/", aliases = "si") -public class Command_staffinfo extends FreedomCommand +@CommandParameters(description = "Information on how to apply for admin.", usage = "/", aliases = "ai") +public class Command_admininfo extends FreedomCommand { @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - List staffInfo = ConfigEntry.STAFF_INFO.getStringList(); + List adminInfo = ConfigEntry.ADMIN_INFO.getStringList(); - if (staffInfo.isEmpty()) + if (adminInfo.isEmpty()) { - msg("The staff information section of the config.yml file has not been configured.", ChatColor.RED); + msg("The admin information section of the config.yml file has not been configured.", ChatColor.RED); } else { - msg(FUtil.colorize(StringUtils.join(staffInfo, "\n"))); + msg(FUtil.colorize(StringUtils.join(adminInfo, "\n"))); } return true; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_staffmode.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminmode.java similarity index 70% rename from src/main/java/me/totalfreedom/totalfreedommod/command/Command_staffmode.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminmode.java index f9984011..ae6647d4 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_staffmode.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminmode.java @@ -10,9 +10,9 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.MOD, source = SourceType.BOTH) -@CommandParameters(description = "Denies joining of operators and only allows staff members to join.", usage = "/ [on | off]") -public class Command_staffmode extends FreedomCommand +@CommandPermissions(level = Rank.TELNET_ADMIN, source = SourceType.BOTH) +@CommandParameters(description = "Denies joining of operators and only allows admins to join.", usage = "/ [on | off]") +public class Command_adminmode extends FreedomCommand { @Override @@ -25,19 +25,19 @@ public class Command_staffmode extends FreedomCommand if (args[0].equalsIgnoreCase("off")) { - ConfigEntry.STAFF_ONLY_MODE.setBoolean(false); - FUtil.staffAction(sender.getName(), "Opening the server to all players.", true); + ConfigEntry.ADMIN_ONLY_MODE.setBoolean(false); + FUtil.adminAction(sender.getName(), "Opening the server to all players.", true); return true; } else if (args[0].equalsIgnoreCase("on")) { - ConfigEntry.STAFF_ONLY_MODE.setBoolean(true); - FUtil.staffAction(sender.getName(), "Closing the server to non-staff.", true); + ConfigEntry.ADMIN_ONLY_MODE.setBoolean(true); + FUtil.adminAction(sender.getName(), "Closing the server to non-admins.", true); for (Player player : server.getOnlinePlayers()) { - if (!isStaff(player)) + if (!isAdmin(player)) { - player.kickPlayer("Server is now closed to non-staff."); + player.kickPlayer("Server is now closed to non-admins."); } } return true; @@ -49,7 +49,7 @@ public class Command_staffmode extends FreedomCommand @Override public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) { - if (args.length == 1 && plugin.sl.isStaff(sender) && !(sender instanceof Player)) + if (args.length == 1 && plugin.al.isAdmin(sender) && !(sender instanceof Player)) { return Arrays.asList("on", "off"); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_staffworld.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminworld.java similarity index 88% rename from src/main/java/me/totalfreedom/totalfreedommod/command/Command_staffworld.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminworld.java index 82db13cc..bf1406eb 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_staffworld.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminworld.java @@ -12,10 +12,10 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @CommandPermissions(level = Rank.OP, source = SourceType.BOTH) -@CommandParameters(description = "Allows for staff to configure time, and weather of the AdminWorld, and allows for staff and ops to go to the AdminWorld.", +@CommandParameters(description = "Allows for admins to configure time, and weather of the AdminWorld, and allows for admins and ops to go to the AdminWorld.", usage = "/ [time | weather ]", aliases = "aw") -public class Command_staffworld extends FreedomCommand +public class Command_adminworld extends FreedomCommand { private enum CommandMode @@ -63,7 +63,7 @@ public class Command_staffworld extends FreedomCommand World adminWorld = null; try { - adminWorld = plugin.wm.staffworld.getWorld(); + adminWorld = plugin.wm.adminworld.getWorld(); } catch (Exception ex) { @@ -76,8 +76,8 @@ public class Command_staffworld extends FreedomCommand } else { - msg("Going to the StaffWorld."); - plugin.wm.staffworld.sendToWorld(playerSender); + msg("Going to the AdminWorld."); + plugin.wm.adminworld.sendToWorld(playerSender); } break; @@ -91,8 +91,8 @@ public class Command_staffworld extends FreedomCommand WorldTime timeOfDay = WorldTime.getByAlias(args[1]); if (timeOfDay != null) { - plugin.wm.staffworld.setTimeOfDay(timeOfDay); - msg("StaffWorld time set to: " + timeOfDay.name()); + plugin.wm.adminworld.setTimeOfDay(timeOfDay); + msg("AdminWorld time set to: " + timeOfDay.name()); } else { @@ -115,8 +115,8 @@ public class Command_staffworld extends FreedomCommand WorldWeather weatherMode = WorldWeather.getByAlias(args[1]); if (weatherMode != null) { - plugin.wm.staffworld.setWeatherMode(weatherMode); - msg("StaffWorld weather set to: " + weatherMode.name()); + plugin.wm.adminworld.setWeatherMode(weatherMode); + msg("AdminWorld weather set to: " + weatherMode.name()); } else { @@ -152,7 +152,7 @@ public class Command_staffworld extends FreedomCommand // TODO: Redo this properly private void assertCommandPerms(CommandSender sender, Player playerSender) throws PermissionDeniedException { - if (!(sender instanceof Player) || playerSender == null || !isStaff(sender)) + if (!(sender instanceof Player) || playerSender == null || !isAdmin(sender)) { throw new PermissionDeniedException(); } @@ -177,7 +177,7 @@ public class Command_staffworld extends FreedomCommand @Override public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) { - if (!plugin.sl.isStaff(sender)) + if (!plugin.al.isAdmin(sender)) { return Collections.emptyList(); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adventure.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adventure.java index 49736cd2..1252dce1 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adventure.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adventure.java @@ -28,7 +28,7 @@ public class Command_adventure extends FreedomCommand return true; } - checkRank(Rank.TRIAL_MOD); + checkRank(Rank.SUPER_ADMIN); if (args[0].equals("-a")) { @@ -37,7 +37,7 @@ public class Command_adventure extends FreedomCommand targetPlayer.setGameMode(GameMode.ADVENTURE); } - FUtil.staffAction(sender.getName(), "Changing everyone's gamemode to adventure", false); + FUtil.adminAction(sender.getName(), "Changing everyone's gamemode to adventure", false); msg("Your gamemode has been set to adventure."); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_aeclear.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_aeclear.java index 5fc4ba28..3127abbf 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_aeclear.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_aeclear.java @@ -9,7 +9,7 @@ import org.bukkit.entity.AreaEffectCloud; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Clears lingering potion area effect clouds.", usage = "/", aliases = "aec") public class Command_aeclear extends FreedomCommand { @@ -17,7 +17,7 @@ public class Command_aeclear extends FreedomCommand @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - FUtil.staffAction(sender.getName(), "Removing all area effect clouds.", true); + FUtil.adminAction(sender.getName(), "Removing all area effect clouds.", true); int removed = 0; for (World world : server.getWorlds()) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_amp.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_amp.java index 45064db9..5f606249 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_amp.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_amp.java @@ -3,7 +3,7 @@ package me.totalfreedom.totalfreedommod.command; import java.util.Arrays; import java.util.Collections; import java.util.List; -import me.totalfreedom.totalfreedommod.staff.StaffMember; +import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; @@ -12,7 +12,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME) +@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_IN_GAME) @CommandParameters(description = "Manage your AMP account", usage = "/ ") public class Command_amp extends FreedomCommand { @@ -43,9 +43,9 @@ public class Command_amp extends FreedomCommand if (args[0].equals("create")) { msg("Creating your AMP account...", ChatColor.GREEN); - StaffMember staffMember = getAdmin(playerSender); + Admin admin = getAdmin(playerSender); - if (staffMember.getAmpUsername() != null) + if (admin.getAmpUsername() != null) { msg("You already have an AMP account.", ChatColor.RED); return true; @@ -54,9 +54,9 @@ public class Command_amp extends FreedomCommand String username = sender.getName(); String password = FUtil.randomString(30); - staffMember.setAmpUsername(username); - plugin.sl.save(staffMember); - plugin.sl.updateTables(); + admin.setAmpUsername(username); + plugin.al.save(admin); + plugin.al.updateTables(); plugin.amp.createAccount(username, password); plugin.dc.sendAMPInfo(playerData, username, password); @@ -65,9 +65,9 @@ public class Command_amp extends FreedomCommand } else if (args[0].equals("resetpassword")) { - StaffMember staffMember = getAdmin(playerSender); + Admin admin = getAdmin(playerSender); - if (staffMember.getAmpUsername() == null) + if (admin.getAmpUsername() == null) { msg("You do not have an AMP account.", ChatColor.RED); return true; @@ -75,7 +75,7 @@ public class Command_amp extends FreedomCommand msg("Resetting your password...", ChatColor.GREEN); - String username = staffMember.getAmpUsername(); + String username = admin.getAmpUsername(); String password = FUtil.randomString(30); plugin.amp.setPassword(username,password); plugin.dc.sendAMPInfo(playerData, username, password); @@ -90,7 +90,7 @@ public class Command_amp extends FreedomCommand @Override public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) { - if (args.length == 1 && plugin.sl.isAdmin(sender)) + if (args.length == 1 && plugin.al.isSeniorAdmin(sender)) { return Arrays.asList("create", "resetpassword"); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_announce.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_announce.java index 8e216bc1..4abaf2b0 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_announce.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_announce.java @@ -6,7 +6,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Make an announcement anonymously to operators.", usage = "/ ") public class Command_announce extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_autoclear.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_autoclear.java index 37a74954..66aa34f5 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_autoclear.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_autoclear.java @@ -5,7 +5,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Toggle whether or not a player has their inventory automatically cleared when they join", usage = "/ ") public class Command_autoclear extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_autotp.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_autotp.java index 5b50a5f5..f52e82b5 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_autotp.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_autotp.java @@ -5,7 +5,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Toggle whether or not a player is automatically teleported when they join", usage = "/ ") public class Command_autotp extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ban.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ban.java index 163530be..06cb6c0f 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ban.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ban.java @@ -18,7 +18,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH, blockHostConsole = true) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true) @CommandParameters(description = "Bans the specified player.", usage = "/ [reason] [-nrb | -q]", aliases = "gtfo") public class Command_ban extends FreedomCommand { @@ -151,7 +151,7 @@ public class Command_ban extends FreedomCommand bcast.append(" - Reason: ").append(ChatColor.YELLOW).append(reason); } msg(sender, ChatColor.GRAY + username + " has been banned and IP is: " + StringUtils.join(ips, ", ")); - FUtil.staffAction(sender.getName(), String.format(bcast.toString()), true); + FUtil.adminAction(sender.getName(), String.format(bcast.toString()), true); } // Kick player and handle others on IP diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banip.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banip.java index 7a408d2a..272960cc 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banip.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banip.java @@ -11,7 +11,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH, blockHostConsole = true) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true) @CommandParameters(description = "Bans the specified ip.", usage = "/ [reason] [-q]") public class Command_banip extends FreedomCommand { @@ -72,7 +72,7 @@ public class Command_banip extends FreedomCommand { // Broadcast FLog.info(ChatColor.RED + sender.getName() + " - Banned the IP " + ip); - String message = ChatColor.RED + sender.getName() + " - Banned " + (plugin.sl.isStaff(player) ? "the IP " + ip : "an IP"); + String message = ChatColor.RED + sender.getName() + " - Banned " + (plugin.al.isAdmin(player) ? "the IP " + ip : "an IP"); player.sendMessage(message); } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banlist.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banlist.java index 366559c5..b16883a2 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banlist.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banlist.java @@ -18,9 +18,9 @@ public class Command_banlist extends FreedomCommand { if (args[0].equalsIgnoreCase("purge")) { - checkRank(Rank.ADMIN); + checkRank(Rank.SENIOR_ADMIN); - FUtil.staffAction(sender.getName(), "Purging the ban list", true); + FUtil.adminAction(sender.getName(), "Purging the ban list", true); int amount = plugin.bm.purge(); msg("Purged " + amount + " player bans."); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banname.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banname.java index 0d0ccd70..2c6c977d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banname.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_banname.java @@ -10,7 +10,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH, blockHostConsole = true) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true) @CommandParameters(description = "Bans the specified name.", usage = "/ [reason] [-q]") public class Command_banname extends FreedomCommand { @@ -55,7 +55,7 @@ public class Command_banname extends FreedomCommand if (!silent) { - FUtil.staffAction(sender.getName(), "Banned the name " + name, true); + FUtil.adminAction(sender.getName(), "Banned the name " + name, true); } Player player = getPlayer(name); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockcmd.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockcmd.java index 73c536d9..32a42f8f 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockcmd.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockcmd.java @@ -8,7 +8,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Block all commands for everyone on the server, or a specific player.", usage = "/ <-a | purge | >", aliases = "blockcommands,blockcommand,bc,bcmd") public class Command_blockcmd extends FreedomCommand { @@ -23,7 +23,7 @@ public class Command_blockcmd extends FreedomCommand if (args[0].equals("purge")) { - FUtil.staffAction(sender.getName(), "Unblocking commands for all players", true); + FUtil.adminAction(sender.getName(), "Unblocking commands for all players", true); int counter = 0; for (Player player : server.getOnlinePlayers()) { @@ -40,18 +40,18 @@ public class Command_blockcmd extends FreedomCommand if (args[0].equals("-a")) { - FUtil.staffAction(sender.getName(), "Blocking commands for all non-staff", true); + FUtil.adminAction(sender.getName(), "Blocking commands for all non-admins", true); int counter = 0; for (Player player : server.getOnlinePlayers()) { - if (isStaff(player)) + if (isAdmin(player)) { continue; } counter += 1; plugin.pl.getPlayer(player).setCommandsBlocked(true); - msg(player, "Your commands have been blocked by a staff member.", ChatColor.RED); + msg(player, "Your commands have been blocked by an admin.", ChatColor.RED); } msg("Blocked commands for " + counter + " players."); @@ -66,9 +66,9 @@ public class Command_blockcmd extends FreedomCommand return true; } - if (isStaff(player)) + if (isAdmin(player)) { - msg(player.getName() + " is a staff member, and cannot have their commands blocked."); + msg(player.getName() + " is an admin, and cannot have their commands blocked."); return true; } @@ -76,7 +76,7 @@ public class Command_blockcmd extends FreedomCommand if (!playerdata.allCommandsBlocked()) { playerdata.setCommandsBlocked(true); - FUtil.staffAction(sender.getName(), "Blocking all commands for " + player.getName(), true); + FUtil.adminAction(sender.getName(), "Blocking all commands for " + player.getName(), true); msg("Blocked commands for " + player.getName() + "."); } else diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockedit.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockedit.java index cc948d7e..70b9f15d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockedit.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockedit.java @@ -10,7 +10,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Restricts/unrestricts block modification abilities for everyone on the server or a certain player.", usage = "/ [[-s] [reason] | list | purge | all]") public class Command_blockedit extends FreedomCommand { @@ -46,7 +46,7 @@ public class Command_blockedit extends FreedomCommand if (args[0].equals("purge")) { - FUtil.staffAction(sender.getName(), "Unblocking block modification abilities for all players.", true); + FUtil.adminAction(sender.getName(), "Unblocking block modification abilities for all players.", true); int count = 0; for (final Player player : this.server.getOnlinePlayers()) { @@ -63,11 +63,11 @@ public class Command_blockedit extends FreedomCommand if (args[0].equals("all")) { - FUtil.staffAction(sender.getName(), "Blocking block modification abilities for all non-staff.", true); + FUtil.adminAction(sender.getName(), "Blocking block modification abilities for all non-admins.", true); int counter = 0; for (final Player player : this.server.getOnlinePlayers()) { - if (!plugin.sl.isStaff(player)) + if (!plugin.al.isAdmin(player)) { final FPlayer playerdata = plugin.pl.getPlayer(player); playerdata.setEditBlocked(true); @@ -105,20 +105,20 @@ public class Command_blockedit extends FreedomCommand final FPlayer pd = plugin.pl.getPlayer(player2); if (pd.isEditBlocked()) { - FUtil.staffAction(sender.getName(), "Unblocking block modification abilities for " + player2.getName(), true); + FUtil.adminAction(sender.getName(), "Unblocking block modification abilities for " + player2.getName(), true); pd.setEditBlocked(false); msg("Unblocking block modification abilities for " + player2.getName()); msg(player2, "Your block modification abilities have been restored.", ChatColor.RED); } else { - if (plugin.sl.isStaff(player2)) + if (plugin.al.isAdmin(player2)) { msg(player2.getName() + " is an admin, and cannot have their block edits blocked."); return true; } - FUtil.staffAction(sender.getName(), "Blocking block modification abilities for " + player2.getName(), true); + FUtil.adminAction(sender.getName(), "Blocking block modification abilities for " + player2.getName(), true); pd.setEditBlocked(true); if (smite) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockpvp.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockpvp.java index 32498376..d9393dcb 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockpvp.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockpvp.java @@ -10,7 +10,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Toggle PVP mode for everyone or a certain player.", usage = "/ [[-s] [reason] | list | purge | all]", aliases = "pvpblock,pvpmode") public class Command_blockpvp extends FreedomCommand { @@ -46,7 +46,7 @@ public class Command_blockpvp extends FreedomCommand if (args[0].equals("purge")) { - FUtil.staffAction(sender.getName(), "Enabling PVP for all players.", true); + FUtil.adminAction(sender.getName(), "Enabling PVP for all players.", true); int count = 0; for (Player player : server.getOnlinePlayers()) { @@ -64,11 +64,11 @@ public class Command_blockpvp extends FreedomCommand if (args[0].equals("all")) { - FUtil.staffAction(sender.getName(), "Disabling PVP for all non-staff", true); + FUtil.adminAction(sender.getName(), "Disabling PVP for all non-admins", true); int counter = 0; for (Player player : server.getOnlinePlayers()) { - if (!plugin.sl.isStaff(player)) + if (!plugin.al.isAdmin(player)) { final FPlayer playerdata = plugin.pl.getPlayer(player); playerdata.setPvpBlocked(true); @@ -106,20 +106,20 @@ public class Command_blockpvp extends FreedomCommand final FPlayer pd = plugin.pl.getPlayer(p); if (pd.isPvpBlocked()) { - FUtil.staffAction(sender.getName(), "Enabling PVP for " + p.getName(), true); + FUtil.adminAction(sender.getName(), "Enabling PVP for " + p.getName(), true); pd.setPvpBlocked(false); msg("Enabling PVP for " + p.getName()); msg(p, "Your PVP have been enabled.", ChatColor.GREEN); } else { - if (plugin.sl.isStaff(p)) + if (plugin.al.isAdmin(p)) { msg(p.getName() + " is an admin, and cannot have their PVP disabled."); return true; } - FUtil.staffAction(sender.getName(), "Disabling PVP for " + p.getName(), true); + FUtil.adminAction(sender.getName(), "Disabling PVP for " + p.getName(), true); pd.setPvpBlocked(true); if (smite) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockredstone.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockredstone.java index 1dfc7a43..312abcce 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockredstone.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockredstone.java @@ -8,7 +8,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Blocks redstone on the server.", usage = "/", aliases = "bre") public class Command_blockredstone extends FreedomCommand { @@ -18,14 +18,14 @@ public class Command_blockredstone extends FreedomCommand if (ConfigEntry.ALLOW_REDSTONE.getBoolean()) { ConfigEntry.ALLOW_REDSTONE.setBoolean(false); - FUtil.staffAction(sender.getName(), "Blocking all redstone", true); + FUtil.adminAction(sender.getName(), "Blocking all redstone", true); new BukkitRunnable() { public void run() { if (!ConfigEntry.ALLOW_REDSTONE.getBoolean()) { - FUtil.staffAction("TotalFreedom", "Unblocking all redstone", false); + FUtil.adminAction("TotalFreedom", "Unblocking all redstone", false); ConfigEntry.ALLOW_REDSTONE.setBoolean(true); } } @@ -34,7 +34,7 @@ public class Command_blockredstone extends FreedomCommand else { ConfigEntry.ALLOW_REDSTONE.setBoolean(true); - FUtil.staffAction(sender.getName(), "Unblocking all redstone", true); + FUtil.adminAction(sender.getName(), "Unblocking all redstone", true); } return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java index 95535a5f..df4f1eba 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java @@ -15,7 +15,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Place a cage around someone with certain blocks, or someone's player head.", usage = "/ [head | block] [playername | blockname]") public class Command_cage extends FreedomCommand { @@ -30,7 +30,7 @@ public class Command_cage extends FreedomCommand String skullName = null; if ("purge".equals(args[0])) { - FUtil.staffAction(sender.getName(), "Uncaging all players", true); + FUtil.adminAction(sender.getName(), "Uncaging all players", true); for (Player player : server.getOnlinePlayers()) { final FPlayer fPlayer = plugin.pl.getPlayer(player); @@ -101,11 +101,11 @@ public class Command_cage extends FreedomCommand if (outerMaterial == Material.PLAYER_HEAD) { - FUtil.staffAction(sender.getName(), "Caging " + player.getName() + " in " + skullName, true); + FUtil.adminAction(sender.getName(), "Caging " + player.getName() + " in " + skullName, true); } else { - FUtil.staffAction(sender.getName(), "Caging " + player.getName(), true); + FUtil.adminAction(sender.getName(), "Caging " + player.getName(), true); } return true; } @@ -113,7 +113,7 @@ public class Command_cage extends FreedomCommand @Override public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) { - if (!plugin.sl.isStaff(sender)) + if (!plugin.al.isAdmin(sender)) { return null; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java index 40afd1de..9b38f804 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java @@ -10,7 +10,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; -@CommandPermissions(level = Rank.MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "For the people that are still alive - gives a cake to everyone on the server.", usage = "/") public class Command_cake extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cartsit.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cartsit.java index 722c4a1b..fe66cdd4 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cartsit.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cartsit.java @@ -16,7 +16,7 @@ public class Command_cartsit extends FreedomCommand { Player targetPlayer = playerSender; - if (args.length == 1 && plugin.sl.isStaff(sender)) + if (args.length == 1 && plugin.al.isAdmin(sender)) { targetPlayer = getPlayer(args[0]); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_clearchat.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_clearchat.java index f6d590ed..35ed9dee 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_clearchat.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_clearchat.java @@ -6,7 +6,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Clears the chat.", usage = "/", aliases = "cc") public class Command_clearchat extends FreedomCommand { @@ -16,7 +16,7 @@ public class Command_clearchat extends FreedomCommand { for (Player player : server.getOnlinePlayers()) { - if (!plugin.sl.isStaff(player)) + if (!plugin.al.isAdmin(player)) { for (int i = 0; i < 100; i++) { @@ -24,7 +24,7 @@ public class Command_clearchat extends FreedomCommand } } } - FUtil.staffAction(sender.getName(), "Cleared chat", true); + FUtil.adminAction(sender.getName(), "Cleared chat", true); return true; } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cleardiscordqueue.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cleardiscordqueue.java index a9b0b152..8346fb70 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cleardiscordqueue.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cleardiscordqueue.java @@ -5,7 +5,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_CONSOLE) +@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE) @CommandParameters(description = "Clear the discord message queue.", usage = "/") public class Command_cleardiscordqueue extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_clearinventory.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_clearinventory.java index e946d2bc..f005d52f 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_clearinventory.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_clearinventory.java @@ -29,11 +29,11 @@ public class Command_clearinventory extends FreedomCommand } else { - if (plugin.sl.isStaff(sender)) + if (plugin.al.isAdmin(sender)) { if (args[0].equals("-a")) { - FUtil.staffAction(sender.getName(), "Clearing everyone's inventory", true); + FUtil.adminAction(sender.getName(), "Clearing everyone's inventory", true); for (Player player : server.getOnlinePlayers()) { player.getInventory().clear(); @@ -67,7 +67,7 @@ public class Command_clearinventory extends FreedomCommand @Override public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) { - if (args.length == 1 && plugin.sl.isStaff(sender)) + if (args.length == 1 && plugin.al.isAdmin(sender)) { List players = FUtil.getPlayerList(); players.add("-a"); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cmdspy.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cmdspy.java index c31e1d5b..6a6a8f8c 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cmdspy.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cmdspy.java @@ -1,12 +1,12 @@ package me.totalfreedom.totalfreedommod.command; -import me.totalfreedom.totalfreedommod.staff.StaffMember; +import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.rank.Rank; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.ONLY_IN_GAME) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME) @CommandParameters(description = "Spy on commands", usage = "/", aliases = "commandspy") public class Command_cmdspy extends FreedomCommand { @@ -14,11 +14,11 @@ public class Command_cmdspy extends FreedomCommand @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - StaffMember staffMember = plugin.sl.getAdmin(playerSender); - staffMember.setCommandSpy(!staffMember.getCommandSpy()); - msg("CommandSpy " + (staffMember.getCommandSpy() ? "enabled." : "disabled.")); - plugin.sl.save(staffMember); - plugin.sl.updateTables(); + Admin admin = plugin.al.getAdmin(playerSender); + admin.setCommandSpy(!admin.getCommandSpy()); + msg("CommandSpy " + (admin.getCommandSpy() ? "enabled." : "disabled.")); + plugin.al.save(admin); + plugin.al.updateTables(); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_consolesay.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_consolesay.java index 6193e32c..745e20ed 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_consolesay.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_consolesay.java @@ -8,7 +8,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.MOD, source = SourceType.ONLY_CONSOLE) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_CONSOLE) @CommandParameters(description = "Telnet/Console command - Send a chat message with chat formatting over telnet.", usage = "/ ", aliases = "csay") public class Command_consolesay extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cookie.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cookie.java index aec2d717..764981f4 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cookie.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cookie.java @@ -11,7 +11,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; -@CommandPermissions(level = Rank.MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "For those who have no friends - gives a cookie to everyone on the server.", usage = "/") public class Command_cookie extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_creative.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_creative.java index 92bf02ee..c81edfab 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_creative.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_creative.java @@ -28,7 +28,7 @@ public class Command_creative extends FreedomCommand return true; } - checkRank(Rank.TRIAL_MOD); + checkRank(Rank.SUPER_ADMIN); if (args[0].equals("-a")) { @@ -37,7 +37,7 @@ public class Command_creative extends FreedomCommand targetPlayer.setGameMode(GameMode.CREATIVE); } - FUtil.staffAction(sender.getName(), "Changing everyone's gamemode to creative", false); + FUtil.adminAction(sender.getName(), "Changing everyone's gamemode to creative", false); msg("Your gamemode has been set to creative."); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_curse.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_curse.java index 85f81ac6..c17b9eea 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_curse.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_curse.java @@ -9,7 +9,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME) +@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_IN_GAME) @CommandParameters(description = "Curse someone - sends a cursed texture pack to the specified player.", usage = "/ ") public class Command_curse extends FreedomCommand { @@ -57,7 +57,7 @@ public class Command_curse extends FreedomCommand @Override public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) { - if (args.length == 1 && plugin.sl.isStaff(sender) && FUtil.isExecutive(sender.getName())) + if (args.length == 1 && plugin.al.isAdmin(sender) && FUtil.isExecutive(sender.getName())) { return FUtil.getPlayerList(); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_denick.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_denick.java index cd395cfa..a03aacb0 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_denick.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_denick.java @@ -6,7 +6,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Essentials Interface Command - Remove the nickname of all players on the server.", usage = "/") public class Command_denick extends FreedomCommand { @@ -20,7 +20,7 @@ public class Command_denick extends FreedomCommand return true; } - FUtil.staffAction(sender.getName(), "Removing all nicknames", false); + FUtil.adminAction(sender.getName(), "Removing all nicknames", false); for (Player player : server.getOnlinePlayers()) { 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 0b989867..56d7e129 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deop.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deop.java @@ -9,7 +9,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Deop a player", usage = "/ ") public class Command_deop extends FreedomCommand { @@ -35,7 +35,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() && !plugin.sl.isVanished(player)) + if (player.isOp() && !plugin.al.isVanished(player)) { matchedPlayerNames.add(player.getName()); player.setOp(false); @@ -48,7 +48,7 @@ public class Command_deop extends FreedomCommand { if (!silent) { - FUtil.staffAction(sender.getName(), "De-opping " + StringUtils.join(matchedPlayerNames, ", "), false); + FUtil.adminAction(sender.getName(), "De-opping " + StringUtils.join(matchedPlayerNames, ", "), false); } } else diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deopall.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deopall.java index b0eedd51..1eb990cf 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deopall.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deopall.java @@ -6,7 +6,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH, blockHostConsole = true) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true) @CommandParameters(description = "Deop everyone on the server.", usage = "/") public class Command_deopall extends FreedomCommand { @@ -14,7 +14,7 @@ public class Command_deopall extends FreedomCommand @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - FUtil.staffAction(sender.getName(), "De-opping all players on the server", true); + FUtil.adminAction(sender.getName(), "De-opping all players on the server", true); for (Player player : server.getOnlinePlayers()) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_disguisetoggle.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_disguisetoggle.java index ff6ac8d1..64121cf0 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_disguisetoggle.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_disguisetoggle.java @@ -6,7 +6,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Toggle LibsDisguises for everyone online.", usage = "/", aliases = "dtoggle") public class Command_disguisetoggle extends FreedomCommand { @@ -20,7 +20,7 @@ public class Command_disguisetoggle extends FreedomCommand return true; } - FUtil.staffAction(sender.getName(), (plugin.ldb.isDisguisesEnabled() ? "Disabling" : "Enabling") + " disguises", false); + FUtil.adminAction(sender.getName(), (plugin.ldb.isDisguisesEnabled() ? "Disabling" : "Enabling") + " disguises", false); if (plugin.ldb.isDisguisesEnabled()) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_donator.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_donator.java index a0100491..50ec5bc2 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_donator.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_donator.java @@ -13,7 +13,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_CONSOLE) +@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE) @CommandParameters(description = "Adds or removes donators", usage = "/ [forum_user]") public class Command_donator extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_doom.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_doom.java index b9b06cae..2cf8579c 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_doom.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_doom.java @@ -1,6 +1,6 @@ package me.totalfreedom.totalfreedommod.command; -import me.totalfreedom.totalfreedommod.staff.StaffMember; +import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.banning.Ban; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.punishments.Punishment; @@ -17,7 +17,7 @@ import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; -@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true) +@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true) @CommandParameters(description = "Sends the specified player to their doom.", usage = "/ [reason]") public class Command_doom extends FreedomCommand { @@ -38,23 +38,23 @@ public class Command_doom extends FreedomCommand return true; } - FUtil.staffAction(sender.getName(), "Casting oblivion over " + player.getName(), true); + FUtil.adminAction(sender.getName(), "Casting oblivion over " + player.getName(), true); FUtil.bcastMsg(player.getName() + " will be completely obliviated!", ChatColor.RED); final String ip = player.getAddress().getAddress().getHostAddress().trim(); // Remove from admin - StaffMember staffMember = getAdmin(player); - if (staffMember != null) + Admin admin = getAdmin(player); + if (admin != null) { - FUtil.staffAction(sender.getName(), "Removing " + player.getName() + " from the staff list", true); - staffMember.setActive(false); - plugin.sl.save(staffMember); - plugin.sl.updateTables(); - plugin.amp.updateAccountStatus(staffMember); + FUtil.adminAction(sender.getName(), "Removing " + player.getName() + " from the admin list", true); + admin.setActive(false); + plugin.al.save(admin); + plugin.al.updateTables(); + plugin.amp.updateAccountStatus(admin); if (plugin.dc.enabled && ConfigEntry.DISCORD_ROLE_SYNC.getBoolean()) { - plugin.dc.syncRoles(staffMember, plugin.pl.getData(staffMember.getName()).getDiscordID()); + plugin.dc.syncRoles(admin, plugin.pl.getData(admin.getName()).getDiscordID()); } } @@ -120,7 +120,7 @@ public class Command_doom extends FreedomCommand public void run() { // message - FUtil.staffAction(sender.getName(), "Banning " + player.getName(), true); + FUtil.adminAction(sender.getName(), "Banning " + player.getName(), true); msg(sender, player.getName() + " has been banned and IP is: " + ip); // generate explosion diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java index 47333c69..e82b27c1 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java @@ -12,7 +12,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Remove various server entities that may cause lag, such as dropped items, minecarts, and boats.", usage = "/ [name | -a]", aliases = "ew,rd") public class Command_entitywipe extends FreedomCommand { @@ -54,7 +54,7 @@ public class Command_entitywipe extends FreedomCommand entityName = FUtil.formatName(type.name()); } - FUtil.staffAction(sender.getName(), "Purging all " + (type != null ? entityName + "s" : "entities"), true); + FUtil.adminAction(sender.getName(), "Purging all " + (type != null ? entityName + "s" : "entities"), true); int count; if (type != null) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_expel.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_expel.java index 13ab38c8..e1c9c279 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_expel.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_expel.java @@ -11,7 +11,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.ONLY_IN_GAME) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME) @CommandParameters(description = "Push people away from you.", usage = "/ [radius] [strength]") public class Command_expel extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_explode.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_explode.java index 372016da..ef4068b1 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_explode.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_explode.java @@ -10,7 +10,7 @@ import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; -@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Surprise someone.", usage = "/ ") public class Command_explode extends FreedomCommand { @@ -58,7 +58,7 @@ public class Command_explode extends FreedomCommand @Override public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) { - if (args.length == 1 && plugin.sl.isStaff(sender)) + if (args.length == 1 && plugin.al.isAdmin(sender)) { return FUtil.getPlayerList(); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_explosivearrows.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_explosivearrows.java index 4f21376a..62aa0f8d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_explosivearrows.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_explosivearrows.java @@ -6,7 +6,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.MOD, source = SourceType.ONLY_IN_GAME) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME) @CommandParameters(description = "Make arrows explode", usage = "/", aliases = "ea") public class Command_explosivearrows extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_findip.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_findip.java index 300d136e..b374f569 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_findip.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_findip.java @@ -6,7 +6,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Shows all IPs registered to a player", usage = "/ ", aliases = "showip,listip") public class Command_findip extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_forcekill.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_forcekill.java index a7c4d1ce..4877457f 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_forcekill.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_forcekill.java @@ -13,7 +13,7 @@ public class Command_forcekill extends FreedomCommand @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - if (!plugin.sl.isMod(sender) && !senderIsConsole) + if (!plugin.al.isAdmin(sender) && !senderIsConsole) { playerSender.setHealth(0); return true; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_freeze.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_freeze.java index c0405010..8c50aec3 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_freeze.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_freeze.java @@ -8,7 +8,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Freeze/Unfreeze a specified player, or all non-admins on the server.", usage = "/ [target | purge]", aliases = "fr") public class Command_freeze extends FreedomCommand { @@ -23,15 +23,15 @@ public class Command_freeze extends FreedomCommand if (!gFreeze) { - FUtil.staffAction(sender.getName(), "Disabling global player freeze", false); + FUtil.adminAction(sender.getName(), "Disabling global player freeze", false); msg("Players are now free to move."); return true; } - FUtil.staffAction(sender.getName(), "Enabling global player freeze", false); + FUtil.adminAction(sender.getName(), "Enabling global player freeze", false); for (Player player : server.getOnlinePlayers()) { - if (!isStaff(player)) + if (!isAdmin(player)) { player.sendTitle(ChatColor.RED + "You've been globally frozen.", ChatColor.YELLOW + "Please be patient and you will be unfrozen shortly.", 20, 100, 60); msg(player, "You have been globally frozen due to an OP breaking the rules, please wait and you will be unfrozen soon.", ChatColor.RED); @@ -44,10 +44,10 @@ public class Command_freeze extends FreedomCommand if (args[0].equals("purge")) { - FUtil.staffAction(sender.getName(), "Unfreezing all players", false); + FUtil.adminAction(sender.getName(), "Unfreezing all players", false); for (Player player : server.getOnlinePlayers()) { - if (!isStaff(player)) + if (!isAdmin(player)) { player.sendTitle(ChatColor.GREEN + "You've been unfrozen.", ChatColor.YELLOW + "You may now move again.", 20, 100, 60); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fuckoff.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fuckoff.java index e1cf22e2..ab5cb382 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fuckoff.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fuckoff.java @@ -6,7 +6,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME) +@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_IN_GAME) @CommandParameters(description = "You'll never even see it coming - repeatedly push players away from you until command is untoggled.", usage = "/ ") public class Command_fuckoff extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_health.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_health.java index 617c7d2c..f17867b8 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_health.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_health.java @@ -13,7 +13,7 @@ import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitTask; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "View server health, such as ticks-per-second, memory, etc.", usage = "/") public class Command_health extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_hubworld.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_hubworld.java index 97ab3f3f..4e9eff37 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_hubworld.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_hubworld.java @@ -152,7 +152,7 @@ public class Command_hubworld extends FreedomCommand @Override public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) { - if (!plugin.sl.isStaff(sender)) + if (!plugin.al.isAdmin(sender)) { return Collections.emptyList(); } @@ -177,7 +177,7 @@ public class Command_hubworld extends FreedomCommand // TODO: Redo this properly private void assertCommandPerms(CommandSender sender, Player playerSender) throws PermissionDeniedException { - if (!(sender instanceof Player) || playerSender == null || !plugin.sl.isAdmin(playerSender)) + if (!(sender instanceof Player) || playerSender == null || !plugin.al.isSeniorAdmin(playerSender)) { throw new PermissionDeniedException(); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_indefban.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_indefban.java index e645bbd3..32f5f1bb 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_indefban.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_indefban.java @@ -5,7 +5,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_CONSOLE) +@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE) @CommandParameters(description = "Reload the indefinite ban list.", usage = "/ reload", aliases = "ib") public class Command_indefban extends FreedomCommand { 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 b1e4a8a9..1dc749d4 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invis.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invis.java @@ -26,11 +26,11 @@ public class Command_invis extends FreedomCommand { if (args[0].equalsIgnoreCase("clear")) { - if(!plugin.sl.isStaff(sender)) + if(!plugin.al.isAdmin(sender)) return noPerms(); else { - FUtil.staffAction(sender.getName(), "Clearing all invisibility potion effects from all players", true); + FUtil.adminAction(sender.getName(), "Clearing all invisibility potion effects from all players", true); clear = true; } } @@ -43,10 +43,10 @@ public class Command_invis extends FreedomCommand for (Player player : server.getOnlinePlayers()) { - if (player.hasPotionEffect(PotionEffectType.INVISIBILITY) && !plugin.sl.isVanished(player)) + if (player.hasPotionEffect(PotionEffectType.INVISIBILITY) && !plugin.al.isVanished(player)) { players.add(player.getName()); - if (clear && !plugin.sl.isStaff(player)) + if (clear && !plugin.al.isAdmin(player)) { player.removePotionEffect((PotionEffectType.INVISIBILITY)); clears++; @@ -71,7 +71,7 @@ public class Command_invis extends FreedomCommand @Override public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) { - if (args.length == 1 && plugin.sl.isStaff(sender)) + if (args.length == 1 && plugin.al.isAdmin(sender)) return Arrays.asList("clear"); return Collections.emptyList(); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invsee.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invsee.java index d4d06ea1..68f31b62 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invsee.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invsee.java @@ -35,7 +35,7 @@ public class Command_invsee extends FreedomCommand return true; } - if (plugin.sl.isStaff(player) && !plugin.sl.isStaff(playerSender)) + if (plugin.al.isAdmin(player) && !plugin.al.isAdmin(playerSender)) { msg("You cannot spy on administrators."); return true; @@ -44,7 +44,7 @@ public class Command_invsee extends FreedomCommand Inventory inv; - if (plugin.sl.isStaff(player)) + if (plugin.al.isAdmin(player)) { if (args.length > 1) { @@ -75,7 +75,7 @@ public class Command_invsee extends FreedomCommand return true; } - if (!plugin.sl.isStaff(player)) + if (!plugin.al.isAdmin(player)) { if (args.length > 1) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_jumppads.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_jumppads.java index 1ec12b73..604ce9be 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_jumppads.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_jumppads.java @@ -95,7 +95,7 @@ public class Command_jumppads extends FreedomCommand @Override public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) { - if (!plugin.sl.isStaff(sender)) + if (!plugin.al.isAdmin(sender)) { return Collections.emptyList(); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kick.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kick.java index 1c575ce0..c18f503b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kick.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kick.java @@ -12,7 +12,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Kick the specified player.", usage = "/ [reason] [-q]") public class Command_kick extends FreedomCommand { @@ -65,11 +65,11 @@ public class Command_kick extends FreedomCommand { if (reason != null) { - FUtil.staffAction(sender.getName(), "Kicking " + player.getName() + " - Reason: " + reason, true); + FUtil.adminAction(sender.getName(), "Kicking " + player.getName() + " - Reason: " + reason, true); } else { - FUtil.staffAction(sender.getName(), "Kicking " + player.getName(), true); + FUtil.adminAction(sender.getName(), "Kicking " + player.getName(), true); } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kicknoob.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kicknoob.java index ce1ce71d..b8b8c810 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kicknoob.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kicknoob.java @@ -7,21 +7,21 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.MOD, source = SourceType.BOTH) -@CommandParameters(description = "Kick all non-staff on server.", usage = "/", aliases = "kickall") +@CommandPermissions(level = Rank.TELNET_ADMIN, source = SourceType.BOTH) +@CommandParameters(description = "Kick all non-admins on server.", usage = "/", aliases = "kickall") public class Command_kicknoob extends FreedomCommand { @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - FUtil.staffAction(sender.getName(), "Disconnecting all non-staff.", true); + FUtil.adminAction(sender.getName(), "Disconnecting all non-admins.", true); for (Player player : server.getOnlinePlayers()) { - if (!plugin.sl.isStaff(player)) + if (!plugin.al.isAdmin(player)) { - player.kickPlayer(ChatColor.RED + "All non-staff were kicked by " + sender.getName() + "."); + player.kickPlayer(ChatColor.RED + "All non-admins were kicked by " + sender.getName() + "."); } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lastcmd.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lastcmd.java index f0f4343f..34600c1a 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lastcmd.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lastcmd.java @@ -7,7 +7,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Show the last command the specified player used.", usage = "/ ") public class Command_lastcmd extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_linkdiscord.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_linkdiscord.java index 94dca915..a6510fc0 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_linkdiscord.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_linkdiscord.java @@ -22,7 +22,7 @@ public class Command_linkdiscord extends FreedomCommand return true; } - if (args.length > 1 && plugin.sl.isStaff(playerSender)) + if (args.length > 1 && plugin.al.isAdmin(playerSender)) { PlayerData playerData = plugin.pl.getData(args[0]); if (playerData == null) 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 f6fcc6b5..d2ee0af0 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java @@ -1,9 +1,9 @@ package me.totalfreedom.totalfreedommod.command; -import de.myzelyam.api.vanish.VanishAPI; import java.util.ArrayList; import java.util.List; -import me.totalfreedom.totalfreedommod.staff.StaffMember; +import me.totalfreedom.totalfreedommod.admin.Admin; +import me.totalfreedom.totalfreedommod.admin.AdminList; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.rank.Displayable; import me.totalfreedom.totalfreedommod.rank.Rank; @@ -15,7 +15,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @CommandPermissions(level = Rank.IMPOSTOR, source = SourceType.BOTH) -@CommandParameters(description = "Lists the real names of all online players.", usage = "/ [-s | -i | -f | -v]", aliases = "who,lsit") +@CommandParameters(description = "Lists the real names of all online players.", usage = "/ [-a | -i | -f | -v]", aliases = "who,lsit") public class Command_list extends FreedomCommand { @@ -41,20 +41,20 @@ public class Command_list extends FreedomCommand String s = args[0]; switch (s) { - case "-s": + case "-a": { - listFilter = ListFilter.STAFF; + listFilter = ListFilter.ADMINS; break; } case "-v": { - checkRank(Rank.TRIAL_MOD); - listFilter = ListFilter.VANISHED_STAFF; + checkRank(Rank.SUPER_ADMIN); + listFilter = ListFilter.VANISHED_ADMINS; break; } case "-t": { - checkRank(Rank.MOD); + checkRank(Rank.TELNET_ADMIN); listFilter = ListFilter.TELNET_SESSIONS; break; } @@ -83,20 +83,20 @@ public class Command_list extends FreedomCommand List n = new ArrayList<>(); - if (listFilter == ListFilter.TELNET_SESSIONS && plugin.sl.isStaff(sender) && plugin.sl.getAdmin(sender).getRank().isAtLeast(Rank.MOD)) + if (listFilter == ListFilter.TELNET_SESSIONS && plugin.al.isAdmin(sender) && plugin.al.getAdmin(sender).getRank().isAtLeast(Rank.TELNET_ADMIN)) { - List connectedStaffMembers = plugin.btb.getConnectedAdmins(); - onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(connectedStaffMembers.size()) + List connectedAdmins = plugin.btb.getConnectedAdmins(); + onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(connectedAdmins.size()) .append(ChatColor.BLUE) - .append(" staff connected to telnet."); - for (StaffMember staffMember : connectedStaffMembers) + .append(" admins connected to telnet."); + for (Admin admin : connectedAdmins) { - n.add(plugin.rm.getDisplay(staffMember).getColoredTag() + staffMember.getName()); + n.add(plugin.rm.getDisplay(admin).getColoredTag() + admin.getName()); } } else { - onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().size() - VanishAPI.getInvisiblePlayers().size()) + onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().size() - AdminList.vanished.size()) .append(ChatColor.BLUE) .append(" out of a maximum ") .append(ChatColor.RED) @@ -105,19 +105,19 @@ public class Command_list extends FreedomCommand .append(" players online."); for (Player p : server.getOnlinePlayers()) { - if (listFilter == ListFilter.STAFF && !plugin.sl.isStaff(p)) + if (listFilter == ListFilter.ADMINS && !plugin.al.isAdmin(p)) { continue; } - if (listFilter == ListFilter.STAFF && plugin.sl.isVanished(p)) + if (listFilter == ListFilter.ADMINS && plugin.al.isVanished(p.getName())) { continue; } - if (listFilter == ListFilter.VANISHED_STAFF && !plugin.sl.isVanished(p)) + if (listFilter == ListFilter.VANISHED_ADMINS && !plugin.al.isVanished(p.getName())) { continue; } - if (listFilter == ListFilter.IMPOSTORS && !plugin.sl.isAdminImpostor(p)) + if (listFilter == ListFilter.IMPOSTORS && !plugin.al.isAdminImpostor(p)) { continue; } @@ -125,13 +125,20 @@ public class Command_list extends FreedomCommand { continue; } - if (listFilter == ListFilter.PLAYERS && plugin.sl.isVanished(p)) + if (listFilter == ListFilter.PLAYERS && plugin.al.isVanished(p)) { continue; } final Displayable display = plugin.rm.getDisplay(p); - n.add(display.getColoredTag() + p.getName()); + if (!senderIsConsole && plugin.al.isAdmin(playerSender) && plugin.al.getAdmin(playerSender).getOldTags()) + { + n.add(getOldPrefix(display) + p.getName()); + } + else + { + n.add(display.getColoredTag() + p.getName()); + } } } String playerType = listFilter.toString().toLowerCase().replace('_', ' '); @@ -155,12 +162,29 @@ public class Command_list extends FreedomCommand return true; } + public String getOldPrefix(Displayable display) + { + ChatColor color = display.getColor(); + + if (color.equals(ChatColor.AQUA)) + { + color = ChatColor.GOLD; + } + else if (color.equals(ChatColor.GOLD)) + { + color = ChatColor.LIGHT_PURPLE; + } + + String prefix = "[" + display.getAbbr() + "]"; + + return color + prefix; + } private enum ListFilter { PLAYERS, - STAFF, - VANISHED_STAFF, + ADMINS, + VANISHED_ADMINS, TELNET_SESSIONS, FAMOUS_PLAYERS, IMPOSTORS diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lockup.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lockup.java index 4d3d4fb8..92222b16 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lockup.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lockup.java @@ -9,7 +9,7 @@ import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitTask; -@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH, blockHostConsole = true) +@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH, blockHostConsole = true) @CommandParameters(description = "This is evil, and I never should have wrote it - blocks specified player's input.", usage = "/ on | off> [-q]>") public class Command_lockup extends FreedomCommand { @@ -22,7 +22,7 @@ public class Command_lockup extends FreedomCommand { if (args[0].equalsIgnoreCase("all")) { - FUtil.staffAction(sender.getName(), "Locking up all players", true); + FUtil.adminAction(sender.getName(), "Locking up all players", true); for (Player player : server.getOnlinePlayers()) { @@ -32,7 +32,7 @@ public class Command_lockup extends FreedomCommand } else if (args[0].equalsIgnoreCase("purge")) { - FUtil.staffAction(sender.getName(), "Unlocking all players", true); + FUtil.adminAction(sender.getName(), "Unlocking all players", true); for (Player player : server.getOnlinePlayers()) { cancelLockup(player); @@ -59,7 +59,7 @@ public class Command_lockup extends FreedomCommand if (!silent) { - FUtil.staffAction(sender.getName(), "Locking up " + player.getName(), true); + FUtil.adminAction(sender.getName(), "Locking up " + player.getName(), true); } startLockup(player); msg("Locked up " + player.getName() + "."); @@ -76,7 +76,7 @@ public class Command_lockup extends FreedomCommand if (!silent) { - FUtil.staffAction(sender.getName(), "Unlocking " + player.getName(), true); + FUtil.adminAction(sender.getName(), "Unlocking " + player.getName(), true); } cancelLockup(player); msg("Unlocked " + player.getName() + "."); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_logs.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_logs.java index 190245b5..5fae0ac8 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_logs.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_logs.java @@ -6,7 +6,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.ONLY_IN_GAME) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME) @CommandParameters(description = "Register your connection with the TFM logviewer.", usage = "/ [off]") public class Command_logs extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_makeopregion.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_makeopregion.java index a1e64b00..e61f8642 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_makeopregion.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_makeopregion.java @@ -19,7 +19,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.ONLY_IN_GAME) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME) @CommandParameters(description = "Make a WorldGuard region for an OP.", usage = "/ ", aliases = "mor") public class Command_makeopregion extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manageshop.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manageshop.java index 30ea0d05..de71f1dd 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manageshop.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manageshop.java @@ -10,7 +10,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_CONSOLE) +@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE) @CommandParameters(description = "Manage the shop", usage = "/ | items: ", aliases = "ms") public class Command_manageshop extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manuallyverify.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manuallyverify.java index 6c875b0a..8141e729 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manuallyverify.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manuallyverify.java @@ -7,7 +7,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Manually verify someone", usage = "/ ", aliases="mv") public class Command_manuallyverify extends FreedomCommand { @@ -39,7 +39,7 @@ public class Command_manuallyverify extends FreedomCommand return true; } - FUtil.staffAction(sender.getName(), "Manually verifying player " + player.getName(), false); + FUtil.adminAction(sender.getName(), "Manually verifying player " + player.getName(), false); player.setOp(true); player.sendMessage(YOU_ARE_OP); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_massmurder.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_massmurder.java index bfa587b7..e5ed5857 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_massmurder.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_massmurder.java @@ -6,7 +6,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "seth's personal command", usage = "/ ", aliases = "genocide") public class Command_massmurder extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_masterbuilderworld.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_masterbuilderworld.java index 1ee29f31..b368a18b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_masterbuilderworld.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_masterbuilderworld.java @@ -152,7 +152,7 @@ public class Command_masterbuilderworld extends FreedomCommand @Override public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) { - if (!plugin.sl.isStaff(sender)) + if (!plugin.al.isAdmin(sender)) { return Collections.emptyList(); } @@ -177,7 +177,7 @@ public class Command_masterbuilderworld extends FreedomCommand // TODO: Redo this properly private void assertCommandPerms(CommandSender sender, Player playerSender) throws PermissionDeniedException { - if (!(sender instanceof Player) || playerSender == null || !plugin.sl.isAdmin(playerSender)) + if (!(sender instanceof Player) || playerSender == null || !plugin.al.isSeniorAdmin(playerSender)) { throw new PermissionDeniedException(); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mbconfig.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mbconfig.java index 7cbc0297..cbc0e349 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mbconfig.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mbconfig.java @@ -65,7 +65,7 @@ public class Command_mbconfig extends FreedomCommand if (data.isMasterBuilder() && plugin.pl.isPlayerImpostor(player)) { - FUtil.staffAction(sender.getName(), "Re-adding " + player.getName() + " to the Master Builder list", true); + FUtil.adminAction(sender.getName(), "Re-adding " + player.getName() + " to the Master Builder list", true); player.setOp(true); player.sendMessage(YOU_ARE_OP); @@ -79,7 +79,7 @@ public class Command_mbconfig extends FreedomCommand } else if (!data.isMasterBuilder()) { - FUtil.staffAction(sender.getName(), "Adding " + player.getName() + " to the Master Builder list", true); + FUtil.adminAction(sender.getName(), "Adding " + player.getName() + " to the Master Builder list", true); data.setMasterBuilder(true); data.setVerification(true); plugin.pl.save(data); @@ -113,7 +113,7 @@ public class Command_mbconfig extends FreedomCommand return true; } - FUtil.staffAction(sender.getName(), "Removing " + data.getName() + " from the Master Builder list", true); + FUtil.adminAction(sender.getName(), "Removing " + data.getName() + " from the Master Builder list", true); data.setMasterBuilder(false); if (data.getDiscordID() == null) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_moblimiter.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_moblimiter.java index 05454acd..2f3d1e94 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_moblimiter.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_moblimiter.java @@ -7,7 +7,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Control mob limiting parameters.", usage = "/ |dragon|giant|ghast|slime>") public class Command_moblimiter extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mobpurge.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mobpurge.java index cb7bcf9c..e6797d8e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mobpurge.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mobpurge.java @@ -12,7 +12,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Purge all mobs in all worlds.", usage = "/ [name]", aliases = "mp") public class Command_mobpurge extends FreedomCommand { @@ -46,7 +46,7 @@ public class Command_mobpurge extends FreedomCommand mobName = FUtil.formatName(type.name()); } - FUtil.staffAction(sender.getName(), "Purging all " + (type != null ? mobName + "s" : "mobs"), true); + FUtil.adminAction(sender.getName(), "Purging all " + (type != null ? mobName + "s" : "mobs"), true); int count = plugin.ew.purgeMobs(type); msg(count + " " + (type != null ? mobName : "mob") + FUtil.showS(count) + " removed."); return true; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mute.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mute.java index 52f23767..538ff60e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mute.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mute.java @@ -16,7 +16,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Mutes a player with brute force.", usage = "/ <[-s | -q] [reason] | list | purge | all>", aliases = "stfu") public class Command_mute extends FreedomCommand { @@ -53,7 +53,7 @@ public class Command_mute extends FreedomCommand if (args[0].equals("purge")) { - FUtil.staffAction(sender.getName(), "Unmuting all players.", true); + FUtil.adminAction(sender.getName(), "Unmuting all players.", true); FPlayer info; int count = 0; for (Player mp : server.getOnlinePlayers()) @@ -73,13 +73,13 @@ public class Command_mute extends FreedomCommand if (args[0].equals("all")) { - FUtil.staffAction(sender.getName(), "Muting all non-admins", true); + FUtil.adminAction(sender.getName(), "Muting all non-admins", true); FPlayer playerdata; int counter = 0; for (Player player : server.getOnlinePlayers()) { - if (!plugin.sl.isStaff(player)) + if (!plugin.al.isAdmin(player)) { player.sendTitle(ChatColor.RED + "You've been muted globally.", ChatColor.YELLOW + "Please be patient and you will be unmuted shortly.", 20, 100, 60); playerdata = plugin.pl.getPlayer(player); @@ -120,7 +120,7 @@ public class Command_mute extends FreedomCommand } FPlayer playerdata = plugin.pl.getPlayer(player); - if (plugin.sl.isStaff(player)) + if (plugin.al.isAdmin(player)) { msg(player.getName() + " is an admin, and can't be muted."); return true; @@ -140,7 +140,7 @@ public class Command_mute extends FreedomCommand return true; } - FUtil.staffAction(sender.getName(), "Muting " + player.getName(), true); + FUtil.adminAction(sender.getName(), "Muting " + player.getName(), true); if (smite) { @@ -163,7 +163,7 @@ public class Command_mute extends FreedomCommand @Override public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) { - if (!plugin.sl.isStaff(sender)) + if (!plugin.al.isAdmin(sender)) { return null; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mystaff.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java similarity index 76% rename from src/main/java/me/totalfreedom/totalfreedommod/command/Command_mystaff.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java index e9c70f43..b1e4cef0 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mystaff.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; -import me.totalfreedom.totalfreedommod.staff.StaffMember; +import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.rank.Rank; @@ -15,9 +15,9 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.ONLY_IN_GAME) -@CommandParameters(description = "Manage your staff entry.", usage = "/ [-o ] | setlogin | clearlogin | setacformat | clearacformat> | oldtags | logstick | syncroles>") -public class Command_mystaff extends FreedomCommand +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME) +@CommandParameters(description = "Manage your admin entry.", usage = "/ [-o ] | setlogin | clearlogin | setacformat | clearacformat> | oldtags | logstick | syncroles>") +public class Command_myadmin extends FreedomCommand { @Override @@ -29,13 +29,13 @@ public class Command_mystaff extends FreedomCommand } Player init = null; - StaffMember target = getAdmin(playerSender); + Admin target = getAdmin(playerSender); Player targetPlayer = playerSender; // -o switch if (args[0].equals("-o")) { - checkRank(Rank.ADMIN); + checkRank(Rank.SENIOR_ADMIN); init = playerSender; targetPlayer = getPlayer(args[1]); if (targetPlayer == null) @@ -47,7 +47,7 @@ public class Command_mystaff extends FreedomCommand target = getAdmin(targetPlayer); if (target == null) { - msg("That player is not a staff member", ChatColor.RED); + msg("That player is not an admin", ChatColor.RED); return true; } @@ -72,19 +72,19 @@ public class Command_mystaff extends FreedomCommand if (init == null) { - FUtil.staffAction(sender.getName(), "Clearing my IPs", true); + FUtil.adminAction(sender.getName(), "Clearing my supered IPs", true); } else { - FUtil.staffAction(sender.getName(), "Clearing " + target.getName() + "' IPs", true); + FUtil.adminAction(sender.getName(), "Clearing " + target.getName() + "' supered IPs", true); } int counter = target.getIps().size() - 1; target.clearIPs(); target.addIp(targetIp); - plugin.sl.save(target); - plugin.sl.updateTables(); + plugin.al.save(target); + plugin.al.updateTables(); plugin.pl.syncIps(target); @@ -121,16 +121,16 @@ public class Command_mystaff extends FreedomCommand } else { - msg("You cannot remove that staff members's current IP."); + msg("You cannot remove that admin's current IP."); } return true; } - FUtil.staffAction(sender.getName(), "Removing an IP" + (init == null ? "" : " from " + targetPlayer.getName() + "'s IPs"), true); + FUtil.adminAction(sender.getName(), "Removing a supered IP" + (init == null ? "" : " from " + targetPlayer.getName() + "'s IPs"), true); target.removeIp(args[1]); - plugin.sl.save(target); - plugin.sl.updateTables(); + plugin.al.save(target); + plugin.al.updateTables(); plugin.pl.syncIps(target); @@ -141,7 +141,6 @@ public class Command_mystaff extends FreedomCommand case "setlogin": { - checkRank(Rank.MOD); if (args.length < 2) { return false; @@ -159,43 +158,50 @@ public class Command_mystaff extends FreedomCommand msg("Your login message cannot be more than 100 characters (excluding your rank and your name)", ChatColor.RED); return true; } - FUtil.staffAction(sender.getName(), "Setting personal login message" + (init == null ? "" : " for " + targetPlayer.getName()), false); + FUtil.adminAction(sender.getName(), "Setting personal login message" + (init == null ? "" : " for " + targetPlayer.getName()), false); target.setLoginMessage(message); String previewMessage = plugin.rm.craftLoginMessage(targetPlayer, message); msg((init == null ? "Your" : targetPlayer.getName() + "'s") + " login message is now: "); msg("> " + previewMessage); - plugin.sl.save(target); - plugin.sl.updateTables(); + plugin.al.save(target); + plugin.al.updateTables(); return true; } case "clearlogin": { - checkRank(Rank.MOD); - FUtil.staffAction(sender.getName(), "Clearing personal login message" + (init == null ? "" : " for " + targetPlayer.getName()), false); + FUtil.adminAction(sender.getName(), "Clearing personal login message" + (init == null ? "" : " for " + targetPlayer.getName()), false); target.setLoginMessage(null); - plugin.sl.save(target); - plugin.sl.updateTables(); + plugin.al.save(target); + plugin.al.updateTables(); return true; } - case "setscformat": + case "setacformat": { String format = StringUtils.join(args, " ", 1, args.length); target.setAcFormat(format); - plugin.sl.save(target); - plugin.sl.updateTables(); - msg("Set staff chat format to \"" + format + "\".", ChatColor.GRAY); - String example = format.replace("%name%", "ExampleStaff").replace("%rank%", Rank.MOD.getAbbr()).replace("%rankcolor%", Rank.MOD.getColor().toString()).replace("%msg%", "The quick brown fox jumps over the lazy dog."); + plugin.al.save(target); + plugin.al.updateTables(); + msg("Set admin chat format to \"" + format + "\".", ChatColor.GRAY); + String example = format.replace("%name%", "ExampleAdmin").replace("%rank%", Rank.TELNET_ADMIN.getAbbr()).replace("%rankcolor%", Rank.TELNET_ADMIN.getColor().toString()).replace("%msg%", "The quick brown fox jumps over the lazy dog."); msg(ChatColor.GRAY + "Example: " + FUtil.colorize(example)); return true; } - case "clearscformat": + case "clearacformat": { target.setAcFormat(null); - plugin.sl.save(target); - plugin.sl.updateTables(); - msg("Cleared staff chat format.", ChatColor.GRAY); + plugin.al.save(target); + plugin.al.updateTables(); + msg("Cleared admin chat format.", ChatColor.GRAY); + return true; + } + case "oldtags": + { + target.setOldTags(!target.getOldTags()); + plugin.al.save(target); + plugin.al.updateTables(); + msg((target.getOldTags() ? "Enabled" : "Disabled") + " old tags."); return true; } @@ -242,7 +248,7 @@ public class Command_mystaff extends FreedomCommand @Override public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) { - if (!plugin.sl.isStaff(sender)) + if (!plugin.al.isAdmin(sender)) { return Collections.emptyList(); } @@ -269,7 +275,7 @@ public class Command_mystaff extends FreedomCommand { if (args[0].equals("clearip")) { - List ips = plugin.sl.getAdmin(sender).getIps(); + List ips = plugin.al.getAdmin(sender).getIps(); ips.remove(FUtil.getIp((Player) sender)); return ips; } @@ -290,10 +296,10 @@ public class Command_mystaff extends FreedomCommand { if (args[0].equals("-o") && args[2].equals("clearip")) { - StaffMember staffMember = plugin.sl.getEntryByName(args[1]); - if (staffMember != null) + Admin admin = plugin.al.getEntryByName(args[1]); + if (admin != null) { - return staffMember.getIps(); + return admin.getIps(); } } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickclean.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickclean.java index 14ba4604..de963d8b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickclean.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickclean.java @@ -16,7 +16,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Essentials Interface Command - Remove illegal chatcodes from nicknames of one or all players on server.", usage = "/ [player]", aliases = "nc") public class Command_nickclean extends FreedomCommand { @@ -53,12 +53,12 @@ public class Command_nickclean extends FreedomCommand return true; } - FUtil.staffAction(sender.getName(), "Cleaning " + player.getName() + "'s nickname", false); + FUtil.adminAction(sender.getName(), "Cleaning " + player.getName() + "'s nickname", false); cleanNickname(player); return true; } - FUtil.staffAction(sender.getName(), "Cleaning all nicknames", false); + FUtil.adminAction(sender.getName(), "Cleaning all nicknames", false); for (final Player player : server.getOnlinePlayers()) { cleanNickname(player); 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 74087862..091fb34c 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.sl.isVanished(player) && !plugin.sl.isStaff(sender)) + if (player == null || plugin.al.isVanished(player) && !plugin.al.isAdmin(sender)) { player = getPlayerByDisplayNameAlt(displayName); - if (player == null || !plugin.sl.isVanished(player) && !plugin.sl.isStaff(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; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_notes.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_notes.java index 81173fa4..43c63234 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_notes.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_notes.java @@ -13,7 +13,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Manage notes for a player", usage = "/ | remove | clear>") public class Command_notes extends FreedomCommand { 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 7b824a7a..968d4804 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_op.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_op.java @@ -36,7 +36,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() && !plugin.sl.isVanished(player)) + if (!player.isOp() && !plugin.al.isVanished(player)) { matchedPlayerNames.add(player.getName()); player.setOp(true); @@ -49,7 +49,7 @@ public class Command_op extends FreedomCommand { if (!silent) { - FUtil.staffAction(sender.getName(), "Opping " + StringUtils.join(matchedPlayerNames, ", "), false); + FUtil.adminAction(sender.getName(), "Opping " + StringUtils.join(matchedPlayerNames, ", "), false); } } else diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opall.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opall.java index 4ce3dd88..b728a7fd 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opall.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opall.java @@ -14,7 +14,7 @@ public class Command_opall extends FreedomCommand @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - FUtil.staffAction(sender.getName(), "Opping all players on the server", false); + FUtil.adminAction(sender.getName(), "Opping all players on the server", false); for (Player player : server.getOnlinePlayers()) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opme.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opme.java index b39e8429..eaadd8fc 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opme.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opme.java @@ -14,7 +14,7 @@ public class Command_opme extends FreedomCommand @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - FUtil.staffAction(sender.getName(), "Opping " + sender.getName(), false); + FUtil.adminAction(sender.getName(), "Opping " + sender.getName(), false); sender.setOp(true); sender.sendMessage(FreedomCommand.YOU_ARE_OP); return true; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ops.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ops.java index 3ac97109..cb7e697f 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ops.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ops.java @@ -42,13 +42,13 @@ public class Command_ops extends FreedomCommand if (args[0].equals("purge")) { - if (!plugin.sl.isStaff(sender)) + if (!plugin.al.isAdmin(sender)) { noPerms(); return true; } - FUtil.staffAction(sender.getName(), "Purging all operators", true); + FUtil.adminAction(sender.getName(), "Purging all operators", true); for (OfflinePlayer player : server.getOperators()) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_orbit.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_orbit.java index 91c25594..b9aeb7ff 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_orbit.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_orbit.java @@ -10,7 +10,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -@CommandPermissions(level = Rank.MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "POW!!! Right in the kisser! One of these days Alice, straight to the Moon - Sends the specified player into orbit.", usage = "/ [< | stop>]") public class Command_orbit extends FreedomCommand @@ -60,7 +60,7 @@ public class Command_orbit extends FreedomCommand playerdata.startOrbiting(strength); player.setVelocity(new Vector(0, strength, 0)); - FUtil.staffAction(sender.getName(), "Orbiting " + player.getName(), false); + FUtil.adminAction(sender.getName(), "Orbiting " + player.getName(), false); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_permissions.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_permissions.java index 2c9c8eeb..ecfa2477 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_permissions.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_permissions.java @@ -15,7 +15,7 @@ public class Command_permissions extends FreedomCommand @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - if (args.length > 0 && args[0].equals("reload") && plugin.sl.isStaff(sender)) + if (args.length > 0 && args[0].equals("reload") && plugin.al.isAdmin(sender)) { plugin.permissions.load(); plugin.pem.loadPermissionNodes(); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playtime.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playtime.java index 493ff68d..276bbd7d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playtime.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_playtime.java @@ -3,14 +3,14 @@ package me.totalfreedom.totalfreedommod.command; import java.time.Instant; import java.util.Date; import java.util.List; -import me.totalfreedom.totalfreedommod.staff.ActivityLogEntry; +import me.totalfreedom.totalfreedommod.admin.ActivityLogEntry; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.ONLY_IN_GAME) +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME) @CommandParameters(description = "Gets your playtime statistics.", usage = "/") public class Command_playtime extends FreedomCommand { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plugincontrol.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plugincontrol.java index 7b2313e2..db928089 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plugincontrol.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plugincontrol.java @@ -13,7 +13,7 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; -@CommandPermissions(level = Rank.MOD, source = SourceType.BOTH) +@CommandPermissions(level = Rank.TELNET_ADMIN, source = SourceType.BOTH) @CommandParameters(description = "Enable, disable, or reload a specified plugin, as well as list all plugins on the server.", usage = "/ < > | list>", aliases = "plc") public class Command_plugincontrol extends FreedomCommand { @@ -135,7 +135,7 @@ public class Command_plugincontrol extends FreedomCommand @Override public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) { - if (!plugin.sl.isStaff(sender)) + if (!plugin.al.isAdmin(sender)) { return Collections.emptyList(); } 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 258286d3..67d93388 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java @@ -41,12 +41,12 @@ public class Command_potion extends FreedomCommand } else if (args[0].equalsIgnoreCase("clearall")) { - if (!(plugin.sl.isStaff(sender) || senderIsConsole)) + if (!(plugin.al.isAdmin(sender) || senderIsConsole)) { noPerms(); return true; } - FUtil.staffAction(sender.getName(), "Cleared all potion effects from all players", true); + FUtil.adminAction(sender.getName(), "Cleared all potion effects from all players", true); for (Player target : server.getOnlinePlayers()) { for (PotionEffect potion_effect : target.getActivePotionEffects()) @@ -76,9 +76,9 @@ public class Command_potion extends FreedomCommand return true; } - if (!plugin.sl.isStaff(sender)) + if (!plugin.al.isAdmin(sender)) { - msg(ChatColor.RED + "Only staff can clear potion effects from other players."); + msg(ChatColor.RED + "Only admins can clear potion effects from other players."); return true; } @@ -104,7 +104,7 @@ public class Command_potion extends FreedomCommand { target = getPlayer(args[4]); - if (target == null || plugin.sl.isVanished(target) && !plugin.sl.isStaff(sender)) + if (target == null || plugin.al.isVanished(target) && !plugin.al.isAdmin(sender)) { msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED); return true; @@ -117,9 +117,9 @@ public class Command_potion extends FreedomCommand return true; } - if (!plugin.sl.isStaff(sender)) + if (!plugin.al.isAdmin(sender)) { - sender.sendMessage(ChatColor.RED + "Only staff can apply potion effects to other players."); + sender.sendMessage(ChatColor.RED + "Only admins can apply potion effects to other players."); return true; } @@ -183,7 +183,7 @@ public class Command_potion extends FreedomCommand { List arguments = new ArrayList<>(); arguments.addAll(Arrays.asList("list", "clear", "add")); - if (plugin.sl.isStaff(sender)) + if (plugin.al.isAdmin(sender)) { arguments.add("clearall"); } @@ -193,7 +193,7 @@ public class Command_potion extends FreedomCommand { if (args[0].equals("clear")) { - if (plugin.sl.isStaff(sender)) + if (plugin.al.isAdmin(sender)) { return FUtil.getPlayerList(); } @@ -217,7 +217,7 @@ public class Command_potion extends FreedomCommand return Arrays.asList(""); } } - else if (args.length == 5 && plugin.sl.isStaff(sender)) + else if (args.length == 5 && plugin.al.isAdmin(sender)) { if (args[0].equals("add")) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potionspy.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potionspy.java index a2fc6133..9a1e7a21 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potionspy.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potionspy.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; -import me.totalfreedom.totalfreedommod.staff.StaffMember; +import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; import org.apache.commons.lang.math.NumberUtils; @@ -15,8 +15,8 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.entity.ThrownPotion; -@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.ONLY_IN_GAME) -@CommandParameters(description = "Allows staff to see potions that are thrown.", usage = "/ | history [player] ", aliases = "potspy") +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME) +@CommandParameters(description = "Allows admins to see potions that are thrown.", usage = "/ | history [player] ", aliases = "potspy") public class Command_potionspy extends FreedomCommand { private String titleText = "&8&m------------------&r &ePotionSpy &8&m------------------&r"; @@ -28,11 +28,11 @@ public class Command_potionspy extends FreedomCommand @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - StaffMember staffMember = plugin.sl.getAdmin(playerSender); + Admin admin = plugin.al.getAdmin(playerSender); if (args.length <= 0) { - setPotionSpyState(staffMember, !staffMember.getPotionSpy()); + setPotionSpyState(admin, !admin.getPotionSpy()); return true; } else @@ -41,12 +41,12 @@ public class Command_potionspy extends FreedomCommand { case "enable": case "on": - setPotionSpyState(staffMember, true); + setPotionSpyState(admin, true); break; case "disable": case "off": - setPotionSpyState(staffMember, false); + setPotionSpyState(admin, false); break; case "history": @@ -176,12 +176,12 @@ public class Command_potionspy extends FreedomCommand return true; } - private void setPotionSpyState(StaffMember staffMember, boolean state) + private void setPotionSpyState(Admin admin, boolean state) { - staffMember.setPotionSpy(state); - plugin.sl.save(staffMember); - plugin.sl.updateTables(); - msg("PotionSpy is now " + (staffMember.getPotionSpy() ? "enabled." : "disabled.")); + admin.setPotionSpy(state); + plugin.al.save(admin); + plugin.al.updateTables(); + msg("PotionSpy is now " + (admin.getPotionSpy() ? "enabled." : "disabled.")); } /** diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_protectarea.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_protectarea.java new file mode 100644 index 00000000..1803aba7 --- /dev/null +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_protectarea.java @@ -0,0 +1,104 @@ +package me.totalfreedom.totalfreedommod.command; + +import me.totalfreedom.totalfreedommod.ProtectArea; +import me.totalfreedom.totalfreedommod.config.ConfigEntry; +import me.totalfreedom.totalfreedommod.rank.Rank; +import org.apache.commons.lang.StringUtils; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) +@CommandParameters( + description = "Protect areas so that only admins can directly modify blocks in those areas. WorldEdit and other such plugins might bypass this.", + usage = "/ | add