From 1afeff873c7fde9f3b1ae778e5fc37a433115781 Mon Sep 17 00:00:00 2001 From: Nathan Wolf Date: Thu, 12 Nov 2015 09:19:50 -0800 Subject: [PATCH] Only register Objective Listeners once. --- src/main/java/me/blackvein/quests/Quests.java | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/main/java/me/blackvein/quests/Quests.java b/src/main/java/me/blackvein/quests/Quests.java index 5de0d8272..2a7a8db15 100644 --- a/src/main/java/me/blackvein/quests/Quests.java +++ b/src/main/java/me/blackvein/quests/Quests.java @@ -672,6 +672,17 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener, count++; getLogger().info("Loaded Module: " + name + " by " + author); + try { + getServer().getPluginManager().registerEvents(objective, this); + getLogger().info("Registered events for custom objective \"" + name + "\""); + } catch (Exception ex) { + getLogger().warning("Failed to register events for custom objective \"" + name + "\". Does the objective class listen for events?"); + if (debug) { + getLogger().warning("Error log:"); + ex.printStackTrace(); + } + } + } } @@ -4203,20 +4214,6 @@ try{ oStage.customObjectives.add(found); oStage.customObjectiveCounts.add(count); oStage.customObjectiveData.add(data); - - try { - - getServer().getPluginManager().registerEvents(found, this); - getLogger().info("Registered events for custom objective \"" + name + "\" in Stage " + s2 + " of Quest \"" + quest.name + "\"."); - - } catch (Exception e) { - getLogger().warning("Failed to register events for custom objective \"" + name + "\" in Stage " + s2 + " of Quest \"" + quest.name + "\". Does the objective class listen for events?"); - if (debug) { - getLogger().warning("Error log:"); - e.printStackTrace(); - } - } - } }