mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-27 19:24:43 +02:00
Update MiniMessage to 4.10.1 (#3617)
* chore!: bump MiniMessage to 4.10.1 BREAKING CHANGE: bumping MiniMessage and Adventure removes the adventure Template class and breaks the whole messaging system api wise * chore: fix minimessage messages, fix circular method reference
This commit is contained in:

committed by
GitHub

parent
d5f8a0842b
commit
62ee60a76c
@ -50,7 +50,9 @@ import com.plotsquared.core.util.EntityUtil;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.entity.EntityCategories;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -188,7 +190,10 @@ public class BukkitEntityUtil {
|
||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
|
||||
TagResolver.resolver(
|
||||
"node",
|
||||
Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_DESTROY + "." + stub))
|
||||
)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -200,7 +205,10 @@ public class BukkitEntityUtil {
|
||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_DESTROY + "." + stub)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", Permission.PERMISSION_ADMIN_DESTROY + "." + stub)
|
||||
TagResolver.resolver(
|
||||
"node",
|
||||
Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_DESTROY + "." + stub))
|
||||
)
|
||||
);
|
||||
if (plot != null) {
|
||||
plot.debug(player.getName()
|
||||
@ -221,7 +229,10 @@ public class BukkitEntityUtil {
|
||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
|
||||
TagResolver.resolver(
|
||||
"node",
|
||||
Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_PVE + "." + stub))
|
||||
)
|
||||
);
|
||||
if (plot != null) {
|
||||
plot.debug(player.getName() + " could not attack " + entityType
|
||||
@ -242,7 +253,10 @@ public class BukkitEntityUtil {
|
||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
|
||||
TagResolver.resolver(
|
||||
"node",
|
||||
Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_PVE + "." + stub))
|
||||
)
|
||||
);
|
||||
if (plot != null) {
|
||||
plot.debug(player.getName() + " could not attack " + entityType
|
||||
@ -256,7 +270,10 @@ public class BukkitEntityUtil {
|
||||
.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
|
||||
TagResolver.resolver(
|
||||
"node",
|
||||
Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_PVP + "." + stub))
|
||||
)
|
||||
);
|
||||
plot.debug(player.getName() + " could not attack " + entityType
|
||||
+ " because pve = false");
|
||||
@ -270,7 +287,10 @@ public class BukkitEntityUtil {
|
||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVP + "." + stub)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", Permission.PERMISSION_ADMIN_PVP + "." + stub)
|
||||
TagResolver.resolver(
|
||||
"node",
|
||||
Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_PVP + "." + stub))
|
||||
)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@ -287,7 +307,10 @@ public class BukkitEntityUtil {
|
||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
|
||||
TagResolver.resolver(
|
||||
"node",
|
||||
Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_PVE + "." + stub))
|
||||
)
|
||||
);
|
||||
if (plot != null) {
|
||||
plot.debug(player.getName() + " could not attack " + entityType
|
||||
@ -309,7 +332,10 @@ public class BukkitEntityUtil {
|
||||
if (!Permissions.hasPermission(plotPlayer, Permission.PERMISSION_ADMIN_PVE + "." + stub)) {
|
||||
plotPlayer.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission_event"),
|
||||
Template.of("node", Permission.PERMISSION_ADMIN_PVE + "." + stub)
|
||||
TagResolver.resolver(
|
||||
"node",
|
||||
Tag.inserting(Component.text(Permission.PERMISSION_ADMIN_PVE + "." + stub))
|
||||
)
|
||||
);
|
||||
if (plot != null) {
|
||||
plot.debug(player.getName() + " could not attack " + entityType
|
||||
|
@ -63,7 +63,7 @@ public class BukkitInventoryUtil extends InventoryUtil {
|
||||
ItemMeta meta = null;
|
||||
if (item.getName() != null) {
|
||||
meta = stack.getItemMeta();
|
||||
Component nameComponent = BukkitUtil.MINI_MESSAGE.parse(item.getName());
|
||||
Component nameComponent = BukkitUtil.MINI_MESSAGE.deserialize(item.getName());
|
||||
meta.setDisplayName(BukkitUtil.LEGACY_COMPONENT_SERIALIZER.serialize(nameComponent));
|
||||
}
|
||||
if (item.getLore() != null) {
|
||||
|
@ -52,7 +52,7 @@ import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@ -339,7 +339,7 @@ public class BukkitUtil extends WorldUtil {
|
||||
@SuppressWarnings("deprecation")
|
||||
public void setSign(
|
||||
final @NonNull Location location, final @NonNull Caption[] lines,
|
||||
final @NonNull Template... replacements
|
||||
final @NonNull TagResolver... replacements
|
||||
) {
|
||||
ensureLoaded(location.getWorldName(), location.getX(), location.getZ(), chunk -> {
|
||||
PlotArea area = location.getPlotArea();
|
||||
@ -372,8 +372,9 @@ public class BukkitUtil extends WorldUtil {
|
||||
final org.bukkit.block.BlockState blockstate = block.getState();
|
||||
if (blockstate instanceof final Sign sign) {
|
||||
for (int i = 0; i < lines.length; i++) {
|
||||
sign.setLine(i, LEGACY_COMPONENT_SERIALIZER
|
||||
.serialize(MINI_MESSAGE.parse(lines[i].getComponent(LocaleHolder.console()), replacements)));
|
||||
sign.setLine(i, LEGACY_COMPONENT_SERIALIZER.serialize(
|
||||
MINI_MESSAGE.deserialize(lines[i].getComponent(LocaleHolder.console()), replacements)
|
||||
));
|
||||
}
|
||||
sign.update(true, false);
|
||||
}
|
||||
|
Reference in New Issue
Block a user