挖了个天坑。
This commit is contained in:
		
							
								
								
									
										7
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								pom.xml
									
									
									
									
									
								
							@@ -126,6 +126,13 @@
 | 
			
		||||
            <scope>system</scope>
 | 
			
		||||
            <systemPath>${basedir}/libs/1_8_R3.jar</systemPath>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>bungeecord</groupId>
 | 
			
		||||
            <artifactId>bungeecord</artifactId>
 | 
			
		||||
            <version>1</version>
 | 
			
		||||
            <scope>system</scope>
 | 
			
		||||
            <systemPath>${basedir}/libs/BungeeCord.jar</systemPath>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>com.sun.tools</groupId>
 | 
			
		||||
            <artifactId>jshell</artifactId>
 | 
			
		||||
 
 | 
			
		||||
@@ -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<WatchService, Triple<File, Object, Consumer<Object>>> 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<Object> consumer) {
 | 
			
		||||
        try {
 | 
			
		||||
            WatchService service = FileSystems.getDefault().newWatchService();
 | 
			
		||||
@@ -82,5 +84,4 @@ public class TConfigWatcher {
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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");
 | 
			
		||||
        });
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										15
									
								
								src/main/java/me/skymc/taboolib/bungee/TabooLibBungee.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								src/main/java/me/skymc/taboolib/bungee/TabooLibBungee.java
									
									
									
									
									
										Normal file
									
								
							@@ -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();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -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) {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										5
									
								
								src/main/resources/bungee.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								src/main/resources/bungee.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
name: TabooLib
 | 
			
		||||
main: me.skymc.taboolib.bungee.TabooLibBungee
 | 
			
		||||
version: ${project.version}
 | 
			
		||||
 | 
			
		||||
author: [lzzelAliz, 坏黑]
 | 
			
		||||
@@ -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]
 | 
			
		||||
    permission: taboolib.admin
 | 
			
		||||
		Reference in New Issue
	
	Block a user