mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
adventure v4.1.0; project now compiles
This commit is contained in:
parent
38333a6d11
commit
333493f351
@ -82,6 +82,7 @@ import com.sk89q.worldedit.WorldEdit;
|
|||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.TextComponent;
|
import net.kyori.adventure.text.TextComponent;
|
||||||
import net.kyori.adventure.text.minimessage.Template;
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import org.bukkit.Bukkit;
|
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)));
|
.of("msg", BukkitUtil.LEGACY_COMPONENT_SERIALIZER.deserialize(ChatColor.translateAlternateColorCodes('&', message)));
|
||||||
} else {
|
} else {
|
||||||
msgTemplate = Template.of("msg", BukkitUtil.MINI_MESSAGE.deserialize(
|
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) {
|
for (PlotPlayer<?> receiver : plotRecipients) {
|
||||||
receiver.sendMessage(msg, msgTemplate, plotTemplate, senderTemplate);
|
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");
|
Caption spymsg = TranslatableCaption.of("chat.plot_chat_spy_format");
|
||||||
Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY());
|
Template plotidTemplate = Template.of("plot_id", id.getX() + ";" + id.getY());
|
||||||
Template spysenderTemplate = Template.of("sender", sender);
|
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) {
|
for (PlotPlayer<?> player : spies) {
|
||||||
player.sendMessage(spymsg, plotidTemplate, spysenderTemplate, spymessageTemplate);
|
player.sendMessage(spymsg, plotidTemplate, spysenderTemplate, spymessageTemplate);
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ dependencies {
|
|||||||
compileOnlyApi("org.yaml:snakeyaml:1.26") // Some platforms provide this
|
compileOnlyApi("org.yaml:snakeyaml:1.26") // Some platforms provide this
|
||||||
|
|
||||||
// Adventure stuff
|
// 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")
|
api("net.kyori:adventure-text-minimessage:4.0.0-SNAPSHOT")
|
||||||
|
|
||||||
// Guice
|
// Guice
|
||||||
|
@ -147,7 +147,7 @@ public class Debug extends SubCommand {
|
|||||||
player.sendMessage(StaticCaption.of(msg.toString()));
|
player.sendMessage(StaticCaption.of(msg.toString()));
|
||||||
return true;
|
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");
|
Component header = MINI_MESSAGE.parse(TranslatableCaption.of("debug.debug_header").getComponent(player) + "\n");
|
||||||
String line = TranslatableCaption.of("debug.debug_line").getComponent(player) + "\n";
|
String line = TranslatableCaption.of("debug.debug_line").getComponent(player) + "\n";
|
||||||
String section = TranslatableCaption.of("debug.debug_section").getComponent(player) + "\n";
|
String section = TranslatableCaption.of("debug.debug_section").getComponent(player) + "\n";
|
||||||
|
@ -33,6 +33,7 @@ import com.plotsquared.core.util.StringMan;
|
|||||||
import com.plotsquared.core.util.helpmenu.HelpMenu;
|
import com.plotsquared.core.util.helpmenu.HelpMenu;
|
||||||
import com.plotsquared.core.util.task.RunnableVal2;
|
import com.plotsquared.core.util.task.RunnableVal2;
|
||||||
import com.plotsquared.core.util.task.RunnableVal3;
|
import com.plotsquared.core.util.task.RunnableVal3;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.TextComponent;
|
import net.kyori.adventure.text.TextComponent;
|
||||||
import net.kyori.adventure.text.minimessage.Template;
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
|
||||||
@ -105,17 +106,17 @@ public class Help extends Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cat == null && page == 0) {
|
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)));
|
builder.append(MINI_MESSAGE.parse(TranslatableCaption.of("help.help_header").getComponent(player)));
|
||||||
for (CommandCategory c : CommandCategory.values()) {
|
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()),
|
.parse(TranslatableCaption.of("help.help_info_item").getComponent(player), Template.of("category", c.name().toLowerCase()),
|
||||||
Template.of("category_desc", c.getComponent(player))));
|
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"),
|
.parse(TranslatableCaption.of("help.help_info_item").getComponent(player), Template.of("category", "all"),
|
||||||
Template.of("category_desc", "Display all commands")));
|
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())));
|
player.sendMessage(StaticCaption.of(MINI_MESSAGE.serialize(builder.asComponent())));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ public class Inbox extends SubCommand {
|
|||||||
if (max > comments.length) {
|
if (max > comments.length) {
|
||||||
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',
|
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("amount", String.valueOf(comments.length)), Template.of("cur", String.valueOf(page + 1)),
|
||||||
Template.of("max", String.valueOf(totalPages + 1)), Template.of("word", "all")));
|
Template.of("max", String.valueOf(totalPages + 1)), Template.of("word", "all")));
|
||||||
|
@ -818,7 +818,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
|||||||
Duration.of(stay * 50, ChronoUnit.MILLIS),
|
Duration.of(stay * 50, ChronoUnit.MILLIS),
|
||||||
Duration.of(fadeOut * 50, ChronoUnit.MILLIS));
|
Duration.of(fadeOut * 50, ChronoUnit.MILLIS));
|
||||||
getAudience().showTitle(Title
|
getAudience().showTitle(Title
|
||||||
.of(titleComponent, subtitleComponent, times));
|
.title(titleComponent, subtitleComponent, times));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void sendMessage(@Nonnull final Caption caption,
|
@Override public void sendMessage(@Nonnull final Caption caption,
|
||||||
|
Loading…
Reference in New Issue
Block a user