+ fix lag & update TMap
This commit is contained in:
		@@ -71,6 +71,11 @@ public class TabooLib {
 | 
				
			|||||||
        // 创建线程检测服务器是否关闭
 | 
					        // 创建线程检测服务器是否关闭
 | 
				
			||||||
        Executors.newSingleThreadExecutor().submit(() -> {
 | 
					        Executors.newSingleThreadExecutor().submit(() -> {
 | 
				
			||||||
            while (NMS.handle().isRunning()) {
 | 
					            while (NMS.handle().isRunning()) {
 | 
				
			||||||
 | 
					                try {
 | 
				
			||||||
 | 
					                    Thread.sleep(50);
 | 
				
			||||||
 | 
					                } catch (InterruptedException e) {
 | 
				
			||||||
 | 
					                    e.printStackTrace();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            // 保存数据
 | 
					            // 保存数据
 | 
				
			||||||
            Local.saveFiles();
 | 
					            Local.saveFiles();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -56,11 +56,11 @@ public class TMap {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static TMap parse(String in) {
 | 
					    public static TMap parse(String in) {
 | 
				
			||||||
        Matcher matcher = Pattern.compile("(?<name>[^{}]+)?\\{(?<content>[^<>]+)}").matcher(in);
 | 
					        Matcher matcher = Pattern.compile("(?<name>[^{}]+)?\\{(?<content>[^<>]+)}").matcher(in.replaceAll("[\r\n]", ""));
 | 
				
			||||||
        if (matcher.find()) {
 | 
					        if (matcher.find()) {
 | 
				
			||||||
            TMap map = new TMap(matcher.group("name"));
 | 
					            TMap map = new TMap(matcher.group("name"));
 | 
				
			||||||
            for (String content : matcher.group("content").split(";")) {
 | 
					            for (String content : matcher.group("content").split(";")) {
 | 
				
			||||||
                String[] v = content.split("=");
 | 
					                String[] v = parsePair(content);
 | 
				
			||||||
                if (v.length == 2) {
 | 
					                if (v.length == 2) {
 | 
				
			||||||
                    map.content.put(v[0].toLowerCase().trim(), v[1].trim());
 | 
					                    map.content.put(v[0].toLowerCase().trim(), v[1].trim());
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@@ -70,6 +70,18 @@ public class TMap {
 | 
				
			|||||||
        return new TMap(null);
 | 
					        return new TMap(null);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static String[] parsePair(String in) {
 | 
				
			||||||
 | 
					        String[] v = in.split("=");
 | 
				
			||||||
 | 
					        StringBuilder r = new StringBuilder();
 | 
				
			||||||
 | 
					        for (int i = 1; i < v.length; i++) {
 | 
				
			||||||
 | 
					            if (i > 1) {
 | 
				
			||||||
 | 
					                r.append("=");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            r.append(v[i]);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return new String[] {v[0], r.toString().replace("`", "")};
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public boolean equals(Object o) {
 | 
					    public boolean equals(Object o) {
 | 
				
			||||||
        if (this == o) {
 | 
					        if (this == o) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user