Merge remote-tracking branch 'origin/master'
This commit is contained in:
		@@ -70,7 +70,7 @@ public class SimpleReflection {
 | 
			
		||||
        }
 | 
			
		||||
        Field field = fields.get(fieldName);
 | 
			
		||||
        if (value == null) {
 | 
			
		||||
            TLogger.getGlobalLogger().error("Field Not Found: " + nmsClass.getName());
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        try {
 | 
			
		||||
            field.set(instance, value);
 | 
			
		||||
@@ -86,7 +86,7 @@ public class SimpleReflection {
 | 
			
		||||
        }
 | 
			
		||||
        Field field = fields.get(fieldName);
 | 
			
		||||
        if (field == null) {
 | 
			
		||||
            TLogger.getGlobalLogger().error("Field Not Found: " + nmsClass.getName());
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
        try {
 | 
			
		||||
            return field.get(instance);
 | 
			
		||||
@@ -103,7 +103,7 @@ public class SimpleReflection {
 | 
			
		||||
        }
 | 
			
		||||
        Field field = fields.get(fieldName);
 | 
			
		||||
        if (field == null) {
 | 
			
		||||
            TLogger.getGlobalLogger().error("Field Not Found: " + nmsClass.getName());
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
        try {
 | 
			
		||||
            return (T) field.get(instance);
 | 
			
		||||
 
 | 
			
		||||
@@ -4,9 +4,9 @@ import com.google.common.collect.ImmutableList;
 | 
			
		||||
import com.google.common.collect.Lists;
 | 
			
		||||
import com.google.common.collect.Maps;
 | 
			
		||||
import io.izzel.taboolib.TabooLib;
 | 
			
		||||
import io.izzel.taboolib.module.compat.PlaceholderHook;
 | 
			
		||||
import io.izzel.taboolib.module.locale.TLocale;
 | 
			
		||||
import io.izzel.taboolib.module.locale.TLocaleSerialize;
 | 
			
		||||
import io.izzel.taboolib.module.compat.PlaceholderHook;
 | 
			
		||||
import io.izzel.taboolib.module.tellraw.TellrawJson;
 | 
			
		||||
import io.izzel.taboolib.util.Strings;
 | 
			
		||||
import io.izzel.taboolib.util.Variables;
 | 
			
		||||
@@ -77,6 +77,8 @@ public class TLocaleJson extends TLocaleSerialize {
 | 
			
		||||
                                Arrays.stream(component).forEach(baseComponent -> baseComponent.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, String.valueOf(value))));
 | 
			
		||||
                            } else if (key.equalsIgnoreCase("command") || "commands".equalsIgnoreCase(key)) {
 | 
			
		||||
                                Arrays.stream(component).forEach(baseComponent -> baseComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, String.valueOf(value))));
 | 
			
		||||
                            } else if (key.equalsIgnoreCase("url")) {
 | 
			
		||||
                                Arrays.stream(component).forEach(baseComponent -> baseComponent.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, String.valueOf(value))));
 | 
			
		||||
                            } else if (key.equalsIgnoreCase("hover")) {
 | 
			
		||||
                                Arrays.stream(component).forEach(baseComponent -> baseComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(TLocale.Translate.setColored(String.valueOf(value))).create())));
 | 
			
		||||
                            }
 | 
			
		||||
 
 | 
			
		||||
@@ -39,13 +39,13 @@ public class Catchers implements Listener {
 | 
			
		||||
            e.setCancelled(true);
 | 
			
		||||
            // 1.14 supported.
 | 
			
		||||
            Bukkit.getScheduler().runTask(TabooLib.getPlugin(), () -> {
 | 
			
		||||
                Catcher catcher = playerdata.get(e.getPlayer().getName()).getFirst();
 | 
			
		||||
                // 退出
 | 
			
		||||
                if (e.getMessage().equalsIgnoreCase("quit()")) {
 | 
			
		||||
                if (e.getMessage().split(" ")[0].matches(catcher.quit())) {
 | 
			
		||||
                    playerdata.get(e.getPlayer().getName()).removeFirst().cancel();
 | 
			
		||||
                }
 | 
			
		||||
                // 默认
 | 
			
		||||
                else {
 | 
			
		||||
                    Catcher catcher = playerdata.get(e.getPlayer().getName()).getFirst();
 | 
			
		||||
                    // 如果终止引导
 | 
			
		||||
                    if (!catcher.after(e.getMessage())) {
 | 
			
		||||
                        playerdata.get(e.getPlayer().getName()).removeFirst();
 | 
			
		||||
@@ -59,6 +59,10 @@ public class Catchers implements Listener {
 | 
			
		||||
 | 
			
		||||
    public interface Catcher {
 | 
			
		||||
 | 
			
		||||
        default String quit() {
 | 
			
		||||
            return "(?i)quit|cancel|exit";
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        default Catcher before() {
 | 
			
		||||
            return this;
 | 
			
		||||
        }
 | 
			
		||||
@@ -67,5 +71,6 @@ public class Catchers implements Listener {
 | 
			
		||||
 | 
			
		||||
        default void cancel() {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user