From 4b1cbd6349d22529a390f4e5fe1887364aa6f5ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9D=8F=E9=BB=91?= Date: Thu, 30 May 2019 21:12:21 +0800 Subject: [PATCH] + fixed tellrawJson --- .../scala/me/skymc/taboolib/json/tellraw/TellrawJson.java | 4 +++- .../me/skymc/taboolib/listener/ListenerPlayerCommand.java | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/scala/me/skymc/taboolib/json/tellraw/TellrawJson.java b/src/main/scala/me/skymc/taboolib/json/tellraw/TellrawJson.java index 265c8fa..12e0fb0 100644 --- a/src/main/scala/me/skymc/taboolib/json/tellraw/TellrawJson.java +++ b/src/main/scala/me/skymc/taboolib/json/tellraw/TellrawJson.java @@ -17,6 +17,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * @Author sky @@ -166,8 +167,9 @@ public class TellrawJson { } public BaseComponent[] getComponentsAll() { + List components = this.components.stream().filter(component -> !(component instanceof TextComponent) || !((TextComponent) component).getText().isEmpty()).collect(Collectors.toList()); this.componentsLatest.stream().filter(component -> !(component instanceof TextComponent) || !((TextComponent) component).getText().isEmpty()).forEach(components::add); - return this.components.stream().filter(component -> !(component instanceof TextComponent) || !((TextComponent) component).getText().isEmpty()).toArray(BaseComponent[]::new); + return components.toArray(new BaseComponent[0]); } @Deprecated diff --git a/src/main/scala/me/skymc/taboolib/listener/ListenerPlayerCommand.java b/src/main/scala/me/skymc/taboolib/listener/ListenerPlayerCommand.java index f8086b4..0b0f990 100644 --- a/src/main/scala/me/skymc/taboolib/listener/ListenerPlayerCommand.java +++ b/src/main/scala/me/skymc/taboolib/listener/ListenerPlayerCommand.java @@ -55,8 +55,10 @@ public class ListenerPlayerCommand implements Listener { if (TabooLib.getVerint() > 10700) { e.setCancelled(true); } - Bukkit.getScheduler().runTask(Main.getInst(), DataUtils::saveAllCaches); - Bukkit.getScheduler().runTask(Main.getInst(), () -> PlayerDataManager.saveAllCaches(true, false)); + Bukkit.getScheduler().runTask(Main.getInst(), () -> { + DataUtils.saveAllCaches(); + PlayerDataManager.saveAllCaches(true, false); + }); TLogger.getGlobalLogger().info("Successfully."); } else if (e.getCommand().equalsIgnoreCase("tDebug")) { if (TabooLib.getVerint() > 10700) {