Merge pull request #2 from NorbiPeti/master

Fix crash at plugin load

*seems legit*
This commit is contained in:
alisolarflare 2016-08-31 06:48:28 -04:00 committed by GitHub
commit 7bb679042a

View file

@ -8,20 +8,21 @@ 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;
public static Objective hardcoreTimeDead; public static Objective hardcoreTimeDead;
public static AbstractMap<String,String> deathMap = new HashMap<String,String>(); public static AbstractMap<String, String> deathMap = new HashMap<String, String>();
public void onEnable(){ public void onEnable() {
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));
} }