diff --git a/pom.xml b/pom.xml index 2d1035b..2453cde 100644 --- a/pom.xml +++ b/pom.xml @@ -126,6 +126,13 @@ system ${basedir}/libs/1_8_R3.jar + + bungeecord + bungeecord + 1 + system + ${basedir}/libs/BungeeCord.jar + com.sun.tools jshell diff --git a/src/main/java/com/ilummc/tlib/inject/TConfigWatcher.java b/src/main/java/com/ilummc/tlib/inject/TConfigWatcher.java index b520d7d..95ef971 100644 --- a/src/main/java/com/ilummc/tlib/inject/TConfigWatcher.java +++ b/src/main/java/com/ilummc/tlib/inject/TConfigWatcher.java @@ -19,9 +19,7 @@ import java.util.function.Consumer; */ public class TConfigWatcher { - private final ScheduledExecutorService service = Executors.newScheduledThreadPool(1, - new BasicThreadFactory.Builder().namingPattern("TConfigWatcherService-%d").build()); - + private final ScheduledExecutorService service = Executors.newScheduledThreadPool(1, new BasicThreadFactory.Builder().namingPattern("TConfigWatcherService-%d").build()); private final Map>> map = new HashMap<>(); public TConfigWatcher() { @@ -42,6 +40,10 @@ public class TConfigWatcher { }, 1000, 100, TimeUnit.MILLISECONDS); } + public void addSimpleListener(File file, Runnable runnable) { + addListener(file, null, obj -> runnable.run()); + } + public void addOnListen(File file, Object obj, Consumer consumer) { try { WatchService service = FileSystems.getDefault().newWatchService(); @@ -82,5 +84,4 @@ public class TConfigWatcher { } }); } - } diff --git a/src/main/java/me/skymc/taboolib/Main.java b/src/main/java/me/skymc/taboolib/Main.java index 6185548..3b49c29 100644 --- a/src/main/java/me/skymc/taboolib/Main.java +++ b/src/main/java/me/skymc/taboolib/Main.java @@ -148,7 +148,7 @@ public class Main extends JavaPlugin implements Listener { // 启动脚本 JavaShell.javaShellSetup(); // 注册脚本 - SkriptHandler.getInst(); + SkriptHandler.register(); // 注册头衔 TagDataHandler.init(this); // 载入语言文件 @@ -167,7 +167,7 @@ public class Main extends JavaPlugin implements Listener { Bukkit.getScheduler().runTaskTimerAsynchronously(this, () -> PlayerDataManager.saveAllCaches(true, false), 20, 20 * 60); // 文件监控 - TLib.getTLib().getConfigWatcher().addListener(new File(getDataFolder(), "config.yml"), null, obj -> { + TLib.getTLib().getConfigWatcher().addSimpleListener(new File(getDataFolder(), "config.yml"), () -> { reloadConfig(); TLocale.Logger.info("CONFIG.RELOAD-SUCCESS", inst.getName(), "config.yml"); }); diff --git a/src/main/java/me/skymc/taboolib/bungee/TabooLibBungee.java b/src/main/java/me/skymc/taboolib/bungee/TabooLibBungee.java new file mode 100644 index 0000000..c10479c --- /dev/null +++ b/src/main/java/me/skymc/taboolib/bungee/TabooLibBungee.java @@ -0,0 +1,15 @@ +package me.skymc.taboolib.bungee; + +import net.md_5.bungee.api.plugin.Plugin; + +/** + * @Author sky + * @Since 2018-08-09 11:47 + */ +public class TabooLibBungee extends Plugin { + + @Override + public void onEnable() { + super.onEnable(); + } +} diff --git a/src/main/java/me/skymc/taboolib/skript/SkriptHandler.java b/src/main/java/me/skymc/taboolib/skript/SkriptHandler.java index 9b88a78..909e87d 100644 --- a/src/main/java/me/skymc/taboolib/skript/SkriptHandler.java +++ b/src/main/java/me/skymc/taboolib/skript/SkriptHandler.java @@ -12,24 +12,14 @@ import org.bukkit.inventory.ItemStack; * @since 2018-02-28 15:40:55 */ public class SkriptHandler { - - private static SkriptHandler inst = null; - - private SkriptHandler() { - if (Bukkit.getPluginManager().getPlugin("Skript") != null) { - Skript.registerExpression(ExpressionItemCache.class, ItemStack.class, ExpressionType.SIMPLE, "taboolib itemcache %string%"); - Skript.registerExpression(ExpressionTabooCodeItem.class, ItemStack.class, ExpressionType.SIMPLE, "taboocode itemcache %string%"); - } - } - - public static SkriptHandler getInst() { - if (inst == null) { - synchronized (SkriptHandler.class) { - if (inst == null) { - inst = new SkriptHandler(); - } - } - } - return inst; - } + + public static void register() { + if (Bukkit.getPluginManager().getPlugin("Skript") != null) { + try { + Skript.registerExpression(ExpressionItemCache.class, ItemStack.class, ExpressionType.SIMPLE, "taboolib itemcache %string%"); + Skript.registerExpression(ExpressionTabooCodeItem.class, ItemStack.class, ExpressionType.SIMPLE, "taboocode itemcache %string%"); + } catch (Exception ignored) { + } + } + } } diff --git a/src/main/resources/bungee.yml b/src/main/resources/bungee.yml new file mode 100644 index 0000000..1ac27bb --- /dev/null +++ b/src/main/resources/bungee.yml @@ -0,0 +1,5 @@ +name: TabooLib +main: me.skymc.taboolib.bungee.TabooLibBungee +version: ${project.version} + +author: [lzzelAliz, 坏黑] \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 2a0c06d..837e4a6 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,13 +1,11 @@ - name: TabooLib - -authors: [坏黑] -website: http://www.15imc.com/index.html - main: me.skymc.taboolib.Main - version: ${project.version} +author: [lzzelAliz, 坏黑] +depend: [Vault] +softdepend: [PlaceholderAPI, Skript, MassiveLag] + commands: taboolib: aliases: [tlib] @@ -28,7 +26,4 @@ commands: aliases: [tlm] translateuuid: aliases: 'tuuid' - permission: taboolib.admin - -depend: [Vault] -softdepend: [PlaceholderAPI, Skript, MassiveLag] \ No newline at end of file + permission: taboolib.admin \ No newline at end of file