re-add sync.

This commit is contained in:
jascotty2 2019-09-19 15:15:27 -05:00
parent c6f2d5530d
commit 6e49b7b6d1
4 changed files with 23 additions and 9 deletions

View File

@ -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()) {

View File

@ -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() {

View File

@ -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);
}
}

View File

@ -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;