use of com.eintosti.buildsystem.object.world.BuildWorld in project BuildSystem by Trichtern.
the class FilteredWorldsInventory method addWorlds.
private void addWorlds(Player player) {
int numWorlds = numOfWorlds(player);
int numInventories = (numWorlds % MAX_WORLDS == 0 ? numWorlds : numWorlds + 1) != 0 ? (numWorlds % MAX_WORLDS == 0 ? numWorlds : numWorlds + 1) : 1;
inventories = new Inventory[numInventories];
Inventory inventory = createInventory(player);
int index = 0;
inventories[index] = inventory;
if (numWorlds == 0) {
inventoryManager.addUrlSkull(inventory, 22, plugin.getString(noWorldsText), "https://textures.minecraft.net/texture/2e3f50ba62cbda3ecf5479b62fedebd61d76589771cc19286bf2745cd71e47c6");
return;
}
int columnWorld = 9, maxColumnWorld = 44;
for (BuildWorld buildWorld : inventoryManager.sortWorlds(worldManager, plugin.getSettingsManager().getSettings(player))) {
if (isValidWorld(player, buildWorld)) {
inventoryManager.addWorldItem(player, inventory, columnWorld++, buildWorld);
}
if (columnWorld > maxColumnWorld) {
columnWorld = 9;
inventory = createInventory(player);
inventories[++index] = inventory;
}
}
}
use of com.eintosti.buildsystem.object.world.BuildWorld in project BuildSystem by Trichtern.
the class GameRuleInventory method onInventoryClick.
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if (!inventoryManager.checkIfValidClick(event, "worldeditor_gamerules_title")) {
return;
}
ItemStack itemStack = event.getCurrentItem();
if (itemStack == null) {
return;
}
Player player = (Player) event.getWhoClicked();
BuildWorld buildWorld = plugin.getPlayerManager().getSelectedWorld().get(player.getUniqueId());
if (buildWorld == null) {
player.closeInventory();
player.sendMessage(plugin.getString("worlds_edit_error"));
return;
}
GameRules gameRules = plugin.getGameRules();
switch(itemStack.getType()) {
case PLAYER_HEAD:
int slot = event.getSlot();
if (slot == 36) {
gameRules.decrementInv(player);
} else if (slot == 44) {
gameRules.incrementInv(player);
}
break;
case FILLED_MAP:
case MAP:
World bukkitWorld = Bukkit.getWorld(buildWorld.getName());
gameRules.toggleGameRule(event, bukkitWorld);
break;
default:
XSound.BLOCK_CHEST_OPEN.play(player);
plugin.getEditInventory().openInventory(player, buildWorld);
return;
}
XSound.ENTITY_CHICKEN_EGG.play(player);
openInventory(player, buildWorld);
}
use of com.eintosti.buildsystem.object.world.BuildWorld in project BuildSystem by Trichtern.
the class GameRuleInventory method openInventory.
public void openInventory(Player player, BuildWorld buildWorld) {
World bukkitWorld = Bukkit.getWorld(buildWorld.getName());
Inventory inventory = plugin.getGameRules().getInventory(player, bukkitWorld);
fillGuiWithGlass(player, inventory);
player.openInventory(inventory);
}
use of com.eintosti.buildsystem.object.world.BuildWorld in project BuildSystem by Trichtern.
the class WorldManipulateListener method onBlockPlace.
@EventHandler(priority = EventPriority.HIGHEST)
public void onBlockPlace(BlockPlaceEvent event) {
if (event.isCancelled()) {
return;
}
Player player = event.getPlayer();
BuildWorld buildWorld = worldManager.getBuildWorld(player.getWorld().getName());
if (buildWorld == null) {
return;
}
if (!manageWorldInteraction(player, event, buildWorld.isBlockPlacement())) {
setStatus(buildWorld, player);
}
}
use of com.eintosti.buildsystem.object.world.BuildWorld in project BuildSystem by Trichtern.
the class WorldManipulateListener method onPlayerArmorStandManipulate.
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerArmorStandManipulate(PlayerArmorStandManipulateEvent event) {
Player player = event.getPlayer();
BuildWorld buildWorld = worldManager.getBuildWorld(player.getWorld().getName());
if (buildWorld == null) {
return;
}
manageWorldInteraction(player, event, buildWorld.isBlockInteractions());
}
Aggregations