Search in sources :

Example 86 with BuildWorld

use of com.eintosti.buildsystem.object.world.BuildWorld in project BuildSystem by einTosti.

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;
        }
    }
}
Also used : BuildWorld(com.eintosti.buildsystem.object.world.BuildWorld) Inventory(org.bukkit.inventory.Inventory)

Example 87 with BuildWorld

use of com.eintosti.buildsystem.object.world.BuildWorld in project BuildSystem by einTosti.

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);
}
Also used : World(org.bukkit.World) BuildWorld(com.eintosti.buildsystem.object.world.BuildWorld) Inventory(org.bukkit.inventory.Inventory)

Example 88 with BuildWorld

use of com.eintosti.buildsystem.object.world.BuildWorld in project BuildSystem by einTosti.

the class PrivateInventory method addWorldCreateItem.

private void addWorldCreateItem(Inventory inventory, Player player) {
    BuildWorld buildWorld = worldManager.getBuildWorld(player.getName());
    if (buildWorld != null || !player.hasPermission("buildsystem.create.private")) {
        inventoryManager.addGlassPane(plugin, player, inventory, 49);
        return;
    }
    inventoryManager.addUrlSkull(inventory, 49, plugin.getString("private_create_world"), "https://textures.minecraft.net/texture/3edd20be93520949e6ce789dc4f43efaeb28c717ee6bfcbbe02780142f716");
}
Also used : BuildWorld(com.eintosti.buildsystem.object.world.BuildWorld)

Example 89 with BuildWorld

use of com.eintosti.buildsystem.object.world.BuildWorld in project BuildSystem by einTosti.

the class BuildSystem method reloadConfigData.

public void reloadConfigData(boolean init) {
    for (Player pl : Bukkit.getOnlinePlayers()) {
        getSettingsManager().stopScoreboard(pl);
    }
    configValues.setConfigValues();
    if (init) {
        initVersionedClasses();
        worldManager.getBuildWorlds().forEach(BuildWorld::manageUnload);
        if (configValues.isScoreboard()) {
            getSettingsManager().startScoreboard();
        } else {
            getSettingsManager().stopScoreboard();
        }
    }
}
Also used : BuildWorld(com.eintosti.buildsystem.object.world.BuildWorld) Player(org.bukkit.entity.Player)

Example 90 with BuildWorld

use of com.eintosti.buildsystem.object.world.BuildWorld in project BuildSystem by einTosti.

the class BlockPhysicsListener method onEntityExplode.

@EventHandler
public void onEntityExplode(EntityExplodeEvent event) {
    Location location = event.getLocation();
    World bukkitWorld = location.getWorld();
    BuildWorld buildWorld = worldManager.getBuildWorld(bukkitWorld.getName());
    if (buildWorld != null && !buildWorld.isExplosions()) {
        event.setCancelled(true);
    }
}
Also used : BuildWorld(com.eintosti.buildsystem.object.world.BuildWorld) World(org.bukkit.World) BuildWorld(com.eintosti.buildsystem.object.world.BuildWorld) Location(org.bukkit.Location) EventHandler(org.bukkit.event.EventHandler)

Aggregations

BuildWorld (com.eintosti.buildsystem.object.world.BuildWorld)143 EventHandler (org.bukkit.event.EventHandler)58 Player (org.bukkit.entity.Player)52 World (org.bukkit.World)40 Block (org.bukkit.block.Block)20 ItemStack (org.bukkit.inventory.ItemStack)18 XMaterial (com.cryptomorin.xseries.XMaterial)16 PlayerChatInput (com.eintosti.buildsystem.util.external.PlayerChatInput)16 UUID (java.util.UUID)14 Location (org.bukkit.Location)14 File (java.io.File)12 ArrayList (java.util.ArrayList)9 BuildSystem (com.eintosti.buildsystem.BuildSystem)6 Builder (com.eintosti.buildsystem.object.world.Builder)6 List (java.util.List)6 Bukkit (org.bukkit.Bukkit)6 Material (org.bukkit.Material)6 ChunkGenerator (org.bukkit.generator.ChunkGenerator)6 Inventory (org.bukkit.inventory.Inventory)6 ItemMeta (org.bukkit.inventory.meta.ItemMeta)6