diff --git a/src/main/java/com/songoda/ultimatekits/gui/AnimatedKitGui.java b/src/main/java/com/songoda/ultimatekits/gui/AnimatedKitGui.java index 903844b..e026ca9 100644 --- a/src/main/java/com/songoda/ultimatekits/gui/AnimatedKitGui.java +++ b/src/main/java/com/songoda/ultimatekits/gui/AnimatedKitGui.java @@ -72,7 +72,7 @@ public class AnimatedKitGui extends Gui { int updatesPerSlow = 6; if (++updateTick >= updatesPerSlow) { updateTick = 0; - int ticksPerUpdateSlow = 10; + int ticksPerUpdateSlow = Settings.ROULETTE_LENGTH_MULTIPLIER.getInt(); if (++ticksPerUpdate >= ticksPerUpdateSlow) { finish = true; } @@ -92,17 +92,17 @@ public class AnimatedKitGui extends Gui { items.removeLast(); Iterator itemIter = items.iterator(); for (int i = 9; i < 18; i++) { - setItem(0, i, itemIter.next().getItemForDisplay()); + setItem(0, i, itemIter.next().getItem()); } } // should we try to wrap it up? if (finish) { ItemStack item = getItem(13); - KitItem kitItem = items.stream().filter(i -> isSimilar(item, i)).findFirst().orElse(null); + KitItem kitItem = items.stream().filter(i -> i.getItem().isSimilar(item)).findFirst().orElse(null); if (item == null) { done = true; // idk. - } else if (isSimilar(give, kitItem)) { + } else if (item.isSimilar(give)) { if (!done) { done = true; if (!Settings.AUTO_EQUIP_ARMOR_ROULETTE.getBoolean() || !ArmorType.equip(player, give)) { @@ -129,20 +129,6 @@ public class AnimatedKitGui extends Gui { } - private boolean isSimilar(ItemStack item, KitItem kitItem) { - if (kitItem == null) return false; - switch (kitItem.getType()) { - case COMMAND: - case ECONOMY: - System.out.println("1 " + item.getItemMeta().getLore()); - System.out.println("2 " + kitItem.getItemForDisplay().getItemMeta().getLore()); - System.out.println(item.getItemMeta().getLore().get(0).equals(kitItem.getItemForDisplay().getItemMeta().getLore())); - return item.getItemMeta().getLore().get(0).equals(kitItem.getItemForDisplay().getItemMeta().getLore()); - default: - return item.isSimilar(kitItem.getItemForDisplay()); - } - } - private void finish() { Bukkit.getScheduler().cancelTask(task); exit(); diff --git a/src/main/java/com/songoda/ultimatekits/kit/Kit.java b/src/main/java/com/songoda/ultimatekits/kit/Kit.java index a3478ee..c2fb9ac 100644 --- a/src/main/java/com/songoda/ultimatekits/kit/Kit.java +++ b/src/main/java/com/songoda/ultimatekits/kit/Kit.java @@ -327,7 +327,7 @@ public class Kit { if (kitAnimation != KitAnimation.NONE) { // TODO: this is a very bad way to solve this problem. // Giving the player kit rewards really should be done outside of the Kit class. - plugin.getGuiManager().showGUI(player, new AnimatedKitGui(plugin, player, this, item.getItemForDisplay())); + plugin.getGuiManager().showGUI(player, new AnimatedKitGui(plugin, player, this, item.getItem())); return true; } else { ItemStack parseStack = item.getContent().process(player); diff --git a/src/main/java/com/songoda/ultimatekits/settings/Settings.java b/src/main/java/com/songoda/ultimatekits/settings/Settings.java index 876671d..43671c0 100644 --- a/src/main/java/com/songoda/ultimatekits/settings/Settings.java +++ b/src/main/java/com/songoda/ultimatekits/settings/Settings.java @@ -24,6 +24,9 @@ public class Settings { public static final ConfigSetting STARTER_KIT = new ConfigSetting(config, "Main.Starter Kit", "none"); public static final ConfigSetting KEY_MATERIAL = new ConfigSetting(config, "Main.Key Material", "TRIPWIRE_HOOK", "What type of material should be used for kit keys?"); + public static final ConfigSetting ROULETTE_LENGTH_MULTIPLIER = new ConfigSetting(config, "Main.Roulette Length Multiplier", 10, + "This affects the roulette animation length.", + "Lower value is a lower length, and vice-versa."); public static final ConfigSetting ECONOMY_PLUGIN = new ConfigSetting(config, "Main.Economy", EconomyManager.getEconomy() == null ? "Vault" : EconomyManager.getEconomy().getName(), "Which economy plugin should be used?",