Revert registration delay, didn't seem to help.

This commit is contained in:
Nathan Wolf 2015-11-12 21:49:10 -08:00
parent b623f5eec8
commit 2abb699f4e

View File

@ -57,7 +57,6 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.PlayerInventory;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
@ -666,29 +665,24 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
Class<? extends CustomObjective> objectiveClass = c.asSubclass(CustomObjective.class); Class<? extends CustomObjective> objectiveClass = c.asSubclass(CustomObjective.class);
Constructor<? extends CustomObjective> cstrctr = objectiveClass.getConstructor(); Constructor<? extends CustomObjective> cstrctr = objectiveClass.getConstructor();
final CustomObjective objective = cstrctr.newInstance(); CustomObjective objective = cstrctr.newInstance();
customObjectives.add(objective); customObjectives.add(objective);
final String name = objective.getName() == null ? "[" + jar.getName() + "]" : objective.getName(); String name = objective.getName() == null ? "[" + jar.getName() + "]" : objective.getName();
String author = objective.getAuthor() == null ? "[Unknown]" : objective.getAuthor(); String author = objective.getAuthor() == null ? "[Unknown]" : objective.getAuthor();
count++; count++;
getLogger().info("Loaded Module: " + name + " by " + author); getLogger().info("Loaded Module: " + name + " by " + author);
final Plugin plugin = this;
getServer().getScheduler().runTaskLater(this, new Runnable() { try {
@Override getServer().getPluginManager().registerEvents(objective, this);
public void run() { getLogger().info("Registered events for custom objective \"" + name + "\"");
try { } catch (Exception ex) {
getServer().getPluginManager().registerEvents(objective, plugin); getLogger().warning("Failed to register events for custom objective \"" + name + "\". Does the objective class listen for events?");
getLogger().info("Registered events for custom objective \"" + name + "\""); if (debug) {
} catch (Exception ex) { getLogger().warning("Error log:");
getLogger().warning("Failed to register events for custom objective \"" + name + "\". Does the objective class listen for events?"); ex.printStackTrace();
if (debug) {
getLogger().warning("Error log:");
ex.printStackTrace();
}
}
} }
}, 20); }
} }
} }