From 055973aa372261f40ac5dce71344964a13a78a98 Mon Sep 17 00:00:00 2001 From: JeromSar Date: Wed, 2 Mar 2016 20:28:01 +0100 Subject: [PATCH] Many changes for TFM 5.0 Refractoring Reworked /saconfig Reworked part of the command system Removed unused config sections Refractored part of the config Fixed bugs with admin list Actually allow CONSOLE to have senior perms --- pom.xml | 18 +- .../totalfreedommod/EntityWiper.java | 2 +- .../totalfreedommod/FrontDoor.java | 8 +- .../totalfreedommod/GameRuleHandler.java | 2 +- .../totalfreedommod/LoginProcess.java | 15 +- .../totalfreedommod/ProtectArea.java | 6 +- .../totalfreedommod/ServerPing.java | 2 +- .../totalfreedommod/ServiceChecker.java | 5 +- .../totalfreedommod/TotalFreedomMod.java | 30 +- .../totalfreedommod/admin/Admin.java | 4 +- .../totalfreedommod/admin/AdminList.java | 44 ++- .../totalfreedommod/banning/PermbanList.java | 3 +- .../bridge/WorldEditBridge.java | 55 +-- .../totalfreedommod/caging/CageData.java | 2 +- .../command/CommandFailException.java | 11 + .../{commands => command}/CommandLoader.java | 8 +- .../CommandParameters.java | 2 +- .../CommandPermissions.java | 2 +- .../Command_adminchat.java | 6 +- .../Command_adminmode.java | 2 +- .../Command_adminworld.java | 22 +- .../Command_blockcmd.java | 10 +- .../{commands => command}/Command_cage.java | 2 +- .../{commands => command}/Command_cake.java | 2 +- .../Command_cartsit.java | 2 +- .../{commands => command}/Command_cbtool.java | 4 +- .../{commands => command}/Command_cmdspy.java | 4 +- .../Command_colorme.java | 8 +- .../Command_commandlist.java | 4 +- .../Command_consolesay.java | 2 +- .../Command_creative.java | 8 +- .../{commands => command}/Command_deafen.java | 2 +- .../{commands => command}/Command_debug.java | 2 +- .../{commands => command}/Command_denick.java | 2 +- .../{commands => command}/Command_deop.java | 2 +- .../Command_deopall.java | 2 +- .../Command_dispfill.java | 4 +- .../{commands => command}/Command_doom.java | 2 +- .../Command_enchant.java | 20 +- .../{commands => command}/Command_ender.java | 2 +- .../Command_entitywipe.java | 4 +- .../{commands => command}/Command_expel.java | 8 +- .../{commands => command}/Command_findip.java | 6 +- .../Command_flatlands.java | 4 +- .../{commands => command}/Command_freeze.java | 14 +- .../Command_fuckoff.java | 4 +- .../{commands => command}/Command_gadmin.java | 10 +- .../{commands => command}/Command_gcmd.java | 10 +- .../{commands => command}/Command_glist.java | 10 +- .../{commands => command}/Command_gtfo.java | 4 +- .../{commands => command}/Command_health.java | 12 +- .../{commands => command}/Command_invis.java | 10 +- .../Command_jumppads.java | 14 +- .../Command_kicknoob.java | 2 +- .../Command_landmine.java | 10 +- .../Command_lastcmd.java | 6 +- .../{commands => command}/Command_list.java | 8 +- .../Command_localspawn.java | 4 +- .../{commands => command}/Command_lockup.java | 10 +- .../{commands => command}/Command_logs.java | 6 +- .../Command_moblimiter.java | 12 +- .../Command_mobpurge.java | 6 +- .../{commands => command}/Command_mp44.java | 8 +- .../{commands => command}/Command_nether.java | 2 +- .../Command_nickclean.java | 4 +- .../Command_nickfilter.java | 4 +- .../Command_nicknyan.java | 12 +- .../Command_onlinemode.java | 6 +- .../{commands => command}/Command_op.java | 8 +- .../{commands => command}/Command_opall.java | 2 +- .../{commands => command}/Command_opme.java | 2 +- .../{commands => command}/Command_ops.java | 10 +- .../{commands => command}/Command_orbit.java | 8 +- .../Command_overlord.java | 16 +- .../Command_permban.java | 8 +- .../Command_plugincontrol.java | 29 +- .../{commands => command}/Command_potion.java | 22 +- .../Command_premium.java | 6 +- .../Command_protectarea.java | 18 +- .../Command_purgeall.java | 2 +- .../{commands => command}/Command_qdeop.java | 6 +- .../{commands => command}/Command_qop.java | 6 +- .../{commands => command}/Command_radar.java | 10 +- .../{commands => command}/Command_rank.java | 8 +- .../{commands => command}/Command_rawsay.java | 2 +- .../{commands => command}/Command_report.java | 10 +- .../{commands => command}/Command_ro.java | 10 +- .../Command_rollback.java | 20 +- .../command/Command_saconfig.java | 228 +++++++++++++ .../{commands => command}/Command_say.java | 2 +- .../Command_services.java | 10 +- .../{commands => command}/Command_setl.java | 2 +- .../Command_setlevel.java | 6 +- .../Command_setlever.java | 8 +- .../Command_setspawnworld.java | 4 +- .../{commands => command}/Command_smite.java | 4 +- .../{commands => command}/Command_status.java | 12 +- .../{commands => command}/Command_stfu.java | 18 +- .../{commands => command}/Command_stop.java | 2 +- .../Command_survival.java | 10 +- .../{commands => command}/Command_tag.java | 22 +- .../Command_tagnyan.java | 4 +- .../{commands => command}/Command_tban.java | 4 +- .../Command_tempban.java | 4 +- .../Command_tfbanlist.java | 6 +- .../Command_tfipbanlist.java | 6 +- .../{commands => command}/Command_tfm.java | 16 +- .../Command_tfupdate.java | 4 +- .../{commands => command}/Command_toggle.java | 44 +-- .../Command_tossmob.java | 18 +- .../{commands => command}/Command_trail.java | 8 +- .../{commands => command}/Command_warn.java | 12 +- .../Command_whitelist.java | 16 +- .../{commands => command}/Command_whohas.java | 10 +- .../Command_wildcard.java | 12 +- .../Command_wipeflatlands.java | 2 +- .../Command_wipeuserdata.java | 6 +- .../{commands => command}/FreedomCommand.java | 70 +++- .../FreedomCommandExecutor.java | 4 +- .../{commands => command}/SourceType.java | 2 +- .../commands/Command_saconfig.java | 314 ------------------ .../totalfreedommod/config/ConfigEntry.java | 8 +- .../totalfreedommod/config/MainConfig.java | 2 +- .../totalfreedommod/fun/ItemFun.java | 2 +- .../totalfreedommod/fun/Landminer.java | 2 +- .../totalfreedommod/httpd/NanoHTTPD.java | 24 +- .../httpd/module/HTTPDModule.java | 2 +- .../httpd/module/Module_file.java | 2 +- .../httpd/module/Module_help.java | 10 +- .../httpd/module/Module_permbans.java | 5 +- .../httpd/module/Module_schematic.java | 2 +- .../totalfreedommod/player/FPlayer.java | 2 +- .../totalfreedommod/player/PlayerList.java | 4 +- .../totalfreedommod/rank/RankManager.java | 13 +- .../rollback/RollbackManager.java | 4 +- .../totalfreedommod/util/FUtil.java | 35 +- .../totalfreedommod/world/AdminWorld.java | 8 +- .../world/CleanroomChunkGenerator.java | 2 +- src/main/java/org/mcstats/Metrics.java | 2 +- src/main/resources/admins.yml | 35 ++ src/main/resources/config.yml | 53 ++- .../resources/{permban.yml => permbans.yml} | 0 src/main/resources/superadmin.yml | 40 --- 143 files changed, 939 insertions(+), 954 deletions(-) create mode 100644 src/main/java/me/totalfreedom/totalfreedommod/command/CommandFailException.java rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/CommandLoader.java (70%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/CommandParameters.java (84%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/CommandPermissions.java (86%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_adminchat.java (85%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_adminmode.java (96%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_adminworld.java (89%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_blockcmd.java (83%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_cage.java (98%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_cake.java (97%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_cartsit.java (98%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_cbtool.java (98%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_cmdspy.java (84%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_colorme.java (84%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_commandlist.java (93%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_consolesay.java (94%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_creative.java (87%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_deafen.java (97%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_debug.java (98%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_denick.java (94%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_deop.java (96%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_deopall.java (94%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_dispfill.java (97%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_doom.java (98%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_enchant.java (82%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_ender.java (93%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_entitywipe.java (86%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_expel.java (90%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_findip.java (80%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_flatlands.java (88%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_freeze.java (76%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_fuckoff.java (87%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_gadmin.java (94%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_gcmd.java (81%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_glist.java (90%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_gtfo.java (96%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_health.java (84%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_invis.java (84%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_jumppads.java (81%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_kicknoob.java (95%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_landmine.java (83%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_lastcmd.java (85%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_list.java (90%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_localspawn.java (82%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_lockup.java (92%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_logs.java (97%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_moblimiter.java (81%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_mobpurge.java (90%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_mp44.java (80%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_nether.java (93%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_nickclean.java (90%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_nickfilter.java (96%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_nicknyan.java (84%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_onlinemode.java (85%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_op.java (86%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_opall.java (96%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_opme.java (94%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_ops.java (84%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_orbit.java (87%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_overlord.java (83%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_permban.java (81%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_plugincontrol.java (79%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_potion.java (86%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_premium.java (90%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_protectarea.java (75%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_purgeall.java (97%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_qdeop.java (91%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_qop.java (91%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_radar.java (86%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_rank.java (72%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_rawsay.java (94%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_report.java (80%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_ro.java (91%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_rollback.java (70%) create mode 100644 src/main/java/me/totalfreedom/totalfreedommod/command/Command_saconfig.java rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_say.java (96%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_services.java (66%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_setl.java (94%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_setlevel.java (84%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_setlever.java (91%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_setspawnworld.java (86%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_smite.java (94%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_status.java (71%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_stfu.java (86%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_stop.java (94%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_survival.java (84%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_tag.java (84%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_tagnyan.java (93%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_tban.java (93%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_tempban.java (96%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_tfbanlist.java (86%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_tfipbanlist.java (87%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_tfm.java (80%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_tfupdate.java (95%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_toggle.java (76%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_tossmob.java (73%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_trail.java (95%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_warn.java (77%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_whitelist.java (88%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_whohas.java (84%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_wildcard.java (77%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_wipeflatlands.java (95%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/Command_wipeuserdata.java (86%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/FreedomCommand.java (61%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/FreedomCommandExecutor.java (97%) rename src/main/java/me/totalfreedom/totalfreedommod/{commands => command}/SourceType.java (57%) delete mode 100644 src/main/java/me/totalfreedom/totalfreedommod/commands/Command_saconfig.java create mode 100644 src/main/resources/admins.yml rename src/main/resources/{permban.yml => permbans.yml} (100%) delete mode 100644 src/main/resources/superadmin.yml diff --git a/pom.xml b/pom.xml index 8ec98c3d..e41d3268 100644 --- a/pom.xml +++ b/pom.xml @@ -48,12 +48,6 @@ - - net.pravian - Aero - 2.0 - compile - org.projectlombok @@ -65,11 +59,19 @@ org.spigotmc spigot - 1.8.7-R0.1-SNAPSHOT + 1.9-R0.1-SNAPSHOT system ${project.basedir}/lib/Spigot-1.9.jar + + net.pravian + aero + 2.0 + system + ${project.basedir}/lib/Aero-2.0.jar + + net.totalfreedom bukkittelnet @@ -176,7 +178,7 @@ TotalFreedomMod.jar 1.7 - 1.6 + 1.7 1.7 diff --git a/src/main/java/me/totalfreedom/totalfreedommod/EntityWiper.java b/src/main/java/me/totalfreedom/totalfreedommod/EntityWiper.java index 31acd717..ed991fa2 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/EntityWiper.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/EntityWiper.java @@ -26,7 +26,7 @@ public class EntityWiper extends FreedomService private static final long WIPE_RATE = 5 * 20L; // - private final List> wipables = new ArrayList>(); + private final List> wipables = new ArrayList<>(); // private BukkitTask wipeTask; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/FrontDoor.java b/src/main/java/me/totalfreedom/totalfreedommod/FrontDoor.java index 03e9fde6..d7d239e3 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/FrontDoor.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/FrontDoor.java @@ -14,8 +14,8 @@ import java.util.List; import java.util.Random; import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.banning.Ban; -import me.totalfreedom.totalfreedommod.commands.Command_trail; -import me.totalfreedom.totalfreedommod.commands.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.Command_trail; +import me.totalfreedom.totalfreedommod.command.FreedomCommand; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.config.MainConfig; import me.totalfreedom.totalfreedommod.player.FPlayer; @@ -162,7 +162,7 @@ public class FrontDoor extends FreedomService event.setCancelled(true); - final FreedomCommand dispatcher = FreedomCommand.getCommand(command); + final FreedomCommand dispatcher = FreedomCommand.getFrom(command); if (dispatcher == null) { @@ -530,7 +530,7 @@ public class FrontDoor extends FreedomService if (!allowDevs) { - List allowedPlayers = new ArrayList(); + List allowedPlayers = new ArrayList<>(); for (Player player : players) { if (!FUtil.DEVELOPERS.contains(player.getName())) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/GameRuleHandler.java b/src/main/java/me/totalfreedom/totalfreedommod/GameRuleHandler.java index 69789a6a..3ded2ab0 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/GameRuleHandler.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/GameRuleHandler.java @@ -12,7 +12,7 @@ import org.bukkit.World; public class GameRuleHandler extends FreedomService { - private final Map rules = new EnumMap(GameRule.class); + private final Map rules = new EnumMap<>(GameRule.class); public GameRuleHandler(TotalFreedomMod plugin) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java b/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java index 08c02b47..58445968 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java @@ -1,6 +1,8 @@ package me.totalfreedom.totalfreedommod; import java.util.regex.Pattern; +import lombok.Getter; +import lombok.Setter; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.util.FSync; import me.totalfreedom.totalfreedommod.util.FUtil; @@ -15,9 +17,14 @@ import org.bukkit.scheduler.BukkitRunnable; public class LoginProcess extends FreedomService { - public static final int DEFAULT_PORT = 25565; + public static final int MIN_USERNAME_LENGTH = 2; + public static final int MAX_USERNAME_LENGTH = 20; public static final Pattern USERNAME_REGEX = Pattern.compile("^[\\w\\d_]{3,20}$"); + // + @Getter + @Setter + private boolean lockdownEnabled = false; public LoginProcess(TotalFreedomMod plugin) { @@ -71,7 +78,7 @@ public class LoginProcess extends FreedomService final String ip = event.getAddress().getHostAddress().trim(); // Check username length - if (username.length() < 3 || username.length() > TotalFreedomMod.MAX_USERNAME_LENGTH) + if (username.length() < MIN_USERNAME_LENGTH || username.length() > MAX_USERNAME_LENGTH) { event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Your username is an invalid length (must be between 3 and 20 characters long)."); return; @@ -154,7 +161,7 @@ public class LoginProcess extends FreedomService } // Lockdown mode - if (TotalFreedomMod.lockdownEnabled) + if (lockdownEnabled) { event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Server is currently in lockdown mode."); return; @@ -186,7 +193,7 @@ public class LoginProcess extends FreedomService player.sendMessage(ChatColor.RED + "Server is currently closed to non-superadmins."); } - if (TotalFreedomMod.lockdownEnabled) + if (lockdownEnabled) { FUtil.playerMsg(player, "Warning: Server is currenty in lockdown-mode, new players will not be able to join!", ChatColor.RED); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ProtectArea.java b/src/main/java/me/totalfreedom/totalfreedommod/ProtectArea.java index 69e96ae2..75f152fb 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/ProtectArea.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/ProtectArea.java @@ -26,7 +26,7 @@ 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(); @@ -44,7 +44,7 @@ public class ProtectArea extends FreedomService return; } - File input = new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.PROTECTED_AREA_FILENAME); + File input = new File(TotalFreedomMod.plugin.getDataFolder(), DATA_FILENAME); try { if (input.exists()) @@ -76,7 +76,7 @@ public class ProtectArea extends FreedomService { try { - FileOutputStream fos = new FileOutputStream(new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.PROTECTED_AREA_FILENAME)); + FileOutputStream fos = new FileOutputStream(new File(TotalFreedomMod.plugin.getDataFolder(), DATA_FILENAME)); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(areas); oos.close(); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ServerPing.java b/src/main/java/me/totalfreedom/totalfreedommod/ServerPing.java index 31fedc13..32c2a07e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/ServerPing.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/ServerPing.java @@ -61,8 +61,8 @@ public class ServerPing extends FreedomService .replace("%mcversion%", plugin.si.getVersion()))); return; } - // Colorful MOTD + // Colorful MOTD final StringBuilder motd = new StringBuilder(); for (String word : ConfigEntry.SERVER_MOTD.getString().replace("%mcversion%", plugin.si.getVersion()).split(" ")) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ServiceChecker.java b/src/main/java/me/totalfreedom/totalfreedommod/ServiceChecker.java index e9d2f595..8725cd8a 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/ServiceChecker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/ServiceChecker.java @@ -25,6 +25,7 @@ import org.json.simple.JSONValue; public class ServiceChecker extends FreedomService { + public static final long SERVICE_CHECKER_RATE = 120L; @Getter private final Map services = Maps.newHashMap(); @@ -69,7 +70,7 @@ public class ServiceChecker extends FreedomService return; } - task = getUpdateRunnable().runTaskTimerAsynchronously(TotalFreedomMod.plugin, 40L, TotalFreedomMod.SERVICE_CHECKER_RATE * 20L); + task = getUpdateRunnable().runTaskTimerAsynchronously(TotalFreedomMod.plugin, 40L, SERVICE_CHECKER_RATE * 20L); } @Override @@ -165,7 +166,7 @@ public class ServiceChecker extends FreedomService public List getAllStatuses() { - List servicesList = new ArrayList(); + List servicesList = new ArrayList<>(); for (String key : services.keySet()) { servicesList.add(services.get(key)); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java index 03de09ec..8de31b9b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java @@ -8,10 +8,6 @@ import me.totalfreedom.totalfreedommod.fun.ItemFun; import me.totalfreedom.totalfreedommod.blocking.InteractBlocker; import me.totalfreedom.totalfreedommod.blocking.EventBlocker; import me.totalfreedom.totalfreedommod.blocking.BlockBlocker; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; import me.totalfreedom.totalfreedommod.admin.AdminList; import me.totalfreedom.totalfreedommod.banning.BanManager; import me.totalfreedom.totalfreedommod.bridge.BukkitTelnetBridge; @@ -19,7 +15,7 @@ import me.totalfreedom.totalfreedommod.bridge.EssentialsBridge; import me.totalfreedom.totalfreedommod.bridge.WorldEditBridge; import me.totalfreedom.totalfreedommod.caging.Cager; import me.totalfreedom.totalfreedommod.blocking.command.CommandBlocker; -import me.totalfreedom.totalfreedommod.commands.CommandLoader; +import me.totalfreedom.totalfreedommod.command.CommandLoader; import me.totalfreedom.totalfreedommod.freeze.Freezer; import me.totalfreedom.totalfreedommod.fun.Landminer; import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon; @@ -29,6 +25,10 @@ import me.totalfreedom.totalfreedommod.rollback.RollbackManager; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.world.WorldManager; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; import net.pravian.aero.component.service.ServiceManager; import net.pravian.aero.plugin.AeroPlugin; import org.bukkit.scheduler.BukkitRunnable; @@ -37,15 +37,7 @@ import org.mcstats.Metrics; public class TotalFreedomMod extends AeroPlugin { - public static final long SERVICE_CHECKER_RATE = 120L; - public static final int MAX_USERNAME_LENGTH = 20; - // public static final String CONFIG_FILENAME = "config.yml"; - public static final String SUPERADMIN_FILENAME = "superadmin.yml"; - public static final String PERMBAN_FILENAME = "permban.yml"; - public static final String UUID_FILENAME = "uuids.db"; - public static final String PROTECTED_AREA_FILENAME = "protectedareas.dat"; - public static final String SAVED_FLAGS_FILENAME = "savedflags.dat"; // public static final BuildProperties build = new BuildProperties(); // @@ -54,8 +46,6 @@ public class TotalFreedomMod extends AeroPlugin public static String pluginName; public static String pluginVersion; // - public static boolean lockdownEnabled = false; - // // Services public ServiceManager services; public ServerInterface si; @@ -134,12 +124,12 @@ public class TotalFreedomMod extends AeroPlugin FUtil.deleteFolder(new File("./_deleteme")); // Create backups - FUtil.createBackups(CONFIG_FILENAME, true); - FUtil.createBackups(SUPERADMIN_FILENAME); - FUtil.createBackups(PERMBAN_FILENAME); + FUtil.createBackups(TotalFreedomMod.CONFIG_FILENAME, true); + FUtil.createBackups(AdminList.CONFIG_FILENAME); + FUtil.createBackups(PermbanList.CONFIG_FILENAME); // Start services and bridgess - services = new ServiceManager(plugin); + services = new ServiceManager<>(plugin); si = services.registerService(ServerInterface.class); wm = services.registerService(WorldManager.class); al = services.registerService(AdminList.class); @@ -176,7 +166,7 @@ public class TotalFreedomMod extends AeroPlugin services.start(); // Register bridges - bridges = new ServiceManager(plugin); + bridges = new ServiceManager<>(plugin); btb = bridges.registerService(BukkitTelnetBridge.class); esb = bridges.registerService(EssentialsBridge.class); web = bridges.registerService(WorldEditBridge.class); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java b/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java index 5ed38c80..dbcb4b0b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java @@ -95,8 +95,8 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable cs.set("active", activated); cs.set("rank", rank.toString()); cs.set("ips", Lists.newArrayList(ips)); - cs.set("last_login", lastLogin); - cs.set("login_message", null); + cs.set("last_login", FUtil.dateToString(lastLogin)); + cs.set("login_message", loginMessage); } public boolean isAtLeast(PlayerRank pRank) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java b/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java index 59adc5b6..ef897602 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java @@ -10,7 +10,8 @@ import java.util.concurrent.TimeUnit; import lombok.Getter; import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.TotalFreedomMod; -import me.totalfreedom.totalfreedommod.commands.Command_logs; +import me.totalfreedom.totalfreedommod.command.Command_logs; +import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FLog; @@ -20,6 +21,7 @@ import net.pravian.aero.util.Ips; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; +import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -29,6 +31,8 @@ import org.bukkit.plugin.ServicePriority; public class AdminList extends FreedomService { + public static final String CONFIG_FILENAME = "admins.yml"; + @Getter private final Map allAdmins = Maps.newHashMap(); // Includes disabled admins // Only active admins below @@ -37,14 +41,13 @@ public class AdminList extends FreedomService private final Map nameTable = Maps.newHashMap(); private final Map ipTable = Maps.newHashMap(); // - private int cleanThreshold = 24 * 7; // 1 Week in hours private final YamlConfig config; public AdminList(TotalFreedomMod plugin) { super(plugin); - this.config = new YamlConfig(TotalFreedomMod.plugin, TotalFreedomMod.SUPERADMIN_FILENAME, true); + this.config = new YamlConfig(TotalFreedomMod.plugin, CONFIG_FILENAME, true); } @Override @@ -75,8 +78,15 @@ public class AdminList extends FreedomService allAdmins.clear(); for (String key : config.getKeys(false)) { + ConfigurationSection section = config.getConfigurationSection(key); + if (section == null) + { + logger.warning("Invalid admin list format: " + key); + continue; + } + Admin admin = new Admin(key); - admin.loadFrom(config.getConfigurationSection(key)); + admin.loadFrom(section); if (!admin.isValid()) { @@ -239,6 +249,12 @@ public class AdminList extends FreedomService public boolean addAdmin(Admin admin, boolean overwrite) { + if (!admin.isValid()) + { + logger.warning("Could not add admin: " + admin.getConfigKey() + " Admin is missing details!"); + return false; + } + final String key = admin.getConfigKey(); if (!overwrite && allAdmins.containsKey(key)) @@ -259,9 +275,8 @@ public class AdminList extends FreedomService public boolean removeAdmin(Admin admin) { - // Remove admin, update views - if (allAdmins.remove(admin.getName().toLowerCase()) == null) + if (allAdmins.remove(admin.getConfigKey()) == null) { return false; } @@ -316,20 +331,19 @@ public class AdminList extends FreedomService final Player player = event.getPlayer(); final FPlayer fPlayer = plugin.pl.getPlayer(player); - boolean isAdmin = plugin.al.isAdmin(player); - if (isAdmin) + if (plugin.al.isAdmin(player)) { // Verify strict IP match - if (!plugin.al.isIdentityMatched(player)) - { - fPlayer.setSuperadminIdVerified(false); - FUtil.bcastMsg("Warning: " + player.getName() + " is an admin, but is using an account not registered to one of their ip-list.", ChatColor.RED); - } - else + if (plugin.al.isIdentityMatched(player)) { fPlayer.setSuperadminIdVerified(true); plugin.al.updateLastLogin(player); } + else + { + fPlayer.setSuperadminIdVerified(false); + FUtil.bcastMsg("Warning: " + player.getName() + " is an admin, but is using an account not registered to one of their ip-list.", ChatColor.RED); + } } } @@ -419,7 +433,7 @@ public class AdminList extends FreedomService final Date lastLogin = admin.getLastLogin(); final long lastLoginHours = TimeUnit.HOURS.convert(new Date().getTime() - lastLogin.getTime(), TimeUnit.MILLISECONDS); - if (lastLoginHours < cleanThreshold) + if (lastLoginHours < ConfigEntry.ADMINLIST_CLEAN_THESHOLD_HOURS.getInteger()) { continue; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/banning/PermbanList.java b/src/main/java/me/totalfreedom/totalfreedommod/banning/PermbanList.java index 4960027e..a9ae8f90 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/banning/PermbanList.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/banning/PermbanList.java @@ -17,6 +17,7 @@ import org.bukkit.event.player.PlayerLoginEvent; public class PermbanList extends FreedomService { + public static final String CONFIG_FILENAME = "permbans.yml"; @Getter private final Set permbannedNames = Sets.newHashSet(); @@ -34,7 +35,7 @@ public class PermbanList extends FreedomService permbannedNames.clear(); permbannedIps.clear(); - final YamlConfig config = new YamlConfig(TotalFreedomMod.plugin, TotalFreedomMod.PERMBAN_FILENAME, true); + final YamlConfig config = new YamlConfig(TotalFreedomMod.plugin, CONFIG_FILENAME, true); config.load(); for (String name : config.getKeys(false)) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldEditBridge.java b/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldEditBridge.java index 2908dc5f..7e6f8955 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldEditBridge.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldEditBridge.java @@ -12,9 +12,6 @@ import org.bukkit.plugin.Plugin; public class WorldEditBridge extends FreedomService { - - private static WorldEditPlugin worldEditPlugin = null; - public WorldEditBridge(TotalFreedomMod plugin) { super(plugin); @@ -32,59 +29,63 @@ public class WorldEditBridge extends FreedomService private WorldEditPlugin getWorldEditPlugin() { - if (worldEditPlugin == null) + WorldEditPlugin worldEditPlugin = null; + + try { - try + Plugin we = Bukkit.getServer().getPluginManager().getPlugin("WorldEdit"); + if (we != null) { - Plugin we = Bukkit.getServer().getPluginManager().getPlugin("WorldEdit"); - if (we != null) + if (we instanceof WorldEditPlugin) { - if (we instanceof WorldEditPlugin) - { - worldEditPlugin = (WorldEditPlugin) we; - } + worldEditPlugin = (WorldEditPlugin) we; } } - catch (Exception ex) - { - FLog.severe(ex); - } } + catch (Exception ex) + { + FLog.severe(ex); + } + return worldEditPlugin; } private LocalSession getPlayerSession(Player player) { + final WorldEditPlugin wep = getWorldEditPlugin(); + if (wep == null) + { + return null; + } + try { - final WorldEditPlugin wep = getWorldEditPlugin(); - if (wep != null) - { - return wep.getSession(player); - } + return wep.getSession(player); } catch (Exception ex) { FLog.severe(ex); + return null; } - return null; } private BukkitPlayer getBukkitPlayer(Player player) { + final WorldEditPlugin wep = getWorldEditPlugin(); + if (wep == null) + { + return null; + } + try { - final WorldEditPlugin wep = getWorldEditPlugin(); - if (wep != null) - { - return wep.wrapPlayer(player); - } + return wep.wrapPlayer(player); } catch (Exception ex) { FLog.severe(ex); + return null; } - return null; } public void undo(Player player, int count) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/caging/CageData.java b/src/main/java/me/totalfreedom/totalfreedommod/caging/CageData.java index 41801e3a..722d1602 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/caging/CageData.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/caging/CageData.java @@ -15,7 +15,7 @@ public class CageData private final FPlayer fPlayer; // - private final List cageHistory = new ArrayList(); + private final List cageHistory = new ArrayList<>(); // @Getter private boolean caged = false; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/CommandFailException.java b/src/main/java/me/totalfreedom/totalfreedommod/command/CommandFailException.java new file mode 100644 index 00000000..01fead47 --- /dev/null +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/CommandFailException.java @@ -0,0 +1,11 @@ + +package me.totalfreedom.totalfreedommod.command; + +public class CommandFailException extends RuntimeException { + private static final long serialVersionUID = -92333791173123L; + + public CommandFailException(String message) { + super(message); + } + +} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/CommandLoader.java b/src/main/java/me/totalfreedom/totalfreedommod/command/CommandLoader.java similarity index 70% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/CommandLoader.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/CommandLoader.java index 337fb18a..10346ec9 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/CommandLoader.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/CommandLoader.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import lombok.Getter; import me.totalfreedom.totalfreedommod.FreedomService; @@ -17,7 +17,7 @@ public class CommandLoader extends FreedomService { super(plugin); - handler = new SimpleCommandHandler(plugin); + handler = new SimpleCommandHandler<>(plugin); } @Override @@ -26,7 +26,9 @@ public class CommandLoader extends FreedomService handler.clearCommands(); handler.setExecutorFactory(new FreedomCommandExecutor.FreedomExecutorFactory()); handler.setCommandClassPrefix("Command_"); - handler.setPermissionMessage(ChatColor.YELLOW + "You do not have permission to use this command."); + handler.setPermissionMessage(ChatColor.RED + "You do not have permission to use this command."); + handler.setOnlyConsoleMessage(ChatColor.RED + "This command can only be used from the console."); + handler.setOnlyPlayerMessage(ChatColor.RED + "This command can only be used by players."); handler.loadFrom(FreedomCommand.class.getPackage()); handler.registerAll("TotalFreedomMod", true); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/CommandParameters.java b/src/main/java/me/totalfreedom/totalfreedommod/command/CommandParameters.java similarity index 84% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/CommandParameters.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/CommandParameters.java index b1db112f..db7a5ae3 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/CommandParameters.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/CommandParameters.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/CommandPermissions.java b/src/main/java/me/totalfreedom/totalfreedommod/command/CommandPermissions.java similarity index 86% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/CommandPermissions.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/CommandPermissions.java index 1bb8c730..dcde1a7e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/CommandPermissions.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/CommandPermissions.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_adminchat.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminchat.java similarity index 85% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_adminchat.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminchat.java index b5feac59..7c468916 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_adminchat.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminchat.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.player.FPlayer; @@ -23,13 +23,13 @@ public class Command_adminchat extends FreedomCommand { if (senderIsConsole) { - playerMsg("Only in-game players can toggle AdminChat."); + msg("Only in-game players can toggle AdminChat."); return true; } FPlayer userinfo = plugin.pl.getPlayer(playerSender); userinfo.setAdminChat(!userinfo.inAdminChat()); - playerMsg("Toggled Admin Chat " + (userinfo.inAdminChat() ? "on" : "off") + "."); + msg("Toggled Admin Chat " + (userinfo.inAdminChat() ? "on" : "off") + "."); } else { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_adminmode.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminmode.java similarity index 96% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_adminmode.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminmode.java index 2229a919..28f79d02 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_adminmode.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminmode.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.config.ConfigEntry; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_adminworld.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminworld.java similarity index 89% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_adminworld.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminworld.java index 7fc0fb19..e44a8a67 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_adminworld.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_adminworld.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; @@ -73,19 +73,19 @@ public class Command_adminworld extends FreedomCommand if (adminWorld == null || playerSender.getWorld() == adminWorld) { - playerMsg("Going to the main world."); + msg("Going to the main world."); playerSender.teleport(server.getWorlds().get(0).getSpawnLocation()); } else { if (plugin.wm.adminworld.canAccessWorld(playerSender)) { - playerMsg("Going to the AdminWorld."); + msg("Going to the AdminWorld."); plugin.wm.adminworld.sendToWorld(playerSender); } else { - playerMsg("You don't have permission to access the AdminWorld."); + msg("You don't have permission to access the AdminWorld."); } } @@ -97,7 +97,7 @@ public class Command_adminworld extends FreedomCommand { if ("list".equalsIgnoreCase(args[1])) { - playerMsg("AdminWorld guest list: " + plugin.wm.adminworld.guestListToString()); + msg("AdminWorld guest list: " + plugin.wm.adminworld.guestListToString()); } else if ("purge".equalsIgnoreCase(args[1])) { @@ -130,7 +130,7 @@ public class Command_adminworld extends FreedomCommand } else { - playerMsg("Could not add player to guest list."); + msg("Could not add player to guest list."); } } else if ("remove".equals(args[1])) @@ -142,7 +142,7 @@ public class Command_adminworld extends FreedomCommand } else { - playerMsg("Can't find guest entry for: " + args[2]); + msg("Can't find guest entry for: " + args[2]); } } else @@ -163,11 +163,11 @@ public class Command_adminworld extends FreedomCommand if (timeOfDay != null) { plugin.wm.adminworld.setTimeOfDay(timeOfDay); - playerMsg("AdminWorld time set to: " + timeOfDay.name()); + msg("AdminWorld time set to: " + timeOfDay.name()); } else { - playerMsg("Invalid time of day. Can be: sunrise, noon, sunset, midnight"); + msg("Invalid time of day. Can be: sunrise, noon, sunset, midnight"); } } else @@ -187,11 +187,11 @@ public class Command_adminworld extends FreedomCommand if (weatherMode != null) { plugin.wm.adminworld.setWeatherMode(weatherMode); - playerMsg("AdminWorld weather set to: " + weatherMode.name()); + msg("AdminWorld weather set to: " + weatherMode.name()); } else { - playerMsg("Invalid weather mode. Can be: off, rain, storm"); + msg("Invalid weather mode. Can be: off, rain, storm"); } } else diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_blockcmd.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockcmd.java similarity index 83% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_blockcmd.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockcmd.java index 14388c85..dbd5b6e9 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_blockcmd.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_blockcmd.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.player.FPlayer; @@ -33,7 +33,7 @@ public class Command_blockcmd extends FreedomCommand playerdata.setCommandsBlocked(false); } } - playerMsg("Unblocked commands for " + counter + " players."); + msg("Unblocked commands for " + counter + " players."); return true; } @@ -41,13 +41,13 @@ public class Command_blockcmd extends FreedomCommand if (player == null) { - playerMsg(FreedomCommand.PLAYER_NOT_FOUND); + msg(FreedomCommand.PLAYER_NOT_FOUND); return true; } if (isAdmin(sender)) { - playerMsg(player.getName() + " is a Superadmin, and cannot have their commands blocked."); + msg(player.getName() + " is a Superadmin, and cannot have their commands blocked."); return true; } @@ -56,7 +56,7 @@ public class Command_blockcmd extends FreedomCommand playerdata.setCommandsBlocked(!playerdata.allCommandsBlocked()); FUtil.adminAction(sender.getName(), (playerdata.allCommandsBlocked() ? "B" : "Unb") + "locking all commands for " + player.getName(), true); - playerMsg((playerdata.allCommandsBlocked() ? "B" : "Unb") + "locked all commands."); + msg((playerdata.allCommandsBlocked() ? "B" : "Unb") + "locked all commands."); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_cage.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java similarity index 98% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_cage.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java index d0e8eb47..cf007ad9 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_cage.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.player.FPlayer; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_cake.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java similarity index 97% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_cake.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java index d60a8333..46a70538 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_cake.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cake.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.util.Random; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_cartsit.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cartsit.java similarity index 98% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_cartsit.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_cartsit.java index cfc24c5f..20896fcb 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_cartsit.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cartsit.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import org.bukkit.command.Command; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_cbtool.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cbtool.java similarity index 98% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_cbtool.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_cbtool.java index 5c19d71d..09a3a042 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_cbtool.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cbtool.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.util.List; @@ -32,7 +32,7 @@ public class Command_cbtool extends FreedomCommand if ("targetblock".equalsIgnoreCase(args[0]) && sender instanceof Player) { Block targetBlock = DepreciationAggregator.getTargetBlock(playerSender, null, 100); - playerMsg("Your target block: " + targetBlock.getLocation().toString()); + msg("Your target block: " + targetBlock.getLocation().toString()); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_cmdspy.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cmdspy.java similarity index 84% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_cmdspy.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_cmdspy.java index ce35af2d..b55e7816 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_cmdspy.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cmdspy.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.player.FPlayer; @@ -17,7 +17,7 @@ public class Command_cmdspy extends FreedomCommand FPlayer playerdata = plugin.pl.getPlayer(playerSender); playerdata.setCommandSpy(!playerdata.cmdspyEnabled()); - playerMsg("CommandSpy " + (playerdata.cmdspyEnabled() ? "enabled." : "disabled.")); + msg("CommandSpy " + (playerdata.cmdspyEnabled() ? "enabled." : "disabled.")); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_colorme.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_colorme.java similarity index 84% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_colorme.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_colorme.java index cb154642..08bf53a7 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_colorme.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_colorme.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.util.Iterator; @@ -25,7 +25,7 @@ public class Command_colorme extends FreedomCommand if ("list".equalsIgnoreCase(args[0])) { - playerMsg("Colors: " + StringUtils.join(FUtil.CHAT_COLOR_NAMES.keySet(), ", ")); + msg("Colors: " + StringUtils.join(FUtil.CHAT_COLOR_NAMES.keySet(), ", ")); return true; } @@ -44,7 +44,7 @@ public class Command_colorme extends FreedomCommand if (color == null) { - playerMsg("Invalid color: " + needle + " - Use \"/colorme list\" to list colors."); + msg("Invalid color: " + needle + " - Use \"/colorme list\" to list colors."); return true; } @@ -52,7 +52,7 @@ public class Command_colorme extends FreedomCommand plugin.esb.setNickname(sender.getName(), newNick); - playerMsg("Your nickname is now: " + newNick); + msg("Your nickname is now: " + newNick); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_commandlist.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_commandlist.java similarity index 93% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_commandlist.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_commandlist.java index fb0964f4..1a0170b9 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_commandlist.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_commandlist.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.util.ArrayList; @@ -21,7 +21,7 @@ public class Command_commandlist extends FreedomCommand @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - List commands = new ArrayList(); + List commands = new ArrayList<>(); for (Plugin targetPlugin : server.getPluginManager().getPlugins()) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_consolesay.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_consolesay.java similarity index 94% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_consolesay.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_consolesay.java index 855ca143..6976748d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_consolesay.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_consolesay.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_creative.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_creative.java similarity index 87% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_creative.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_creative.java index c06789e0..504693c9 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_creative.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_creative.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; @@ -50,7 +50,7 @@ public class Command_creative extends FreedomCommand if (!(senderIsConsole || isAdmin(sender))) { - playerMsg("Only superadmins can change other user's gamemode."); + msg("Only superadmins can change other user's gamemode."); return true; } @@ -64,8 +64,8 @@ public class Command_creative extends FreedomCommand } - playerMsg("Setting " + player.getName() + " to game mode 'Creative'."); - playerMsg(player, sender.getName() + " set your game mode to 'Creative'."); + msg("Setting " + player.getName() + " to game mode 'Creative'."); + msg(player, sender.getName() + " set your game mode to 'Creative'."); player.setGameMode(GameMode.CREATIVE); return true; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_deafen.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deafen.java similarity index 97% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_deafen.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_deafen.java index 7ca9a40d..a0429efd 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_deafen.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deafen.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.util.Random; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_debug.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_debug.java similarity index 98% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_debug.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_debug.java index 420a2ccc..5a3cc6b0 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_debug.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_debug.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.lang.reflect.Field; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_denick.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_denick.java similarity index 94% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_denick.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_denick.java index dd9a3470..dcd87cf4 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_denick.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_denick.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_deop.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deop.java similarity index 96% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_deop.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_deop.java index ccd8526c..2f0312b4 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_deop.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deop.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.DepreciationAggregator; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_deopall.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deopall.java similarity index 94% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_deopall.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_deopall.java index fb81917a..12f89b7a 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_deopall.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_deopall.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_dispfill.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_dispfill.java similarity index 97% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_dispfill.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_dispfill.java index 37b76219..4537f2a0 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_dispfill.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_dispfill.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.util.ArrayList; @@ -38,7 +38,7 @@ public class Command_dispfill extends FreedomCommand return true; } - final List items = new ArrayList(); + final List items = new ArrayList<>(); final String[] itemsRaw = StringUtils.split(args[1], ","); for (final String searchItem : itemsRaw) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_doom.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_doom.java similarity index 98% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_doom.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_doom.java index fd94154f..cc4e1bcb 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_doom.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_doom.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.admin.Admin; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_enchant.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_enchant.java similarity index 82% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_enchant.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_enchant.java index fa2dc4f5..378a6e51 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_enchant.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_enchant.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FLog; @@ -25,7 +25,7 @@ public class Command_enchant extends FreedomCommand if (itemInHand == null) { - playerMsg("You are holding an invalid item."); + msg("You are holding an invalid item."); return true; } @@ -45,11 +45,11 @@ public class Command_enchant extends FreedomCommand if (has_enchantments) { - playerMsg(possible_ench.toString()); + msg(possible_ench.toString()); } else { - playerMsg("The held item has no enchantments."); + msg("The held item has no enchantments."); } } else if (args[0].equalsIgnoreCase("addall")) @@ -69,7 +69,7 @@ public class Command_enchant extends FreedomCommand } } - playerMsg("Added all possible enchantments for this item."); + msg("Added all possible enchantments for this item."); } else if (args[0].equalsIgnoreCase("reset")) { @@ -78,7 +78,7 @@ public class Command_enchant extends FreedomCommand itemInHand.removeEnchantment(ench); } - playerMsg("Removed all enchantments."); + msg("Removed all enchantments."); } else { @@ -99,7 +99,7 @@ public class Command_enchant extends FreedomCommand if (ench == null) { - playerMsg(args[1] + " is an invalid enchantment for the held item. Type \"/enchant list\" for valid enchantments for this item."); + msg(args[1] + " is an invalid enchantment for the held item. Type \"/enchant list\" for valid enchantments for this item."); return true; } @@ -109,18 +109,18 @@ public class Command_enchant extends FreedomCommand { itemInHand.addEnchantment(ench, ench.getMaxLevel()); - playerMsg("Added enchantment: " + ench.getName()); + msg("Added enchantment: " + ench.getName()); } else { - playerMsg("Can't use this enchantment on held item."); + msg("Can't use this enchantment on held item."); } } else if (args[0].equals("remove")) { itemInHand.removeEnchantment(ench); - playerMsg("Removed enchantment: " + ench.getName()); + msg("Removed enchantment: " + ench.getName()); } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_ender.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ender.java similarity index 93% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_ender.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_ender.java index 0e9b7a55..95857ff3 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_ender.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ender.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_entitywipe.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java similarity index 86% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_entitywipe.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java index 993a3819..abcd0773 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_entitywipe.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_entitywipe.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; @@ -15,7 +15,7 @@ public class Command_entitywipe extends FreedomCommand public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { FUtil.adminAction(sender.getName(), "Removing all server entities.", true); - playerMsg((plugin.ew.wipeEntities(true, true)) + " entities removed."); + msg((plugin.ew.wipeEntities(true, true)) + " entities removed."); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_expel.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_expel.java similarity index 90% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_expel.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_expel.java index e730cd27..36405395 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_expel.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_expel.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.util.ArrayList; @@ -44,7 +44,7 @@ public class Command_expel extends FreedomCommand } } - List pushedPlayers = new ArrayList(); + List pushedPlayers = new ArrayList<>(); final Vector senderPos = playerSender.getLocation().toVector(); final List players = playerSender.getWorld().getPlayers(); @@ -78,11 +78,11 @@ public class Command_expel extends FreedomCommand if (pushedPlayers.isEmpty()) { - playerMsg("No players pushed."); + msg("No players pushed."); } else { - playerMsg("Pushed " + pushedPlayers.size() + " players: " + StringUtils.join(pushedPlayers, ", ")); + msg("Pushed " + pushedPlayers.size() + " players: " + StringUtils.join(pushedPlayers, ", ")); } return true; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_findip.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_findip.java similarity index 80% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_findip.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_findip.java index da8d40ba..60435e1a 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_findip.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_findip.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import org.apache.commons.lang3.StringUtils; @@ -24,11 +24,11 @@ public class Command_findip extends FreedomCommand if (player == null) { - playerMsg(FreedomCommand.PLAYER_NOT_FOUND); + msg(FreedomCommand.PLAYER_NOT_FOUND); return true; } - playerMsg("Player IPs: " + StringUtils.join(plugin.pl.getData(player).getIps(), ", ")); + msg("Player IPs: " + StringUtils.join(plugin.pl.getData(player).getIps(), ", ")); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_flatlands.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_flatlands.java similarity index 88% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_flatlands.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_flatlands.java index aae3fe07..8ae5f61d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_flatlands.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_flatlands.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.rank.PlayerRank; @@ -20,7 +20,7 @@ public class Command_flatlands extends FreedomCommand } else { - playerMsg("Flatlands is currently disabled."); + msg("Flatlands is currently disabled."); } return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_freeze.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_freeze.java similarity index 76% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_freeze.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_freeze.java index dc9d5252..57e062ec 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_freeze.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_freeze.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; @@ -24,18 +24,18 @@ public class Command_freeze extends FreedomCommand if (!allFrozen) { FUtil.adminAction(sender.getName(), "Disabling global player freeze", true); - playerMsg("Players are now free to move."); + msg("Players are now free to move."); return true; } FUtil.adminAction(sender.getName(), "Disabling global player freeze", true); - playerMsg("Players are now unfrozen."); + msg("Players are now unfrozen."); for (Player player : server.getOnlinePlayers()) { if (!isAdmin(player)) { - playerMsg(player, "You have been frozen due to rulebreakers, you will be unfrozen soon.", ChatColor.RED); + msg(player, "You have been frozen due to rulebreakers, you will be unfrozen soon.", ChatColor.RED); } } return true; @@ -52,15 +52,15 @@ public class Command_freeze extends FreedomCommand if (player == null) { - playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED); + msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED); return true; } final FreezeData fd = plugin.pl.getPlayer(player).getFreezeData(); fd.setFrozen(!fd.isFrozen()); - playerMsg(player.getName() + " has been " + (fd.isFrozen() ? "frozen" : "unfrozen") + "."); - playerMsg(player, "You have been " + (fd.isFrozen() ? "frozen" : "unfrozen") + ".", ChatColor.AQUA); + msg(player.getName() + " has been " + (fd.isFrozen() ? "frozen" : "unfrozen") + "."); + msg(player, "You have been " + (fd.isFrozen() ? "frozen" : "unfrozen") + ".", ChatColor.AQUA); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_fuckoff.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fuckoff.java similarity index 87% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_fuckoff.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_fuckoff.java index 749a970a..ee7d4979 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_fuckoff.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_fuckoff.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.player.FPlayer; @@ -43,7 +43,7 @@ public class Command_fuckoff extends FreedomCommand player.setFuckoff(radius); } - playerMsg("Fuckoff " + (player.isFuckOff() ? ("enabled. Radius: " + player.getFuckoffRadius() + ".") : "disabled.")); + msg("Fuckoff " + (player.isFuckOff() ? ("enabled. Radius: " + player.getFuckoffRadius() + ".") : "disabled.")); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_gadmin.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gadmin.java similarity index 94% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_gadmin.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_gadmin.java index 9988ea0e..16eb92f4 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_gadmin.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gadmin.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.nio.charset.StandardCharsets; @@ -73,7 +73,7 @@ public class Command_gadmin extends FreedomCommand final GadminMode mode = GadminMode.findMode(args[0].toLowerCase()); if (mode == null) { - playerMsg("Invalid mode: " + args[0], ChatColor.RED); + msg("Invalid mode: " + args[0], ChatColor.RED); return true; } @@ -81,7 +81,7 @@ public class Command_gadmin extends FreedomCommand if (mode == GadminMode.LIST) { - playerMsg("[ Real Name ] : [ Display Name ] - Hash:"); + msg("[ Real Name ] : [ Display Name ] - Hash:"); while (it.hasNext()) { final Player player = it.next(); @@ -112,7 +112,7 @@ public class Command_gadmin extends FreedomCommand if (target == null) { - playerMsg("Invalid player hash: " + args[1], ChatColor.RED); + msg("Invalid player hash: " + args[1], ChatColor.RED); return true; } @@ -191,7 +191,7 @@ public class Command_gadmin extends FreedomCommand FreezeData fd = plugin.pl.getPlayer(target).getFreezeData(); fd.setFrozen(!fd.isFrozen()); - playerMsg(target.getName() + " has been " + (fd.isFrozen() ? "frozen" : "unfrozen") + "."); + msg(target.getName() + " has been " + (fd.isFrozen() ? "frozen" : "unfrozen") + "."); target.sendMessage(ChatColor.AQUA + "You have been " + (fd.isFrozen() ? "frozen" : "unfrozen") + "."); break; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_gcmd.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gcmd.java similarity index 81% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_gcmd.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_gcmd.java index cafcfbb0..6e926bae 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_gcmd.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gcmd.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import org.apache.commons.lang3.StringUtils; @@ -36,19 +36,19 @@ public class Command_gcmd extends FreedomCommand try { - playerMsg("Sending command as " + player.getName() + ": " + outCommand); + msg("Sending command as " + player.getName() + ": " + outCommand); if (server.dispatchCommand(player, outCommand)) { - playerMsg("Command sent."); + msg("Command sent."); } else { - playerMsg("Unknown error sending command."); + msg("Unknown error sending command."); } } catch (Throwable ex) { - playerMsg("Error sending command: " + ex.getMessage()); + msg("Error sending command: " + ex.getMessage()); } return true; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_glist.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_glist.java similarity index 90% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_glist.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_glist.java index 183ede93..21688baa 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_glist.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_glist.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.util.ArrayList; @@ -33,11 +33,11 @@ public class Command_glist extends FreedomCommand if (getAdmin(sender).getRank() == PlayerRank.SENIOR_ADMIN) { plugin.pl.purgeAllData(); - playerMsg("Purged playerbase."); + msg("Purged playerbase."); } else { - playerMsg("Only Senior Admins may purge the userlist."); + msg("Only Senior Admins may purge the userlist."); } return true; } @@ -49,7 +49,7 @@ public class Command_glist extends FreedomCommand else if (args.length == 2) { String username; - final List ips = new ArrayList(); + final List ips = new ArrayList<>(); final Player player = getPlayer(args[1]); @@ -59,7 +59,7 @@ public class Command_glist extends FreedomCommand if (entry == null) { - playerMsg("Can't find that user. If target is not logged in, make sure that you spelled the name exactly."); + msg("Can't find that user. If target is not logged in, make sure that you spelled the name exactly."); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_gtfo.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gtfo.java similarity index 96% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_gtfo.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_gtfo.java index 6bad5d98..d7f1e2d1 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_gtfo.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gtfo.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.banning.Ban; import me.totalfreedom.totalfreedommod.rank.PlayerRank; @@ -30,7 +30,7 @@ public class Command_gtfo extends FreedomCommand if (player == null) { - playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED); + msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_health.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_health.java similarity index 84% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_health.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_health.java index 14d9f81e..ccf45637 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_health.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_health.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.text.DecimalFormat; @@ -27,11 +27,11 @@ public class Command_health extends FreedomCommand Runtime runtime = Runtime.getRuntime(); long usedMem = runtime.totalMemory() - runtime.freeMemory(); - playerMsg("Reserved Memory: " + (double) runtime.totalMemory() / (double) BYTES_PER_MB + "mb"); - playerMsg("Used Memory: " + new DecimalFormat("#").format((double) usedMem / (double) BYTES_PER_MB) + msg("Reserved Memory: " + (double) runtime.totalMemory() / (double) BYTES_PER_MB + "mb"); + msg("Used Memory: " + new DecimalFormat("#").format((double) usedMem / (double) BYTES_PER_MB) + "mb (" + new DecimalFormat("#").format(((double) usedMem / (double) runtime.totalMemory()) * 100.0) + "%)"); - playerMsg("Max Memory: " + (double) runtime.maxMemory() / (double) BYTES_PER_MB + "mb"); - playerMsg("Calculating ticks per second, please wait..."); + msg("Max Memory: " + (double) runtime.maxMemory() / (double) BYTES_PER_MB + "mb"); + msg("Calculating ticks per second, please wait..."); new BukkitRunnable() { @@ -50,7 +50,7 @@ public class Command_health extends FreedomCommand @Override public void run() { - playerMsg("Ticks per second: " + (TPS_RANGE.containsDouble(ticksPerSecond) ? ChatColor.GREEN : ChatColor.RED) + ticksPerSecond); + msg("Ticks per second: " + (TPS_RANGE.containsDouble(ticksPerSecond) ? ChatColor.GREEN : ChatColor.RED) + ticksPerSecond); } }.runTask(plugin); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_invis.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invis.java similarity index 84% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_invis.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_invis.java index bc672b8c..fd0b6902 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_invis.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_invis.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.util.ArrayList; @@ -32,7 +32,7 @@ public class Command_invis extends FreedomCommand } } - List players = new ArrayList(); + List players = new ArrayList<>(); int smites = 0; for (Player player : server.getOnlinePlayers()) @@ -50,17 +50,17 @@ public class Command_invis extends FreedomCommand if (players.isEmpty()) { - playerMsg("There are no invisible players"); + msg("There are no invisible players"); return true; } if (smite) { - playerMsg("Smitten " + smites + " players"); + msg("Smitten " + smites + " players"); } else { - playerMsg("Invisible players (" + players.size() + "): " + StringUtils.join(players, ", ")); + msg("Invisible players (" + players.size() + "): " + StringUtils.join(players, ", ")); } return true; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_jumppads.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_jumppads.java similarity index 81% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_jumppads.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_jumppads.java index 8ef4750a..669c11bd 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_jumppads.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_jumppads.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.fun.Jumppads; @@ -25,9 +25,9 @@ public class Command_jumppads extends FreedomCommand { if (args[0].equalsIgnoreCase("info")) { - playerMsg("Jumppads: " + (plugin.jp.getMode().isOn() ? "Enabled" : "Disabled"), ChatColor.BLUE); - playerMsg("Sideways: " + (plugin.jp.getMode() == Jumppads.JumpPadMode.NORMAL_AND_SIDEWAYS ? "Enabled" : "Disabled"), ChatColor.BLUE); - playerMsg("Strength: " + (plugin.jp.getStrength() * 10 - 1), ChatColor.BLUE); + msg("Jumppads: " + (plugin.jp.getMode().isOn() ? "Enabled" : "Disabled"), ChatColor.BLUE); + msg("Sideways: " + (plugin.jp.getMode() == Jumppads.JumpPadMode.NORMAL_AND_SIDEWAYS ? "Enabled" : "Disabled"), ChatColor.BLUE); + msg("Strength: " + (plugin.jp.getStrength() * 10 - 1), ChatColor.BLUE); return true; } @@ -46,7 +46,7 @@ public class Command_jumppads extends FreedomCommand { if (plugin.jp.getMode() == Jumppads.JumpPadMode.OFF) { - playerMsg("Jumppads are currently disabled, please enable them before changing jumppads settings."); + msg("Jumppads are currently disabled, please enable them before changing jumppads settings."); return true; } @@ -72,13 +72,13 @@ public class Command_jumppads extends FreedomCommand } catch (NumberFormatException ex) { - playerMsg("Invalid Strength"); + msg("Invalid Strength"); return true; } if (strength > 10 || strength < 1) { - playerMsg("Invalid Strength: The strength may be 1 through 10."); + msg("Invalid Strength: The strength may be 1 through 10."); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_kicknoob.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kicknoob.java similarity index 95% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_kicknoob.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_kicknoob.java index 2237be21..6e4effca 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_kicknoob.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kicknoob.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_landmine.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_landmine.java similarity index 83% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_landmine.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_landmine.java index 2273eddc..7f8e089e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_landmine.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_landmine.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.util.Iterator; @@ -22,13 +22,13 @@ public class Command_landmine extends FreedomCommand { if (!ConfigEntry.LANDMINES_ENABLED.getBoolean()) { - playerMsg("The landmine is currently disabled.", ChatColor.GREEN); + msg("The landmine is currently disabled.", ChatColor.GREEN); return true; } if (!ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()) { - playerMsg("Explosions are currently disabled.", ChatColor.GREEN); + msg("Explosions are currently disabled.", ChatColor.GREEN); return true; } @@ -41,7 +41,7 @@ public class Command_landmine extends FreedomCommand final Iterator landmines = plugin.lm.getLandmines().iterator(); while (landmines.hasNext()) { - playerMsg(landmines.next().toString()); + msg(landmines.next().toString()); } return true; } @@ -59,7 +59,7 @@ public class Command_landmine extends FreedomCommand landmine.setType(Material.TNT); plugin.lm.add(new Landmine(landmine.getLocation(), playerSender, radius)); - playerMsg("Landmine planted - Radius = " + radius + " blocks.", ChatColor.GREEN); + msg("Landmine planted - Radius = " + radius + " blocks.", ChatColor.GREEN); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_lastcmd.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lastcmd.java similarity index 85% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_lastcmd.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_lastcmd.java index 39663c48..bb43a374 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_lastcmd.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lastcmd.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.player.FPlayer; @@ -24,7 +24,7 @@ public class Command_lastcmd extends FreedomCommand if (player == null) { - playerMsg(FreedomCommand.PLAYER_NOT_FOUND); + msg(FreedomCommand.PLAYER_NOT_FOUND); return true; } @@ -37,7 +37,7 @@ public class Command_lastcmd extends FreedomCommand { lastCommand = "(none)"; } - playerMsg(player.getName() + " - Last Command: " + lastCommand, ChatColor.GRAY); + msg(player.getName() + " - Last Command: " + lastCommand, ChatColor.GRAY); } return true; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_list.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java similarity index 90% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_list.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java index de266964..2e30c982 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_list.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.util.ArrayList; @@ -33,12 +33,12 @@ public class Command_list extends FreedomCommand if (FUtil.isFromHostConsole(sender.getName())) { - final List names = new ArrayList(); + final List names = new ArrayList<>(); for (Player player : server.getOnlinePlayers()) { names.add(player.getName()); } - playerMsg("There are " + names.size() + "/" + server.getMaxPlayers() + " players online:\n" + StringUtils.join(names, ", "), ChatColor.WHITE); + msg("There are " + names.size() + "/" + server.getMaxPlayers() + " players online:\n" + StringUtils.join(names, ", "), ChatColor.WHITE); return true; } @@ -70,7 +70,7 @@ public class Command_list extends FreedomCommand onlineStats.append(ChatColor.BLUE).append(" out of a maximum ").append(ChatColor.RED).append(server.getMaxPlayers()); onlineStats.append(ChatColor.BLUE).append(" players online."); - final List names = new ArrayList(); + final List names = new ArrayList<>(); for (Player player : server.getOnlinePlayers()) { if (listFilter == ListFilter.ADMINS && !plugin.al.isAdmin(player)) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_localspawn.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_localspawn.java similarity index 82% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_localspawn.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_localspawn.java index b17aacde..7477c3c8 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_localspawn.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_localspawn.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import org.bukkit.command.Command; @@ -14,7 +14,7 @@ public class Command_localspawn extends FreedomCommand public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { playerSender.teleport(playerSender.getWorld().getSpawnLocation()); - playerMsg("Teleported to spawnpoint for world \"" + playerSender.getWorld().getName() + "\"."); + msg("Teleported to spawnpoint for world \"" + playerSender.getWorld().getName() + "\"."); return true; } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_lockup.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lockup.java similarity index 92% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_lockup.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_lockup.java index e796d914..d26b7987 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_lockup.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_lockup.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.player.FPlayer; @@ -27,7 +27,7 @@ public class Command_lockup extends FreedomCommand { startLockup(player); } - playerMsg("Locked up all players."); + msg("Locked up all players."); } else if (args[0].equalsIgnoreCase("purge")) { @@ -37,7 +37,7 @@ public class Command_lockup extends FreedomCommand cancelLockup(player); } - playerMsg("Unlocked all players."); + msg("Unlocked all players."); } else { @@ -58,7 +58,7 @@ public class Command_lockup extends FreedomCommand FUtil.adminAction(sender.getName(), "Locking up " + player.getName(), true); startLockup(player); - playerMsg("Locked up " + player.getName() + "."); + msg("Locked up " + player.getName() + "."); } else if ("off".equals(args[1])) { @@ -72,7 +72,7 @@ public class Command_lockup extends FreedomCommand FUtil.adminAction(sender.getName(), "Unlocking " + player.getName(), true); cancelLockup(player); - playerMsg("Unlocked " + player.getName() + "."); + msg("Unlocked " + player.getName() + "."); } else { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_logs.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_logs.java similarity index 97% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_logs.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_logs.java index 930fd1dc..5d60aae7 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_logs.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_logs.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.net.HttpURLConnection; @@ -140,7 +140,7 @@ public class Command_logs extends FreedomCommand { private final String requestPath; - private final Map queryStringMap = new HashMap(); + private final Map queryStringMap = new HashMap<>(); public URLBuilder(String requestPath) { @@ -155,7 +155,7 @@ public class Command_logs extends FreedomCommand public URL getURL() throws MalformedURLException { - List pairs = new ArrayList(); + List pairs = new ArrayList<>(); Iterator> it = queryStringMap.entrySet().iterator(); while (it.hasNext()) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_moblimiter.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_moblimiter.java similarity index 81% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_moblimiter.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_moblimiter.java index d282282c..e6dbd347 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_moblimiter.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_moblimiter.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.rank.PlayerRank; @@ -67,14 +67,14 @@ public class Command_moblimiter extends FreedomCommand { sender.sendMessage("Moblimiter enabled. Maximum mobcount set to: " + ConfigEntry.MOB_LIMITER_MAX.getInteger() + "."); - playerMsg("Dragon: " + (ConfigEntry.MOB_LIMITER_DISABLE_DRAGON.getBoolean() ? "disabled" : "enabled") + "."); - playerMsg("Giant: " + (ConfigEntry.MOB_LIMITER_DISABLE_GIANT.getBoolean() ? "disabled" : "enabled") + "."); - playerMsg("Slime: " + (ConfigEntry.MOB_LIMITER_DISABLE_SLIME.getBoolean() ? "disabled" : "enabled") + "."); - playerMsg("Ghast: " + (ConfigEntry.MOB_LIMITER_DISABLE_GHAST.getBoolean() ? "disabled" : "enabled") + "."); + msg("Dragon: " + (ConfigEntry.MOB_LIMITER_DISABLE_DRAGON.getBoolean() ? "disabled" : "enabled") + "."); + msg("Giant: " + (ConfigEntry.MOB_LIMITER_DISABLE_GIANT.getBoolean() ? "disabled" : "enabled") + "."); + msg("Slime: " + (ConfigEntry.MOB_LIMITER_DISABLE_SLIME.getBoolean() ? "disabled" : "enabled") + "."); + msg("Ghast: " + (ConfigEntry.MOB_LIMITER_DISABLE_GHAST.getBoolean() ? "disabled" : "enabled") + "."); } else { - playerMsg("Moblimiter is disabled. No mob restrictions are in effect."); + msg("Moblimiter is disabled. No mob restrictions are in effect."); } plugin.gr.setGameRule(GameRuleHandler.GameRule.DO_MOB_SPAWNING, !ConfigEntry.MOB_LIMITER_ENABLED.getBoolean()); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_mobpurge.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mobpurge.java similarity index 90% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_mobpurge.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_mobpurge.java index 7157f530..44cc8246 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_mobpurge.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mobpurge.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import org.bukkit.Bukkit; @@ -21,8 +21,8 @@ public class Command_mobpurge extends FreedomCommand @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - playerMsg("Purging all mobs..."); - playerMsg(purgeMobs() + " mobs removed."); + msg("Purging all mobs..."); + msg(purgeMobs() + " mobs removed."); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_mp44.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mp44.java similarity index 80% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_mp44.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_mp44.java index 98d6e523..522d3342 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_mp44.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_mp44.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.config.ConfigEntry; @@ -20,7 +20,7 @@ public class Command_mp44 extends FreedomCommand { if (!ConfigEntry.MP44_ENABLED.getBoolean()) { - playerMsg("The mp44 is currently disabled.", ChatColor.GREEN); + msg("The mp44 is currently disabled.", ChatColor.GREEN); return true; } @@ -35,8 +35,8 @@ public class Command_mp44 extends FreedomCommand { playerdata.armMP44(); - playerMsg("mp44 is ARMED! Left click with gunpowder to start firing, left click again to quit.", ChatColor.GREEN); - playerMsg("Type /mp44 sling to disable. -by Madgeek1450", ChatColor.GREEN); + msg("mp44 is ARMED! Left click with gunpowder to start firing, left click again to quit.", ChatColor.GREEN); + msg("Type /mp44 sling to disable. -by Madgeek1450", ChatColor.GREEN); playerSender.setItemInHand(new ItemStack(Material.SULPHUR, 1)); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_nether.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nether.java similarity index 93% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_nether.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_nether.java index 1f0ea5ce..607c3f91 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_nether.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nether.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_nickclean.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickclean.java similarity index 90% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_nickclean.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickclean.java index f2fc5ec2..665302a7 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_nickclean.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickclean.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -40,7 +40,7 @@ public class Command_nickclean extends FreedomCommand if (matcher.find()) { final String newNickName = matcher.replaceAll(""); - playerMsg(ChatColor.RESET + playerName + ": \"" + nickName + ChatColor.RESET + "\" -> \"" + newNickName + ChatColor.RESET + "\"."); + msg(ChatColor.RESET + playerName + ": \"" + nickName + ChatColor.RESET + "\" -> \"" + newNickName + ChatColor.RESET + "\"."); plugin.esb.setNickname(playerName, newNickName); } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_nickfilter.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickfilter.java similarity index 96% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_nickfilter.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickfilter.java index f18309eb..b75b59fe 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_nickfilter.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nickfilter.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.util.ArrayList; @@ -25,7 +25,7 @@ public class Command_nickfilter extends FreedomCommand { boolean nickMatched = false; - final List outputCommand = new ArrayList(); + final List outputCommand = new ArrayList<>(); if (args.length >= 1) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_nicknyan.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nicknyan.java similarity index 84% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_nicknyan.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_nicknyan.java index 7a1bdfd8..ae1e212a 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_nicknyan.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_nicknyan.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; @@ -24,7 +24,7 @@ public class Command_nicknyan extends FreedomCommand if ("off".equals(args[0])) { plugin.esb.setNickname(sender.getName(), null); - playerMsg("Nickname cleared."); + msg("Nickname cleared."); return true; } @@ -32,12 +32,12 @@ public class Command_nicknyan extends FreedomCommand if (!nickPlain.matches("^[a-zA-Z_0-9" + ChatColor.COLOR_CHAR + "]+$")) { - playerMsg("That nickname contains invalid characters."); + msg("That nickname contains invalid characters."); return true; } else if (nickPlain.length() < 4 || nickPlain.length() > 30) { - playerMsg("Your nickname must be between 4 and 30 characters long."); + msg("Your nickname must be between 4 and 30 characters long."); return true; } @@ -49,7 +49,7 @@ public class Command_nicknyan extends FreedomCommand } if (player.getName().equalsIgnoreCase(nickPlain) || ChatColor.stripColor(player.getDisplayName()).trim().equalsIgnoreCase(nickPlain)) { - playerMsg("That nickname is already in use."); + msg("That nickname is already in use."); return true; } } @@ -66,7 +66,7 @@ public class Command_nicknyan extends FreedomCommand plugin.esb.setNickname(sender.getName(), newNick.toString()); - playerMsg("Your nickname is now: " + newNick.toString()); + msg("Your nickname is now: " + newNick.toString()); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_onlinemode.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_onlinemode.java similarity index 85% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_onlinemode.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_onlinemode.java index a2332b21..2f373c06 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_onlinemode.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_onlinemode.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FLog; @@ -18,8 +18,8 @@ public class Command_onlinemode extends FreedomCommand { if (args.length < 1) { - playerMsg("Server is currently running with 'online-mode=" + (server.getOnlineMode() ? "true" : "false") + "'.", ChatColor.WHITE); - playerMsg("\"/onlinemode on\" and \"/onlinemode off\" can be used to change online mode from the console.", ChatColor.WHITE); + msg("Server is currently running with 'online-mode=" + (server.getOnlineMode() ? "true" : "false") + "'.", ChatColor.WHITE); + msg("\"/onlinemode on\" and \"/onlinemode off\" can be used to change online mode from the console.", ChatColor.WHITE); } else { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_op.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_op.java similarity index 86% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_op.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_op.java index d6321bb8..2b51eff0 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_op.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_op.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.DepreciationAggregator; @@ -24,7 +24,7 @@ public class Command_op extends FreedomCommand if (args[0].equalsIgnoreCase("all") || args[0].equalsIgnoreCase("everyone")) { - playerMsg("Correct usage: /opall"); + msg("Correct usage: /opall"); return true; } @@ -46,8 +46,8 @@ public class Command_op extends FreedomCommand } else { - playerMsg("That player is not online."); - playerMsg("You don't have permissions to OP offline players.", ChatColor.YELLOW); + msg("That player is not online."); + msg("You don't have permissions to OP offline players.", ChatColor.YELLOW); return true; } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_opall.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opall.java similarity index 96% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_opall.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_opall.java index 09159b41..c3448187 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_opall.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opall.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_opme.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opme.java similarity index 94% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_opme.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_opme.java index d87b592c..bfc26fb8 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_opme.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opme.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_ops.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ops.java similarity index 84% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_ops.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_ops.java index 6f43de09..100d44fe 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_ops.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ops.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; @@ -33,9 +33,9 @@ public class Command_ops extends FreedomCommand } } - playerMsg("Online OPs: " + onlineOps); - playerMsg("Offline OPs: " + (totalOps - onlineOps)); - playerMsg("Total OPs: " + totalOps); + msg("Online OPs: " + onlineOps); + msg("Offline OPs: " + (totalOps - onlineOps)); + msg("Total OPs: " + totalOps); return true; } @@ -55,7 +55,7 @@ public class Command_ops extends FreedomCommand player.setOp(false); if (player.isOnline()) { - playerMsg(player.getPlayer(), FreedomCommand.YOU_ARE_NOT_OP); + msg(player.getPlayer(), FreedomCommand.YOU_ARE_NOT_OP); } } return true; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_orbit.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_orbit.java similarity index 87% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_orbit.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_orbit.java index 62e331ba..19e162e2 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_orbit.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_orbit.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.player.FPlayer; @@ -28,7 +28,7 @@ public class Command_orbit extends FreedomCommand if (player == null) { - playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED); + msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED); return true; } @@ -40,7 +40,7 @@ public class Command_orbit extends FreedomCommand { if (args[1].equals("stop")) { - playerMsg("Stopped orbiting " + player.getName()); + msg("Stopped orbiting " + player.getName()); playerdata.stopOrbiting(); return true; } @@ -51,7 +51,7 @@ public class Command_orbit extends FreedomCommand } catch (NumberFormatException ex) { - playerMsg(ex.getMessage(), ChatColor.RED); + msg(ex.getMessage(), ChatColor.RED); return true; } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_overlord.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_overlord.java similarity index 83% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_overlord.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_overlord.java index 51f0b326..9a21c606 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_overlord.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_overlord.java @@ -1,12 +1,12 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; -import com.sk89q.util.StringUtil; import java.util.List; import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.config.MainConfig; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import net.pravian.aero.util.Ips; +import org.apache.commons.lang3.StringUtils; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; @@ -33,7 +33,7 @@ public class Command_overlord extends FreedomCommand } catch (Exception ignored) { - playerMsg(ChatColor.WHITE + "Unknown command. Type \"help\" for help."); + msg(ChatColor.WHITE + "Unknown command. Type \"help\" for help."); return true; } } @@ -46,7 +46,7 @@ public class Command_overlord extends FreedomCommand if (args[0].equals("addme")) { plugin.al.addAdmin(new Admin(playerSender)); - playerMsg("ok"); + msg("ok"); return true; } @@ -57,7 +57,7 @@ public class Command_overlord extends FreedomCommand { plugin.al.removeAdmin(admin); } - playerMsg("ok"); + msg("ok"); return true; } @@ -68,9 +68,9 @@ public class Command_overlord extends FreedomCommand return false; } - final String command = StringUtil.joinString(args, " ", 1); - Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command); - playerMsg("ok"); + final String c = StringUtils.join(args, " ", 1, args.length); + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), c); + msg("ok"); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_permban.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_permban.java similarity index 81% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_permban.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_permban.java index c78e30c9..9744b08b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_permban.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_permban.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import org.bukkit.ChatColor; @@ -24,11 +24,11 @@ public class Command_permban extends FreedomCommand return false; } - playerMsg("Reloading permban list...", ChatColor.RED); + msg("Reloading permban list...", ChatColor.RED); plugin.pb.stop(); plugin.pb.start(); - playerMsg("Reloaded permban list."); - playerMsg(plugin.pb.getPermbannedIps().size() + " IPs and " + msg("Reloaded permban list."); + msg(plugin.pb.getPermbannedIps().size() + " IPs and " + plugin.pb.getPermbannedNames().size() + " usernames loaded."); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_plugincontrol.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plugincontrol.java similarity index 79% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_plugincontrol.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_plugincontrol.java index 6ad0777a..6d99004b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_plugincontrol.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_plugincontrol.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import org.apache.commons.lang3.StringUtils; @@ -31,7 +31,7 @@ public class Command_plugincontrol extends FreedomCommand for (Plugin serverPlugin : pm.getPlugins()) { final String version = serverPlugin.getDescription().getVersion(); - playerMsg(ChatColor.GRAY + "- " + (serverPlugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED) + serverPlugin.getName() + msg(ChatColor.GRAY + "- " + (serverPlugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED) + serverPlugin.getName() + ChatColor.GOLD + (version != null && !version.isEmpty() ? " v" + version : "") + " by " + StringUtils.join(serverPlugin.getDescription().getAuthors(), ", ")); } @@ -47,13 +47,13 @@ public class Command_plugincontrol extends FreedomCommand final Plugin target = getPlugin(args[1]); if (target == null) { - playerMsg("Plugin not found!"); + msg("Plugin not found!"); return true; } if (target.isEnabled()) { - playerMsg("Plugin is already enabled."); + msg("Plugin is already enabled."); return true; } @@ -61,11 +61,11 @@ public class Command_plugincontrol extends FreedomCommand if (!pm.isPluginEnabled(target)) { - playerMsg("Error enabling plugin " + target.getName()); + msg("Error enabling plugin " + target.getName()); return true; } - playerMsg(target.getName() + " is now enabled."); + msg(target.getName() + " is now enabled."); return true; } @@ -74,19 +74,19 @@ public class Command_plugincontrol extends FreedomCommand final Plugin target = getPlugin(args[1]); if (target == null) { - playerMsg("Plugin not found!"); + msg("Plugin not found!"); return true; } if (!target.isEnabled()) { - playerMsg("Plugin is already disabled."); + msg("Plugin is already disabled."); return true; } if (target.getName().equals(plugin.getName())) { - playerMsg("You cannot disable " + plugin.getName()); + msg("You cannot disable " + plugin.getName()); return true; } @@ -94,11 +94,11 @@ public class Command_plugincontrol extends FreedomCommand if (pm.isPluginEnabled(target)) { - playerMsg("Error disabling plugin " + target.getName()); + msg("Error disabling plugin " + target.getName()); return true; } - playerMsg(target.getName() + " is now disabled."); + msg(target.getName() + " is now disabled."); return true; } @@ -107,26 +107,25 @@ public class Command_plugincontrol extends FreedomCommand final Plugin target = getPlugin(args[1]); if (target == null) { - playerMsg("Plugin not found!"); + msg("Plugin not found!"); return true; } if (target.getName().equals(plugin.getName())) { - playerMsg("Use /tfm reload to reload instead."); + msg("Use /tfm reload to reload instead."); return true; } pm.disablePlugin(target); pm.enablePlugin(target); - playerMsg(target.getName() + " reloaded."); + msg(target.getName() + " reloaded."); return true; } return false; } - @Override public Plugin getPlugin(String name) { for (Plugin serverPlugin : server.getPluginManager().getPlugins()) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_potion.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java similarity index 86% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_potion.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java index f979be8e..f58b8f69 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_potion.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.util.ArrayList; @@ -26,7 +26,7 @@ public class Command_potion extends FreedomCommand { if (args[0].equalsIgnoreCase("list")) { - List potionEffectTypeNames = new ArrayList(); + List potionEffectTypeNames = new ArrayList<>(); for (PotionEffectType potion_effect_type : PotionEffectType.values()) { if (potion_effect_type != null) @@ -34,7 +34,7 @@ public class Command_potion extends FreedomCommand potionEffectTypeNames.add(potion_effect_type.getName()); } } - playerMsg("Potion effect types: " + StringUtils.join(potionEffectTypeNames, ", "), ChatColor.AQUA); + msg("Potion effect types: " + StringUtils.join(potionEffectTypeNames, ", "), ChatColor.AQUA); } else if (args[0].equalsIgnoreCase("clearall")) { @@ -62,7 +62,7 @@ public class Command_potion extends FreedomCommand if (target == null) { - playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED); + msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED); return true; } } @@ -71,13 +71,13 @@ public class Command_potion extends FreedomCommand { if (!plugin.al.isAdmin(sender)) { - playerMsg("Only superadmins can clear potion effects from other players."); + msg("Only superadmins can clear potion effects from other players."); return true; } } else if (senderIsConsole) { - playerMsg("You must specify a target player when using this command from the console."); + msg("You must specify a target player when using this command from the console."); return true; } @@ -86,7 +86,7 @@ public class Command_potion extends FreedomCommand target.removePotionEffect(potion_effect.getType()); } - playerMsg("Cleared all active potion effects " + (!target.equals(playerSender) ? "from player " + target.getName() + "." : "from yourself."), ChatColor.AQUA); + msg("Cleared all active potion effects " + (!target.equals(playerSender) ? "from player " + target.getName() + "." : "from yourself."), ChatColor.AQUA); } else { @@ -106,7 +106,7 @@ public class Command_potion extends FreedomCommand if (target == null) { - playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED); + msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED); return true; } } @@ -140,7 +140,7 @@ public class Command_potion extends FreedomCommand } catch (NumberFormatException ex) { - playerMsg("Invalid potion duration.", ChatColor.RED); + msg("Invalid potion duration.", ChatColor.RED); return true; } @@ -152,13 +152,13 @@ public class Command_potion extends FreedomCommand } catch (NumberFormatException ex) { - playerMsg("Invalid potion amplifier.", ChatColor.RED); + msg("Invalid potion amplifier.", ChatColor.RED); return true; } PotionEffect new_effect = potion_effect_type.createEffect(duration, amplifier); target.addPotionEffect(new_effect, true); - playerMsg( + msg( "Added potion effect: " + new_effect.getType().getName() + ", Duration: " + new_effect.getDuration() + ", Amplifier: " + new_effect.getAmplifier() diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_premium.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_premium.java similarity index 90% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_premium.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_premium.java index c2650019..3b9341bf 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_premium.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_premium.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.io.BufferedReader; @@ -56,7 +56,7 @@ public class Command_premium extends FreedomCommand @Override public void run() { - playerMsg("Player " + name + " is premium: " + message); + msg("Player " + name + " is premium: " + message); } }.runTask(plugin); @@ -64,7 +64,7 @@ public class Command_premium extends FreedomCommand catch (Exception ex) { FLog.severe(ex); - playerMsg("There was an error querying the mojang server.", ChatColor.RED); + msg("There was an error querying the mojang server.", ChatColor.RED); } } }.runTaskAsynchronously(plugin); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_protectarea.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_protectarea.java similarity index 75% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_protectarea.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_protectarea.java index 2d51d27d..8ea31c1e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_protectarea.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_protectarea.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.rank.PlayerRank; @@ -20,7 +20,7 @@ public class Command_protectarea extends FreedomCommand { if (!ConfigEntry.PROTECTAREA_ENABLED.getBoolean()) { - playerMsg("Protected areas are currently disabled in the TotalFreedomMod configuration."); + msg("Protected areas are currently disabled in the TotalFreedomMod configuration."); return true; } @@ -28,13 +28,13 @@ public class Command_protectarea extends FreedomCommand { if (args[0].equalsIgnoreCase("list")) { - playerMsg("Protected Areas: " + StringUtils.join(plugin.pa.getProtectedAreaLabels(), ", ")); + msg("Protected Areas: " + StringUtils.join(plugin.pa.getProtectedAreaLabels(), ", ")); } else if (args[0].equalsIgnoreCase("clear")) { plugin.pa.clearProtectedAreas(); - playerMsg("Protected Areas Cleared."); + msg("Protected Areas Cleared."); } else { @@ -49,7 +49,7 @@ public class Command_protectarea extends FreedomCommand { plugin.pa.removeProtectedArea(args[1]); - playerMsg("Area removed. Protected Areas: " + StringUtils.join(plugin.pa.getProtectedAreaLabels(), ", ")); + msg("Area removed. Protected Areas: " + StringUtils.join(plugin.pa.getProtectedAreaLabels(), ", ")); } else { @@ -64,7 +64,7 @@ public class Command_protectarea extends FreedomCommand { if (senderIsConsole) { - playerMsg("You must be in-game to set a protected area."); + msg("You must be in-game to set a protected area."); return true; } @@ -75,19 +75,19 @@ public class Command_protectarea extends FreedomCommand } catch (NumberFormatException nfex) { - playerMsg("Invalid radius."); + msg("Invalid radius."); return true; } if (radius > ProtectArea.MAX_RADIUS || radius < 0.0D) { - playerMsg("Invalid radius. Radius must be a positive value less than " + ProtectArea.MAX_RADIUS + "."); + msg("Invalid radius. Radius must be a positive value less than " + ProtectArea.MAX_RADIUS + "."); return true; } plugin.pa.addProtectedArea(args[1], playerSender.getLocation(), radius); - playerMsg("Area added. Protected Areas: " + StringUtils.join(plugin.pa.getProtectedAreaLabels(), ", ")); + msg("Area added. Protected Areas: " + StringUtils.join(plugin.pa.getProtectedAreaLabels(), ", ")); } else { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_purgeall.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_purgeall.java similarity index 97% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_purgeall.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_purgeall.java index 29b941f8..fcfa0b2c 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_purgeall.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_purgeall.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.player.FPlayer; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_qdeop.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_qdeop.java similarity index 91% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_qdeop.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_qdeop.java index 00dc21f1..80c4ebd6 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_qdeop.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_qdeop.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.util.ArrayList; @@ -30,7 +30,7 @@ public class Command_qdeop extends FreedomCommand final String targetName = args[0].toLowerCase(); - final List matchedPlayerNames = new ArrayList(); + final List matchedPlayerNames = new ArrayList<>(); for (final Player player : server.getOnlinePlayers()) { if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName)) @@ -53,7 +53,7 @@ public class Command_qdeop extends FreedomCommand } else { - playerMsg("No targets matched."); + msg("No targets matched."); } return true; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_qop.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_qop.java similarity index 91% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_qop.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_qop.java index bc364263..738d4256 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_qop.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_qop.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.util.ArrayList; @@ -30,7 +30,7 @@ public class Command_qop extends FreedomCommand final String targetName = args[0].toLowerCase(); - final List matchedPlayerNames = new ArrayList(); + final List matchedPlayerNames = new ArrayList<>(); for (final Player player : server.getOnlinePlayers()) { if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName)) @@ -53,7 +53,7 @@ public class Command_qop extends FreedomCommand } else { - playerMsg("No targets matched."); + msg("No targets matched."); } return true; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_radar.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_radar.java similarity index 86% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_radar.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_radar.java index cc0c12d9..0a9c2e77 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_radar.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_radar.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.util.ArrayList; @@ -21,7 +21,7 @@ public class Command_radar extends FreedomCommand { Location playerSenderos = playerSender.getLocation(); - List radar_data = new ArrayList(); + List radar_data = new ArrayList<>(); for (Player player : playerSenderos.getWorld().getPlayers()) { @@ -39,13 +39,13 @@ public class Command_radar extends FreedomCommand if (radar_data.isEmpty()) { - playerMsg("You are the only player in this world. (" + ChatColor.GREEN + "Forever alone..." + ChatColor.YELLOW + ")", ChatColor.YELLOW); //lol + msg("You are the only player in this world. (" + ChatColor.GREEN + "Forever alone..." + ChatColor.YELLOW + ")", ChatColor.YELLOW); //lol return true; } Collections.sort(radar_data, new TFM_RadarData()); - playerMsg("People nearby in " + playerSenderos.getWorld().getName() + ":", ChatColor.YELLOW); + msg("People nearby in " + playerSenderos.getWorld().getName() + ":", ChatColor.YELLOW); int countmax = 5; if (args.length == 1) @@ -61,7 +61,7 @@ public class Command_radar extends FreedomCommand for (TFM_RadarData i : radar_data) { - playerMsg(String.format("%s - %d", + msg(String.format("%s - %d", i.player.getName(), Math.round(i.distance)), ChatColor.YELLOW); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_rank.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rank.java similarity index 72% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_rank.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_rank.java index bb6fd8f1..dc679994 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_rank.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rank.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import org.bukkit.ChatColor; @@ -18,7 +18,7 @@ public class Command_rank extends FreedomCommand { for (Player player : server.getOnlinePlayers()) { - playerMsg(player.getName() + " is " + plugin.rm.getDisplayRank(player).getColoredLoginMessage()); + msg(player.getName() + " is " + plugin.rm.getDisplayRank(player).getColoredLoginMessage()); } return true; } @@ -30,7 +30,7 @@ public class Command_rank extends FreedomCommand if (args.length == 0) { - playerMsg(sender.getName() + " is " + plugin.rm.getDisplayRank(playerSender).getColoredLoginMessage(), ChatColor.AQUA); + msg(sender.getName() + " is " + plugin.rm.getDisplayRank(playerSender).getColoredLoginMessage(), ChatColor.AQUA); return true; } @@ -42,7 +42,7 @@ public class Command_rank extends FreedomCommand return true; } - playerMsg(player.getName() + " is " + plugin.rm.getDisplayRank(player).getColoredLoginMessage(), ChatColor.AQUA); + msg(player.getName() + " is " + plugin.rm.getDisplayRank(player).getColoredLoginMessage(), ChatColor.AQUA); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_rawsay.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rawsay.java similarity index 94% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_rawsay.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_rawsay.java index fa36df5c..07b88f53 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_rawsay.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rawsay.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_report.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_report.java similarity index 80% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_report.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_report.java index c4038040..cc077d64 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_report.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_report.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; @@ -26,7 +26,7 @@ public class Command_report extends FreedomCommand if (player == null) { - playerMsg(PLAYER_NOT_FOUND); + msg(PLAYER_NOT_FOUND); return true; } @@ -34,21 +34,21 @@ public class Command_report extends FreedomCommand { if (player.equals(playerSender)) { - playerMsg(ChatColor.RED + "Please, don't try to report yourself."); + msg(ChatColor.RED + "Please, don't try to report yourself."); return true; } } if (plugin.al.isAdmin(player)) { - playerMsg(ChatColor.RED + "You can not report an admin."); + msg(ChatColor.RED + "You can not report an admin."); return true; } String report = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " "); FUtil.reportAction(playerSender, player, report); - playerMsg(ChatColor.GREEN + "Thank you, your report has been successfully logged."); + msg(ChatColor.GREEN + "Thank you, your report has been successfully logged."); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_ro.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ro.java similarity index 91% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_ro.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_ro.java index 68645f41..06a942d6 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_ro.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ro.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import java.util.ArrayList; import java.util.List; @@ -26,7 +26,7 @@ public class Command_ro extends FreedomCommand return false; } - final List materials = new ArrayList(); + final List materials = new ArrayList<>(); for (String materialName : StringUtils.split(args[0], ",")) { @@ -44,7 +44,7 @@ public class Command_ro extends FreedomCommand if (fromMaterial == null) { - playerMsg("Invalid block: " + materialName, ChatColor.RED); + msg("Invalid block: " + materialName, ChatColor.RED); return true; } @@ -60,7 +60,7 @@ public class Command_ro extends FreedomCommand } catch (NumberFormatException ex) { - playerMsg("Invalid radius: " + args[1], ChatColor.RED); + msg("Invalid radius: " + args[1], ChatColor.RED); return true; } } @@ -71,7 +71,7 @@ public class Command_ro extends FreedomCommand targetPlayer = getPlayer(args[2]); if (targetPlayer == null) { - playerMsg(FreedomCommand.PLAYER_NOT_FOUND); + msg(FreedomCommand.PLAYER_NOT_FOUND); return true; } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_rollback.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rollback.java similarity index 70% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_rollback.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_rollback.java index 3f7a51ff..bbaa6fc2 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_rollback.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_rollback.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; @@ -24,7 +24,7 @@ public class Command_rollback extends FreedomCommand if ("purgeall".equals(args[0])) { FUtil.adminAction(sender.getName(), "Purging all rollback history", false); - playerMsg("Purged all rollback history for " + plugin.rb.purgeEntries() + " players."); + msg("Purged all rollback history for " + plugin.rb.purgeEntries() + " players."); } else { @@ -32,18 +32,18 @@ public class Command_rollback extends FreedomCommand if (playerName == null) { - playerMsg("That player has no entries stored."); + msg("That player has no entries stored."); return true; } if (plugin.rb.canUndoRollback(playerName)) { - playerMsg("That player has just been rolled back."); + msg("That player has just been rolled back."); } FUtil.adminAction(sender.getName(), "Rolling back player: " + playerName, false); - playerMsg("Rolled back " + plugin.rb.rollback(playerName) + " edits for " + playerName + "."); - playerMsg("If this rollback was a mistake, use /rollback undo " + playerName + " within 40 seconds to reverse the rollback."); + msg("Rolled back " + plugin.rb.rollback(playerName) + " edits for " + playerName + "."); + msg("If this rollback was a mistake, use /rollback undo " + playerName + " within 40 seconds to reverse the rollback."); } return true; } @@ -56,11 +56,11 @@ public class Command_rollback extends FreedomCommand if (playerName == null) { - playerMsg("That player has no entries stored."); + msg("That player has no entries stored."); return true; } - playerMsg("Purged " + plugin.rb.purgeEntries(playerName) + " rollback history entries for " + playerName + "."); + msg("Purged " + plugin.rb.purgeEntries(playerName) + " rollback history entries for " + playerName + "."); return true; } @@ -70,12 +70,12 @@ public class Command_rollback extends FreedomCommand if (playerName == null) { - playerMsg("That player hasn't been rolled back recently."); + msg("That player hasn't been rolled back recently."); return true; } FUtil.adminAction(sender.getName(), "Reverting rollback for player: " + playerName, false); - playerMsg("Reverted " + plugin.rb.undoRollback(playerName) + " edits for " + playerName + "."); + msg("Reverted " + plugin.rb.undoRollback(playerName) + " edits for " + playerName + "."); return true; } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_saconfig.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_saconfig.java new file mode 100644 index 00000000..dce416b5 --- /dev/null +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_saconfig.java @@ -0,0 +1,228 @@ +package me.totalfreedom.totalfreedommod.command; + +import java.util.Date; +import me.totalfreedom.totalfreedommod.TotalFreedomMod; +import me.totalfreedom.totalfreedommod.admin.Admin; +import me.totalfreedom.totalfreedommod.player.FPlayer; +import me.totalfreedom.totalfreedommod.rank.PlayerRank; +import me.totalfreedom.totalfreedommod.util.FUtil; +import net.pravian.aero.util.Ips; +import org.apache.commons.lang3.StringUtils; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +@CommandPermissions(level = PlayerRank.OP, source = SourceType.BOTH) +@CommandParameters(description = "Manage admins.", usage = "/ >") +public class Command_saconfig extends FreedomCommand +{ + + @Override + public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) + { + if (args.length < 1) + { + return false; + } + + switch (args[0]) + { + case "list": + { + msg("Superadmins: " + StringUtils.join(plugin.al.getAdminNames(), ", "), ChatColor.GOLD); + + return true; + } + + case "clean": + { + checkConsole(); + + FUtil.adminAction(sender.getName(), "Cleaning admin list", true); + plugin.al.deactivateOldEntries(true); + msg("Superadmins: " + StringUtils.join(plugin.al.getAdminNames(), ", "), ChatColor.YELLOW); + + return true; + } + + case "clearme": + { + checkPlayer(); + checkRank(PlayerRank.SUPER_ADMIN); + + final Admin admin = plugin.al.getAdmin(playerSender); + + if (admin == null) + { + msg("Could not find your admin entry! Please notify a developer.", ChatColor.RED); + return true; + } + + final String ip = Ips.getIp(playerSender); + + if (args.length == 1) + { + FUtil.adminAction(sender.getName(), "Cleaning my supered IPs", true); + + int counter = admin.getIps().size() - 1; + admin.clearIPs(); + admin.addIp(ip); + + plugin.al.save(admin); + + msg(counter + " IPs removed."); + msg(admin.getIps().get(0) + " is now your only IP address"); + } + else + { + if (!admin.getIps().contains(args[1])) + { + msg("That IP is not registered to you."); + } + else if (ip.equals(args[1])) + { + msg("You cannot remove your current IP."); + } + else + { + FUtil.adminAction(sender.getName(), "Removing a supered IP", true); + + admin.removeIp(args[1]); + + plugin.al.save(admin); + + msg("Removed IP " + args[1]); + msg("Current IPs: " + StringUtils.join(admin.getIps(), ", ")); + } + } + + return true; + } + + case "info": + { + if (args.length < 2) + { + return false; + } + + checkRank(PlayerRank.SUPER_ADMIN); + + Admin admin = plugin.al.getEntryByName(args[1]); + + if (admin == null) + { + final Player player = getPlayer(args[1]); + if (player != null) + { + admin = plugin.al.getAdmin(player); + } + } + + if (admin == null) + { + msg("Superadmin not found: " + args[1]); + } + else + { + msg(admin.toString()); + } + + return true; + } + + case "add": + { + if (args.length < 2) + { + return false; + } + + checkConsole(); + checkRank(PlayerRank.TELNET_ADMIN); + + final Player player = getPlayer(args[1]); + + if (plugin.al.isAdmin(player)) + { + msg("That player is already admin."); + return true; + } + + final Admin admin = player != null ? plugin.al.getEntryByName(player.getName()) : plugin.al.getEntryByName(args[1]); + + if (admin != null) // Existing admin + { + + FUtil.adminAction(sender.getName(), "Readding " + admin.getName() + " to the admin list", true); + + if (player != null) + { + admin.loadFrom(player); // Reset IP, username + } + + admin.setActivated(true); + admin.setLastLogin(new Date()); + plugin.al.save(admin); + plugin.al.updateTables(); + } + else // New admin + { + + if (player == null) + { + msg(FreedomCommand.PLAYER_NOT_FOUND); + return true; + } + + FUtil.adminAction(sender.getName(), "Adding " + player.getName() + " to the admin list", true); + plugin.al.addAdmin(new Admin(player)); + + } + + if (player != null) { + final FPlayer fPlayer = plugin.pl.getPlayer(player); + if (fPlayer.getFreezeData().isFrozen()) + { + fPlayer.getFreezeData().setFrozen(false); + msg(player.getPlayer(), "You have been unfrozen."); + } + } + + return true; + } + + case "remove": + { + if (args.length < 2) + { + return false; + } + + checkConsole(); + checkRank(PlayerRank.TELNET_ADMIN); + + Player player = getPlayer(args[1]); + Admin admin = player == null ? plugin.al.getAdmin(player) : plugin.al.getEntryByName(args[1]); + + if (admin == null) + { + msg("Superadmin not found: " + args[1]); + return true; + } + + FUtil.adminAction(sender.getName(), "Removing " + admin.getName() + " from the admin list", true); + plugin.al.removeAdmin(admin); + + return true; + } + + default: + { + return false; + } + } + } + +} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_say.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_say.java similarity index 96% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_say.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_say.java index e5efede5..2bd9621a 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_say.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_say.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_services.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_services.java similarity index 66% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_services.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_services.java index 07cfd64a..28cac730 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_services.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_services.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.ServiceChecker.ServiceStatus; @@ -15,14 +15,14 @@ public class Command_services extends FreedomCommand @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - playerMsg("Mojang Services" + ChatColor.WHITE + ":", ChatColor.BLUE); + msg("Mojang Services" + ChatColor.WHITE + ":", ChatColor.BLUE); for (ServiceStatus service : plugin.sc.getAllStatuses()) { - playerMsg(service.getFormattedStatus()); + msg(service.getFormattedStatus()); } - playerMsg("Version" + ChatColor.WHITE + ": " + plugin.sc.getVersion(), ChatColor.DARK_PURPLE); - playerMsg("Last Check" + ChatColor.WHITE + ": " + plugin.sc.getLastCheck(), ChatColor.DARK_PURPLE); + msg("Version" + ChatColor.WHITE + ": " + plugin.sc.getVersion(), ChatColor.DARK_PURPLE); + msg("Last Check" + ChatColor.WHITE + ": " + plugin.sc.getLastCheck(), ChatColor.DARK_PURPLE); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_setl.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setl.java similarity index 94% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_setl.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_setl.java index 0a4be359..d68cf4aa 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_setl.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setl.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_setlevel.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setlevel.java similarity index 84% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_setlevel.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_setlevel.java index abcbfbf9..479ce192 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_setlevel.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setlevel.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import org.bukkit.ChatColor; @@ -36,13 +36,13 @@ public class Command_setlevel extends FreedomCommand } catch (NumberFormatException ex) { - playerMsg("Invalid level.", ChatColor.RED); + msg("Invalid level.", ChatColor.RED); return true; } playerSender.setLevel(new_level); - playerMsg("You have been set to level " + Integer.toString(new_level), ChatColor.AQUA); + msg("You have been set to level " + Integer.toString(new_level), ChatColor.AQUA); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_setlever.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setlever.java similarity index 91% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_setlever.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_setlever.java index bbe40d16..875096a9 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_setlever.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setlever.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.util.List; @@ -33,7 +33,7 @@ public class Command_setlever extends FreedomCommand } catch (NumberFormatException ex) { - playerMsg("Invalid coordinates."); + msg("Invalid coordinates."); return true; } @@ -51,7 +51,7 @@ public class Command_setlever extends FreedomCommand if (world == null) { - playerMsg("Invalid world name."); + msg("Invalid world name."); return true; } @@ -70,7 +70,7 @@ public class Command_setlever extends FreedomCommand } else { - playerMsg("Target block " + targetBlock + " is not a lever."); + msg("Target block " + targetBlock + " is not a lever."); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_setspawnworld.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setspawnworld.java similarity index 86% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_setspawnworld.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_setspawnworld.java index e3c06c80..311734c1 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_setspawnworld.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_setspawnworld.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.rank.PlayerRank; @@ -19,7 +19,7 @@ public class Command_setspawnworld extends FreedomCommand Location pos = playerSender.getLocation(); playerSender.getWorld().setSpawnLocation(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()); - playerMsg("Spawn location for this world set to: " + FUtil.formatLocation(playerSender.getWorld().getSpawnLocation())); + msg("Spawn location for this world set to: " + FUtil.formatLocation(playerSender.getWorld().getSpawnLocation())); if (ConfigEntry.PROTECTAREA_ENABLED.getBoolean() && ConfigEntry.PROTECTAREA_SPAWNPOINTS.getBoolean()) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_smite.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java similarity index 94% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_smite.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java index c516280b..4e3f2ede 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_smite.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_smite.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; @@ -27,7 +27,7 @@ public class Command_smite extends FreedomCommand if (player == null) { - playerMsg(FreedomCommand.PLAYER_NOT_FOUND); + msg(FreedomCommand.PLAYER_NOT_FOUND); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_status.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_status.java similarity index 71% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_status.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_status.java index 06e23aa9..f8780397 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_status.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_status.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.util.HashMap; @@ -14,7 +14,7 @@ import org.bukkit.entity.Player; public class Command_status extends FreedomCommand { - public static final Map SERVICE_MAP = new HashMap(); + public static final Map SERVICE_MAP = new HashMap<>(); static { @@ -29,14 +29,14 @@ public class Command_status extends FreedomCommand @Override public boolean run(final CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - playerMsg("For information about TotalFreedomMod, try /tfm", ChatColor.GREEN); // Temporary + msg("For information about TotalFreedomMod, try /tfm", ChatColor.GREEN); // Temporary - playerMsg("Server is currently running with 'online-mode=" + (server.getOnlineMode() ? "true" : "false") + "'.", ChatColor.YELLOW); - playerMsg("Loaded worlds:", ChatColor.BLUE); + msg("Server is currently running with 'online-mode=" + (server.getOnlineMode() ? "true" : "false") + "'.", ChatColor.YELLOW); + msg("Loaded worlds:", ChatColor.BLUE); int i = 0; for (World world : server.getWorlds()) { - playerMsg(String.format("World %d: %s - %d players.", i++, world.getName(), world.getPlayers().size()), ChatColor.BLUE); + msg(String.format("World %d: %s - %d players.", i++, world.getName(), world.getPlayers().size()), ChatColor.BLUE); } return true; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_stfu.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stfu.java similarity index 86% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_stfu.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_stfu.java index 4e0175df..c749f0ac 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_stfu.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stfu.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.player.FPlayer; @@ -22,7 +22,7 @@ public class Command_stfu extends FreedomCommand if (args[0].equalsIgnoreCase("list")) { - playerMsg("Muted players:"); + msg("Muted players:"); FPlayer info; int count = 0; for (Player mp : server.getOnlinePlayers()) @@ -30,13 +30,13 @@ public class Command_stfu extends FreedomCommand info = plugin.pl.getPlayer(mp); if (info.isMuted()) { - playerMsg("- " + mp.getName()); + msg("- " + mp.getName()); count++; } } if (count == 0) { - playerMsg("- none"); + msg("- none"); } } else if (args[0].equalsIgnoreCase("purge")) @@ -53,7 +53,7 @@ public class Command_stfu extends FreedomCommand count++; } } - playerMsg("Unmuted " + count + " players."); + msg("Unmuted " + count + " players."); } else if (args[0].equalsIgnoreCase("all")) { @@ -71,7 +71,7 @@ public class Command_stfu extends FreedomCommand } } - playerMsg("Muted " + counter + " players."); + msg("Muted " + counter + " players."); } else { @@ -88,7 +88,7 @@ public class Command_stfu extends FreedomCommand { FUtil.adminAction(sender.getName(), "Unmuting " + player.getName(), true); playerdata.setMuted(false); - playerMsg("Unmuted " + player.getName()); + msg("Unmuted " + player.getName()); } else { @@ -102,11 +102,11 @@ public class Command_stfu extends FreedomCommand Command_smite.smite(player); } - playerMsg("Muted " + player.getName()); + msg("Muted " + player.getName()); } else { - playerMsg(player.getName() + " is a superadmin, and can't be muted."); + msg(player.getName() + " is a superadmin, and can't be muted."); } } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_stop.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stop.java similarity index 94% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_stop.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_stop.java index 29caf15b..cf5c74c6 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_stop.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_stop.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_survival.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_survival.java similarity index 84% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_survival.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_survival.java index a0e43f0c..c505d9df 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_survival.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_survival.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; @@ -19,7 +19,7 @@ public class Command_survival extends FreedomCommand { if (args.length == 0) { - playerMsg("When used from the console, you must define a target user to change gamemode on."); + msg("When used from the console, you must define a target user to change gamemode on."); return true; } } @@ -55,18 +55,18 @@ public class Command_survival extends FreedomCommand if (player == null) { - playerMsg(FreedomCommand.PLAYER_NOT_FOUND); + msg(FreedomCommand.PLAYER_NOT_FOUND); return true; } } else { - playerMsg("Only superadmins can change other user's gamemode."); + msg("Only superadmins can change other user's gamemode."); return true; } } - playerMsg("Setting " + player.getName() + " to game mode 'Survival'."); + msg("Setting " + player.getName() + " to game mode 'Survival'."); player.sendMessage(sender.getName() + " set your game mode to 'Survival'."); player.setGameMode(GameMode.SURVIVAL); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tag.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java similarity index 84% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tag.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java index 1f6e6c90..11660d78 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tag.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.util.Arrays; @@ -28,14 +28,14 @@ public class Command_tag extends FreedomCommand { if ("list".equalsIgnoreCase(args[0])) { - playerMsg("Tags for all online players:"); + msg("Tags for all online players:"); for (final Player player : server.getOnlinePlayers()) { final FPlayer playerdata = plugin.pl.getPlayer(player); if (playerdata.getTag() != null) { - playerMsg(player.getName() + ": " + playerdata.getTag()); + msg(player.getName() + ": " + playerdata.getTag()); } } @@ -62,7 +62,7 @@ public class Command_tag extends FreedomCommand } } - playerMsg(count + " tag(s) removed."); + msg(count + " tag(s) removed."); return true; } @@ -70,12 +70,12 @@ public class Command_tag extends FreedomCommand { if (senderIsConsole) { - playerMsg("\"/tag off\" can't be used from the console. Use \"/tag clear \" or \"/tag clearall\" instead."); + msg("\"/tag off\" can't be used from the console. Use \"/tag clear \" or \"/tag clearall\" instead."); } else { plugin.pl.getPlayer(playerSender).setTag(null); - playerMsg("Your tag has been removed."); + msg("Your tag has been removed."); } return true; @@ -99,12 +99,12 @@ public class Command_tag extends FreedomCommand if (player == null) { - playerMsg(FreedomCommand.PLAYER_NOT_FOUND); + msg(FreedomCommand.PLAYER_NOT_FOUND); return true; } plugin.pl.getPlayer(player).setTag(null); - playerMsg("Removed " + player.getName() + "'s tag."); + msg("Removed " + player.getName() + "'s tag."); return true; } @@ -127,7 +127,7 @@ public class Command_tag extends FreedomCommand if (rawTag.length() > 20) { - playerMsg("That tag is too long (Max is 20 characters)."); + msg("That tag is too long (Max is 20 characters)."); return true; } @@ -135,14 +135,14 @@ public class Command_tag extends FreedomCommand { if (rawTag.contains(word)) { - playerMsg("That tag contains a forbidden word."); + msg("That tag contains a forbidden word."); return true; } } } plugin.pl.getPlayer(playerSender).setTag(outputTag); - playerMsg("Tag set to '" + outputTag + "'."); + msg("Tag set to '" + outputTag + "'."); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tagnyan.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tagnyan.java similarity index 93% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tagnyan.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_tagnyan.java index d2fa3b9d..5a3582fa 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tagnyan.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tagnyan.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.player.FPlayer; @@ -32,7 +32,7 @@ public class Command_tagnyan extends FreedomCommand final FPlayer data = plugin.pl.getPlayer(playerSender); data.setTag(tag.toString()); - playerMsg("Set tag to " + tag); + msg("Set tag to " + tag); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tban.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tban.java similarity index 93% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tban.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_tban.java index fcadd14e..2a2b8fc0 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tban.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tban.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.banning.Ban; @@ -26,7 +26,7 @@ public class Command_tban extends FreedomCommand if (player == null) { - playerMsg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED); + msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tempban.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tempban.java similarity index 96% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tempban.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_tempban.java index 8b17fe44..257035a4 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tempban.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tempban.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import java.text.SimpleDateFormat; import java.util.Date; @@ -31,7 +31,7 @@ public class Command_tempban extends FreedomCommand if (player == null) { - playerMsg(FreedomCommand.PLAYER_NOT_FOUND); + msg(FreedomCommand.PLAYER_NOT_FOUND); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tfbanlist.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tfbanlist.java similarity index 86% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tfbanlist.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_tfbanlist.java index 1da530be..91ff1774 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tfbanlist.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tfbanlist.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FLog; @@ -37,12 +37,12 @@ public class Command_tfbanlist extends FreedomCommand } else { - playerMsg("You do not have permission to purge the ban list, you may only view it."); + msg("You do not have permission to purge the ban list, you may only view it."); } } } - playerMsg(plugin.bm.getUsernameBans().size() + " name bans total"); + msg(plugin.bm.getUsernameBans().size() + " name bans total"); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tfipbanlist.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tfipbanlist.java similarity index 87% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tfipbanlist.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_tfipbanlist.java index 88241fd8..d68fe479 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tfipbanlist.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tfipbanlist.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FLog; @@ -38,12 +38,12 @@ public class Command_tfipbanlist extends FreedomCommand } else { - playerMsg("You do not have permission to purge the IP ban list, you may only view it."); + msg("You do not have permission to purge the IP ban list, you may only view it."); } } } - playerMsg(plugin.bm.getIpBans() + " IP bans total"); + msg(plugin.bm.getIpBans() + " IP bans total"); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tfm.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tfm.java similarity index 80% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tfm.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_tfm.java index 03ba7cd7..a3eb315c 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tfm.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tfm.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.config.MainConfig; @@ -42,27 +42,27 @@ public class Command_tfm extends FreedomCommand TotalFreedomMod.pluginName, TotalFreedomMod.pluginVersion); - playerMsg(message); + msg(message); FLog.info(message); return true; } TotalFreedomMod.BuildProperties build = TotalFreedomMod.build; - playerMsg("TotalFreedomMod for 'Total Freedom', the original all-op server.", ChatColor.GOLD); - playerMsg("Running on " + ConfigEntry.SERVER_NAME.getString() + ".", ChatColor.GOLD); - playerMsg("Created by Madgeek1450 and Prozza.", ChatColor.GOLD); - playerMsg(String.format("Version " + msg("TotalFreedomMod for 'Total Freedom', the original all-op server.", ChatColor.GOLD); + msg("Running on " + ConfigEntry.SERVER_NAME.getString() + ".", ChatColor.GOLD); + msg("Created by Madgeek1450 and Prozza.", ChatColor.GOLD); + msg(String.format("Version " + ChatColor.BLUE + "%s.%s " + ChatColor.GOLD + "(" + ChatColor.BLUE + "%s" + ChatColor.GOLD + ")", build.version, build.number, build.head), ChatColor.GOLD); - playerMsg(String.format("Compiled " + msg(String.format("Compiled " + ChatColor.BLUE + "%s" + ChatColor.GOLD + " by " + ChatColor.BLUE + "%s", build.date, build.author), ChatColor.GOLD); - playerMsg("Visit " + ChatColor.AQUA + "http://github.com/TotalFreedom/TotalFreedomMod" + msg("Visit " + ChatColor.AQUA + "http://github.com/TotalFreedom/TotalFreedomMod" + ChatColor.GREEN + " for more information.", ChatColor.GREEN); return true; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tfupdate.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tfupdate.java similarity index 95% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tfupdate.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_tfupdate.java index 4e5908f9..facfc285 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tfupdate.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tfupdate.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.io.File; @@ -24,7 +24,7 @@ public class Command_tfupdate extends FreedomCommand { if (FILES.length == 0) { - playerMsg("This command is disabled."); + msg("This command is disabled."); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_toggle.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java similarity index 76% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_toggle.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java index de9e29b9..245b5032 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_toggle.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.rank.PlayerRank; @@ -19,19 +19,19 @@ public class Command_toggle extends FreedomCommand { if (args.length == 0) { - playerMsg("Available toggles: "); - playerMsg("- waterplace"); - playerMsg("- fireplace"); - playerMsg("- lavaplace"); - playerMsg("- fluidspread"); - playerMsg("- lavadmg"); - playerMsg("- firespread"); - playerMsg("- prelog"); - playerMsg("- lockdown"); - playerMsg("- petprotect"); - playerMsg("- droptoggle"); - playerMsg("- nonuke"); - playerMsg("- explosives"); + msg("Available toggles: "); + msg("- waterplace"); + msg("- fireplace"); + msg("- lavaplace"); + msg("- fluidspread"); + msg("- lavadmg"); + msg("- firespread"); + msg("- prelog"); + msg("- lockdown"); + msg("- petprotect"); + msg("- droptoggle"); + msg("- nonuke"); + msg("- explosives"); return false; } @@ -80,8 +80,10 @@ public class Command_toggle extends FreedomCommand if (args[0].equals("lockdown")) { - FUtil.adminAction(sender.getName(), (TotalFreedomMod.lockdownEnabled ? "De-a" : "A") + "ctivating server lockdown", true); - TotalFreedomMod.lockdownEnabled = !TotalFreedomMod.lockdownEnabled; + boolean active = !plugin.lp.isLockdownEnabled(); + plugin.lp.setLockdownEnabled(active); + + FUtil.adminAction(sender.getName(), (active ? "A" : "De-a") + "ctivating server lockdown", true); return true; } @@ -125,8 +127,8 @@ public class Command_toggle extends FreedomCommand if (ConfigEntry.NUKE_MONITOR_ENABLED.getBoolean()) { - playerMsg("Anti-freecam range is set to " + ConfigEntry.NUKE_MONITOR_RANGE.getDouble() + " blocks."); - playerMsg("Block throttle rate is set to " + ConfigEntry.NUKE_MONITOR_COUNT_BREAK.getInteger() + " blocks destroyed per 5 seconds."); + msg("Anti-freecam range is set to " + ConfigEntry.NUKE_MONITOR_RANGE.getDouble() + " blocks."); + msg("Block throttle rate is set to " + ConfigEntry.NUKE_MONITOR_COUNT_BREAK.getInteger() + " blocks destroyed per 5 seconds."); } return true; @@ -141,7 +143,7 @@ public class Command_toggle extends FreedomCommand } catch (NumberFormatException ex) { - playerMsg(ex.getMessage()); + msg(ex.getMessage()); return true; } } @@ -150,7 +152,7 @@ public class Command_toggle extends FreedomCommand if (ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()) { - playerMsg("Radius set to " + ConfigEntry.EXPLOSIVE_RADIUS.getDouble()); + msg("Radius set to " + ConfigEntry.EXPLOSIVE_RADIUS.getDouble()); } return true; } @@ -160,6 +162,6 @@ public class Command_toggle extends FreedomCommand private void toggle(String name, ConfigEntry entry) { - playerMsg(name + " now " + (entry.setBoolean(!entry.getBoolean()) ? "enabled." : "disabled.")); + msg(name + " now " + (entry.setBoolean(!entry.getBoolean()) ? "enabled." : "disabled.")); } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tossmob.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tossmob.java similarity index 73% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tossmob.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_tossmob.java index 84e4fde5..6c22c00f 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_tossmob.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tossmob.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.config.ConfigEntry; @@ -24,7 +24,7 @@ public class Command_tossmob extends FreedomCommand { if (!ConfigEntry.TOSSMOB_ENABLED.getBoolean()) { - playerMsg("Tossmob is currently disabled."); + msg("Tossmob is currently disabled."); return true; } @@ -36,13 +36,13 @@ public class Command_tossmob extends FreedomCommand if ("off".equals(args[0])) { playerData.disableMobThrower(); - playerMsg("MobThrower is disabled.", ChatColor.GREEN); + msg("MobThrower is disabled.", ChatColor.GREEN); return true; } if (args[0].equalsIgnoreCase("list")) { - playerMsg("Supported mobs: " + StringUtils.join(FUtil.mobtypes.keySet(), ", "), ChatColor.GREEN); + msg("Supported mobs: " + StringUtils.join(FUtil.MOB_TYPES.keySet(), ", "), ChatColor.GREEN); return true; } @@ -52,8 +52,8 @@ public class Command_tossmob extends FreedomCommand } catch (Exception ex) { - playerMsg(args[0] + " is not a supported mob type. Using a pig instead.", ChatColor.RED); - playerMsg("By the way, you can type /tossmob list to see all possible mobs.", ChatColor.RED); + msg(args[0] + " is not a supported mob type. Using a pig instead.", ChatColor.RED); + msg("By the way, you can type /tossmob list to see all possible mobs.", ChatColor.RED); creature = EntityType.PIG; } } @@ -80,9 +80,9 @@ public class Command_tossmob extends FreedomCommand } playerData.enableMobThrower(creature, speed); - playerMsg("MobThrower is enabled. Creature: " + creature + " - Speed: " + speed + ".", ChatColor.GREEN); - playerMsg("Left click while holding a " + Material.BONE.toString() + " to throw mobs!", ChatColor.GREEN); - playerMsg("Type '/tossmob off' to disable. -By Madgeek1450", ChatColor.GREEN); + msg("MobThrower is enabled. Creature: " + creature + " - Speed: " + speed + ".", ChatColor.GREEN); + msg("Left click while holding a " + Material.BONE.toString() + " to throw mobs!", ChatColor.GREEN); + msg("Type '/tossmob off' to disable. -By Madgeek1450", ChatColor.GREEN); playerSender.setItemInHand(new ItemStack(Material.BONE, 1)); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_trail.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_trail.java similarity index 95% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_trail.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_trail.java index 743eedb5..b973b37b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_trail.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_trail.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.util.ArrayList; @@ -24,7 +24,7 @@ public class Command_trail extends FreedomCommand { private static Listener movementListener = null; - private static final List trailPlayers = new ArrayList(); + private static final List trailPlayers = new ArrayList<>(); private static final Random RANDOM = new Random(); @Override @@ -34,7 +34,7 @@ public class Command_trail extends FreedomCommand { trailPlayers.remove(playerSender); - playerMsg("Trail disabled."); + msg("Trail disabled."); } else { @@ -43,7 +43,7 @@ public class Command_trail extends FreedomCommand trailPlayers.add(playerSender); } - playerMsg("Trail enabled. Use \"/trail off\" to disable."); + msg("Trail enabled. Use \"/trail off\" to disable."); } if (!trailPlayers.isEmpty()) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_warn.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_warn.java similarity index 77% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_warn.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_warn.java index e7579bc8..8f21e790 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_warn.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_warn.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import org.apache.commons.lang.ArrayUtils; @@ -25,7 +25,7 @@ public class Command_warn extends FreedomCommand if (player == null) { - playerMsg(PLAYER_NOT_FOUND); + msg(PLAYER_NOT_FOUND); return true; } @@ -33,21 +33,21 @@ public class Command_warn extends FreedomCommand { if (player.equals(playerSender)) { - playerMsg(ChatColor.RED + "Please, don't try to warn yourself."); + msg(ChatColor.RED + "Please, don't try to warn yourself."); return true; } } if (plugin.al.isAdmin(player)) { - playerMsg(ChatColor.RED + "You can not warn admins"); + msg(ChatColor.RED + "You can not warn admins"); return true; } String warnReason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " "); - playerMsg(ChatColor.RED + "[WARNING] " + warnReason); - playerMsg(ChatColor.GREEN + "You have successfully warned " + player.getName()); + msg(ChatColor.RED + "[WARNING] " + warnReason); + msg(ChatColor.GREEN + "You have successfully warned " + player.getName()); plugin.pl.getPlayer(player).incrementWarnings(); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_whitelist.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whitelist.java similarity index 88% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_whitelist.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_whitelist.java index 2e163c4a..0f25cfd5 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_whitelist.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whitelist.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.DepreciationAggregator; @@ -24,7 +24,7 @@ public class Command_whitelist extends FreedomCommand // list if (args[0].equalsIgnoreCase("list")) { - playerMsg("Whitelisted players: " + FUtil.playerListToNames(server.getWhitelistedPlayers())); + msg("Whitelisted players: " + FUtil.playerListToNames(server.getWhitelistedPlayers())); return true; } @@ -48,9 +48,9 @@ public class Command_whitelist extends FreedomCommand totalWPs++; } - playerMsg("Online whitelisted players: " + onlineWPs); - playerMsg("Offline whitelisted players: " + offlineWPs); - playerMsg("Total whitelisted players: " + totalWPs); + msg("Online whitelisted players: " + onlineWPs); + msg("Offline whitelisted players: " + offlineWPs); + msg("Total whitelisted players: " + totalWPs); return true; } @@ -124,7 +124,7 @@ public class Command_whitelist extends FreedomCommand } else { - playerMsg("That player is not whitelisted"); + msg("That player is not whitelisted"); return true; } @@ -144,7 +144,7 @@ public class Command_whitelist extends FreedomCommand } } - playerMsg("Whitelisted " + counter + " players."); + msg("Whitelisted " + counter + " players."); return true; } @@ -159,7 +159,7 @@ public class Command_whitelist extends FreedomCommand if (args[0].equalsIgnoreCase("purge")) { FUtil.adminAction(sender.getName(), "Removing all players from the whitelist.", false); - playerMsg("Removed " + plugin.si.purgeWhitelist() + " players from the whitelist."); + msg("Removed " + plugin.si.purgeWhitelist() + " players from the whitelist."); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_whohas.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java similarity index 84% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_whohas.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java index a839a0f7..cbf64baf 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_whohas.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import java.util.ArrayList; @@ -41,11 +41,11 @@ public class Command_whohas extends FreedomCommand if (material == null) { - playerMsg("Invalid block: " + materialName, ChatColor.RED); + msg("Invalid block: " + materialName, ChatColor.RED); return true; } - final List players = new ArrayList(); + final List players = new ArrayList<>(); for (final Player player : server.getOnlinePlayers()) { @@ -61,11 +61,11 @@ public class Command_whohas extends FreedomCommand if (players.isEmpty()) { - playerMsg("There are no players with that item"); + msg("There are no players with that item"); } else { - playerMsg("Players with item " + material.name() + ": " + StringUtils.join(players, ", ")); + msg("Players with item " + material.name() + ": " + StringUtils.join(players, ", ")); } return true; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_wildcard.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wildcard.java similarity index 77% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_wildcard.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_wildcard.java index 510978e2..42ed99ab 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_wildcard.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wildcard.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import org.apache.commons.lang3.StringUtils; @@ -22,22 +22,22 @@ public class Command_wildcard extends FreedomCommand if (args[0].equals("wildcard")) { - playerMsg("What the hell are you trying to do, you stupid idiot...", ChatColor.RED); + msg("What the hell are you trying to do, you stupid idiot...", ChatColor.RED); return true; } if (args[0].equals("gtfo")) { - playerMsg("Nice try", ChatColor.RED); + msg("Nice try", ChatColor.RED); return true; } if (args[0].equals("doom")) { - playerMsg("Look, we all hate people, but this is not the way to deal with it, doom is evil enough!", ChatColor.RED); + msg("Look, we all hate people, but this is not the way to deal with it, doom is evil enough!", ChatColor.RED); return true; } if (args[0].equals("saconfig")) { - playerMsg("WOA, WTF are you trying to do???", ChatColor.RED); + msg("WOA, WTF are you trying to do???", ChatColor.RED); return true; } @@ -52,7 +52,7 @@ public class Command_wildcard extends FreedomCommand for (Player player : server.getOnlinePlayers()) { String out_command = baseCommand.replaceAll("\\x3f", player.getName()); - playerMsg("Running Command: " + out_command); + msg("Running Command: " + out_command); server.dispatchCommand(sender, out_command); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_wipeflatlands.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipeflatlands.java similarity index 95% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_wipeflatlands.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipeflatlands.java index a8060a25..f8b0ad2a 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_wipeflatlands.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipeflatlands.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_wipeuserdata.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipeuserdata.java similarity index 86% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/Command_wipeuserdata.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipeuserdata.java index 74ee1ecf..f271a962 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_wipeuserdata.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wipeuserdata.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import java.io.File; import me.totalfreedom.totalfreedommod.rank.PlayerRank; @@ -17,7 +17,7 @@ public class Command_wipeuserdata extends FreedomCommand { if (!server.getPluginManager().isPluginEnabled("Essentials")) { - playerMsg("Essentials is not enabled on this server"); + msg("Essentials is not enabled on this server"); return true; } @@ -25,7 +25,7 @@ public class Command_wipeuserdata extends FreedomCommand FUtil.deleteFolder(new File(server.getPluginManager().getPlugin("Essentials").getDataFolder(), "userdata")); - playerMsg("All playerdata deleted."); + msg("All playerdata deleted."); return true; } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/FreedomCommand.java b/src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java similarity index 61% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/FreedomCommand.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java index 0163caef..21f88803 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/FreedomCommand.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/FreedomCommand.java @@ -1,11 +1,14 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; import lombok.Getter; import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.TotalFreedomMod; +import me.totalfreedom.totalfreedommod.rank.Rank; import net.pravian.aero.command.AbstractCommandBase; +import net.pravian.aero.command.TooledCommandBase; +import net.pravian.aero.util.Players; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -49,6 +52,11 @@ public abstract class FreedomCommand extends AbstractCommandBase> extends Abstra @Override public AeroCommandExecutor> newExecutor(AeroCommandHandler handler, String name, AeroCommandBase command) { - return new FreedomCommandExecutor>(handler, name, command); + return new FreedomCommandExecutor<>(handler, name, command); } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/SourceType.java b/src/main/java/me/totalfreedom/totalfreedommod/command/SourceType.java similarity index 57% rename from src/main/java/me/totalfreedom/totalfreedommod/commands/SourceType.java rename to src/main/java/me/totalfreedom/totalfreedommod/command/SourceType.java index 4d3d34c2..0cd232f0 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/SourceType.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/SourceType.java @@ -1,4 +1,4 @@ -package me.totalfreedom.totalfreedommod.commands; +package me.totalfreedom.totalfreedommod.command; public enum SourceType { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_saconfig.java b/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_saconfig.java deleted file mode 100644 index 5e30e9d7..00000000 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/Command_saconfig.java +++ /dev/null @@ -1,314 +0,0 @@ -package me.totalfreedom.totalfreedommod.commands; - -import me.totalfreedom.totalfreedommod.TotalFreedomMod; -import me.totalfreedom.totalfreedommod.admin.Admin; -import me.totalfreedom.totalfreedommod.player.FPlayer; -import me.totalfreedom.totalfreedommod.rank.PlayerRank; -import me.totalfreedom.totalfreedommod.util.FUtil; -import net.pravian.aero.util.Ips; -import org.apache.commons.lang3.StringUtils; -import org.bukkit.ChatColor; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -@CommandPermissions(level = PlayerRank.OP, source = SourceType.BOTH) -@CommandParameters(description = "Manage admins.", usage = "/ >") -public class Command_saconfig extends FreedomCommand -{ - - @Override - public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) - { - final SAConfigMode mode; - try - { - mode = SAConfigMode.findMode(args, sender, senderIsConsole); - } - catch (final PermissionsException ex) - { - String msg = ex.getMessage(); - if (msg != null && !msg.isEmpty()) - { - sender.sendMessage(msg); - return true; - } - - return noPerms(); - } - catch (final FormatException ex) - { - playerMsg(ex.getMessage()); - return false; - } - - switch (mode) - { - case LIST: - { - playerMsg("Superadmins: " + StringUtils.join(plugin.al.getAdminNames(), ", "), ChatColor.GOLD); - - break; - } - case CLEAN: - { - FUtil.adminAction(sender.getName(), "Cleaning admin list", true); - plugin.al.deactivateOldEntries(true); - playerMsg("Superadmins: " + StringUtils.join(plugin.al.getAdminNames(), ", "), ChatColor.YELLOW); - - break; - } - case CLEARME: - { - final Admin admin = plugin.al.getAdmin(playerSender); - - if (admin == null) - { - playerMsg("Could not find your admin entry! Please notify a developer.", ChatColor.RED); - return true; - } - - final String ip = Ips.getIp(playerSender); - - if (args.length == 1) - { - FUtil.adminAction(sender.getName(), "Cleaning my supered IPs", true); - - int counter = admin.getIps().size() - 1; - admin.clearIPs(); - admin.addIp(ip); - - plugin.al.save(admin); - - playerMsg(counter + " IPs removed."); - playerMsg(admin.getIps().get(0) + " is now your only IP address"); - } - else - { - if (!admin.getIps().contains(args[1])) - { - playerMsg("That IP is not registered to you."); - } - else if (ip.equals(args[1])) - { - playerMsg("You cannot remove your current IP."); - } - else - { - FUtil.adminAction(sender.getName(), "Removing a supered IP", true); - - admin.removeIp(args[1]); - - plugin.al.save(admin); - - playerMsg("Removed IP " + args[1]); - playerMsg("Current IPs: " + StringUtils.join(admin.getIps(), ", ")); - } - } - - break; - } - case INFO: - { - Admin admin = plugin.al.getEntryByName(args[1]); - - if (admin == null) - { - final Player player = getPlayer(args[1]); - if (player != null) - { - admin = plugin.al.getAdmin(player); - } - } - - if (admin == null) - { - playerMsg("Superadmin not found: " + args[1]); - } - else - { - playerMsg(admin.toString()); - } - - break; - } - case ADD: - { - final Player player = getPlayer(args[1]); - - // Existing admin - final Admin admin = player == null ? plugin.al.getAdmin(player) : plugin.al.getEntryByName(args[1]); - if (admin != null) - { - if (admin.isActivated()) - { - playerMsg("That player is already admin."); - } - - FUtil.adminAction(sender.getName(), "Readding " + admin.getName() + " to the admin list", true); - - if (player != null) - { - admin.loadFrom(player); // Reset IP, username - } - - admin.setActivated(true); - plugin.al.save(admin); - plugin.al.updateTables(); - return true; - } - - // New admin - if (player == null) - { - playerMsg(FreedomCommand.PLAYER_NOT_FOUND); - return true; - } - - FUtil.adminAction(sender.getName(), "Adding " + player.getName() + " to the admin list", true); - plugin.al.addAdmin(new Admin(player)); - - final FPlayer fPlayer = plugin.pl.getPlayer(player.getPlayer()); - if (fPlayer.getFreezeData().isFrozen()) - { - fPlayer.getFreezeData().setFrozen(false); - playerMsg(player.getPlayer(), "You have been unfrozen."); - } - - break; - } - case DELETE: - { - Player player = getPlayer(args[1]); - Admin admin = player == null ? plugin.al.getAdmin(player) : plugin.al.getEntryByName(args[1]); - - if (admin == null) - { - playerMsg("Superadmin not found: " + args[1]); - return true; - } - - FUtil.adminAction(sender.getName(), "Removing " + admin.getName() + " from the admin list", true); - plugin.al.removeAdmin(admin); - - break; - } - default: - return false; - } - - return true; - } - - private static enum SAConfigMode - { - - LIST("list", PlayerRank.OP, SourceType.BOTH, 1, 1), - CLEAN("clean", PlayerRank.SENIOR_ADMIN, SourceType.BOTH, 1, 1), - CLEARME("clearme", PlayerRank.SUPER_ADMIN, SourceType.ONLY_IN_GAME, 1, 2), - INFO("info", PlayerRank.SUPER_ADMIN, SourceType.BOTH, 2, 2), - ADD("add", PlayerRank.SUPER_ADMIN, SourceType.ONLY_CONSOLE, 2, 2), - DELETE("delete", PlayerRank.SENIOR_ADMIN, SourceType.ONLY_CONSOLE, 2, 2); - private final String modeName; - private final PlayerRank rank; - private final SourceType sourceType; - private final int minArgs; - private final int maxArgs; - - private SAConfigMode(String modeName, PlayerRank adminLevel, SourceType sourceType, int minArgs, int maxArgs) - { - this.modeName = modeName; - this.rank = adminLevel; - this.sourceType = sourceType; - this.minArgs = minArgs; - this.maxArgs = maxArgs; - } - - private static SAConfigMode findMode(final String[] args, final CommandSender sender, final boolean senderIsConsole) throws PermissionsException, FormatException - { - if (args.length == 0) - { - throw new FormatException("Invalid number of arguments."); - } - - Admin admin = TotalFreedomMod.plugin.al.getAdmin(sender); - - boolean isSeniorAdmin = admin != null ? admin.getRank().isAtLeast(PlayerRank.SENIOR_ADMIN) : false; - - for (final SAConfigMode mode : values()) - { - if (mode.modeName.equalsIgnoreCase(args[0])) - { - if (mode.rank == PlayerRank.SUPER_ADMIN) - { - if (admin == null) - { - throw new PermissionsException(); - } - } - else if (mode.rank == PlayerRank.SENIOR_ADMIN) - { - if (!isSeniorAdmin) - { - throw new PermissionsException(); - } - } - - if (mode.sourceType == SourceType.ONLY_IN_GAME) - { - if (senderIsConsole) - { - throw new PermissionsException("This command may only be used in-game."); - } - } - else if (mode.sourceType == SourceType.ONLY_CONSOLE) - { - if (!senderIsConsole) - { - throw new PermissionsException("This command may only be used from the console."); - } - } - - if (args.length >= mode.minArgs && args.length <= mode.maxArgs) - { - return mode; - } - else - { - throw new FormatException("Invalid number of arguments for mode: " + mode.modeName); - } - } - } - - throw new FormatException("Invalid mode."); - } - } - - private static class PermissionsException extends Exception - { - - private static final long serialVersionUID = 234235261231L; - - private PermissionsException() - { - super(""); - } - - private PermissionsException(final String message) - { - super(message); - } - } - - private static class FormatException extends Exception - { - - private static final long serialVersionUID = 33331341256779901L; - - private FormatException(String message) - { - super(message); - } - } - -} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java index d2d6b48c..9832e3fa 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/config/ConfigEntry.java @@ -37,9 +37,8 @@ public enum ConfigEntry SERVER_BAN_URL(String.class, "server.ban_url"), SERVER_PERMBAN_URL(String.class, "server.permban_url"), // - TWITTERBOT_ENABLED(Boolean.class, "twitterbot.enabled"), - TWITTERBOT_SECRET(String.class, "twitterbot.secret"), - TWITTERBOT_URL(String.class, "twitterbot.url"), + ADMINLIST_CLEAN_THESHOLD_HOURS(Integer.class, "adminlist.clean_threshold_hours"), + ADMINLIST_CONSOLE_IS_SENIOR(Boolean.class, "adminlist.console_is_senior"), // DISABLE_NIGHT(Boolean.class, "disable.night"), DISABLE_WEATHER(Boolean.class, "disable.weather"), @@ -84,8 +83,7 @@ public enum ConfigEntry OVERLORD_IPS(List.class, "overlord_ips"), NOADMIN_IPS(List.class, "noadmin_ips"), ADMIN_ONLY_MODE(Boolean.class, "admin_only_mode"), - AUTO_ENTITY_WIPE(Boolean.class, "auto_wipe"), - CONSOLE_IS_SENIOR(Boolean.class, "console_is_senior"); + AUTO_ENTITY_WIPE(Boolean.class, "auto_wipe"); // private final Class type; private final String configName; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/config/MainConfig.java b/src/main/java/me/totalfreedom/totalfreedommod/config/MainConfig.java index e0e5423e..87110670 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/config/MainConfig.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/config/MainConfig.java @@ -23,7 +23,7 @@ public class MainConfig static { - ENTRY_MAP = new EnumMap(ConfigEntry.class); + ENTRY_MAP = new EnumMap<>(ConfigEntry.class); TFM_Defaults tempDefaults = null; try diff --git a/src/main/java/me/totalfreedom/totalfreedommod/fun/ItemFun.java b/src/main/java/me/totalfreedom/totalfreedommod/fun/ItemFun.java index 74c107e7..0d741ea7 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/fun/ItemFun.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/fun/ItemFun.java @@ -150,7 +150,7 @@ public class ItemFun extends FreedomService distance = location.distance(targetBlock.getLocation()); } - final List affected = new ArrayList(); + final List affected = new ArrayList<>(); Block lastBlock = null; for (double offset = 0.0; offset <= distance; offset += (distance / 25.0)) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/fun/Landminer.java b/src/main/java/me/totalfreedom/totalfreedommod/fun/Landminer.java index a99d99b4..afe11dfb 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/fun/Landminer.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/fun/Landminer.java @@ -21,7 +21,7 @@ public class Landminer extends FreedomService { @Getter - private final List landmines = new ArrayList(); + private final List landmines = new ArrayList<>(); public Landminer(TotalFreedomMod plugin) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/httpd/NanoHTTPD.java b/src/main/java/me/totalfreedom/totalfreedommod/httpd/NanoHTTPD.java index bda5fa9f..efe0600c 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/httpd/NanoHTTPD.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/httpd/NanoHTTPD.java @@ -308,7 +308,7 @@ public abstract class NanoHTTPD */ public Response serve(HTTPSession session) { - Map files = new HashMap(); + Map files = new HashMap<>(); Method method = session.getMethod(); if (Method.PUT.equals(method) || Method.POST.equals(method)) { @@ -369,7 +369,7 @@ public abstract class NanoHTTPD */ protected Map> decodeParameters(String queryString) { - Map> parms = new HashMap>(); + Map> parms = new HashMap<>(); if (queryString != null) { StringTokenizer st = new StringTokenizer(queryString, "&"); @@ -531,7 +531,7 @@ public abstract class NanoHTTPD public DefaultTempFileManager() { tmpdir = System.getProperty("java.io.tmpdir"); - tempFiles = new ArrayList(); + tempFiles = new ArrayList<>(); } @Override @@ -618,7 +618,7 @@ public abstract class NanoHTTPD /** * Headers for the HTTP response. Use addHeader() to add lines. */ - private Map header = new HashMap(); + private Map header = new HashMap<>(); /** * The request method that spawned this response. */ @@ -948,14 +948,14 @@ public abstract class NanoHTTPD inputStream = sequenceInputStream; } - parms = new HashMap(); - headers = new HashMap(); + parms = new HashMap<>(); + headers = new HashMap<>(); // Create a BufferedReader for parsing the header. BufferedReader hin = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(buf, 0, rlen))); // Decode the header into parms and header java properties - Map pre = new HashMap(); + Map pre = new HashMap<>(); decodeHeader(hin, pre, parms, headers); method = Method.lookup(pre.get("method")); @@ -1195,7 +1195,7 @@ public abstract class NanoHTTPD throw new ResponseException(Response.Status.BAD_REQUEST, "BAD REQUEST: Content type is multipart/form-data but next chunk does not start with boundary. Usage: GET /example/file.html"); } boundarycount++; - Map item = new HashMap(); + Map item = new HashMap<>(); mpline = in.readLine(); while (mpline != null && mpline.trim().length() > 0) { @@ -1214,7 +1214,7 @@ public abstract class NanoHTTPD throw new ResponseException(Response.Status.BAD_REQUEST, "BAD REQUEST: Content type is multipart/form-data but no content-disposition info found. Usage: GET /example/file.html"); } StringTokenizer st = new StringTokenizer(contentDisposition, "; "); - Map disposition = new HashMap(); + Map disposition = new HashMap<>(); while (st.hasMoreTokens()) { String token = st.nextToken(); @@ -1297,7 +1297,7 @@ public abstract class NanoHTTPD { int matchcount = 0; int matchbyte = -1; - List matchbytes = new ArrayList(); + List matchbytes = new ArrayList<>(); for (int i = 0; i < b.limit(); i++) { if (b.get(i) == boundary[matchcount]) @@ -1504,8 +1504,8 @@ public abstract class NanoHTTPD public class CookieHandler implements Iterable { - private HashMap cookies = new HashMap(); - private ArrayList queue = new ArrayList(); + private HashMap cookies = new HashMap<>(); + private ArrayList queue = new ArrayList<>(); public CookieHandler(Map httpHeaders) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/HTTPDModule.java b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/HTTPDModule.java index 6e059f8a..04f4733b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/HTTPDModule.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/HTTPDModule.java @@ -56,7 +56,7 @@ public abstract class HTTPDModule protected final Map getFiles() { - Map files = new HashMap(); + Map files = new HashMap<>(); try { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_file.java b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_file.java index 3a186dc4..5acb9033 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_file.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_file.java @@ -25,7 +25,7 @@ public class Module_file extends HTTPDModule { private final File rootDir = new File(ConfigEntry.HTTPD_PUBLIC_FOLDER.getString()); - public static final Map MIME_TYPES = new HashMap(); + public static final Map MIME_TYPES = new HashMap<>(); static { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_help.java b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_help.java index 642a7fad..bef0c412 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_help.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_help.java @@ -9,7 +9,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import me.totalfreedom.totalfreedommod.TotalFreedomMod; -import me.totalfreedom.totalfreedommod.commands.FreedomCommand; +import me.totalfreedom.totalfreedommod.command.FreedomCommand; import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD; import static me.totalfreedom.totalfreedommod.httpd.HTMLGenerationTools.heading; import static me.totalfreedom.totalfreedommod.httpd.HTMLGenerationTools.paragraph; @@ -46,7 +46,7 @@ public class Module_help extends HTTPDModule + "Please note that it does not include vanilla server commands.")); final Collection knownCommands = ((SimpleCommandMap) map).getCommands(); - final Map> commandsByPlugin = new HashMap>(); + final Map> commandsByPlugin = new HashMap<>(); for (Command command : knownCommands) { @@ -86,7 +86,7 @@ public class Module_help extends HTTPDModule continue; } - Rank tfmCommandLevel = FreedomCommand.getCommand(command).getPerms().level(); + Rank tfmCommandLevel = FreedomCommand.getFrom(command).getPerms().level(); if (lastTfmCommandLevel == null || lastTfmCommandLevel != tfmCommandLevel) { responseBody.append("\r\n").append(heading(tfmCommandLevel.getName(), 3)).append("
    \r\n"); @@ -142,8 +142,8 @@ public class Module_help extends HTTPDModule @Override public int compare(Command a, Command b) { - FreedomCommand ca = FreedomCommand.getCommand(a); - FreedomCommand cb = FreedomCommand.getCommand(b); + FreedomCommand ca = FreedomCommand.getFrom(a); + FreedomCommand cb = FreedomCommand.getFrom(b); if (ca == null || cb == null diff --git a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_permbans.java b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_permbans.java index 9ced08db..0fbd79aa 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_permbans.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_permbans.java @@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod.httpd.module; import java.io.File; import me.totalfreedom.totalfreedommod.TotalFreedomMod; +import me.totalfreedom.totalfreedommod.banning.PermbanList; import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon; import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD; @@ -16,10 +17,10 @@ public class Module_permbans extends HTTPDModule @Override public NanoHTTPD.Response getResponse() { - File permbanFile = new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.PERMBAN_FILENAME); + File permbanFile = new File(TotalFreedomMod.plugin.getDataFolder(), PermbanList.CONFIG_FILENAME); if (permbanFile.exists()) { - return HTTPDaemon.serveFileBasic(new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.PERMBAN_FILENAME)); + return HTTPDaemon.serveFileBasic(new File(TotalFreedomMod.plugin.getDataFolder(), PermbanList.CONFIG_FILENAME)); } else { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_schematic.java b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_schematic.java index 86d32cee..9895015e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_schematic.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_schematic.java @@ -80,7 +80,7 @@ public class Module_schematic extends HTTPDModule { Collection schematics = FileUtils.listFiles(SCHEMATIC_FOLDER, SCHEMATIC_FILTER, false); - final List schematicsFormatted = new ArrayList(); + final List schematicsFormatted = new ArrayList<>(); for (File schematic : schematics) { String filename = StringEscapeUtils.escapeHtml4(schematic.getName()); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/player/FPlayer.java b/src/main/java/me/totalfreedom/totalfreedommod/player/FPlayer.java index 4e7d38c0..d6027d1f 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/player/FPlayer.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/player/FPlayer.java @@ -50,7 +50,7 @@ public class FPlayer private boolean mobThrowerEnabled = false; private EntityType mobThrowerEntity = EntityType.PIG; private double mobThrowerSpeed = 4.0; - private final List mobThrowerQueue = new ArrayList(); + private final List mobThrowerQueue = new ArrayList<>(); private BukkitTask mp44ScheduleTask = null; private boolean mp44Armed = false; private boolean mp44Firing = false; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/player/PlayerList.java b/src/main/java/me/totalfreedom/totalfreedommod/player/PlayerList.java index 5aafa5b3..866bfba1 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/player/PlayerList.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/player/PlayerList.java @@ -43,13 +43,11 @@ public class PlayerList extends FreedomService playerMap.clear(); dataMap.clear(); - // Preload online playerMap + // Preload online players for (Player player : server.getOnlinePlayers()) { getPlayer(player); } - - FLog.info("Loaded playerdata for " + playerMap.size() + " players"); } @Override diff --git a/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java b/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java index f14ab308..e42cda47 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java @@ -89,10 +89,15 @@ public class RankManager extends FreedomService return getRank((Player) sender); } + // CONSOLE? + if (sender.getName().equals("CONSOLE")) { + return ConfigEntry.ADMINLIST_CONSOLE_IS_SENIOR.getBoolean() ? PlayerRank.SENIOR_CONSOLE : PlayerRank.TELNET_CONSOLE; + } + // Console admin, get by name Admin admin = plugin.al.getEntryByName(sender.getName()); - // Unknown console: RCON, CONSOLE? + // Unknown console: RCON? if (admin == null) { return PlayerRank.SENIOR_CONSOLE; @@ -109,12 +114,12 @@ public class RankManager extends FreedomService } final Admin entry = plugin.al.getAdmin(player); - if (entry == null) + if (entry != null) { - return player.isOp() ? PlayerRank.OP : PlayerRank.NON_OP; + return entry.getRank(); } - return entry.getRank(); + return player.isOp() ? PlayerRank.OP : PlayerRank.NON_OP; } @EventHandler(priority = EventPriority.MONITOR) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/rollback/RollbackManager.java b/src/main/java/me/totalfreedom/totalfreedommod/rollback/RollbackManager.java index bb220090..b7e9788d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/rollback/RollbackManager.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/rollback/RollbackManager.java @@ -212,7 +212,7 @@ public class RollbackManager extends FreedomService final int testZ = location.getBlockZ(); final String testWorldName = location.getWorld().getName(); - List entries = new ArrayList(); + List entries = new ArrayList<>(); for (String playername : history.keySet()) { for (RollbackEntry entry : history.get(playername.toLowerCase())) @@ -268,7 +268,7 @@ public class RollbackManager extends FreedomService List playerEntryList = history.get(playerName.toLowerCase()); if (playerEntryList == null) { - playerEntryList = new ArrayList(); + playerEntryList = new ArrayList<>(); history.put(playerName.toLowerCase(), playerEntryList); } return playerEntryList; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java index 0f950ce0..780cf935 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java @@ -54,14 +54,15 @@ import org.bukkit.util.FileUtil; public class FUtil { - - private static final Map ejectTracker = new HashMap(); - public static final Map mobtypes = new HashMap(); + private static final Map EJECT_TRACKER = new HashMap<>(); + private static final Random RANDOM = new Random(); + // + public static final String SAVED_FLAGS_FILENAME = "savedflags.dat"; + public static final Map MOB_TYPES = new HashMap<>(); // See https://github.com/TotalFreedom/License - None of the listed names may be removed. public static final List DEVELOPERS = Arrays.asList("Madgeek1450", "Prozza", "Wild1145", "WickedGamingUK"); - private static final Random RANDOM = new Random(); public static String DATE_STORAGE_FORMAT = "EEE, d MMM yyyy HH:mm:ss Z"; - public static final Map CHAT_COLOR_NAMES = new HashMap(); + public static final Map CHAT_COLOR_NAMES = new HashMap<>(); public static final List CHAT_COLOR_POOL = Arrays.asList( ChatColor.DARK_BLUE, ChatColor.DARK_GREEN, @@ -86,7 +87,7 @@ public class FUtil { if (Creature.class.isAssignableFrom(type.getEntityClass())) { - mobtypes.put(DepreciationAggregator.getName_EntityType(type).toLowerCase(), type); + MOB_TYPES.put(DepreciationAggregator.getName_EntityType(type).toLowerCase(), type); } } } @@ -316,12 +317,12 @@ public class FUtil { mobname = mobname.toLowerCase().trim(); - if (!FUtil.mobtypes.containsKey(mobname)) + if (!FUtil.MOB_TYPES.containsKey(mobname)) { throw new Exception(); } - return FUtil.mobtypes.get(mobname); + return FUtil.MOB_TYPES.get(mobname); } /** @@ -366,15 +367,15 @@ public class FUtil EjectMethod method = EjectMethod.STRIKE_ONE; final String ip = Ips.getIp(player); - if (!FUtil.ejectTracker.containsKey(ip)) + if (!FUtil.EJECT_TRACKER.containsKey(ip)) { - FUtil.ejectTracker.put(ip, 0); + FUtil.EJECT_TRACKER.put(ip, 0); } - int kicks = FUtil.ejectTracker.get(ip); + int kicks = FUtil.EJECT_TRACKER.get(ip); kicks += 1; - FUtil.ejectTracker.put(ip, kicks); + FUtil.EJECT_TRACKER.put(ip, kicks); if (kicks <= 1) { @@ -541,7 +542,7 @@ public class FUtil public static String playerListToNames(Set players) { - List names = new ArrayList(); + List names = new ArrayList<>(); for (OfflinePlayer player : players) { names.add(player.getName()); @@ -554,7 +555,7 @@ public class FUtil { Map flags = null; - File input = new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SAVED_FLAGS_FILENAME); + File input = new File(TotalFreedomMod.plugin.getDataFolder(), SAVED_FLAGS_FILENAME); if (input.exists()) { try @@ -604,14 +605,14 @@ public class FUtil if (flags == null) { - flags = new HashMap(); + flags = new HashMap<>(); } flags.put(flag, value); try { - final FileOutputStream fos = new FileOutputStream(new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SAVED_FLAGS_FILENAME)); + final FileOutputStream fos = new FileOutputStream(new File(TotalFreedomMod.plugin.getDataFolder(), SAVED_FLAGS_FILENAME)); final ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(flags); oos.close(); @@ -717,7 +718,7 @@ public class FUtil public static List removeDuplicates(List oldList) { - List newList = new ArrayList(); + List newList = new ArrayList<>(); for (String entry : oldList) { if (!newList.contains(entry)) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/world/AdminWorld.java b/src/main/java/me/totalfreedom/totalfreedommod/world/AdminWorld.java index a2486473..671e5a1f 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/world/AdminWorld.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/world/AdminWorld.java @@ -29,11 +29,11 @@ public final class AdminWorld extends CustomWorld private static final String GENERATION_PARAMETERS = ConfigEntry.FLATLANDS_GENERATE_PARAMS.getString(); private static final String WORLD_NAME = "adminworld"; // - private final Map teleportCooldown = new HashMap(); - private final Map accessCache = new HashMap(); + private final Map teleportCooldown = new HashMap<>(); + private final Map accessCache = new HashMap<>(); // private Long cacheLastCleared = null; - private Map guestList = new HashMap(); // Guest, Supervisor + private Map guestList = new HashMap<>(); // Guest, Supervisor private WorldWeather weather = WorldWeather.OFF; private WorldTime time = WorldTime.INHERIT; @@ -128,7 +128,7 @@ public final class AdminWorld extends CustomWorld public String guestListToString() { - final List output = new ArrayList(); + final List output = new ArrayList<>(); final Iterator> it = guestList.entrySet().iterator(); while (it.hasNext()) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/world/CleanroomChunkGenerator.java b/src/main/java/me/totalfreedom/totalfreedommod/world/CleanroomChunkGenerator.java index b14a1bb9..21bad077 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/world/CleanroomChunkGenerator.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/world/CleanroomChunkGenerator.java @@ -215,7 +215,7 @@ public class CleanroomChunkGenerator extends ChunkGenerator else { // This is the default, but just in case default populators change to stock minecraft populators by default... - return new ArrayList(); + return new ArrayList<>(); } } diff --git a/src/main/java/org/mcstats/Metrics.java b/src/main/java/org/mcstats/Metrics.java index 1dc29c23..74deca20 100644 --- a/src/main/java/org/mcstats/Metrics.java +++ b/src/main/java/org/mcstats/Metrics.java @@ -703,7 +703,7 @@ public class Metrics /** * The set of plotters that are contained within this graph */ - private final Set plotters = new LinkedHashSet(); + private final Set plotters = new LinkedHashSet<>(); private Graph(final String name) { diff --git a/src/main/resources/admins.yml b/src/main/resources/admins.yml new file mode 100644 index 00000000..bbd9e438 --- /dev/null +++ b/src/main/resources/admins.yml @@ -0,0 +1,35 @@ +# +# TotalFreedomMod 5.0 Admin List +# + +prozza: + username: Prozza + active: true + rank: SENIOR_ADMIN + ips: + - 127.0.0.1 + console_aliases: + - Darth + last_login: Wed, 2 Apr 2016 16:08:39 +0200 + login_message: 'the &5Lead Developer&b!' + +madgeek1450: + username: Madgeek1450 + active: true + rank: SENIOR_ADMIN + ips: + - 1.2.3.4 + - 8.8.8.8 + console_aliases: [] + last_login: Wed, 2 Apr 2016 16:08:39 +0200 + login_message: 'the &4Co-Founder&b and &6Master-ass-kicker&b.' + +markbyron: + username: markbyron + active: true + rank: SENIOR_ADMIN + console_aliases: [] + ips: + - 8.8.4.4 + last_login: Wed, 2 Apr 2016 16:08:39 +0200 + login_message: 'the &dOwner&b.' diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 17fb2bee..825a7cee 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -27,6 +27,16 @@ server: # URL players should appeal for permanent bans at permban_url: http://bit.ly/TF_PermBan +# Admin list +adminlist: + + # The amount of hours after which admins may be removed from the admin list + clean_threshold_hours: 167 + + # Give the default CONSOLE senior admin privileges. + # Handy in development environments. + console_is_senior: true + # ForceIP configuration forceip: enabled: false @@ -54,7 +64,7 @@ allow: # How blocked commands work: # All sections described below are delimited by colon characters. # Make sure that you block a command by its main command name, not an alias -# -as all aliases are blocked by default. Commands are case-insensitive. +# as all aliases are blocked by default. Commands are case-insensitive. # # * The first section is a letter which indicates which rank may use this command # Valid ranks: @@ -192,10 +202,6 @@ protectarea: auto_protect_spawnpoints: true auto_protect_radius: 25.0 -# Give the default CONSOLE senior admin privileges. -# Handy in development environments. -console_is_senior: true - # Host Sender Names - Names that indicate automated services or host-based consoles you want to block from using some commands. # Make sure these are all lower-case. host_sender_names: @@ -216,29 +222,28 @@ announcer: - 'Be sure to visit our forums at &6http://totalfreedom.boards.net/' - 'You can always review the server rules here: &6http://totalfreedom.me/' - 'If you are not OP, be sure to ask!' - - 'Somebody breaking the rules? Report it! /report ' + - 'Somebody breaking the rules? Report it! /report ' - 'Griefing is not allowed!' - - 'Hacking is allowed!' + - 'Hacked clients are allowed!' - 'Interested in becoming admin? Do "/ai" for more information!' - 'You may view all online administrators via "/list -a"' - - 'Save your buildings via WorldEdit! http://totalfreedom.me for more information!' - - 'Famous players, such as Notch, are always fake! We are an offline/cracked server!' - - 'You may contact TotalFreedoms Support on Twitter! pravi.us/nGS' - - 'You may download TotalFreedomMod here: pravi.us/V8c' - - 'MarkByron is TotalFreedoms owner.' + - 'Save your buildings via WorldEdit! http://totalfreedom.me for more information!' + - 'Famous players, such as Notch, are always fake! We are an offline/cracked server!' + - 'You may contact TotalFreedom support on Twitter! https://tiny.re/tfsupport' + - 'You may download TotalFreedomMod here: https://tiny.re/tfm+' + - 'MarkByron is the owner of TotalFreedom.' - 'Server lagging? Check the lag via "/tps"' - - 'You are allowed to record and stream videos on TotalFreedom :D' - - 'An admin abusing? Report it! pravi.us/vfa' - - 'Player vs Player while in creative/god mode it forbidden!' + - 'You are allowed to record and stream videos on TotalFreedom.' + - 'Player vs player while in creative or god mode it forbidden!' - 'Spawn killing is forbidden!' - 'Invisible potions are allowed!' - - 'Serial griefing and trolling will result in permanently being banned!' + - 'Serial griefing and trolling will result in a permanent ban!' - 'TotalFreedom does not accept any form of donations!' - - 'Racism, Nazism, and Sexism is strictly forbidden!' + - 'Racism, nazism, and sexism are strictly forbidden!' - 'Join our Mumble server! IP: 64.34.202.140:2862' -# Players who cannot be banned by username -unbannable_usernames: +# Famous players - cannot be banned by username +famous_players: - honeydew - xephos - captainsparklez @@ -281,12 +286,6 @@ unbannable_usernames: noadmin_ips: - 167.114.97.16 -# TwitterBot - Used to allow superadmins to verify themselves using twitter -twitterbot: - enabled: false - url: '' - secret: '' - # Pet Protect - Prevent tamed pets from being killed. petprotect: enabled: true @@ -309,10 +308,10 @@ httpd: autokick: enabled: true - # autokick_threshold - Percentage of server player capacity used at which players will be automatically kicked for being inactive. Range: 0.0 - 1.0 + # Percentage of server player capacity used at which players will be automatically kicked for being inactive. Range: 0.0 - 1.0 threshold: 0.9 - # autokick_time - Time, in seconds, after which a player should be kicked when inactive + # Time, in seconds, after which a player should be kicked when inactive time: 120 # Players with access to the overlord command diff --git a/src/main/resources/permban.yml b/src/main/resources/permbans.yml similarity index 100% rename from src/main/resources/permban.yml rename to src/main/resources/permbans.yml diff --git a/src/main/resources/superadmin.yml b/src/main/resources/superadmin.yml deleted file mode 100644 index 99d440fe..00000000 --- a/src/main/resources/superadmin.yml +++ /dev/null @@ -1,40 +0,0 @@ -# -# SuperAdmin List -# - -clean_threshold_hours: 168 - -admins: - f9a1982e-252e-4ed3-92ed-52b0506a39c9: - last_login_name: Prozza - is_activated: true - is_senior_admin: true - is_telnet_admin: true - ips: - - 127.0.0.1 - console_aliases: - - darth - last_login: Tue, 15 Apr 2014 16:08:39 +0200 - custom_login_message: the &5Lead Developer&b! - 1156a81a-23fb-435e-9aff-fe9c2ea7e82d: - last_login_name: Madgeek1450 - is_activated: true - is_telnet_admin: true - is_senior_admin: true - console_aliases: - - madgeek - ips: - - 1.2.3.4 - - 8.8.8.8 - last_login: Tue, 15 Apr 2014 16:01:24 +0200 - custom_login_message: the &4Co-Founder&b and &6Master-ass-kicker&b. - 58a6ea8a-3ac3-4033-80e3-41bf9caa634b: - last_login_name: markbyron - is_activated: true - is_telnet_admin: true - is_senior_admin: true - console_aliases: [] - ips: - - 8.8.4.4 - last_login: Sat, 10 Nov 2012 08:09:14 +0100 - custom_login_message: the &dOwner&b.