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>
<groupId>com.craftaro</groupId>
<artifactId>CraftaroCore</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.3.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>

View File

@ -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());

View File

@ -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 -> {

View File

@ -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<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("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<Player> 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;
}