From 9d9837dcbc0dee54799bb260ade7dcbafaba4ac1 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sun, 3 Nov 2019 14:15:41 -0800 Subject: [PATCH] Fixed bug with nullable --- .../java/world/bentobox/acidisland/AcidIsland.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/world/bentobox/acidisland/AcidIsland.java b/src/main/java/world/bentobox/acidisland/AcidIsland.java index 427c729..73a25d9 100644 --- a/src/main/java/world/bentobox/acidisland/AcidIsland.java +++ b/src/main/java/world/bentobox/acidisland/AcidIsland.java @@ -5,6 +5,7 @@ import org.bukkit.WorldCreator; import org.bukkit.WorldType; import org.bukkit.generator.ChunkGenerator; import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; import world.bentobox.acidisland.commands.AcidCommand; import world.bentobox.acidisland.commands.AiCommand; @@ -24,9 +25,9 @@ import world.bentobox.bentobox.lists.Flags; */ public class AcidIsland extends GameModeAddon { - private AISettings settings; - private AcidTask acidTask; - private @NonNull ChunkGenerator chunkGenerator; + private @Nullable AISettings settings; + private @Nullable AcidTask acidTask; + private @Nullable ChunkGenerator chunkGenerator; private Config config = new Config<>(this, AISettings.class); private static final String NETHER = "_nether"; @@ -78,10 +79,11 @@ public class AcidIsland extends GameModeAddon { } @Override - public void onDisable(){ - acidTask.cancelTasks(); + public void onDisable() { + if (acidTask != null) acidTask.cancelTasks(); } + @Nullable public AISettings getSettings() { return settings; }