diff --git a/Core/src/main/java/com/songoda/core/SongodaCore.java b/Core/src/main/java/com/songoda/core/SongodaCore.java index a9ff8c62..911a5678 100644 --- a/Core/src/main/java/com/songoda/core/SongodaCore.java +++ b/Core/src/main/java/com/songoda/core/SongodaCore.java @@ -88,10 +88,15 @@ public class SongodaCore { if(clazz.getSimpleName().equals("SongodaCore")) { try { // test to see if we're up to date - int otherVersion = (int) clazz.getMethod("getCoreVersion").invoke(null); + int otherVersion; + try { + otherVersion = (int) clazz.getMethod("getCoreVersion").invoke(null); + } catch (Exception ignore) { + otherVersion = -1; + } if(otherVersion >= getCoreVersion()) { // use the active service - // assuming that the other is greater than R6 ;) + // assuming that the other is greater than R6 if we get here ;) clazz.getMethod("registerPlugin", JavaPlugin.class, int.class, String.class, String.class).invoke(null, plugin, pluginID, icon, coreVersion); if(hasShading()) { diff --git a/Core/src/main/java/com/songoda/core/configuration/editor/ConfigEditorGui.java b/Core/src/main/java/com/songoda/core/configuration/editor/ConfigEditorGui.java index 1d226ba3..7a96df75 100644 --- a/Core/src/main/java/com/songoda/core/configuration/editor/ConfigEditorGui.java +++ b/Core/src/main/java/com/songoda/core/configuration/editor/ConfigEditorGui.java @@ -40,10 +40,9 @@ public class ConfigEditorGui extends SimplePagedGui { public ConfigEditorGui(JavaPlugin plugin, Gui parent, String file, MemoryConfiguration config) { this(plugin, parent, file, config, config); - setOnClose((gui) -> save()); } - public ConfigEditorGui(JavaPlugin plugin, Gui parent, String file, MemoryConfiguration config, ConfigurationSection node) { + protected ConfigEditorGui(JavaPlugin plugin, Gui parent, String file, MemoryConfiguration config, ConfigurationSection node) { super(parent); this.plugin = plugin; this.file = file; @@ -150,6 +149,7 @@ public class ConfigEditorGui extends SimplePagedGui { ++index; } + setOnClose((gui) -> save()); } public ConfigurationSection getCurrentNode() { diff --git a/Core/src/main/java/com/songoda/core/database/DataManagerAbstract.java b/Core/src/main/java/com/songoda/core/database/DataManagerAbstract.java index 57ae5388..604f70d6 100644 --- a/Core/src/main/java/com/songoda/core/database/DataManagerAbstract.java +++ b/Core/src/main/java/com/songoda/core/database/DataManagerAbstract.java @@ -52,4 +52,13 @@ public class DataManagerAbstract { public void async(Runnable runnable) { Bukkit.getScheduler().runTaskAsynchronously(this.plugin, runnable); } + + /** + * Queue a task to be run synchronously. + * + * @param runnable task to run on the next server tick + */ + public void sync(Runnable runnable) { + Bukkit.getScheduler().runTask(this.plugin, runnable); + } } diff --git a/Core/src/main/java/com/songoda/core/hooks/worldguard/WorldGuardFlagHandler.java b/Core/src/main/java/com/songoda/core/hooks/worldguard/WorldGuardFlagHandler.java index 05103431..7fd7c151 100644 --- a/Core/src/main/java/com/songoda/core/hooks/worldguard/WorldGuardFlagHandler.java +++ b/Core/src/main/java/com/songoda/core/hooks/worldguard/WorldGuardFlagHandler.java @@ -1,8 +1,3 @@ -/** - * Hooks for adding a custom WorldGuard flag - * - * Note: Hooks must be added before WG loads! - */ package com.songoda.core.hooks.worldguard; import com.sk89q.worldedit.bukkit.BukkitAdapter; @@ -29,6 +24,11 @@ import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.Location; +/** + * Hooks for adding a custom WorldGuard flag + * + * Note: Hooks must be added before WG loads! + */ public class WorldGuardFlagHandler { static Boolean wgPlugin = null;