Merge branch 'development'

This commit is contained in:
Brianna 2020-10-26 15:40:55 -05:00
commit b604e34bc1
4 changed files with 19 additions and 4 deletions

View File

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

View File

@ -324,13 +324,13 @@ public class Kit {
itemGiveAmount--;
if (rand < ch || ch == 100) {
ItemStack parseStack = item.getContent().process(player);
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, parseStack));
plugin.getGuiManager().showGUI(player, new AnimatedKitGui(plugin, player, this, item.getItemForDisplay()));
return true;
} else {
ItemStack parseStack = item.getContent().process(player);
if (item.getContent() instanceof KitContentEconomy
|| item.getContent() instanceof KitContentCommand)
continue;
@ -347,7 +347,7 @@ public class Kit {
}
}
if (itemGiveAmount != 0) {
if (itemGiveAmount > 0 && !innerContents.isEmpty()) {
return generateRandomItem(innerContents, itemGiveAmount, player);
}

View File

@ -22,6 +22,7 @@ import java.util.List;
public class KitItem {
private KitContent content;
private KitItemType type;
private String displayName, displayLore = null;
private Material displayItem = null;
private double chance = 0;
@ -46,11 +47,14 @@ public class KitItem {
private void processContent(String line, ItemStack item) {
if (line != null && line.startsWith(Settings.CURRENCY_SYMBOL.getString())) {
this.content = new KitContentEconomy(Double.parseDouble(line.substring(1).trim()));
this.type = KitItemType.ECONOMY;
} else if (line != null && line.startsWith("/")) {
this.content = new KitContentCommand(line.substring(1));
this.type = KitItemType.COMMAND;
} else {
ItemStack itemStack = item == null ? UltimateKits.getInstance().getItemSerializer().deserializeItemStackFromJson(line) : item;
this.content = itemStack != null ? new KitContentItem(itemStack) : null;
this.type = KitItemType.ITEM;
}
}
@ -214,6 +218,10 @@ public class KitItem {
return item;
}
public KitItemType getType() {
return type;
}
@Override
public String toString() {
return "KitItem:{"

View File

@ -0,0 +1,7 @@
package com.songoda.ultimatekits.kit;
public enum KitItemType {
ITEM, ECONOMY, COMMAND
}