adventure v4.1.0; project now compiles

This commit is contained in:
Mariell Hoversholm 2020-10-17 21:45:43 +02:00 committed by dordsor21
parent 38333a6d11
commit 333493f351
6 changed files with 12 additions and 10 deletions

View File

@ -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);
}

View File

@ -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

View File

@ -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";

View File

@ -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;
}

View File

@ -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")));

View File

@ -818,7 +818,7 @@ public abstract class PlotPlayer<P> 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,