From 8dc83033bd8bc959894a2cb3715b5c8b09e73ffd Mon Sep 17 00:00:00 2001 From: ceze88 Date: Wed, 21 Aug 2024 17:38:33 +0200 Subject: [PATCH] Update to core version 3.3.0-SNAPSHOT --- pom.xml | 2 +- .../libraries/inventory/PlayersMenu.java | 3 ++- .../com/craftaro/epicvouchers/menus/ConfirmMenu.java | 10 +++++----- .../com/craftaro/epicvouchers/voucher/Voucher.java | 12 +++++++----- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index 2c9733b..abfbaa7 100644 --- a/pom.xml +++ b/pom.xml @@ -108,7 +108,7 @@ com.craftaro CraftaroCore - 3.1.0-SNAPSHOT + 3.3.0-SNAPSHOT compile diff --git a/src/main/java/com/craftaro/epicvouchers/libraries/inventory/PlayersMenu.java b/src/main/java/com/craftaro/epicvouchers/libraries/inventory/PlayersMenu.java index 23cf037..3a6be4a 100644 --- a/src/main/java/com/craftaro/epicvouchers/libraries/inventory/PlayersMenu.java +++ b/src/main/java/com/craftaro/epicvouchers/libraries/inventory/PlayersMenu.java @@ -1,5 +1,6 @@ package com.craftaro.epicvouchers.libraries.inventory; +import com.craftaro.core.utils.SkullItemCreator; import com.craftaro.epicvouchers.EpicVouchers; import com.craftaro.epicvouchers.libraries.ItemBuilder; import com.craftaro.epicvouchers.menus.ActionMenu; @@ -54,7 +55,7 @@ public abstract class PlayersMenu extends FastInv { Player player = this.players.get(index); - ItemStack itemStack = XSkull.createItem().profile(new Profileable.OfflinePlayerProfileable(player)).apply(); + ItemStack itemStack = SkullItemCreator.byPlayer(player); ItemMeta itemMeta = itemStack.getItemMeta(); itemMeta.setDisplayName(YELLOW + player.getName()); diff --git a/src/main/java/com/craftaro/epicvouchers/menus/ConfirmMenu.java b/src/main/java/com/craftaro/epicvouchers/menus/ConfirmMenu.java index 7a69d85..22f570f 100644 --- a/src/main/java/com/craftaro/epicvouchers/menus/ConfirmMenu.java +++ b/src/main/java/com/craftaro/epicvouchers/menus/ConfirmMenu.java @@ -13,19 +13,19 @@ import static org.bukkit.inventory.ItemFlag.HIDE_ENCHANTS; public class ConfirmMenu extends FastInv { public ConfirmMenu(EpicVouchers instance, Runnable success, Runnable failure) { - super(27, instance.getLocale().getMessage("interface.confirmsettings.title").getMessage()); + super(27, instance.getLocale().getMessage("interface.confirmsettings.title").toText()); addItem(11, new ItemBuilder(Material.EMERALD) - .name(instance.getLocale().getMessage("interface.confirmsettings.confirmitemname").getMessage()) - .lore(instance.getLocale().getMessage("interface.confirmsettings.confirmitemlore").getMessage()) + .name(instance.getLocale().getMessage("interface.confirmsettings.confirmitemname").toText()) + .lore(instance.getLocale().getMessage("interface.confirmsettings.confirmitemlore").toText()) .addGlow().build(), event -> { event.getPlayer().closeInventory(); success.run(); }); addItem(15, new ItemBuilder(Material.REDSTONE_BLOCK) - .name(instance.getLocale().getMessage("interface.confirmsettings.cancelitemname").getMessage()) - .lore(instance.getLocale().getMessage("interface.confirmsettings.cancelitemlore").getMessage()) + .name(instance.getLocale().getMessage("interface.confirmsettings.cancelitemname").toText()) + .lore(instance.getLocale().getMessage("interface.confirmsettings.cancelitemlore").toText()) .enchant(DURABILITY, 1) .addFlags(HIDE_ENCHANTS) .build(), event -> { diff --git a/src/main/java/com/craftaro/epicvouchers/voucher/Voucher.java b/src/main/java/com/craftaro/epicvouchers/voucher/Voucher.java index 001d781..9b32570 100644 --- a/src/main/java/com/craftaro/epicvouchers/voucher/Voucher.java +++ b/src/main/java/com/craftaro/epicvouchers/voucher/Voucher.java @@ -1,6 +1,8 @@ package com.craftaro.epicvouchers.voucher; +import com.craftaro.core.chat.AdventureUtils; import com.craftaro.core.compatibility.ServerVersion; +import com.craftaro.core.third_party.net.kyori.adventure.text.Component; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBTItem; import com.craftaro.core.utils.ItemUtils; @@ -196,13 +198,13 @@ public class Voucher { } public void give(CommandSender sender, List players, int amount) { - String giveMessage = this.instance.getLocale().getMessage("command.give.send") + Component giveMessage = this.instance.getLocale().getMessage("command.give.send") .processPlaceholder("player", players.size() == 1 ? players.get(0).getName() : "everyone") .processPlaceholder("voucher", getName(true)) .processPlaceholder("amount", String.valueOf(amount)).getPrefixedMessage(); for (Player player : players) { - String receiveMessage = this.instance.getLocale().getMessage("command.give.receive") + Component receiveMessage = this.instance.getLocale().getMessage("command.give.receive") .processPlaceholder("voucher", getName(true)) .processPlaceholder("player", player.getName()) .processPlaceholder("amount", String.valueOf(amount)).getPrefixedMessage(); @@ -215,11 +217,11 @@ public class Voucher { continue; } - player.sendMessage(receiveMessage); + AdventureUtils.sendMessage(EpicVouchers.getInstance(), receiveMessage, player); player.getInventory().addItem(toItemStack(amount)); } - sender.sendMessage(giveMessage); + AdventureUtils.sendMessage(EpicVouchers.getInstance(), giveMessage, sender); } public void forceRedeem(CommandSender sender, List players, int amount) { @@ -242,7 +244,7 @@ public class Voucher { // does the player have permission to redeem this voucher? if (!this.permission.isEmpty() && !player.hasPermission(this.permission)) { - player.sendMessage(this.instance.getLocale().getMessage("event.general.nopermission").getPrefixedMessage()); + this.instance.getLocale().getMessage("event.general.nopermission").sendPrefixedMessage(player); return; }