Update to core version 3.3.0-SNAPSHOT

This commit is contained in:
ceze88 2024-08-21 17:38:33 +02:00
parent f4c1b02ed7
commit 8dc83033bd
4 changed files with 15 additions and 12 deletions

View File

@ -108,7 +108,7 @@
<dependency> <dependency>
<groupId>com.craftaro</groupId> <groupId>com.craftaro</groupId>
<artifactId>CraftaroCore</artifactId> <artifactId>CraftaroCore</artifactId>
<version>3.1.0-SNAPSHOT</version> <version>3.3.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>

View File

@ -1,5 +1,6 @@
package com.craftaro.epicvouchers.libraries.inventory; package com.craftaro.epicvouchers.libraries.inventory;
import com.craftaro.core.utils.SkullItemCreator;
import com.craftaro.epicvouchers.EpicVouchers; import com.craftaro.epicvouchers.EpicVouchers;
import com.craftaro.epicvouchers.libraries.ItemBuilder; import com.craftaro.epicvouchers.libraries.ItemBuilder;
import com.craftaro.epicvouchers.menus.ActionMenu; import com.craftaro.epicvouchers.menus.ActionMenu;
@ -54,7 +55,7 @@ public abstract class PlayersMenu extends FastInv {
Player player = this.players.get(index); 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 itemMeta = itemStack.getItemMeta();
itemMeta.setDisplayName(YELLOW + player.getName()); itemMeta.setDisplayName(YELLOW + player.getName());

View File

@ -13,19 +13,19 @@ import static org.bukkit.inventory.ItemFlag.HIDE_ENCHANTS;
public class ConfirmMenu extends FastInv { public class ConfirmMenu extends FastInv {
public ConfirmMenu(EpicVouchers instance, Runnable success, Runnable failure) { 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) addItem(11, new ItemBuilder(Material.EMERALD)
.name(instance.getLocale().getMessage("interface.confirmsettings.confirmitemname").getMessage()) .name(instance.getLocale().getMessage("interface.confirmsettings.confirmitemname").toText())
.lore(instance.getLocale().getMessage("interface.confirmsettings.confirmitemlore").getMessage()) .lore(instance.getLocale().getMessage("interface.confirmsettings.confirmitemlore").toText())
.addGlow().build(), event -> { .addGlow().build(), event -> {
event.getPlayer().closeInventory(); event.getPlayer().closeInventory();
success.run(); success.run();
}); });
addItem(15, new ItemBuilder(Material.REDSTONE_BLOCK) addItem(15, new ItemBuilder(Material.REDSTONE_BLOCK)
.name(instance.getLocale().getMessage("interface.confirmsettings.cancelitemname").getMessage()) .name(instance.getLocale().getMessage("interface.confirmsettings.cancelitemname").toText())
.lore(instance.getLocale().getMessage("interface.confirmsettings.cancelitemlore").getMessage()) .lore(instance.getLocale().getMessage("interface.confirmsettings.cancelitemlore").toText())
.enchant(DURABILITY, 1) .enchant(DURABILITY, 1)
.addFlags(HIDE_ENCHANTS) .addFlags(HIDE_ENCHANTS)
.build(), event -> { .build(), event -> {

View File

@ -1,6 +1,8 @@
package com.craftaro.epicvouchers.voucher; package com.craftaro.epicvouchers.voucher;
import com.craftaro.core.chat.AdventureUtils;
import com.craftaro.core.compatibility.ServerVersion; 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.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBTItem; import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBTItem;
import com.craftaro.core.utils.ItemUtils; import com.craftaro.core.utils.ItemUtils;
@ -196,13 +198,13 @@ public class Voucher {
} }
public void give(CommandSender sender, List<Player> players, int amount) { public void give(CommandSender sender, List<Player> 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("player", players.size() == 1 ? players.get(0).getName() : "everyone")
.processPlaceholder("voucher", getName(true)) .processPlaceholder("voucher", getName(true))
.processPlaceholder("amount", String.valueOf(amount)).getPrefixedMessage(); .processPlaceholder("amount", String.valueOf(amount)).getPrefixedMessage();
for (Player player : players) { 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("voucher", getName(true))
.processPlaceholder("player", player.getName()) .processPlaceholder("player", player.getName())
.processPlaceholder("amount", String.valueOf(amount)).getPrefixedMessage(); .processPlaceholder("amount", String.valueOf(amount)).getPrefixedMessage();
@ -215,11 +217,11 @@ public class Voucher {
continue; continue;
} }
player.sendMessage(receiveMessage); AdventureUtils.sendMessage(EpicVouchers.getInstance(), receiveMessage, player);
player.getInventory().addItem(toItemStack(amount)); player.getInventory().addItem(toItemStack(amount));
} }
sender.sendMessage(giveMessage); AdventureUtils.sendMessage(EpicVouchers.getInstance(), giveMessage, sender);
} }
public void forceRedeem(CommandSender sender, List<Player> players, int amount) { public void forceRedeem(CommandSender sender, List<Player> players, int amount) {
@ -242,7 +244,7 @@ public class Voucher {
// does the player have permission to redeem this voucher? // does the player have permission to redeem this voucher?
if (!this.permission.isEmpty() && !player.hasPermission(this.permission)) { 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; return;
} }