mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-26 02:34:42 +02:00
chore: fix minimessage messages, fix circular method reference
This commit is contained in:
@ -288,8 +288,8 @@ public class BlockEventListener implements Listener {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("height.height_limit"),
|
||||
TagResolver.builder()
|
||||
.tag("minHeight", Tag.inserting(Component.text(area.getMinBuildHeight())))
|
||||
.tag("maxHeight", Tag.inserting(Component.text(area.getMaxBuildHeight())))
|
||||
.tag("minheight", Tag.inserting(Component.text(area.getMinBuildHeight())))
|
||||
.tag("maxheight", Tag.inserting(Component.text(area.getMaxBuildHeight())))
|
||||
.build()
|
||||
);
|
||||
}
|
||||
@ -388,8 +388,8 @@ public class BlockEventListener implements Listener {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("height.height_limit"),
|
||||
TagResolver.builder()
|
||||
.tag("minHeight", Tag.inserting(Component.text(area.getMinBuildHeight())))
|
||||
.tag("maxHeight", Tag.inserting(Component.text(area.getMaxBuildHeight())))
|
||||
.tag("minheight", Tag.inserting(Component.text(area.getMinBuildHeight())))
|
||||
.tag("maxheight", Tag.inserting(Component.text(area.getMaxBuildHeight())))
|
||||
.build()
|
||||
);
|
||||
}
|
||||
@ -1284,8 +1284,8 @@ public class BlockEventListener implements Listener {
|
||||
pp.sendMessage(
|
||||
TranslatableCaption.of("height.height_limit"),
|
||||
TagResolver.builder()
|
||||
.tag("minHeight", Tag.inserting(Component.text(area.getMinBuildHeight())))
|
||||
.tag("maxHeight", Tag.inserting(Component.text(area.getMaxBuildHeight())))
|
||||
.tag("minheight", Tag.inserting(Component.text(area.getMinBuildHeight())))
|
||||
.tag("maxheight", Tag.inserting(Component.text(area.getMaxBuildHeight())))
|
||||
.build()
|
||||
);
|
||||
event.setCancelled(true);
|
||||
|
@ -84,8 +84,10 @@ 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.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
import net.kyori.adventure.text.minimessage.tag.standard.StandardTags;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.FluidCollisionMode;
|
||||
@ -741,18 +743,13 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||
builder.tag("world", Tag.inserting(Component.text(worldName)));
|
||||
builder.tag("plot_id", Tag.inserting(Component.text(id.toString())));
|
||||
builder.tag("sender", Tag.inserting(Component.text(sender)));
|
||||
// If we do/don't want colour, we need to be careful about how to go about it, as players could attempt either <gold></gold> or &6 etc.
|
||||
// In both cases, we want to use a Component Template to ensure that the player cannot use any placeholders in their message on purpose
|
||||
// or accidentally, as component templates are done at the end. We also need to deserialize from legacy color codes to a Component if
|
||||
// allowing colour.
|
||||
if (plotPlayer.hasPermission("plots.chat.color")) {
|
||||
builder.tag(
|
||||
"msg",
|
||||
Tag.inserting(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.deserialize(ChatColor.translateAlternateColorCodes(
|
||||
'&',
|
||||
message
|
||||
)))
|
||||
);
|
||||
builder.tag("msg", Tag.inserting(MiniMessage.miniMessage().deserialize(
|
||||
message,
|
||||
TagResolver.resolver(StandardTags.color(), StandardTags.gradient(),
|
||||
StandardTags.rainbow(), StandardTags.decorations()
|
||||
)
|
||||
)));
|
||||
} else {
|
||||
builder.tag("msg", Tag.inserting(Component.text(message)));
|
||||
}
|
||||
|
Reference in New Issue
Block a user