Declare kit types.

This commit is contained in:
Brianna 2020-10-26 15:27:08 -05:00
parent e5e9a96211
commit 85011e0453
2 changed files with 15 additions and 0 deletions

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
}