From e30e60da28bb62c42df2bf24d8880e24e5f9e0dd Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Tue, 30 Aug 2016 18:17:37 +0200 Subject: [PATCH] Fix crash at plugin load --- src/iie/HelloWorldPlugin.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/iie/HelloWorldPlugin.java b/src/iie/HelloWorldPlugin.java index 382729e..4061f63 100644 --- a/src/iie/HelloWorldPlugin.java +++ b/src/iie/HelloWorldPlugin.java @@ -8,20 +8,21 @@ import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Scoreboard; - public class HelloWorldPlugin extends JavaPlugin { - + public static Scoreboard board; - public static Objective hardcoreTimeDead; - public static AbstractMap deathMap = new HashMap(); - - public void onEnable(){ + public static Objective hardcoreTimeDead; + public static AbstractMap deathMap = new HashMap(); + + public void onEnable() { registerCommands(); getServer().getPluginManager().registerEvents(new DeathListener(this), this); board = Bukkit.getServer().getScoreboardManager().getMainScoreboard(); - hardcoreTimeDead = board.registerNewObjective("hardcoreTimeDead", "dummy"); + if (board.getObjective("hardcoreTimeDead") == null) + hardcoreTimeDead = board.registerNewObjective("hardcoreTimeDead", "dummy"); } - public void registerCommands(){ + + public void registerCommands() { getCommand("HelloWorld").setExecutor(new HelloWorld(this)); }