Search in sources :

Example 71 with BuildWorld

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

the class BuildWorldResetUnloadListener method onPlayerQuit.

@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
    World from = event.getPlayer().getWorld();
    BuildWorld buildWorld = worldManager.getBuildWorld(from.getName());
    if (buildWorld != null) {
        buildWorld.resetUnloadTask();
    }
}
Also used : BuildWorld(com.eintosti.buildsystem.object.world.BuildWorld) World(org.bukkit.World) BuildWorld(com.eintosti.buildsystem.object.world.BuildWorld) EventHandler(org.bukkit.event.EventHandler)

Example 72 with BuildWorld

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

the class EditSessionListener method onEditSession.

@Subscribe
public void onEditSession(EditSessionEvent event) {
    Actor actor = event.getActor();
    if (actor == null || !actor.isPlayer()) {
        return;
    }
    Player player = Bukkit.getPlayer(actor.getName());
    if (player == null) {
        return;
    }
    BuildWorld buildWorld = worldManager.getBuildWorld(player.getWorld().getName());
    if (buildWorld == null) {
        return;
    }
    if (event.getStage() == EditSession.Stage.BEFORE_CHANGE) {
        disableArchivedWorlds(buildWorld, player, event);
        checkBuilders(buildWorld, player, event);
    }
}
Also used : BuildWorld(com.eintosti.buildsystem.object.world.BuildWorld) Player(org.bukkit.entity.Player) Actor(com.sk89q.worldedit.extension.platform.Actor) Subscribe(com.sk89q.worldedit.util.eventbus.Subscribe)

Example 73 with BuildWorld

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

the class PlayerChangedWorldListener method onPlayerChangedWorld.

@EventHandler
public void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
    Player player = event.getPlayer();
    String worldName = player.getWorld().getName();
    BuildWorld oldWorld = worldManager.getBuildWorld(event.getFrom().getName());
    if (oldWorld != null && configValues.isUnloadWorlds()) {
        oldWorld.resetUnloadTask();
    }
    BuildWorld newWorld = worldManager.getBuildWorld(worldName);
    if (newWorld != null) {
        if (!newWorld.isPhysics()) {
            if (player.hasPermission("buildsystem.physics.message")) {
                player.sendMessage(plugin.getString("physics_deactivated_in_world").replace("%world%", newWorld.getName()));
            }
        }
    }
    removeOldNavigator(player);
    removeBuildMode(player);
    setGoldBlock(newWorld);
    checkWorldStatus(player);
    if (settingsManager.getSettings(player).isScoreboard()) {
        playerManager.forceUpdateSidebar(player);
    }
}
Also used : BuildWorld(com.eintosti.buildsystem.object.world.BuildWorld) Player(org.bukkit.entity.Player) EventHandler(org.bukkit.event.EventHandler)

Example 74 with BuildWorld

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

the class ExplosionsCommand method toggleExplosions.

private void toggleExplosions(Player player, World bukkitWorld) {
    if (bukkitWorld == null) {
        player.sendMessage(plugin.getString("explosions_unknown_world"));
        return;
    }
    BuildWorld buildWorld = worldManager.getBuildWorld(bukkitWorld.getName());
    if (buildWorld == null) {
        player.sendMessage(plugin.getString("explosions_world_not_imported"));
        return;
    }
    if (!buildWorld.isExplosions()) {
        buildWorld.setExplosions(true);
        player.sendMessage(plugin.getString("explosions_activated").replace("%world%", buildWorld.getName()));
    } else {
        buildWorld.setExplosions(false);
        player.sendMessage(plugin.getString("explosions_deactivated").replace("%world%", buildWorld.getName()));
    }
}
Also used : BuildWorld(com.eintosti.buildsystem.object.world.BuildWorld)

Example 75 with BuildWorld

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

the class RoleCalculator method calculate.

@Override
public void calculate(@NonNull Player player, @NonNull ContextConsumer contextConsumer) {
    BuildWorld buildWorld = worldManager.getBuildWorld(player.getWorld());
    contextConsumer.accept(KEY, Role.matchRole(player, buildWorld).toString());
}
Also used : BuildWorld(com.eintosti.buildsystem.object.world.BuildWorld)

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