Merge branch 'development'

This commit is contained in:
Fernando Pettinelli 2021-01-19 21:58:41 -03:00
commit b7e021aa05
4 changed files with 9 additions and 20 deletions

View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId>
<artifactId>UltimateKits</artifactId>
<modelVersion>4.0.0</modelVersion>
<version>2.6.12b</version>
<version>2.6.13</version>
<build>
<defaultGoal>clean install</defaultGoal>
<finalName>UltimateKits-${project.version}</finalName>

View File

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

View File

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

View File

@ -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?",