mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 14:05:25 +01:00
Centralizing event listener register to avoid issues
Fixing issue with chat entry no longer being recognized after plugin reload
This commit is contained in:
parent
f9ba65d56b
commit
f70027708e
@ -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) {
|
||||
|
@ -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 {
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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() {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user