mirror of
https://github.com/songoda/UltimateKits.git
synced 2024-11-08 11:41:28 +01:00
Fixed roulette, added configurable roulette length multiplier.
This commit is contained in:
parent
4adbfae627
commit
66f5ce7a2c
@ -72,7 +72,7 @@ public class AnimatedKitGui extends Gui {
|
|||||||
int updatesPerSlow = 6;
|
int updatesPerSlow = 6;
|
||||||
if (++updateTick >= updatesPerSlow) {
|
if (++updateTick >= updatesPerSlow) {
|
||||||
updateTick = 0;
|
updateTick = 0;
|
||||||
int ticksPerUpdateSlow = 10;
|
int ticksPerUpdateSlow = Settings.ROULETTE_LENGTH_MULTIPLIER.getInt();
|
||||||
if (++ticksPerUpdate >= ticksPerUpdateSlow) {
|
if (++ticksPerUpdate >= ticksPerUpdateSlow) {
|
||||||
finish = true;
|
finish = true;
|
||||||
}
|
}
|
||||||
@ -92,17 +92,17 @@ public class AnimatedKitGui extends Gui {
|
|||||||
items.removeLast();
|
items.removeLast();
|
||||||
Iterator<KitItem> itemIter = items.iterator();
|
Iterator<KitItem> itemIter = items.iterator();
|
||||||
for (int i = 9; i < 18; i++) {
|
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?
|
// should we try to wrap it up?
|
||||||
if (finish) {
|
if (finish) {
|
||||||
ItemStack item = getItem(13);
|
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) {
|
if (item == null) {
|
||||||
done = true; // idk.
|
done = true; // idk.
|
||||||
} else if (isSimilar(give, kitItem)) {
|
} else if (item.isSimilar(give)) {
|
||||||
if (!done) {
|
if (!done) {
|
||||||
done = true;
|
done = true;
|
||||||
if (!Settings.AUTO_EQUIP_ARMOR_ROULETTE.getBoolean() || !ArmorType.equip(player, give)) {
|
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() {
|
private void finish() {
|
||||||
Bukkit.getScheduler().cancelTask(task);
|
Bukkit.getScheduler().cancelTask(task);
|
||||||
exit();
|
exit();
|
||||||
|
@ -327,7 +327,7 @@ public class Kit {
|
|||||||
if (kitAnimation != KitAnimation.NONE) {
|
if (kitAnimation != KitAnimation.NONE) {
|
||||||
// TODO: this is a very bad way to solve this problem.
|
// 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.
|
// 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;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
ItemStack parseStack = item.getContent().process(player);
|
ItemStack parseStack = item.getContent().process(player);
|
||||||
|
@ -24,6 +24,9 @@ public class Settings {
|
|||||||
public static final ConfigSetting STARTER_KIT = new ConfigSetting(config, "Main.Starter Kit", "none");
|
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",
|
public static final ConfigSetting KEY_MATERIAL = new ConfigSetting(config, "Main.Key Material", "TRIPWIRE_HOOK",
|
||||||
"What type of material should be used for kit keys?");
|
"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(),
|
public static final ConfigSetting ECONOMY_PLUGIN = new ConfigSetting(config, "Main.Economy", EconomyManager.getEconomy() == null ? "Vault" : EconomyManager.getEconomy().getName(),
|
||||||
"Which economy plugin should be used?",
|
"Which economy plugin should be used?",
|
||||||
|
Loading…
Reference in New Issue
Block a user