use of com.eintosti.buildsystem.object.world.data.WorldType in project BuildSystem by Trichtern.
the class CreateInventory method onInventoryClick.
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if (!inventoryManager.checkIfValidClick(event, "create_title")) {
return;
}
Player player = (Player) event.getWhoClicked();
CreateInventory.Page newPage = null;
switch(event.getSlot()) {
case 12:
newPage = CreateInventory.Page.PREDEFINED;
break;
case 13:
newPage = CreateInventory.Page.GENERATOR;
break;
case 14:
newPage = CreateInventory.Page.TEMPLATES;
break;
}
if (newPage != null) {
openInventory(player, newPage, this.createPrivateWorld);
XSound.ENTITY_CHICKEN_EGG.play(player);
return;
}
Inventory inventory = event.getClickedInventory();
if (inventory == null) {
return;
}
int slot = event.getSlot();
switch(Page.getCurrentPage(inventory)) {
case PREDEFINED:
{
WorldType worldType = null;
switch(slot) {
case 29:
worldType = WorldType.NORMAL;
break;
case 30:
worldType = WorldType.FLAT;
break;
case 31:
worldType = WorldType.NETHER;
break;
case 32:
worldType = WorldType.END;
break;
case 33:
worldType = WorldType.VOID;
break;
}
if (worldType != null) {
worldManager.startWorldNameInput(player, worldType, null, createPrivateWorld);
XSound.ENTITY_CHICKEN_EGG.play(player);
}
break;
}
case GENERATOR:
{
if (slot == 31) {
worldManager.startWorldNameInput(player, WorldType.CUSTOM, null, createPrivateWorld);
XSound.ENTITY_CHICKEN_EGG.play(player);
}
break;
}
case TEMPLATES:
{
ItemStack itemStack = event.getCurrentItem();
if (itemStack == null) {
return;
}
XMaterial xMaterial = XMaterial.matchXMaterial(itemStack);
switch(xMaterial) {
case FILLED_MAP:
worldManager.startWorldNameInput(player, WorldType.TEMPLATE, itemStack.getItemMeta().getDisplayName(), createPrivateWorld);
break;
case PLAYER_HEAD:
if (slot == 38) {
decrementInv(player);
} else if (slot == 42) {
incrementInv(player);
}
openInventory(player, CreateInventory.Page.TEMPLATES, createPrivateWorld);
break;
default:
return;
}
XSound.ENTITY_CHICKEN_EGG.play(player);
break;
}
}
}
Aggregations