diff --git a/src/main/java/com/gamingmesh/jobs/Jobs.java b/src/main/java/com/gamingmesh/jobs/Jobs.java index 4a36e80f..0fde683a 100644 --- a/src/main/java/com/gamingmesh/jobs/Jobs.java +++ b/src/main/java/com/gamingmesh/jobs/Jobs.java @@ -751,22 +751,8 @@ public final class Jobs extends JavaPlugin { new YmlMaker(getFolder(), "Signs.yml").saveDefaultConfig(); } - // register the listeners - if (Version.isCurrentEqualOrHigher(Version.v1_9_R1)) { - getServer().getPluginManager().registerEvents(new com.gamingmesh.jobs.listeners.Listener1_9(), getInstance()); - } - - getServer().getPluginManager().registerEvents(new JobsListener(this), this); - getServer().getPluginManager().registerEvents(new JobsPaymentListener(this), this); - if (Version.isCurrentEqualOrHigher(Version.v1_14_R1)) { - getServer().getPluginManager().registerEvents(new JobsPayment14Listener(), this); - } - HookManager.loadHooks(); - - if (getGCManager().useBlockProtection) { - getServer().getPluginManager().registerEvents(new PistonProtectionListener(), this); - } + registerListeners(); if (Version.isCurrentEqualOrHigher(Version.v1_16_R3) && kyoriSupported) { complement = new Complement2(); @@ -774,7 +760,6 @@ public final class Jobs extends JavaPlugin { } else { complement = new Complement1(); } - getServer().getPluginManager().registerEvents(new JobsChatEvent(this), this); // register economy getServer().getScheduler().runTask(this, new HookEconomyTask(this)); @@ -794,6 +779,34 @@ public final class Jobs extends JavaPlugin { CMIMessages.consoleMessage(suffix); } + private static void registerListeners() { + + org.bukkit.plugin.PluginManager pm = getInstance().getServer().getPluginManager(); + + if (Version.isCurrentEqualOrHigher(Version.v1_9_R1)) { + pm.registerEvents(new com.gamingmesh.jobs.listeners.Listener1_9(), getInstance()); + } + + pm.registerEvents(new JobsListener(getInstance()), getInstance()); + pm.registerEvents(new JobsPaymentListener(getInstance()), getInstance()); + if (Version.isCurrentEqualOrHigher(Version.v1_14_R1)) { + pm.registerEvents(new JobsPayment14Listener(), getInstance()); + } + + if (getGCManager().useBlockProtection) { + pm.registerEvents(new PistonProtectionListener(), getInstance()); + } + + pm.registerEvents(new JobsChatEvent(getInstance()), getInstance()); + + if (HookManager.getMcMMOManager().CheckmcMMO()) { + HookManager.setMcMMOlistener(); + } + if (HookManager.checkMythicMobs()) { + HookManager.getMythicManager().registerListener(); + } + } + public static void reload() { reload(false); } @@ -801,30 +814,8 @@ public final class Jobs extends JavaPlugin { public static void reload(boolean startup) { // unregister all registered listeners by this plugin and register again if (!startup) { - org.bukkit.plugin.PluginManager pm = getInstance().getServer().getPluginManager(); - HandlerList.unregisterAll(getInstance()); - - if (Version.isCurrentEqualOrHigher(Version.v1_9_R1)) { - pm.registerEvents(new com.gamingmesh.jobs.listeners.Listener1_9(), getInstance()); - } - - pm.registerEvents(new JobsListener(getInstance()), getInstance()); - pm.registerEvents(new JobsPaymentListener(getInstance()), getInstance()); - if (Version.isCurrentEqualOrHigher(Version.v1_14_R1)) { - pm.registerEvents(new JobsPayment14Listener(), getInstance()); - } - - if (getGCManager().useBlockProtection) { - pm.registerEvents(new PistonProtectionListener(), getInstance()); - } - - if (HookManager.getMcMMOManager().CheckmcMMO()) { - HookManager.setMcMMOlistener(); - } - if (HookManager.checkMythicMobs()) { - HookManager.getMythicManager().registerListener(); - } + registerListeners(); } if (saveTask != null) { diff --git a/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java b/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java index 4976d419..0328a11e 100644 --- a/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java +++ b/src/main/java/com/gamingmesh/jobs/Placeholders/Placeholder.java @@ -16,7 +16,6 @@ import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.commands.JobsCommands; import com.gamingmesh.jobs.container.Boost; import com.gamingmesh.jobs.container.CurrencyType; import com.gamingmesh.jobs.container.Job; @@ -33,7 +32,6 @@ import com.gamingmesh.jobs.stuff.TimeManage; import net.Zrips.CMILib.Colors.CMIChatColor; import net.Zrips.CMILib.Container.CMIList; import net.Zrips.CMILib.Locale.LC; -import net.Zrips.CMILib.Logs.CMIDebug; public class Placeholder { diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/archive.java b/src/main/java/com/gamingmesh/jobs/commands/list/archive.java index 43c5ae3f..d8f2bb7c 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/archive.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/archive.java @@ -39,7 +39,7 @@ public class archive implements Cmd { sender.sendMessage(Jobs.getLanguage().getMessage("command.archive.error.nojob")); return true; } - + sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", jPlayer.getName())); for (JobProgression jobInfo : allJobs) { RawMessage rm = new RawMessage(); diff --git a/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java b/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java index 13152a3a..084e2ad8 100644 --- a/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java +++ b/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java @@ -15,8 +15,6 @@ import com.gamingmesh.jobs.hooks.WorldGuard.WorldGuardManager; import com.gamingmesh.jobs.hooks.stackMob.StackMobHandler; import com.gamingmesh.jobs.hooks.wildStacker.WildStackerHandler; -import net.Zrips.CMILib.Logs.CMIDebug; - public class HookManager { private static McMMOManager McMMOManager; @@ -33,18 +31,11 @@ public class HookManager { public static void loadHooks() { pm = PLUGIN.getServer().getPluginManager(); - if (getMcMMOManager().CheckmcMMO()) - setMcMMOlistener(); - setMyPetManager(); setWorldGuard(); setMythicManager(); setStackMobHandler(); setWildStackerHandler(); - - if (checkMythicMobs()) { - MythicManager.registerListener(); - } } public static StackMobHandler getStackMobHandler() { diff --git a/src/main/java/com/gamingmesh/jobs/hooks/McMMO/McMMO1_X_listener.java b/src/main/java/com/gamingmesh/jobs/hooks/McMMO/McMMO1_X_listener.java index 37ebff8d..ad0ceb62 100644 --- a/src/main/java/com/gamingmesh/jobs/hooks/McMMO/McMMO1_X_listener.java +++ b/src/main/java/com/gamingmesh/jobs/hooks/McMMO/McMMO1_X_listener.java @@ -16,7 +16,6 @@ import com.gamingmesh.jobs.hooks.HookManager; import com.gamingmesh.jobs.listeners.JobsPaymentListener; import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent; import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityDeactivateEvent; -import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent; import com.gmail.nossr50.events.skills.repair.McMMOPlayerRepairCheckEvent; public class McMMO1_X_listener implements Listener { diff --git a/src/main/java/com/gamingmesh/jobs/hooks/McMMO/McMMO2_X_listener.java b/src/main/java/com/gamingmesh/jobs/hooks/McMMO/McMMO2_X_listener.java index 5345f8a9..6601b861 100644 --- a/src/main/java/com/gamingmesh/jobs/hooks/McMMO/McMMO2_X_listener.java +++ b/src/main/java/com/gamingmesh/jobs/hooks/McMMO/McMMO2_X_listener.java @@ -14,10 +14,8 @@ import com.gamingmesh.jobs.actions.ItemActionInfo; import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.hooks.HookManager; -import com.gamingmesh.jobs.listeners.JobsPaymentListener; import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent; import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityDeactivateEvent; -import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent; import com.gmail.nossr50.events.skills.repair.McMMOPlayerRepairCheckEvent; public class McMMO2_X_listener implements Listener {