From 333493f35107d61ed1fd84645fc2f99e9e5df5a6 Mon Sep 17 00:00:00 2001 From: Mariell Hoversholm Date: Sat, 17 Oct 2020 21:45:43 +0200 Subject: [PATCH] adventure v4.1.0; project now compiles --- .../plotsquared/bukkit/listener/PlayerEventListener.java | 5 +++-- Core/build.gradle.kts | 2 +- .../main/java/com/plotsquared/core/command/Debug.java | 2 +- .../src/main/java/com/plotsquared/core/command/Help.java | 9 +++++---- .../main/java/com/plotsquared/core/command/Inbox.java | 2 +- .../java/com/plotsquared/core/player/PlotPlayer.java | 2 +- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java index 496d19482..bdf51d45a 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java @@ -82,6 +82,7 @@ import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.world.block.BlockType; import io.papermc.lib.PaperLib; +import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.minimessage.Template; import org.bukkit.Bukkit; @@ -685,7 +686,7 @@ public class PlayerEventListener extends PlotListener implements Listener { .of("msg", BukkitUtil.LEGACY_COMPONENT_SERIALIZER.deserialize(ChatColor.translateAlternateColorCodes('&', message))); } else { msgTemplate = Template.of("msg", BukkitUtil.MINI_MESSAGE.deserialize( - ChatColor.stripColor(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(TextComponent.builder(message).build())))); + ChatColor.stripColor(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(Component.text(message))))); } for (PlotPlayer receiver : plotRecipients) { receiver.sendMessage(msg, msgTemplate, plotTemplate, senderTemplate); @@ -694,7 +695,7 @@ public class PlayerEventListener extends PlotListener implements Listener { Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format"); Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY()); Template spysenderTemplate = Template.of("sender", sender); - Template spymessageTemplate = Template.of("msg", TextComponent.builder(message).build()); + Template spymessageTemplate = Template.of("msg", Component.text(message)); for (PlotPlayer player : spies) { player.sendMessage(spymsg, plotidTemplate, spysenderTemplate, spymessageTemplate); } diff --git a/Core/build.gradle.kts b/Core/build.gradle.kts index b886a9407..423aca3ac 100644 --- a/Core/build.gradle.kts +++ b/Core/build.gradle.kts @@ -12,7 +12,7 @@ dependencies { compileOnlyApi("org.yaml:snakeyaml:1.26") // Some platforms provide this // Adventure stuff - api("net.kyori:adventure-api:4.0.0-SNAPSHOT") + api("net.kyori:adventure-api:4.1.0") api("net.kyori:adventure-text-minimessage:4.0.0-SNAPSHOT") // Guice diff --git a/Core/src/main/java/com/plotsquared/core/command/Debug.java b/Core/src/main/java/com/plotsquared/core/command/Debug.java index 67eb61d3f..b0d77dcbb 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Debug.java +++ b/Core/src/main/java/com/plotsquared/core/command/Debug.java @@ -147,7 +147,7 @@ public class Debug extends SubCommand { player.sendMessage(StaticCaption.of(msg.toString())); return true; } - TextComponent.Builder information = TextComponent.builder(); + TextComponent.Builder information = Component.text(); Component header = MINI_MESSAGE.parse(TranslatableCaption.of("debug.debug_header").getComponent(player) + "\n"); String line = TranslatableCaption.of("debug.debug_line").getComponent(player) + "\n"; String section = TranslatableCaption.of("debug.debug_section").getComponent(player) + "\n"; diff --git a/Core/src/main/java/com/plotsquared/core/command/Help.java b/Core/src/main/java/com/plotsquared/core/command/Help.java index 8ec4f7e40..dc291b43f 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Help.java +++ b/Core/src/main/java/com/plotsquared/core/command/Help.java @@ -33,6 +33,7 @@ import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.helpmenu.HelpMenu; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; +import net.kyori.adventure.text.Component; import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.minimessage.Template; @@ -105,17 +106,17 @@ public class Help extends Command { } } if (cat == null && page == 0) { - TextComponent.Builder builder = TextComponent.builder(); + TextComponent.Builder builder = Component.text(); builder.append(MINI_MESSAGE.parse(TranslatableCaption.of("help.help_header").getComponent(player))); for (CommandCategory c : CommandCategory.values()) { - builder.append("\n").append(MINI_MESSAGE + builder.append(Component.newline()).append(MINI_MESSAGE .parse(TranslatableCaption.of("help.help_info_item").getComponent(player), Template.of("category", c.name().toLowerCase()), Template.of("category_desc", c.getComponent(player)))); } - builder.append("\n").append(MINI_MESSAGE + builder.append(Component.newline()).append(MINI_MESSAGE .parse(TranslatableCaption.of("help.help_info_item").getComponent(player), Template.of("category", "all"), Template.of("category_desc", "Display all commands"))); - builder.append("\n").append(MINI_MESSAGE.parse(TranslatableCaption.of("help.help_footer").getComponent(player))); + builder.append(Component.newline()).append(MINI_MESSAGE.parse(TranslatableCaption.of("help.help_footer").getComponent(player))); player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(builder.asComponent()))); return true; } diff --git a/Core/src/main/java/com/plotsquared/core/command/Inbox.java b/Core/src/main/java/com/plotsquared/core/command/Inbox.java index b722c2caa..33ff92b33 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Inbox.java +++ b/Core/src/main/java/com/plotsquared/core/command/Inbox.java @@ -70,7 +70,7 @@ public class Inbox extends SubCommand { if (max > comments.length) { max = comments.length; } - TextComponent.Builder builder = TextComponent.builder(); + TextComponent.Builder builder = Component.text(); builder.append(MINI_MESSAGE.parse(TranslatableCaption.of("list.comment_list_header_paged").getComponent(player) + '\n', Template.of("amount", String.valueOf(comments.length)), Template.of("cur", String.valueOf(page + 1)), Template.of("max", String.valueOf(totalPages + 1)), Template.of("word", "all"))); diff --git a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java index b225546d1..fe17a7899 100644 --- a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java +++ b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java @@ -818,7 +818,7 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer, Duration.of(stay * 50, ChronoUnit.MILLIS), Duration.of(fadeOut * 50, ChronoUnit.MILLIS)); getAudience().showTitle(Title - .of(titleComponent, subtitleComponent, times)); + .title(titleComponent, subtitleComponent, times)); } @Override public void sendMessage(@Nonnull final Caption caption,