diff --git a/paper/src/main/java/com/badbones69/crazycrates/api/objects/Tier.java b/paper/src/main/java/com/badbones69/crazycrates/api/objects/Tier.java
index 993b092b2..6fa6878be 100644
--- a/paper/src/main/java/com/badbones69/crazycrates/api/objects/Tier.java
+++ b/paper/src/main/java/com/badbones69/crazycrates/api/objects/Tier.java
@@ -83,6 +83,6 @@ public final int getSlot() {
public @NotNull final ItemStack getTierItem(final @Nullable Player target) {
if (target != null) this.item.setPlayer(target);
- return this.item.setDisplayName(this.coloredName).setDisplayLore(this.lore).setPersistentString(PersistentKeys.preview_tier_button.getNamespacedKey(), this.name).getStack();
+ return this.item.setDisplayName(this.coloredName).setDisplayLore(this.lore).setPersistentString(PersistentKeys.crate_tier.getNamespacedKey(), this.name).getStack();
}
}
\ No newline at end of file
diff --git a/paper/src/main/java/com/badbones69/crazycrates/listeners/crates/CosmicCrateListener.java b/paper/src/main/java/com/badbones69/crazycrates/listeners/crates/CosmicCrateListener.java
index 8396ed541..4fe7bae02 100644
--- a/paper/src/main/java/com/badbones69/crazycrates/listeners/crates/CosmicCrateListener.java
+++ b/paper/src/main/java/com/badbones69/crazycrates/listeners/crates/CosmicCrateListener.java
@@ -80,7 +80,7 @@ public void onInventoryClose(InventoryCloseEvent event) {
final ItemStack item = inventory.getItem(key);
if (item != null) {
- Tier tier = getTier(crate, item);
+ final Tier tier = getTier(crate, item);
if (tier != null) {
Prize prize = crate.pickPrize(player, tier);
@@ -98,7 +98,7 @@ public void onInventoryClose(InventoryCloseEvent event) {
}
// Play sound.
- if (playSound) crate.playSound(player, player.getLocation(), "click-sound", "UI_BUTTON_CLICK", Sound.Source.PLAYER);
+ if (playSound) crate.playSound(player, player.getLocation(), "click-sound", "ui.button.click", Sound.Source.PLAYER);
// Remove opening stuff.
this.crateManager.removePlayerFromOpeningList(player);
@@ -392,7 +392,7 @@ public void run() {
// Check if event is cancelled.
if (!event.isCancelled()) {
// Add the keys
- userManager.addKeys(uuid, crateName, type, 1);
+ userManager.addKeys(uuid, crateName, type == null ? KeyType.virtual_key : type, 1);
// Remove opening stuff.
crateManager.removePlayerFromOpeningList(player);
@@ -493,8 +493,14 @@ public void run() {
}
private Tier getTier(final Crate crate, final ItemStack item) {
- for (Tier tier : crate.getTiers()) {
- if (tier.getTierItem(null).isSimilar(item)) return tier;
+ if (!item.hasItemMeta()) return null;
+
+ ItemMeta itemMeta = item.getItemMeta();
+
+ PersistentDataContainer container = itemMeta.getPersistentDataContainer();
+
+ if (container.has(PersistentKeys.crate_tier.getNamespacedKey())) {
+ return crate.getTier(container.get(PersistentKeys.crate_tier.getNamespacedKey(), PersistentDataType.STRING));
}
return null;
diff --git a/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/other/AbstractCrateManager.java b/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/other/AbstractCrateManager.java
index 16dbd6a89..5052fef94 100644
--- a/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/other/AbstractCrateManager.java
+++ b/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/other/AbstractCrateManager.java
@@ -1,3 +1,10 @@
package com.badbones69.crazycrates.tasks.crates.other;
-public abstract class AbstractCrateManager {}
\ No newline at end of file
+import com.badbones69.crazycrates.CrazyCrates;
+import org.bukkit.plugin.java.JavaPlugin;
+
+public abstract class AbstractCrateManager {
+
+ protected final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
+
+}
\ No newline at end of file
diff --git a/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/other/quadcrates/QuadCrateManager.java b/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/other/quadcrates/QuadCrateManager.java
index dce9cafde..ed755a706 100644
--- a/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/other/quadcrates/QuadCrateManager.java
+++ b/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/other/quadcrates/QuadCrateManager.java
@@ -228,7 +228,7 @@ public void run() {
this.tickTillSpawn++;
} else {
- crate.playSound(player, player.getLocation(), "cycle-sound", "BLOCK_STONE_STEP", Sound.Source.PLAYER);
+ crate.playSound(player, player.getLocation(), "cycle-sound", "block.stone.step", Sound.Source.PLAYER);
Block chest = crateLocations.get(crateNumber).getBlock();
diff --git a/paper/src/main/resources/crates/types/CasinoCrate.yml b/paper/src/main/resources/crates/types/CasinoCrate.yml
index 4cc3f61f9..c8c38b868 100644
--- a/paper/src/main/resources/crates/types/CasinoCrate.yml
+++ b/paper/src/main/resources/crates/types/CasinoCrate.yml
@@ -198,7 +198,7 @@ Crate:
- "Casino Crate"
# All the prizes that can be obtained in the Crate.
Prizes:
- '1':
+ "1":
# The name of the item to display in the gui.
DisplayName: "BadBones69"
# The item to display in the gui.
@@ -216,4 +216,155 @@ Crate:
# An example of a custom player head.
# This can be a player head as well.
# https://minecraft-heads.com/
- Player: "1ee3126ff2c343da525eef2b93272b9fed36273d0ea08c2616b80009948ad57e"
\ No newline at end of file
+ Player: "1ee3126ff2c343da525eef2b93272b9fed36273d0ea08c2616b80009948ad57e"
+ "2":
+ # The name of the item to display in the gui.
+ DisplayName: "Warlord's Set"
+ # The item to display in the gui.
+ DisplayItem: "netherite_helmet"
+ # The enchants on the item.
+ DisplayEnchantments:
+ - "protection:5"
+ - "unbreaking:3"
+ # https://docs.crazycrew.us/docs/plugins/crazycrates/guides/prizes/items/armor-trim
+ DisplayTrim:
+ # The list of materials to use can be found on the link above
+ Material: "redstone"
+ # The list of patterns to use can be found on the link above
+ Pattern: "sentry"
+ # The amount to display in the gui.
+ DisplayAmount: 1
+ # The lore of the item.
+ Lore:
+ - "Win the warlord's set."
+ - "Chance: 40%"
+ # The max range i.e. 40/100 = 40% chance to win.
+ MaxRange: 100
+ # The chance to win i.e. 40%
+ Chance: 40
+ # Tiers are available in Cosmic and Casino crate types.
+ # The Tiers the rewards can be found in.
+ Tiers:
+ - "UnCommon"
+ # A list of commands to run when they roll this prize.
+ Commands:
+ # This adds the blacklist permission to the player when they win the prize,
+ # After this, they will no longer be able to use this prize.
+ - "lp user %player% permission set crazycrates.blacklist.warlord"
+ # The list of items to give.
+ Items:
+ - "Item:netherite_helmet, Amount:1, Damage:25, Trim-Pattern:sentry, Trim-Material:redstone, Name:Warlord's Helmet, protection:5, unbreaking:3"
+ - "Item:netherite_chestplate, Amount:1, Damage:25, Trim-Pattern:sentry, Trim-Material:redstone, Name:Warlord's Chestplate, protection:5, unbreaking:3"
+ - "Item:netherite_leggings, Amount:1, Damage:25, Trim-Pattern:sentry, Trim-Material:redstone, Name:Warlord's Leggings, protection:5, unbreaking:3"
+ - "Item:netherite_boots, Amount:1, Damage:25, Trim-Pattern:sentry, Trim-Material:redstone, Name:Warlord's Boots, protection:5, unbreaking:3"
+ # A list of permissions, If a player has any of these permissions. they cannot win this prize again!
+ BlackListed-Permissions:
+ - "crazycrates.blacklist.warlord"
+ # The alternative prize.
+ Alternative-Prize:
+ # if it should be enabled.
+ Toggle: true
+ # The message to send.
+ Messages:
+ - " [CrazyCrates]: You have already won that prize, so enjoy some gold nuggets."
+ # A list of commands to run.
+ Commands:
+ - "give %player% gold_nugget 16"
+ # Alternatively, instead of commands. You can have an Items section which functions the same as the Items section above.
+ Items:
+ - "Item:gold_nugget, Amount:16"
+ "3":
+ # The enchants to be stored on the book.
+ DisplayEnchantments:
+ - "protection:5"
+ - "unbreaking:3"
+ # The item to display in the gui.
+ # The enchanted book will function with the enchants properly in an anvil.
+ DisplayItem: "enchanted_book"
+ # The amount to display in the gui.
+ DisplayAmount: 3
+ # The lore of the item.
+ Lore:
+ - "A gradient lore!"
+ # The max range i.e. 25/100 = 15% chance to win.
+ MaxRange: 100
+ # The chance to win i.e. 25%
+ Chance: 25
+ # Tiers are available in Cosmic and Casino crate types.
+ # The Tiers the rewards can be found in.
+ Tiers:
+ - "Rare"
+ "4":
+ # The name of the item to display in the gui.
+ DisplayName: "Fancy Pants"
+ # The item to display in the gui.
+ DisplayItem: "chainmail_leggings"
+ # The enchants on the item.
+ DisplayEnchantments:
+ - "protection:2"
+ # Only works on items with durability. This will make the item appear more damaged.
+ # It does not set the durability but subtracts this number from the durability is 100, It subtracts 75.
+ # It cannot be 0.
+ DisplayDamage: 75
+ # https://docs.crazycrew.us/docs/plugins/crazycrates/guides/prizes/items/armor-trim
+ DisplayTrim:
+ # The list of materials to use can be found on the link above
+ Material: "lapis"
+ # The list of patterns to use can be found on the link above
+ Pattern: "sentry"
+ # The amount to display in the gui.
+ DisplayAmount: 1
+ # The max range i.e. 40/1000 = 4% chance to win.
+ MaxRange: 1000
+ # The chance to win i.e. 4%
+ Chance: 40
+ # Tiers are available in Cosmic and Casino crate types.
+ # The Tiers the rewards can be found in.
+ Tiers:
+ - "Basic"
+ - "UnCommon"
+ # The lore of the item.
+ Lore:
+ - "Win a fancy pair of pants."
+ - "Chance: 4%"
+ # The items to win.
+ Items:
+ - "Item:chainmail_leggings, Amount:1, Damage:75, Trim-Pattern:sentry, Trim-Material:lapis, Name:Fancy Pants, protection:2"
+ # The messages to send.
+ Messages:
+ - "You just won a %reward%."
+ "5":
+ # The name of the item to display in the gui.
+ DisplayName: "Classic Sword"
+ # The item to display in the gui.
+ DisplayItem: "diamond_sword"
+ # The enchants on the item.
+ DisplayEnchantments:
+ - "sharpness:2"
+ - "fire_aspect:1"
+ # Only works on items with durability. This will make the item appear more damaged.
+ # It does not set the durability but subtracts this number from the durability is 100, It subtracts 7.
+ # It cannot be 0.
+ DisplayDamage: 7
+ # The amount to display in the gui.
+ DisplayAmount: 1
+ # The lore of the item.
+ Lore:
+ - "Win a old classic sword."
+ - "Chance: 3.5%"
+ # The max range i.e. 35/1000 = 3.5% chance to win.
+ MaxRange: 1000
+ # The chance to win i.e. 3.5%.
+ Chance: 35
+ # Tiers are available in Cosmic and Casino crate types.
+ # The Tiers the rewards can be found in.
+ Tiers:
+ - "Basic"
+ - "UnCommon"
+ - "Rare"
+ # The items to win.
+ Items:
+ - "Item:diamond_sword, Amount:1, Damage:7, Name:Classic Sword, sharpness:2, fire_aspect:1"
+ # The messages to send.
+ Messages:
+ - "You just won %reward%."
\ No newline at end of file