diff --git a/.gitignore b/.gitignore index 381c6a3e6..949c725e0 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ api/.gradle api/build paper/libs/compile/bLibs-2.0.0-WIP.jar -run/ +paper/run !paper/run/config/paper-global.yml !paper/run/config/paper-world-defaults.yml diff --git a/paper/src/main/java/com/badbones69/crazycrates/CrazyCrates.java b/paper/src/main/java/com/badbones69/crazycrates/CrazyCrates.java index 6d096d79b..4345b2258 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/CrazyCrates.java +++ b/paper/src/main/java/com/badbones69/crazycrates/CrazyCrates.java @@ -1,26 +1,29 @@ package com.badbones69.crazycrates; +import com.badbones69.crazycrates.api.builders.InventoryBuilder; +import com.badbones69.crazycrates.api.builders.InventoryListener; +import com.badbones69.crazycrates.api.builders.types.items.UltimateMenu; +import com.badbones69.crazycrates.api.objects.gacha.BaseProfileManager; import com.badbones69.crazycrates.api.objects.other.Server; -import com.badbones69.crazycrates.api.utils.MiscUtils; import com.badbones69.crazycrates.commands.CommandManager; import com.badbones69.crazycrates.listeners.BrokeLocationsListener; import com.badbones69.crazycrates.listeners.CrateControlListener; import com.badbones69.crazycrates.listeners.MiscListener; -import com.badbones69.crazycrates.listeners.crates.types.CosmicCrateListener; +import com.badbones69.crazycrates.listeners.crates.types.*; import com.badbones69.crazycrates.listeners.crates.CrateOpenListener; -import com.badbones69.crazycrates.listeners.crates.types.MobileCrateListener; -import com.badbones69.crazycrates.listeners.crates.types.QuadCrateListener; -import com.badbones69.crazycrates.listeners.crates.types.WarCrateListener; import com.badbones69.crazycrates.listeners.other.EntityDamageListener; +import com.badbones69.crazycrates.managers.BukkitUserManager; +import com.badbones69.crazycrates.managers.InventoryManager; import com.badbones69.crazycrates.support.MetricsWrapper; import com.badbones69.crazycrates.support.holograms.HologramManager; import com.badbones69.crazycrates.support.placeholders.PlaceholderAPISupport; -import com.badbones69.crazycrates.tasks.BukkitUserManager; -import com.badbones69.crazycrates.tasks.InventoryManager; import com.badbones69.crazycrates.tasks.crates.CrateManager; +import com.badbones69.crazycrates.utils.MiscUtils; +import com.google.common.reflect.ClassPath; import com.ryderbelserion.vital.paper.Vital; import com.ryderbelserion.vital.paper.api.enums.Support; import com.ryderbelserion.vital.paper.util.AdvUtil; +import lombok.Getter; import me.arcaniax.hdb.api.HeadDatabaseAPI; import org.bukkit.plugin.java.JavaPlugin; import org.jetbrains.annotations.NotNull; @@ -29,7 +32,9 @@ import java.util.List; import java.util.Locale; import java.util.Timer; -import static com.badbones69.crazycrates.api.utils.MiscUtils.registerPermissions; +import java.util.logging.Logger; + +import static com.badbones69.crazycrates.utils.MiscUtils.registerPermissions; public class CrazyCrates extends Vital { diff --git a/paper/src/main/java/com/badbones69/crazycrates/api/PrizeManager.java b/paper/src/main/java/com/badbones69/crazycrates/api/PrizeManager.java index c057346d5..6223cffae 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/api/PrizeManager.java +++ b/paper/src/main/java/com/badbones69/crazycrates/api/PrizeManager.java @@ -16,12 +16,12 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; -import com.badbones69.crazycrates.api.utils.MiscUtils; -import com.badbones69.crazycrates.api.utils.MsgUtils; +import com.badbones69.crazycrates.utils.MiscUtils; +import com.badbones69.crazycrates.utils.MsgUtils; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; +import java.util.HashMap; import java.util.Random; import java.util.concurrent.ThreadLocalRandom; import static java.util.regex.Matcher.quoteReplacement; diff --git a/paper/src/main/java/com/badbones69/crazycrates/api/builders/InventoryBuilder.java b/paper/src/main/java/com/badbones69/crazycrates/api/builders/InventoryBuilder.java index 18b4c9795..62739ca16 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/api/builders/InventoryBuilder.java +++ b/paper/src/main/java/com/badbones69/crazycrates/api/builders/InventoryBuilder.java @@ -11,6 +11,7 @@ import com.ryderbelserion.vital.paper.api.enums.Support; import com.ryderbelserion.vital.paper.util.AdvUtil; import com.ryderbelserion.vital.paper.util.ItemUtil; +import net.kyori.adventure.text.Component; import net.kyori.adventure.text.serializer.json.JSONComponentSerializer; import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket; import net.minecraft.server.level.ServerPlayer; diff --git a/paper/src/main/java/com/badbones69/crazycrates/api/builders/types/items/BonusPityMenu.java b/paper/src/main/java/com/badbones69/crazycrates/api/builders/types/items/BonusPityMenu.java index 220f94862..f9dce233f 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/api/builders/types/items/BonusPityMenu.java +++ b/paper/src/main/java/com/badbones69/crazycrates/api/builders/types/items/BonusPityMenu.java @@ -2,11 +2,11 @@ import com.badbones69.crazycrates.api.builders.InventoryBuilder; import com.badbones69.crazycrates.api.builders.ItemBuilder; -import com.badbones69.crazycrates.api.builders.types.CrateTierMenu; import com.badbones69.crazycrates.api.objects.Crate; import com.badbones69.crazycrates.api.objects.gacha.DatabaseManager; import com.badbones69.crazycrates.api.objects.gacha.data.PlayerProfile; import com.badbones69.crazycrates.api.objects.gacha.ultimatemenu.UltimateMenuStuff; +import com.badbones69.crazycrates.tasks.menus.CrateTierMenu; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.InventoryClickEvent; diff --git a/paper/src/main/java/com/badbones69/crazycrates/api/objects/Crate.java b/paper/src/main/java/com/badbones69/crazycrates/api/objects/Crate.java index 5fc008d19..3c385b220 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/api/objects/Crate.java +++ b/paper/src/main/java/com/badbones69/crazycrates/api/objects/Crate.java @@ -2,19 +2,23 @@ import ch.jalu.configme.SettingsManager; import com.badbones69.crazycrates.api.PrizeManager; -import com.badbones69.crazycrates.api.builders.types.CratePreviewMenu; -import com.badbones69.crazycrates.api.builders.types.CrateTierMenu; -import com.badbones69.crazycrates.api.crates.CrateHologram; +import com.badbones69.crazycrates.api.objects.crates.CrateHologram; import com.badbones69.crazycrates.api.enums.misc.Keys; -import com.badbones69.crazycrates.config.ConfigManager; -import com.badbones69.crazycrates.config.impl.ConfigKeys; -import com.badbones69.crazycrates.tasks.BukkitUserManager; +import com.badbones69.crazycrates.api.objects.gacha.data.CrateSettings; +import com.badbones69.crazycrates.managers.config.ConfigManager; +import com.badbones69.crazycrates.managers.config.impl.ConfigKeys; +import com.badbones69.crazycrates.managers.BukkitUserManager; import com.badbones69.crazycrates.tasks.crates.CrateManager; import com.badbones69.crazycrates.tasks.crates.effects.SoundEffect; import com.badbones69.crazycrates.api.builders.ItemBuilder; +import com.badbones69.crazycrates.tasks.crates.other.GachaCrateManager; +import com.badbones69.crazycrates.tasks.menus.CratePreviewMenu; +import com.badbones69.crazycrates.tasks.menus.CrateTierMenu; import com.ryderbelserion.vital.paper.api.files.CustomFile; +import com.ryderbelserion.vital.paper.util.AdvUtil; import com.ryderbelserion.vital.paper.util.DyeUtil; import com.ryderbelserion.vital.paper.util.ItemUtil; +import lombok.Getter; import net.kyori.adventure.sound.Sound; import net.kyori.adventure.text.Component; import org.bukkit.Color; @@ -33,12 +37,9 @@ import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import com.badbones69.crazycrates.tasks.InventoryManager; -import com.badbones69.crazycrates.api.utils.MiscUtils; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Random; +import com.badbones69.crazycrates.utils.MiscUtils; + +import java.util.*; import java.util.concurrent.ThreadLocalRandom; public class Crate { diff --git a/paper/src/main/java/com/badbones69/crazycrates/api/objects/Prize.java b/paper/src/main/java/com/badbones69/crazycrates/api/objects/Prize.java index b54c84aa5..f911b5909 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/api/objects/Prize.java +++ b/paper/src/main/java/com/badbones69/crazycrates/api/objects/Prize.java @@ -4,15 +4,18 @@ import com.badbones69.crazycrates.api.PrizeManager; import com.badbones69.crazycrates.api.enums.Messages; import com.badbones69.crazycrates.api.enums.misc.Keys; -import com.badbones69.crazycrates.api.utils.ItemUtils; -import com.badbones69.crazycrates.api.utils.MiscUtils; +import com.badbones69.crazycrates.api.objects.gacha.enums.Rarity; +import com.badbones69.crazycrates.api.objects.gacha.enums.RewardType; +import com.badbones69.crazycrates.utils.ItemUtils; +import com.badbones69.crazycrates.utils.MiscUtils; import com.badbones69.crazycrates.api.builders.ItemBuilder; -import com.badbones69.crazycrates.config.ConfigManager; -import com.badbones69.crazycrates.config.impl.messages.CrateKeys; -import com.ryderbelserion.vital.common.utils.StringUtil; +import com.badbones69.crazycrates.managers.config.ConfigManager; +import com.badbones69.crazycrates.managers.config.impl.messages.CrateKeys; import com.ryderbelserion.vital.paper.api.enums.Support; import com.ryderbelserion.vital.paper.util.AdvUtil; import com.ryderbelserion.vital.paper.util.ItemUtil; +import cz.basicland.blibs.spigot.utils.item.NBT; +import lombok.Getter; import me.clip.placeholderapi.PlaceholderAPI; import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; import org.bukkit.Material; @@ -22,7 +25,10 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.bukkit.configuration.ConfigurationSection; +import java.math.RoundingMode; +import java.text.DecimalFormat; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -120,8 +126,7 @@ public Prize(String prizeNumber, String crateName, Tier tier, ItemStack stack, b this.alternativePrize = null; this.prizeName = ""; - this.maxRange = 100; - this.chance = 100; + this.weight = 100; this.firework = false; this.messages = messages; 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 af78fc5a7..0958745f2 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 @@ -2,7 +2,7 @@ import com.badbones69.crazycrates.api.enums.misc.Keys; import com.badbones69.crazycrates.api.builders.ItemBuilder; -import com.ryderbelserion.vital.common.utils.StringUtil; +import com.badbones69.crazycrates.api.objects.gacha.util.TierInfo; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; @@ -38,8 +38,7 @@ public Tier(String tier, double chance, int slot, @NotNull TierInfo stack) { this.coloredName = stack.name(); this.lore = stack.lore(); this.item = new ItemBuilder(stack.material()).setCustomModelData(stack.modelData()); - this.chance = chance; - this.maxRange = 100; + this.weight = chance; this.slot = slot; } diff --git a/paper/src/main/java/com/badbones69/crazycrates/api/objects/gacha/data/CrateSettings.java b/paper/src/main/java/com/badbones69/crazycrates/api/objects/gacha/data/CrateSettings.java index 42f301a9e..12b251643 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/api/objects/gacha/data/CrateSettings.java +++ b/paper/src/main/java/com/badbones69/crazycrates/api/objects/gacha/data/CrateSettings.java @@ -83,7 +83,7 @@ public CrateSettings(FileConfiguration config, String crateName, Crate crate) { rarityMap.put(rarity, raritySettings); } - CustomFile customFile = plugin.getFileManager().getFile(true, bannerFile); + CustomFile customFile = plugin.getFileManager().getFile(bannerFile, true); if (customFile == null) { bannerPackage = new BannerPackage(null, null, false); diff --git a/paper/src/main/java/com/badbones69/crazycrates/commands/CommandManager.java b/paper/src/main/java/com/badbones69/crazycrates/commands/CommandManager.java index f419bd7da..65e1f7fc6 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/commands/CommandManager.java +++ b/paper/src/main/java/com/badbones69/crazycrates/commands/CommandManager.java @@ -1,10 +1,15 @@ package com.badbones69.crazycrates.commands; import com.badbones69.crazycrates.api.objects.Crate; -import com.badbones69.crazycrates.api.objects.other.CrateLocation; +import com.badbones69.crazycrates.api.objects.crates.CrateLocation; +import com.badbones69.crazycrates.api.objects.gacha.data.CrateSettings; +import com.badbones69.crazycrates.api.objects.gacha.data.RaritySettings; +import com.badbones69.crazycrates.api.objects.gacha.enums.Rarity; +import com.badbones69.crazycrates.api.objects.gacha.enums.RewardType; import com.badbones69.crazycrates.commands.crates.types.admin.crates.CommandAddItem; import com.badbones69.crazycrates.commands.crates.types.admin.crates.CommandMigrate; import com.badbones69.crazycrates.commands.crates.types.admin.crates.migrator.enums.MigrationType; +import com.badbones69.crazycrates.commands.crates.types.custom.*; import com.badbones69.crazycrates.commands.relations.ArgumentRelations; import com.badbones69.crazycrates.commands.crates.types.player.CommandHelp; import com.badbones69.crazycrates.commands.crates.types.admin.CommandAdmin; @@ -25,11 +30,12 @@ import dev.triumphteam.cmd.core.suggestion.SuggestionKey; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; import org.jetbrains.annotations.NotNull; import com.badbones69.crazycrates.CrazyCrates; -import java.util.ArrayList; -import java.util.List; + +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.IntStream; public class CommandManager { @@ -128,9 +134,7 @@ public static void load() { return collect; }); - commandManager.registerSuggestion(SuggestionKey.of("cmdd"), (sender, context) -> { - return List.of("vote", "premium"); - }); + commandManager.registerSuggestion(SuggestionKey.of("cmdd"), (sender, context) -> List.of("vote", "premium")); commandManager.registerSuggestion(SuggestionKey.of("doubles"), (sender, context) -> { final List numbers = new ArrayList<>(); diff --git a/paper/src/main/java/com/badbones69/crazycrates/listeners/crates/types/GachaCrateListener.java b/paper/src/main/java/com/badbones69/crazycrates/listeners/crates/types/GachaCrateListener.java index b0791c713..459770089 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/listeners/crates/types/GachaCrateListener.java +++ b/paper/src/main/java/com/badbones69/crazycrates/listeners/crates/types/GachaCrateListener.java @@ -1,12 +1,12 @@ package com.badbones69.crazycrates.listeners.crates.types; import com.badbones69.crazycrates.CrazyCrates; -import com.badbones69.crazycrates.api.builders.types.CratePrizeMenu; import com.badbones69.crazycrates.api.objects.Crate; import com.badbones69.crazycrates.api.objects.gacha.data.Result; import com.badbones69.crazycrates.tasks.crates.CrateManager; import com.badbones69.crazycrates.tasks.crates.other.GachaCrateManager; import com.badbones69.crazycrates.tasks.crates.types.roulette.RouletteStandard; +import com.badbones69.crazycrates.tasks.menus.CratePrizeMenu; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/CrateManager.java b/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/CrateManager.java index d82505c62..059f8c4cc 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/CrateManager.java +++ b/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/CrateManager.java @@ -3,28 +3,24 @@ import ch.jalu.configme.SettingsManager; import com.Zrips.CMI.Modules.ModuleHandling.CMIModule; import com.badbones69.crazycrates.api.builders.CrateBuilder; -import com.badbones69.crazycrates.api.builders.types.CrateMainMenu; -import com.badbones69.crazycrates.api.crates.CrateHologram; -import com.badbones69.crazycrates.api.crates.quadcrates.CrateSchematic; import com.badbones69.crazycrates.api.enums.misc.Files; -import com.badbones69.crazycrates.api.objects.other.BrokeLocation; import com.badbones69.crazycrates.api.ChestManager; -import com.badbones69.crazycrates.api.utils.MiscUtils; +import com.badbones69.crazycrates.api.objects.crates.BrokeLocation; +import com.badbones69.crazycrates.api.objects.crates.CrateHologram; +import com.badbones69.crazycrates.api.objects.crates.CrateLocation; +import com.badbones69.crazycrates.api.objects.crates.quadcrates.CrateSchematic; +import com.badbones69.crazycrates.api.objects.gacha.DatabaseManager; +import com.badbones69.crazycrates.api.objects.gacha.gacha.GachaSystem; +import com.badbones69.crazycrates.managers.InventoryManager; +import com.badbones69.crazycrates.managers.config.ConfigManager; +import com.badbones69.crazycrates.managers.config.impl.ConfigKeys; import com.badbones69.crazycrates.support.holograms.types.CMIHologramsSupport; import com.badbones69.crazycrates.support.holograms.types.DecentHologramsSupport; import com.badbones69.crazycrates.support.holograms.types.FancyHologramsSupport; -import com.badbones69.crazycrates.tasks.InventoryManager; -import com.badbones69.crazycrates.tasks.crates.types.CasinoCrate; -import com.badbones69.crazycrates.tasks.crates.types.CosmicCrate; -import com.badbones69.crazycrates.tasks.crates.types.CrateOnTheGo; -import com.badbones69.crazycrates.tasks.crates.types.CsgoCrate; -import com.badbones69.crazycrates.tasks.crates.types.FireCrackerCrate; -import com.badbones69.crazycrates.tasks.crates.types.QuadCrate; -import com.badbones69.crazycrates.tasks.crates.types.QuickCrate; -import com.badbones69.crazycrates.tasks.crates.types.RouletteCrate; -import com.badbones69.crazycrates.tasks.crates.types.WarCrate; -import com.badbones69.crazycrates.tasks.crates.types.WheelCrate; -import com.badbones69.crazycrates.tasks.crates.types.WonderCrate; +import com.badbones69.crazycrates.tasks.crates.types.*; +import com.badbones69.crazycrates.tasks.menus.CrateMainMenu; +import com.badbones69.crazycrates.utils.ItemUtils; +import com.badbones69.crazycrates.utils.MiscUtils; import com.ryderbelserion.vital.paper.api.files.CustomFile; import com.ryderbelserion.vital.paper.api.files.FileManager; import com.ryderbelserion.vital.common.utils.FileUtil; @@ -32,6 +28,7 @@ import com.ryderbelserion.vital.paper.api.enums.Support; import io.papermc.paper.persistence.PersistentDataContainerView; import io.papermc.paper.threadedregions.scheduler.ScheduledTask; +import lombok.Getter; import net.kyori.adventure.text.logger.slf4j.ComponentLogger; import org.bukkit.NamespacedKey; import org.bukkit.event.inventory.InventoryCloseEvent; @@ -46,12 +43,9 @@ import us.crazycrew.crazycrates.api.enums.types.CrateType; import us.crazycrew.crazycrates.api.enums.types.KeyType; import com.badbones69.crazycrates.api.enums.misc.Keys; -import com.badbones69.crazycrates.config.ConfigManager; -import com.badbones69.crazycrates.config.impl.ConfigKeys; import com.badbones69.crazycrates.api.enums.Messages; import com.badbones69.crazycrates.support.holograms.HologramManager; import com.badbones69.crazycrates.api.objects.Crate; -import com.badbones69.crazycrates.api.objects.other.CrateLocation; import com.badbones69.crazycrates.api.objects.Prize; import com.badbones69.crazycrates.api.objects.Tier; import org.bukkit.Location; @@ -63,7 +57,6 @@ import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; import com.badbones69.crazycrates.CrazyCrates; -import com.badbones69.crazycrates.api.utils.ItemUtils; import java.io.File; import java.nio.file.Path; import java.util.ArrayList; diff --git a/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/types/GachaCrate.java b/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/types/GachaCrate.java index 503e61f03..02dc7820b 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/types/GachaCrate.java +++ b/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/types/GachaCrate.java @@ -10,10 +10,10 @@ import com.badbones69.crazycrates.api.objects.gacha.enums.Rarity; import com.badbones69.crazycrates.api.objects.gacha.gacha.GachaSystem; import com.badbones69.crazycrates.api.objects.gacha.ultimatemenu.UltimateMenuStuff; -import com.badbones69.crazycrates.api.utils.MiscUtils; -import com.badbones69.crazycrates.tasks.BukkitUserManager; +import com.badbones69.crazycrates.managers.BukkitUserManager; import com.badbones69.crazycrates.tasks.crates.CrateManager; import com.badbones69.crazycrates.tasks.crates.types.roulette.RouletteStandard; +import com.badbones69.crazycrates.utils.MiscUtils; import org.bukkit.Material; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; diff --git a/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/types/roulette/RouletteStandard.java b/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/types/roulette/RouletteStandard.java index 249b187dd..b9ad78c59 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/types/roulette/RouletteStandard.java +++ b/paper/src/main/java/com/badbones69/crazycrates/tasks/crates/types/roulette/RouletteStandard.java @@ -9,9 +9,9 @@ import com.badbones69.crazycrates.api.objects.gacha.data.Result; import com.badbones69.crazycrates.api.objects.gacha.enums.Rarity; import com.badbones69.crazycrates.api.objects.gacha.ultimatemenu.UltimateMenuStuff; -import com.badbones69.crazycrates.api.utils.MiscUtils; import com.badbones69.crazycrates.tasks.crates.CrateManager; import com.badbones69.crazycrates.tasks.crates.other.GachaCrateManager; +import com.badbones69.crazycrates.utils.MiscUtils; import com.ryderbelserion.vital.paper.util.scheduler.FoliaRunnable; import lombok.Getter; import net.kyori.adventure.sound.Sound; diff --git a/paper/src/main/java/com/badbones69/crazycrates/tasks/menus/CratePreviewMenu.java b/paper/src/main/java/com/badbones69/crazycrates/tasks/menus/CratePreviewMenu.java index 2acb42ee7..ae27ea3a5 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/tasks/menus/CratePreviewMenu.java +++ b/paper/src/main/java/com/badbones69/crazycrates/tasks/menus/CratePreviewMenu.java @@ -1,4 +1,4 @@ -package com.badbones69.crazycrates.api.builders.types; +package com.badbones69.crazycrates.tasks.menus; import com.badbones69.crazycrates.api.builders.gui.DynamicInventoryBuilder; import com.badbones69.crazycrates.api.objects.Crate; diff --git a/paper/src/main/java/com/badbones69/crazycrates/tasks/menus/CrateTierMenu.java b/paper/src/main/java/com/badbones69/crazycrates/tasks/menus/CrateTierMenu.java index b72e7b0ba..9bb1b04fe 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/tasks/menus/CrateTierMenu.java +++ b/paper/src/main/java/com/badbones69/crazycrates/tasks/menus/CrateTierMenu.java @@ -1,14 +1,18 @@ -package com.badbones69.crazycrates.api.builders.types; +package com.badbones69.crazycrates.tasks.menus; +import com.badbones69.crazycrates.api.builders.ItemBuilder; import com.badbones69.crazycrates.api.builders.gui.StaticInventoryBuilder; +import com.badbones69.crazycrates.api.builders.types.items.BonusPityMenu; import com.badbones69.crazycrates.api.enums.misc.Keys; import com.badbones69.crazycrates.api.objects.Crate; import com.badbones69.crazycrates.api.objects.Tier; +import com.badbones69.crazycrates.api.objects.gacha.ultimatemenu.UltimateMenuStuff; import com.ryderbelserion.vital.paper.api.builders.gui.interfaces.Gui; import com.ryderbelserion.vital.paper.api.builders.gui.interfaces.GuiFiller; import com.ryderbelserion.vital.paper.api.builders.gui.interfaces.GuiItem; import io.papermc.paper.persistence.PersistentDataContainerView; import net.kyori.adventure.sound.Sound; +import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import us.crazycrew.crazycrates.api.enums.types.CrateType; @@ -79,7 +83,7 @@ private void setItemsGacha() { .addDisplayLore("po dostatku otevření"); item.setCustomModelData(1000001); - gui.setItem(crate.getAbsolutePreviewItemPosition(8), item.asGuiItem(action -> { + gui.setItem(crate.getMaxSlots() - 1, item.asGuiItem(action -> { player.playSound(UltimateMenuStuff.CLICK); player.openInventory(new BonusPityMenu(crate, player, 36, "Bonus pity prize", this).build().getInventory()); })); @@ -87,11 +91,11 @@ private void setItemsGacha() { ItemBuilder paper = new ItemBuilder(Material.PAPER).setCustomModelData(11).setDisplayName("Info"); paper.addDisplayLore("Zde najdeš informace o"); paper.addDisplayLore("itemech a jejich šancích"); - gui.setItem(getCrate().getAbsolutePreviewItemPosition(4), paper.asGuiItem()); + gui.setItem(crate.getMaxSlots() - 5, paper.asGuiItem()); ItemBuilder mainMenu = new ItemBuilder(Material.CHEST).setDisplayName("Hlavní Menu"); mainMenu.setCustomModelData(1000001); - gui.setItem(getCrate().getAbsolutePreviewItemPosition(0), mainMenu.asGuiItem(action -> { + gui.setItem(crate.getMaxSlots() - 8, mainMenu.asGuiItem(action -> { player.playSound(UltimateMenuStuff.BACK); plugin.getCrateManager().getDatabaseManager().getUltimateMenuManager().open(player, crate); }));