Files
EnderDragon/src/main/java/xanadu/enderdragon/gui/GUISlot.java
T
2023-02-10 19:58:06 +08:00

40 lines
1.2 KiB
Java

package xanadu.enderdragon.gui;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.ItemStack;
import xanadu.enderdragon.gui.slots.*;
public abstract class GUISlot {
private final GUISlotType guiSlotType;
public abstract ItemStack getItem();
public abstract ItemStack getItemOnDisable();
protected GUISlot(GUISlotType type){
this.guiSlotType = type;
}
public final GUISlotType getType(){
return this.guiSlotType;
}
public static GUISlot parse(ConfigurationSection section){
if(section == null) return new EmptySlot();
GUISlotType guiSlotType = GUISlotType.getByName(section.getString("type"));
switch (guiSlotType) {
case ITEM_SLOT : {
return new ItemSlot(section);
}
case DRAGON_SLOT : {
return new DragonSlot(section);
}
case PAGE_PREV :
case PAGE_NEXT :
case PAGE_TIP :
case TIP : {
return new TipSlot(guiSlotType, section);
}
case PAGE_JUMP : {
return new PageJumpSlot(section);
}
}
return new EmptySlot();
}
}