From cf0ae06da9034b9d4dacf67cdbb9e7dbfc03aa6f Mon Sep 17 00:00:00 2001 From: tastybento Date: Mon, 23 Oct 2017 07:25:29 -0700 Subject: [PATCH] Version 3.0.8.1 Hotfix for API NPE https://github.com/tastybento/ASkyBlock-Bugs-N-Features/issues/513 --- pom.xml | 2 +- src/com/wasteofplastic/askyblock/ASkyBlock.java | 5 ++--- src/com/wasteofplastic/askyblock/ASkyBlockAPI.java | 10 ++++------ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 49f1d93a1..c684cbc52 100644 --- a/pom.xml +++ b/pom.xml @@ -201,6 +201,6 @@ http://maven.sk89q.com/repo/ - 3.0.8 + 3.0.8.1 This pom contains reference to a lot of servers that are not included in the GitHub repository because they are binary objects and maybe subject to copyright. These are used so that the NMS code that is used especially for pasting of islands can operate. Before you can build successfully, you need to put zero or more server binaries into the lib directory on your build machine. This version will match the version of the server you will use, for example 1.12. Then delete all the unneeded packages in com.wasteofplastic.askyblock.nms that you do not need or do not have. This will allow you to build. If you have no server binaries and delete all the packages, the Bukkit API will be used instead of NMS, which is slow and not recommended. Good luck! diff --git a/src/com/wasteofplastic/askyblock/ASkyBlock.java b/src/com/wasteofplastic/askyblock/ASkyBlock.java index 80420bbc7..7dd90a21b 100644 --- a/src/com/wasteofplastic/askyblock/ASkyBlock.java +++ b/src/com/wasteofplastic/askyblock/ASkyBlock.java @@ -253,6 +253,8 @@ public void onDisable() { public void onEnable() { // instance of this plugin plugin = this; + // Initialize the API + new ASkyBlockAPI(this); // Check server version - check for a class that only 1.8 has Class clazz; try { @@ -464,9 +466,6 @@ public void run() { // Give temp permissions playerEvents.giveAllTempPerms(); - // Initialize the API - ASkyBlockAPI.setInstance(new ASkyBlockAPI(plugin)); - getLogger().info("All files loaded. Ready to play..."); registerCustomCharts(); diff --git a/src/com/wasteofplastic/askyblock/ASkyBlockAPI.java b/src/com/wasteofplastic/askyblock/ASkyBlockAPI.java index 8b0659504..d5b4cf90e 100644 --- a/src/com/wasteofplastic/askyblock/ASkyBlockAPI.java +++ b/src/com/wasteofplastic/askyblock/ASkyBlockAPI.java @@ -52,15 +52,12 @@ public class ASkyBlockAPI { public static ASkyBlockAPI getInstance() { if (DEBUG) Bukkit.getLogger().info("DEBUG: ASkyBlock API, getInstance()"); + if (instance == null) + // Initialize the API + new ASkyBlockAPI(ASkyBlock.getPlugin()); return instance; } - /** - * @param instance the instance to set - */ - public static void setInstance(ASkyBlockAPI instance) { - ASkyBlockAPI.instance = instance; - } private ASkyBlock plugin; @@ -68,6 +65,7 @@ protected ASkyBlockAPI(ASkyBlock plugin) { this.plugin = plugin; if (DEBUG) Bukkit.getLogger().info("DEBUG: API constructed"); + instance = this; } /**