From 85011e0453054f117a922ff42314ac141f0d634b Mon Sep 17 00:00:00 2001 From: Brianna Date: Mon, 26 Oct 2020 15:27:08 -0500 Subject: [PATCH] Declare kit types. --- src/main/java/com/songoda/ultimatekits/kit/KitItem.java | 8 ++++++++ .../java/com/songoda/ultimatekits/kit/KitItemType.java | 7 +++++++ 2 files changed, 15 insertions(+) create mode 100644 src/main/java/com/songoda/ultimatekits/kit/KitItemType.java 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 + +}