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) {