Only register Objective Listeners once.

This commit is contained in:
Nathan Wolf 2015-11-12 09:19:50 -08:00
parent 2389adb648
commit 1afeff873c

View File

@ -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();
}
}
}
}