diff --git a/pom.xml b/pom.xml
index 62a94fe..b41265b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
com.songoda
UltimateKits
4.0.0
- 2.6.11
+ 2.6.12
clean install
UltimateKits-${project.version}
diff --git a/src/main/java/com/songoda/ultimatekits/kit/Kit.java b/src/main/java/com/songoda/ultimatekits/kit/Kit.java
index 4a74511..a3478ee 100644
--- a/src/main/java/com/songoda/ultimatekits/kit/Kit.java
+++ b/src/main/java/com/songoda/ultimatekits/kit/Kit.java
@@ -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);
}
diff --git a/src/main/java/com/songoda/ultimatekits/kit/KitItem.java b/src/main/java/com/songoda/ultimatekits/kit/KitItem.java
index 8e779a8..7175fb5 100644
--- a/src/main/java/com/songoda/ultimatekits/kit/KitItem.java
+++ b/src/main/java/com/songoda/ultimatekits/kit/KitItem.java
@@ -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:{"
diff --git a/src/main/java/com/songoda/ultimatekits/kit/KitItemType.java b/src/main/java/com/songoda/ultimatekits/kit/KitItemType.java
new file mode 100644
index 0000000..9a6974c
--- /dev/null
+++ b/src/main/java/com/songoda/ultimatekits/kit/KitItemType.java
@@ -0,0 +1,7 @@
+package com.songoda.ultimatekits.kit;
+
+public enum KitItemType {
+
+ ITEM, ECONOMY, COMMAND
+
+}