Fix crash at plugin load

This commit is contained in:
Norbi Peti 2016-08-30 18:17:37 +02:00
parent a566c95087
commit e30e60da28

View file

@ -8,7 +8,6 @@ import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Scoreboard; import org.bukkit.scoreboard.Scoreboard;
public class HelloWorldPlugin extends JavaPlugin { public class HelloWorldPlugin extends JavaPlugin {
public static Scoreboard board; public static Scoreboard board;
@ -19,8 +18,10 @@ public class HelloWorldPlugin extends JavaPlugin {
registerCommands(); registerCommands();
getServer().getPluginManager().registerEvents(new DeathListener(this), this); getServer().getPluginManager().registerEvents(new DeathListener(this), this);
board = Bukkit.getServer().getScoreboardManager().getMainScoreboard(); board = Bukkit.getServer().getScoreboardManager().getMainScoreboard();
if (board.getObjective("hardcoreTimeDead") == null)
hardcoreTimeDead = board.registerNewObjective("hardcoreTimeDead", "dummy"); hardcoreTimeDead = board.registerNewObjective("hardcoreTimeDead", "dummy");
} }
public void registerCommands() { public void registerCommands() {
getCommand("HelloWorld").setExecutor(new HelloWorld(this)); getCommand("HelloWorld").setExecutor(new HelloWorld(this));
} }