From 8d212b355187dcc09dbe0f995f742ddaaf0f6e2a Mon Sep 17 00:00:00 2001 From: David Berdik Date: Mon, 2 Sep 2019 19:44:55 -0400 Subject: [PATCH] Updated CustomID. All errors are gone now! --- .../jakub1221/herobrineai/misc/CustomID.java | 57 ++----------------- 1 file changed, 6 insertions(+), 51 deletions(-) diff --git a/src/org/jakub1221/herobrineai/misc/CustomID.java b/src/org/jakub1221/herobrineai/misc/CustomID.java index 872a361..67a7ba0 100644 --- a/src/org/jakub1221/herobrineai/misc/CustomID.java +++ b/src/org/jakub1221/herobrineai/misc/CustomID.java @@ -1,63 +1,18 @@ package org.jakub1221.herobrineai.misc; +import org.bukkit.Material; import org.bukkit.inventory.ItemStack; public class CustomID { - - private int ID; - private int DATA; - + + private String NAME; + public CustomID(String _data) { - if (_data != null) { - if (!_data.equals("0")) { - if (_data != null && _data.length() > 0) { - String[] both = _data.split(":"); - ID = Integer.parseInt(both[0]); - if (both.length > 1) { - DATA = Integer.parseInt(both[1]); - } else { - DATA = 0; - } - } else { - ID = 0; - DATA = 0; - } - } else { - ID = 0; - DATA = 0; - } - } else { - ID = 0; - DATA = 0; - } - } - - public int getID() { - return ID; - } - - public int getDATA() { - return DATA; - } - - public boolean isData() { - if (DATA > 0) { - return true; - } - return false; + NAME = _data; } public ItemStack getItemStack() { - ItemStack item = null; - if (ID != 0) { - if (DATA > 0) { - item = new ItemStack(ID, 1, (byte) DATA); - } else { - item = new ItemStack(ID); - } - } - return item; - + return new ItemStack(Material.matchMaterial(NAME)); } }