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