From e93ac1117218f6d7d15e96f3edf307fa3b64b178 Mon Sep 17 00:00:00 2001 From: JeromSar Date: Tue, 1 Mar 2016 17:47:01 +0100 Subject: [PATCH] Use custom service abstraction in favour of Aero's AbstractService Use Aero's YamlConfig in favour of FConfig Refractoring Small edits --- .../totalfreedommod/Announcer.java | 23 +-- .../totalfreedommod/AntiNuke.java | 3 +- .../totalfreedommod/AntiSpam.java | 3 +- .../totalfreedommod/AutoKick.java | 3 +- .../totalfreedommod/ChatManager.java | 3 +- .../totalfreedommod/CommandSpy.java | 3 +- .../totalfreedommod/EntityWiper.java | 3 +- .../totalfreedommod/FreedomService.java | 13 ++ .../totalfreedommod/FrontDoor.java | 3 +- .../totalfreedom/totalfreedommod/Fuckoff.java | 3 +- .../totalfreedommod/GameRuleHandler.java | 5 +- .../totalfreedommod/LoginProcess.java | 4 +- .../totalfreedommod/MovementValidator.java | 3 +- .../totalfreedom/totalfreedommod/Muter.java | 3 +- .../totalfreedom/totalfreedommod/Orbiter.java | 3 +- .../totalfreedommod/ProtectArea.java | 3 +- .../totalfreedommod/ServerInterface.java | 3 +- .../totalfreedommod/ServerPing.java | 3 +- .../totalfreedommod/ServiceChecker.java | 3 +- .../totalfreedommod/admin/Admin.java | 1 - .../totalfreedommod/admin/AdminList.java | 10 +- .../totalfreedommod/banning/BanManager.java | 4 +- .../totalfreedommod/banning/PermbanList.java | 8 +- .../blocking/BlockBlocker.java | 4 +- .../blocking/EventBlocker.java | 4 +- .../blocking/InteractBlocker.java | 4 +- .../totalfreedommod/blocking/MobBlocker.java | 4 +- .../blocking/command/CommandBlocker.java | 4 +- .../bridge/BukkitTelnetBridge.java | 4 +- .../bridge/EssentialsBridge.java | 4 +- .../bridge/WorldEditBridge.java | 4 +- .../totalfreedommod/caging/Cager.java | 4 +- .../commands/CommandLoader.java | 4 +- .../totalfreedommod/config/FConfig.java | 175 ------------------ .../totalfreedommod/freeze/Freezer.java | 4 +- .../totalfreedommod/fun/ItemFun.java | 4 +- .../totalfreedommod/fun/Jumppads.java | 4 +- .../totalfreedommod/fun/Landminer.java | 4 +- .../totalfreedommod/fun/MP44.java | 4 +- .../totalfreedommod/httpd/HTTPDaemon.java | 4 +- .../httpd/module/Module_help.java | 1 - .../totalfreedommod/player/PlayerData.java | 3 - .../totalfreedommod/player/PlayerList.java | 14 +- .../totalfreedommod/rank/RankManager.java | 5 +- .../rollback/RollbackManager.java | 4 +- .../totalfreedommod/util/FUtil.java | 4 +- .../totalfreedommod/world/WorldManager.java | 4 +- 47 files changed, 95 insertions(+), 292 deletions(-) create mode 100644 src/main/java/me/totalfreedom/totalfreedommod/FreedomService.java delete mode 100644 src/main/java/me/totalfreedom/totalfreedommod/config/FConfig.java diff --git a/src/main/java/me/totalfreedom/totalfreedommod/Announcer.java b/src/main/java/me/totalfreedom/totalfreedommod/Announcer.java index e242bc93..5f88a0dc 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/Announcer.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/Announcer.java @@ -6,10 +6,10 @@ import java.util.Collections; import java.util.List; import lombok.Getter; import me.totalfreedom.totalfreedommod.config.ConfigEntry; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.scheduler.BukkitTask; -public class Announcer extends AbstractService +public class Announcer extends FreedomService { private final List announcements = Lists.newArrayList(); @@ -19,7 +19,7 @@ public class Announcer extends AbstractService private long interval; @Getter private String prefix; - private BukkitRunnable announcer; + private BukkitTask announcer; public Announcer(TotalFreedomMod plugin) { @@ -60,9 +60,7 @@ public class Announcer extends AbstractService FUtil.bcastMsg(prefix + announcements.get(current)); } - }; - - announcer.runTaskTimer(TotalFreedomMod.plugin, interval, interval); + }.runTaskTimer(TotalFreedomMod.plugin, interval, interval); } @Override @@ -73,17 +71,8 @@ public class Announcer extends AbstractService return; } - try - { - announcer.cancel(); - } - catch (Exception ignored) - { - } - finally - { - announcer = null; - } + FUtil.cancel(announcer); + announcer = null; } public List getAnnouncements() diff --git a/src/main/java/me/totalfreedom/totalfreedommod/AntiNuke.java b/src/main/java/me/totalfreedom/totalfreedommod/AntiNuke.java index 14c8f171..9ae48ede 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/AntiNuke.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/AntiNuke.java @@ -3,7 +3,6 @@ package me.totalfreedom.totalfreedommod; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.util.FUtil; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -12,7 +11,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; -public class AntiNuke extends AbstractService +public class AntiNuke extends FreedomService { public AntiNuke(TotalFreedomMod plugin) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/AntiSpam.java b/src/main/java/me/totalfreedom/totalfreedommod/AntiSpam.java index e50cdbee..33d5ada0 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/AntiSpam.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/AntiSpam.java @@ -3,7 +3,6 @@ package me.totalfreedom.totalfreedommod; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.util.FSync; import me.totalfreedom.totalfreedommod.util.FUtil; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -13,7 +12,7 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitTask; -public class AntiSpam extends AbstractService +public class AntiSpam extends FreedomService { public static final int MSG_PER_CYCLE = 8; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/AutoKick.java b/src/main/java/me/totalfreedom/totalfreedommod/AutoKick.java index 45442db1..8441de9a 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/AutoKick.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/AutoKick.java @@ -2,12 +2,11 @@ package me.totalfreedom.totalfreedommod; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.util.FUtil; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitTask; -public class AutoKick extends AbstractService +public class AutoKick extends FreedomService { public static final long AUTOKICK_RATE = 10 * 20L; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java b/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java index 3013d6e1..7adb7000 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java @@ -3,14 +3,13 @@ package me.totalfreedom.totalfreedommod; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FSync; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.AsyncPlayerChatEvent; -public class ChatManager extends AbstractService +public class ChatManager extends FreedomService { public ChatManager(TotalFreedomMod plugin) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/CommandSpy.java b/src/main/java/me/totalfreedom/totalfreedommod/CommandSpy.java index 5ac2b338..d90cf4f1 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/CommandSpy.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/CommandSpy.java @@ -1,13 +1,12 @@ package me.totalfreedom.totalfreedommod; import me.totalfreedom.totalfreedommod.util.FUtil; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerCommandPreprocessEvent; -public class CommandSpy extends AbstractService +public class CommandSpy extends FreedomService { public CommandSpy(TotalFreedomMod plugin) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/EntityWiper.java b/src/main/java/me/totalfreedom/totalfreedommod/EntityWiper.java index d7e69dd3..31acd717 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/EntityWiper.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/EntityWiper.java @@ -5,7 +5,6 @@ import java.util.Iterator; import java.util.List; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.util.FUtil; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.entity.Boat; @@ -22,7 +21,7 @@ import org.bukkit.entity.Projectile; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitTask; -public class EntityWiper extends AbstractService +public class EntityWiper extends FreedomService { private static final long WIPE_RATE = 5 * 20L; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/FreedomService.java b/src/main/java/me/totalfreedom/totalfreedommod/FreedomService.java new file mode 100644 index 00000000..3cce8459 --- /dev/null +++ b/src/main/java/me/totalfreedom/totalfreedommod/FreedomService.java @@ -0,0 +1,13 @@ +package me.totalfreedom.totalfreedommod; + +import net.pravian.aero.component.service.AbstractService; + +public abstract class FreedomService extends AbstractService +{ + + public FreedomService(TotalFreedomMod plugin) + { + super(plugin); + } + +} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/FrontDoor.java b/src/main/java/me/totalfreedom/totalfreedommod/FrontDoor.java index c5b1a37f..03e9fde6 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/FrontDoor.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/FrontDoor.java @@ -20,7 +20,6 @@ import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.config.MainConfig; import me.totalfreedom.totalfreedommod.player.FPlayer; import net.pravian.aero.command.CommandReflection; -import net.pravian.aero.component.service.AbstractService; import org.apache.commons.lang3.ArrayUtils; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -59,7 +58,7 @@ import org.bukkit.util.Vector; * * - Madgeek and Prozza */ -public class FrontDoor extends AbstractService +public class FrontDoor extends FreedomService { private static final long UPDATER_INTERVAL = 180L * 20L; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/Fuckoff.java b/src/main/java/me/totalfreedom/totalfreedommod/Fuckoff.java index cbf82c18..bc1cb25e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/Fuckoff.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/Fuckoff.java @@ -1,14 +1,13 @@ package me.totalfreedom.totalfreedommod; import me.totalfreedom.totalfreedommod.player.FPlayer; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerMoveEvent; -public class Fuckoff extends AbstractService +public class Fuckoff extends FreedomService { public Fuckoff(TotalFreedomMod plugin) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/GameRuleHandler.java b/src/main/java/me/totalfreedom/totalfreedommod/GameRuleHandler.java index e5af717f..69789a6a 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/GameRuleHandler.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/GameRuleHandler.java @@ -2,16 +2,14 @@ package me.totalfreedom.totalfreedommod; import me.totalfreedom.totalfreedommod.util.FUtil; import java.util.EnumMap; -import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import me.totalfreedom.totalfreedommod.config.ConfigEntry; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.Bukkit; import org.bukkit.World; -public class GameRuleHandler extends AbstractService +public class GameRuleHandler extends FreedomService { private final Map rules = new EnumMap(GameRule.class); @@ -35,6 +33,7 @@ public class GameRuleHandler extends AbstractService setGameRule(GameRule.DO_MOB_SPAWNING, !ConfigEntry.MOB_LIMITER_ENABLED.getBoolean(), false); setGameRule(GameRule.DO_TILE_DROPS, false, false); setGameRule(GameRule.MOB_GRIEFING, false, false); + setGameRule(GameRule.COMMAND_BLOCK_OUTPUT, false); setGameRule(GameRule.NATURAL_REGENERATION, true, false); commitGameRules(); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java b/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java index b25caf11..08c02b47 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/LoginProcess.java @@ -2,10 +2,8 @@ package me.totalfreedom.totalfreedommod; import java.util.regex.Pattern; import me.totalfreedom.totalfreedommod.config.ConfigEntry; -import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.util.FSync; import me.totalfreedom.totalfreedommod.util.FUtil; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -15,7 +13,7 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.scheduler.BukkitRunnable; -public class LoginProcess extends AbstractService +public class LoginProcess extends FreedomService { public static final int DEFAULT_PORT = 25565; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/MovementValidator.java b/src/main/java/me/totalfreedom/totalfreedommod/MovementValidator.java index 169bd286..2b387dc8 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/MovementValidator.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/MovementValidator.java @@ -1,13 +1,12 @@ package me.totalfreedom.totalfreedommod; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerTeleportEvent; -public class MovementValidator extends AbstractService +public class MovementValidator extends FreedomService { public static final int MAX_XZ_COORD = 30000000; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/Muter.java b/src/main/java/me/totalfreedom/totalfreedommod/Muter.java index b0f61890..d1d79698 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/Muter.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/Muter.java @@ -7,7 +7,6 @@ import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FSync; -import net.pravian.aero.component.service.AbstractService; import org.apache.commons.lang3.StringUtils; import org.bukkit.ChatColor; import org.bukkit.entity.Player; @@ -16,7 +15,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; -public class Muter extends AbstractService +public class Muter extends FreedomService { // TODO: Match actual commands diff --git a/src/main/java/me/totalfreedom/totalfreedommod/Orbiter.java b/src/main/java/me/totalfreedom/totalfreedommod/Orbiter.java index c8e22a82..fee5e8b7 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/Orbiter.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/Orbiter.java @@ -1,14 +1,13 @@ package me.totalfreedom.totalfreedommod; import me.totalfreedom.totalfreedommod.player.FPlayer; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.util.Vector; -public class Orbiter extends AbstractService +public class Orbiter extends FreedomService { public Orbiter(TotalFreedomMod plugin) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ProtectArea.java b/src/main/java/me/totalfreedom/totalfreedommod/ProtectArea.java index 93df5101..69e96ae2 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/ProtectArea.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/ProtectArea.java @@ -14,7 +14,6 @@ import java.util.Set; import java.util.UUID; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.util.FLog; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; @@ -25,7 +24,7 @@ import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.util.Vector; -public class ProtectArea extends AbstractService +public class ProtectArea extends FreedomService { public static final double MAX_RADIUS = 50.0; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ServerInterface.java b/src/main/java/me/totalfreedom/totalfreedommod/ServerInterface.java index ce3ad321..a0ac51dd 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/ServerInterface.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/ServerInterface.java @@ -6,9 +6,8 @@ import java.util.List; import net.minecraft.server.v1_8_R3.EntityPlayer; import net.minecraft.server.v1_8_R3.MinecraftServer; import net.minecraft.server.v1_8_R3.PropertyManager; -import net.pravian.aero.component.service.AbstractService; -public class ServerInterface extends AbstractService +public class ServerInterface extends FreedomService { public static final String COMPILE_NMS_VERSION = "v1_8_R3"; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ServerPing.java b/src/main/java/me/totalfreedom/totalfreedommod/ServerPing.java index 63bfe340..31fedc13 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/ServerPing.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/ServerPing.java @@ -2,14 +2,13 @@ package me.totalfreedom.totalfreedommod; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.util.FUtil; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.server.ServerListPingEvent; -public class ServerPing extends AbstractService +public class ServerPing extends FreedomService { public ServerPing(TotalFreedomMod plugin) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ServiceChecker.java b/src/main/java/me/totalfreedom/totalfreedommod/ServiceChecker.java index e16a06c2..e9d2f595 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/ServiceChecker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/ServiceChecker.java @@ -16,7 +16,6 @@ import java.util.Map.Entry; import lombok.Getter; import lombok.Setter; import me.totalfreedom.totalfreedommod.config.ConfigEntry; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.ChatColor; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitTask; @@ -24,7 +23,7 @@ import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.JSONValue; -public class ServiceChecker extends AbstractService +public class ServiceChecker extends FreedomService { @Getter diff --git a/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java b/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java index e54ff073..5ed38c80 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java @@ -6,7 +6,6 @@ import java.util.List; import lombok.Getter; import lombok.Setter; import me.totalfreedom.totalfreedommod.rank.PlayerRank; -import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FUtil; import net.pravian.aero.base.ConfigLoadable; import net.pravian.aero.base.ConfigSavable; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java b/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java index 1ddf916b..59adc5b6 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java @@ -8,14 +8,14 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; import lombok.Getter; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.commands.Command_logs; -import me.totalfreedom.totalfreedommod.config.FConfig; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; -import net.pravian.aero.component.service.AbstractService; +import net.pravian.aero.config.YamlConfig; import net.pravian.aero.util.Ips; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -26,7 +26,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.plugin.ServicePriority; -public class AdminList extends AbstractService +public class AdminList extends FreedomService { @Getter @@ -38,13 +38,13 @@ public class AdminList extends AbstractService private final Map ipTable = Maps.newHashMap(); // private int cleanThreshold = 24 * 7; // 1 Week in hours - private final FConfig config; + private final YamlConfig config; public AdminList(TotalFreedomMod plugin) { super(plugin); - this.config = new FConfig(TotalFreedomMod.plugin, TotalFreedomMod.SUPERADMIN_FILENAME, true); + this.config = new YamlConfig(TotalFreedomMod.plugin, TotalFreedomMod.SUPERADMIN_FILENAME, true); } @Override diff --git a/src/main/java/me/totalfreedom/totalfreedommod/banning/BanManager.java b/src/main/java/me/totalfreedom/totalfreedommod/banning/BanManager.java index 2f467619..323d782e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/banning/BanManager.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/banning/BanManager.java @@ -9,12 +9,12 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.util.FUtil; -import net.pravian.aero.component.service.AbstractService; import net.pravian.aero.config.YamlConfig; import net.pravian.aero.util.Ips; import org.bukkit.entity.Player; @@ -23,7 +23,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerLoginEvent; -public class BanManager extends AbstractService +public class BanManager extends FreedomService { private final Set bans = Sets.newHashSet(); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/banning/PermbanList.java b/src/main/java/me/totalfreedom/totalfreedommod/banning/PermbanList.java index df97f44b..4960027e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/banning/PermbanList.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/banning/PermbanList.java @@ -4,18 +4,18 @@ import me.totalfreedom.totalfreedommod.util.FLog; import com.google.common.collect.Sets; import java.util.Set; import lombok.Getter; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.config.ConfigEntry; -import me.totalfreedom.totalfreedommod.config.FConfig; import me.totalfreedom.totalfreedommod.util.FUtil; -import net.pravian.aero.component.service.AbstractService; +import net.pravian.aero.config.YamlConfig; import net.pravian.aero.util.Ips; import org.bukkit.ChatColor; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerLoginEvent; -public class PermbanList extends AbstractService +public class PermbanList extends FreedomService { @Getter @@ -34,7 +34,7 @@ public class PermbanList extends AbstractService permbannedNames.clear(); permbannedIps.clear(); - final FConfig config = new FConfig(TotalFreedomMod.plugin, TotalFreedomMod.PERMBAN_FILENAME, true); + final YamlConfig config = new YamlConfig(TotalFreedomMod.plugin, TotalFreedomMod.PERMBAN_FILENAME, true); config.load(); for (String name : config.getKeys(false)) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/BlockBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/BlockBlocker.java index 839a62e0..befd5e90 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/BlockBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/BlockBlocker.java @@ -1,10 +1,10 @@ package me.totalfreedom.totalfreedommod.blocking; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -13,7 +13,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.inventory.ItemStack; -public class BlockBlocker extends AbstractService +public class BlockBlocker extends FreedomService { public BlockBlocker(TotalFreedomMod plugin) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java index 8da5c782..90ead70d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/EventBlocker.java @@ -1,8 +1,8 @@ package me.totalfreedom.totalfreedommod.blocking; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.config.ConfigEntry; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Projectile; @@ -21,7 +21,7 @@ import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.player.PlayerDropItemEvent; -public class EventBlocker extends AbstractService +public class EventBlocker extends FreedomService { public EventBlocker(TotalFreedomMod plugin) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java index 215d145c..49e6a933 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java @@ -1,9 +1,9 @@ package me.totalfreedom.totalfreedommod.blocking; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.FPlayer; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -12,7 +12,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; -public class InteractBlocker extends AbstractService +public class InteractBlocker extends FreedomService { public InteractBlocker(TotalFreedomMod plugin) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/MobBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/MobBlocker.java index 02073654..e9efce7b 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/MobBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/MobBlocker.java @@ -1,8 +1,8 @@ package me.totalfreedom.totalfreedommod.blocking; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.config.ConfigEntry; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.entity.Bat; import org.bukkit.entity.EnderDragon; import org.bukkit.entity.Entity; @@ -14,7 +14,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.CreatureSpawnEvent; -public class MobBlocker extends AbstractService +public class MobBlocker extends FreedomService { public MobBlocker(TotalFreedomMod plugin) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlocker.java index a184e91a..79bd24e3 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/command/CommandBlocker.java @@ -5,12 +5,12 @@ import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import net.pravian.aero.command.CommandReflection; -import net.pravian.aero.component.service.AbstractService; import org.apache.commons.lang3.StringUtils; import org.bukkit.command.Command; import org.bukkit.command.CommandMap; @@ -19,7 +19,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerCommandPreprocessEvent; -public class CommandBlocker extends AbstractService +public class CommandBlocker extends FreedomService { public static Pattern NUMBER_FLAG_PATTERN = Pattern.compile("(:([0-9]){5,})"); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/bridge/BukkitTelnetBridge.java b/src/main/java/me/totalfreedom/totalfreedommod/bridge/BukkitTelnetBridge.java index c2295bea..08ec7cb7 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/bridge/BukkitTelnetBridge.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/bridge/BukkitTelnetBridge.java @@ -5,15 +5,15 @@ import java.util.Map; import me.StevenLawson.BukkitTelnet.api.TelnetCommandEvent; import me.StevenLawson.BukkitTelnet.api.TelnetPreLoginEvent; import me.StevenLawson.BukkitTelnet.api.TelnetRequestDataTagsEvent; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.TotalFreedomMod; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -public class BukkitTelnetBridge extends AbstractService +public class BukkitTelnetBridge extends FreedomService { public BukkitTelnetBridge(TotalFreedomMod plugin) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/bridge/EssentialsBridge.java b/src/main/java/me/totalfreedom/totalfreedommod/bridge/EssentialsBridge.java index f4458308..40b41bc5 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/bridge/EssentialsBridge.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/bridge/EssentialsBridge.java @@ -2,14 +2,14 @@ package me.totalfreedom.totalfreedommod.bridge; import com.earth2me.essentials.Essentials; import com.earth2me.essentials.User; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.TotalFreedomMod; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.Bukkit; import org.bukkit.plugin.Plugin; -public class EssentialsBridge extends AbstractService +public class EssentialsBridge extends FreedomService { private Essentials essentialsPlugin = null; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldEditBridge.java b/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldEditBridge.java index 6c9d6eff..2908dc5f 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldEditBridge.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldEditBridge.java @@ -3,14 +3,14 @@ package me.totalfreedom.totalfreedommod.bridge; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.bukkit.BukkitPlayer; import com.sk89q.worldedit.bukkit.WorldEditPlugin; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.TotalFreedomMod; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -public class WorldEditBridge extends AbstractService +public class WorldEditBridge extends FreedomService { private static WorldEditPlugin worldEditPlugin = null; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/caging/Cager.java b/src/main/java/me/totalfreedom/totalfreedommod/caging/Cager.java index 6c66a252..c60bd6f5 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/caging/Cager.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/caging/Cager.java @@ -1,9 +1,9 @@ package me.totalfreedom.totalfreedommod.caging; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.util.FUtil; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.event.EventHandler; @@ -12,7 +12,7 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; -public class Cager extends AbstractService +public class Cager extends FreedomService { public Cager(TotalFreedomMod plugin) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/commands/CommandLoader.java b/src/main/java/me/totalfreedom/totalfreedommod/commands/CommandLoader.java index 313c9b69..337fb18a 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/commands/CommandLoader.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/commands/CommandLoader.java @@ -1,13 +1,13 @@ package me.totalfreedom.totalfreedommod.commands; import lombok.Getter; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.util.FLog; import net.pravian.aero.command.handler.SimpleCommandHandler; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.ChatColor; -public class CommandLoader extends AbstractService +public class CommandLoader extends FreedomService { @Getter diff --git a/src/main/java/me/totalfreedom/totalfreedommod/config/FConfig.java b/src/main/java/me/totalfreedom/totalfreedommod/config/FConfig.java deleted file mode 100644 index 26efa030..00000000 --- a/src/main/java/me/totalfreedom/totalfreedommod/config/FConfig.java +++ /dev/null @@ -1,175 +0,0 @@ -package me.totalfreedom.totalfreedommod.config; - -import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; -import me.totalfreedom.totalfreedommod.util.FUtil; -import org.apache.commons.lang3.exception.ExceptionUtils; -import org.bukkit.configuration.InvalidConfigurationException; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.plugin.Plugin; - -/** - * Represents a definable YAML configuration. - * - * @see YamlConfiguration - */ -public class FConfig extends YamlConfiguration // BukkitLib @ https://github.com/Pravian/BukkitLib -{ - - private final Plugin plugin; - private final File configFile; - private final boolean copyDefaults; - - /** - * Creates a new YamlConfig instance. - * - *

- * Example: - *

-     * YamlConfig config = new YamlConfig(this, "config.yml", true);
-     * config.load();
-     * 

- * - * @param plugin The plugin to which the config belongs. - * @param fileName The filename of the config file. - * @param copyDefaults If the defaults should be copied and/loaded from a config in the plugin jar-file. - */ - public FConfig(Plugin plugin, String fileName, boolean copyDefaults) - { - this(plugin, FUtil.getPluginFile(plugin, fileName), copyDefaults); - } - - /** - * Creates a new YamlConfig instance. - * - *

- * Example: - *

-     * YamlConfig config = new YamlConfig(this, new File(plugin.getDataFolder() + "/players", "Prozza.yml"), false);
-     * config.load();
-     * 

- * - * @param plugin The plugin to which the config belongs. - * @param file The file of the config file. - * @param copyDefaults If the defaults should be copied and/loaded from a config in the plugin jar-file. - */ - public FConfig(Plugin plugin, File file, boolean copyDefaults) - { - this.plugin = plugin; - this.configFile = file; - this.copyDefaults = copyDefaults; - } - - /** - * Validates if the configuration exists. - * - * @return True if the configuration exists. - */ - public boolean exists() - { - return configFile.exists(); - } - - /** - * Saves the configuration to the predefined file. - * - * @see #YamlConfig(Plugin, String, boolean) - */ - public void save() - { - try - { - super.save(configFile); - } - catch (Exception ex) - { - plugin.getLogger().severe("Could not save configuration file: " + configFile.getName()); - plugin.getLogger().severe(ExceptionUtils.getStackTrace(ex)); - } - } - - /** - * Loads the configuration from the predefined file. - * - *

- * Optionally, if loadDefaults has been set to true, the file will be copied over from the default inside the jar-file of the owning plugin.

- * - * @see #YamlConfig(Plugin, String, boolean) - */ - public void load() - { - try - { - if (copyDefaults) - { - if (!configFile.exists()) - { - configFile.getParentFile().mkdirs(); - try - { - FUtil.copy(plugin.getResource(configFile.getName()), configFile); - } - catch (IOException ex) - { - plugin.getLogger().severe("Could not write default configuration file: " + configFile.getName()); - plugin.getLogger().severe(ExceptionUtils.getStackTrace(ex)); - } - plugin.getLogger().info("Installed default configuration " + configFile.getName()); - } - - super.addDefaults(getDefaultConfig()); - } - - if (configFile.exists()) - { - super.load(configFile); - } - } - catch (Exception ex) - { - plugin.getLogger().severe("Could not load configuration file: " + configFile.getName()); - plugin.getLogger().severe(ExceptionUtils.getStackTrace(ex)); - } - } - - /** - * Returns the raw YamlConfiguration this config is based on. - * - * @return The YamlConfiguration. - * @see YamlConfiguration - */ - public YamlConfiguration getConfig() - { - return this; - } - - /** - * Returns the default configuration as been stored in the jar-file of the owning plugin. - * - * @return The default configuration. - */ - public YamlConfiguration getDefaultConfig() - { - final YamlConfiguration DEFAULT_CONFIG = new YamlConfiguration(); - try - { - final InputStreamReader isr = new InputStreamReader(plugin.getResource(configFile.getName())); - DEFAULT_CONFIG.load(isr); - isr.close(); - } - catch (IOException ex) - { - plugin.getLogger().severe("Could not load default configuration: " + configFile.getName()); - plugin.getLogger().severe(ExceptionUtils.getStackTrace(ex)); - return null; - } - catch (InvalidConfigurationException ex) - { - plugin.getLogger().severe("Could not load default configuration: " + configFile.getName()); - plugin.getLogger().severe(ExceptionUtils.getStackTrace(ex)); - return null; - } - return DEFAULT_CONFIG; - } -} diff --git a/src/main/java/me/totalfreedom/totalfreedommod/freeze/Freezer.java b/src/main/java/me/totalfreedom/totalfreedommod/freeze/Freezer.java index c81e81eb..f7692914 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/freeze/Freezer.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/freeze/Freezer.java @@ -1,15 +1,15 @@ package me.totalfreedom.totalfreedommod.freeze; import lombok.Getter; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.util.FUtil; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerMoveEvent; -public class Freezer extends AbstractService +public class Freezer extends FreedomService { @Getter diff --git a/src/main/java/me/totalfreedom/totalfreedommod/fun/ItemFun.java b/src/main/java/me/totalfreedom/totalfreedommod/fun/ItemFun.java index 365f474c..74c107e7 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/fun/ItemFun.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/fun/ItemFun.java @@ -3,12 +3,12 @@ package me.totalfreedom.totalfreedommod.fun; import java.util.ArrayList; import java.util.List; import java.util.Random; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.util.DepreciationAggregator; import me.totalfreedom.totalfreedommod.util.FUtil; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -22,7 +22,7 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; -public class ItemFun extends AbstractService +public class ItemFun extends FreedomService { private final Random random = new Random(); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/fun/Jumppads.java b/src/main/java/me/totalfreedom/totalfreedommod/fun/Jumppads.java index 46c84abc..2385bd21 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/fun/Jumppads.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/fun/Jumppads.java @@ -4,8 +4,8 @@ import com.google.common.collect.Maps; import java.util.Map; import lombok.Getter; import lombok.Setter; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.TotalFreedomMod; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; @@ -13,7 +13,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.util.Vector; -public class Jumppads extends AbstractService +public class Jumppads extends FreedomService { public static final Material BLOCK_ID = Material.WOOL; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/fun/Landminer.java b/src/main/java/me/totalfreedom/totalfreedommod/fun/Landminer.java index f2e7e0a7..a99d99b4 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/fun/Landminer.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/fun/Landminer.java @@ -4,9 +4,9 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import lombok.Getter; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.config.ConfigEntry; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; @@ -17,7 +17,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.util.Vector; -public class Landminer extends AbstractService +public class Landminer extends FreedomService { @Getter diff --git a/src/main/java/me/totalfreedom/totalfreedommod/fun/MP44.java b/src/main/java/me/totalfreedom/totalfreedommod/fun/MP44.java index 1bf7041e..763aa278 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/fun/MP44.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/fun/MP44.java @@ -1,12 +1,12 @@ package me.totalfreedom.totalfreedommod.fun; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.TotalFreedomMod; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerQuitEvent; -public class MP44 extends AbstractService +public class MP44 extends FreedomService { public MP44(TotalFreedomMod plugin) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/httpd/HTTPDaemon.java b/src/main/java/me/totalfreedom/totalfreedommod/httpd/HTTPDaemon.java index 1b5bca72..757d3c0e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/httpd/HTTPDaemon.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/httpd/HTTPDaemon.java @@ -13,17 +13,17 @@ import java.io.IOException; import java.util.concurrent.Callable; import java.util.regex.Matcher; import java.util.regex.Pattern; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD.HTTPSession; import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD.Response; import me.totalfreedom.totalfreedommod.util.FLog; -import net.pravian.aero.component.service.AbstractService; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.exception.ExceptionUtils; import org.bukkit.Bukkit; -public class HTTPDaemon extends AbstractService +public class HTTPDaemon extends FreedomService { public static String MIME_DEFAULT_BINARY = "application/octet-stream"; 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 6f90a9b3..642a7fad 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 @@ -13,7 +13,6 @@ import me.totalfreedom.totalfreedommod.commands.FreedomCommand; import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD; import static me.totalfreedom.totalfreedommod.httpd.HTMLGenerationTools.heading; import static me.totalfreedom.totalfreedommod.httpd.HTMLGenerationTools.paragraph; -import me.totalfreedom.totalfreedommod.rank.PlayerRank; import me.totalfreedom.totalfreedommod.rank.Rank; import net.pravian.aero.command.CommandReflection; import static org.apache.commons.lang3.StringEscapeUtils.escapeHtml4; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/player/PlayerData.java b/src/main/java/me/totalfreedom/totalfreedommod/player/PlayerData.java index b7b66410..78a14ce7 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/player/PlayerData.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/player/PlayerData.java @@ -1,11 +1,8 @@ package me.totalfreedom.totalfreedommod.player; import com.google.common.collect.Lists; -import com.google.common.collect.Sets; -import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.Set; import lombok.Getter; import lombok.Setter; import net.pravian.aero.base.ConfigLoadable; diff --git a/src/main/java/me/totalfreedom/totalfreedommod/player/PlayerList.java b/src/main/java/me/totalfreedom/totalfreedommod/player/PlayerList.java index 55930938..5aafa5b3 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/player/PlayerList.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/player/PlayerList.java @@ -5,11 +5,11 @@ import java.io.File; import java.util.Collection; import java.util.Map; import lombok.Getter; -import me.totalfreedom.totalfreedommod.config.FConfig; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.TotalFreedomMod; -import net.pravian.aero.component.service.AbstractService; +import net.pravian.aero.config.YamlConfig; import net.pravian.aero.util.Ips; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; @@ -18,7 +18,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerQuitEvent; -public class PlayerList extends AbstractService +public class PlayerList extends FreedomService { public static final long AUTO_PURGE_TICKS = 20L * 60L * 5L; @@ -62,7 +62,7 @@ public class PlayerList extends AbstractService { for (PlayerData data : dataMap.values()) { - FConfig config = getConfig(data); + YamlConfig config = getConfig(data); data.saveTo(config); config.save(); } @@ -132,7 +132,7 @@ public class PlayerList extends AbstractService dataMap.put(player.getName().toLowerCase(), data); // Save player - FConfig config = getConfig(data); + YamlConfig config = getConfig(data); data.saveTo(config); config.save(); } @@ -214,9 +214,9 @@ public class PlayerList extends AbstractService return new File(getConfigFolder(), name + ".yml"); } - protected FConfig getConfig(PlayerData data) + protected YamlConfig getConfig(PlayerData data) { - final FConfig config = new FConfig(TotalFreedomMod.plugin, getConfigFile(data.getUsername().toLowerCase()), false); + final YamlConfig config = new YamlConfig(TotalFreedomMod.plugin, getConfigFile(data.getUsername().toLowerCase()), false); config.load(); return config; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java b/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java index f0111969..f14ab308 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/rank/RankManager.java @@ -1,14 +1,13 @@ package me.totalfreedom.totalfreedommod.rank; import java.util.List; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.config.MainConfig; import me.totalfreedom.totalfreedommod.player.FPlayer; -import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.util.FUtil; -import net.pravian.aero.component.service.AbstractService; import net.pravian.aero.util.ChatUtils; import org.bukkit.ChatColor; import org.bukkit.GameMode; @@ -18,7 +17,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerJoinEvent; -public class RankManager extends AbstractService +public class RankManager extends FreedomService { public RankManager(TotalFreedomMod plugin) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/rollback/RollbackManager.java b/src/main/java/me/totalfreedom/totalfreedommod/rollback/RollbackManager.java index e2a87f55..bb220090 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/rollback/RollbackManager.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/rollback/RollbackManager.java @@ -7,10 +7,10 @@ import java.util.Iterator; import java.util.List; import java.util.ListIterator; import java.util.Map; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.util.DepreciationAggregator; import me.totalfreedom.totalfreedommod.util.FUtil; -import net.pravian.aero.component.service.AbstractService; import org.apache.commons.lang3.StringUtils; import org.bukkit.ChatColor; import org.bukkit.Location; @@ -23,7 +23,7 @@ import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.scheduler.BukkitRunnable; -public class RollbackManager extends AbstractService +public class RollbackManager extends FreedomService { private static final Map> history = Maps.newHashMap(); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java index 5aff51e4..0f950ce0 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java @@ -31,7 +31,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.banning.Ban; -import me.totalfreedom.totalfreedommod.config.FConfig; +import net.pravian.aero.config.YamlConfig; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import net.pravian.aero.util.Ips; import org.apache.commons.io.FileUtils; @@ -631,7 +631,7 @@ public class FUtil public static void createBackups(String file, boolean onlyWeekly) { final String save = file.split("\\.")[0]; - final FConfig config = new FConfig(TotalFreedomMod.plugin, "backup/backup.yml", false); + final YamlConfig config = new YamlConfig(TotalFreedomMod.plugin, "backup/backup.yml", false); config.load(); // Weekly diff --git a/src/main/java/me/totalfreedom/totalfreedommod/world/WorldManager.java b/src/main/java/me/totalfreedom/totalfreedommod/world/WorldManager.java index 47e09069..536a574a 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/world/WorldManager.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/world/WorldManager.java @@ -1,9 +1,9 @@ package me.totalfreedom.totalfreedommod.world; +import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.player.FPlayer; -import net.pravian.aero.component.service.AbstractService; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Player; @@ -14,7 +14,7 @@ import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.weather.ThunderChangeEvent; import org.bukkit.event.weather.WeatherChangeEvent; -public class WorldManager extends AbstractService +public class WorldManager extends FreedomService { public Flatlands flatlands;