add data_type:simple
This commit is contained in:
@@ -6,11 +6,12 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import pers.xanadu.enderdragon.gui.GUISlot;
|
import pers.xanadu.enderdragon.gui.GUISlot;
|
||||||
import pers.xanadu.enderdragon.gui.GUISlotType;
|
import pers.xanadu.enderdragon.gui.GUISlotType;
|
||||||
|
import pers.xanadu.enderdragon.manager.ItemManager;
|
||||||
|
|
||||||
import static pers.xanadu.enderdragon.manager.ItemManager.*;
|
import static pers.xanadu.enderdragon.manager.ItemManager.*;
|
||||||
|
|
||||||
public class TipSlot extends GUISlot {
|
public class TipSlot extends GUISlot {
|
||||||
private ItemStack item;
|
private final ItemStack item;
|
||||||
protected boolean hasDisableMode;
|
protected boolean hasDisableMode;
|
||||||
protected ItemStack itemOnDisable;
|
protected ItemStack itemOnDisable;
|
||||||
|
|
||||||
@@ -18,6 +19,7 @@ public class TipSlot extends GUISlot {
|
|||||||
super(slotType);
|
super(slotType);
|
||||||
this.item = new ItemStack(material);
|
this.item = new ItemStack(material);
|
||||||
ItemMeta meta = this.item.getItemMeta();
|
ItemMeta meta = this.item.getItemMeta();
|
||||||
|
assert meta != null;
|
||||||
meta.setDisplayName(str);
|
meta.setDisplayName(str);
|
||||||
this.item.setItemMeta(meta);
|
this.item.setItemMeta(meta);
|
||||||
}
|
}
|
||||||
@@ -28,22 +30,25 @@ public class TipSlot extends GUISlot {
|
|||||||
this.hasDisableMode = true;
|
this.hasDisableMode = true;
|
||||||
}
|
}
|
||||||
else this.hasDisableMode = false;
|
else this.hasDisableMode = false;
|
||||||
if(hasDisableMode){
|
this.data_type = DataType.fromString(section.getString("data_type"));
|
||||||
if(data_type == DataType.NBT) this.itemOnDisable = readFromNBT(section,"data_disable");
|
switch (data_type) {
|
||||||
else this.itemOnDisable = readFromBukkit(section,"data_disable");
|
case NBT:
|
||||||
}
|
ItemManager.getLegacy().compareAndSet(false,true);
|
||||||
String data_type = section.getString("data_type");
|
|
||||||
if("nbt".equals(data_type)) {
|
|
||||||
this.data_type = DataType.NBT;
|
|
||||||
this.item = readFromNBT(section,"data");
|
this.item = readFromNBT(section,"data");
|
||||||
}
|
if(hasDisableMode) this.itemOnDisable = readFromNBT(section,"data_disable");
|
||||||
else if("advanced".equals(data_type)){
|
break;
|
||||||
this.data_type = DataType.ADVANCED;
|
case ADVANCED:
|
||||||
|
ItemManager.getLegacy().compareAndSet(false,true);
|
||||||
this.item = readFromAdvData(section,"data");
|
this.item = readFromAdvData(section,"data");
|
||||||
}
|
if(hasDisableMode) this.itemOnDisable = readFromAdvData(section,"data_disable");
|
||||||
else {
|
break;
|
||||||
this.data_type = DataType.DEFAULT;
|
case SIMPLE:
|
||||||
|
this.item = readFromSimple(section,"data");
|
||||||
|
if(hasDisableMode) this.itemOnDisable = readFromSimple(section,"data_disable");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
this.item = readFromBukkit(section,"data");
|
this.item = readFromBukkit(section,"data");
|
||||||
|
if(hasDisableMode) this.itemOnDisable = readFromBukkit(section,"data_disable");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user