Search in sources :

Example 16 with Settings

use of com.eintosti.buildsystem.object.settings.Settings in project BuildSystem by Trichtern.

the class SettingsInventory method getInventory.

private Inventory getInventory(Player player) {
    Inventory inventory = Bukkit.createInventory(null, 45, plugin.getString("settings_title"));
    fillGuiWithGlass(player, inventory);
    Settings settings = settingsManager.getSettings(player);
    addDesignItem(inventory, player);
    addClearInventoryItem(inventory, player);
    addSettingsItem(inventory, 13, XMaterial.DIAMOND_AXE, settings.isDisableInteract(), plugin.getString("settings_disableinteract_item"), plugin.getStringList("settings_disableinteract_lore"));
    addSettingsItem(inventory, 14, XMaterial.ENDER_EYE, settings.isHidePlayers(), plugin.getString("settings_hideplayers_item"), plugin.getStringList("settings_hideplayers_lore"));
    addSettingsItem(inventory, 15, XMaterial.OAK_SIGN, settings.isInstantPlaceSigns(), plugin.getString("settings_instantplacesigns_item"), plugin.getStringList("settings_instantplacesigns_lore"));
    addSettingsItem(inventory, 20, XMaterial.SLIME_BLOCK, settings.isKeepNavigator(), plugin.getString("settings_keep_navigator_item"), plugin.getStringList("settings_keep_navigator_lore"));
    addSettingsItem(inventory, 21, configValues.getNavigatorItem(), settings.getNavigatorType().equals(NavigatorType.NEW), plugin.getString("settings_new_navigator_item"), plugin.getStringList("settings_new_navigator_lore"));
    addSettingsItem(inventory, 22, XMaterial.GOLDEN_CARROT, settings.isNightVision(), plugin.getString("settings_nightvision_item"), plugin.getStringList("settings_nightvision_lore"));
    addSettingsItem(inventory, 23, XMaterial.BRICKS, settings.isNoClip(), plugin.getString("settings_no_clip_item"), plugin.getStringList("settings_no_clip_lore"));
    addSettingsItem(inventory, 24, XMaterial.IRON_TRAPDOOR, settings.isTrapDoor(), plugin.getString("settings_open_trapdoors_item"), plugin.getStringList("settings_open_trapdoors_lore"));
    addSettingsItem(inventory, 29, XMaterial.FERN, settings.isPlacePlants(), plugin.getString("settings_placeplants_item"), plugin.getStringList("settings_placeplants_lore"));
    addSettingsItem(inventory, 30, XMaterial.PAPER, settings.isScoreboard(), configValues.isScoreboard() ? plugin.getString("settings_scoreboard_item") : plugin.getString("settings_scoreboard_disabled_item"), configValues.isScoreboard() ? plugin.getStringList("settings_scoreboard_lore") : plugin.getStringList("settings_scoreboard_disabled_lore"));
    addSettingsItem(inventory, 31, getSlabBreakingMaterial(), settings.isSlabBreaking(), plugin.getString("settings_slab_breaking_item"), plugin.getStringList("settings_slab_breaking_lore"));
    addSettingsItem(inventory, 32, XMaterial.MAGMA_CREAM, settings.isSpawnTeleport(), plugin.getString("settings_spawnteleport_item"), plugin.getStringList("settings_spawnteleport_lore"));
    addWorldSortItem(inventory, player);
    return inventory;
}
Also used : Inventory(org.bukkit.inventory.Inventory) Settings(com.eintosti.buildsystem.object.settings.Settings)

Example 17 with Settings

use of com.eintosti.buildsystem.object.settings.Settings in project BuildSystem by Trichtern.

the class PlayerInventoryClearListener method onPlayerInventoryClear.

@EventHandler
public void onPlayerInventoryClear(PlayerInventoryClearEvent event) {
    Player player = event.getPlayer();
    Settings settings = settingsManager.getSettings(player);
    if (!settings.isKeepNavigator() || !player.hasPermission("buildsystem.navigator.item")) {
        return;
    }
    PlayerInventory playerInventory = player.getInventory();
    ItemStack navigatorItem = inventoryManager.getItemStack(plugin.getConfigValues().getNavigatorItem(), plugin.getString("navigator_item"));
    event.getNavigatorSlots().forEach(slot -> playerInventory.setItem(slot, navigatorItem));
}
Also used : Player(org.bukkit.entity.Player) PlayerInventory(org.bukkit.inventory.PlayerInventory) ItemStack(org.bukkit.inventory.ItemStack) Settings(com.eintosti.buildsystem.object.settings.Settings) EventHandler(org.bukkit.event.EventHandler)

Example 18 with Settings

use of com.eintosti.buildsystem.object.settings.Settings in project BuildSystem by Trichtern.

the class PlayerMoveListener method onPlayerMove.

@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
    Player player = event.getPlayer();
    if (!playerManager.getOpenNavigator().contains(player)) {
        return;
    }
    Settings settings = settingsManager.getSettings(player);
    if (!settings.getNavigatorType().equals(NavigatorType.NEW)) {
        return;
    }
    Location to = event.getTo();
    if (to == null) {
        return;
    }
    Location from = event.getFrom();
    if (from.getBlockX() != to.getBlockX() || from.getBlockZ() != to.getBlockZ()) {
        Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> playerManager.closeNavigator(player), 5L);
    }
}
Also used : Player(org.bukkit.entity.Player) Settings(com.eintosti.buildsystem.object.settings.Settings) Location(org.bukkit.Location) EventHandler(org.bukkit.event.EventHandler)

Example 19 with Settings

use of com.eintosti.buildsystem.object.settings.Settings in project BuildSystem by Trichtern.

the class PlayerRespawnListener method onPlayerRespawn.

@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent event) {
    Player player = event.getPlayer();
    Settings settings = settingsManager.getSettings(player);
    if (settings.isSpawnTeleport() && spawnManager.spawnExists()) {
        event.setRespawnLocation(spawnManager.getSpawn());
    }
}
Also used : Player(org.bukkit.entity.Player) Settings(com.eintosti.buildsystem.object.settings.Settings) EventHandler(org.bukkit.event.EventHandler)

Example 20 with Settings

use of com.eintosti.buildsystem.object.settings.Settings in project BuildSystem by Trichtern.

the class SettingsInteractListener method manageSlabSetting.

@EventHandler
public void manageSlabSetting(PlayerInteractEvent event) {
    if (!isValid(event)) {
        return;
    }
    Player player = event.getPlayer();
    Action action = event.getAction();
    Settings settings = settingsManager.getSettings(player);
    if (settings.isSlabBreaking() && action == Action.LEFT_CLICK_BLOCK) {
        plugin.getCustomBlocks().modifySlab(event);
    }
}
Also used : Player(org.bukkit.entity.Player) Action(org.bukkit.event.block.Action) Settings(com.eintosti.buildsystem.object.settings.Settings) EventHandler(org.bukkit.event.EventHandler)

Aggregations

Settings (com.eintosti.buildsystem.object.settings.Settings)48 Player (org.bukkit.entity.Player)24 EventHandler (org.bukkit.event.EventHandler)24 ItemStack (org.bukkit.inventory.ItemStack)16 XMaterial (com.cryptomorin.xseries.XMaterial)14 XBlock (com.cryptomorin.xseries.XBlock)6 Material (org.bukkit.Material)6 Block (org.bukkit.block.Block)6 Action (org.bukkit.event.block.Action)4 ItemMeta (org.bukkit.inventory.meta.ItemMeta)4 PotionEffect (org.bukkit.potion.PotionEffect)4 NoClipManager (com.eintosti.buildsystem.manager.NoClipManager)2 SettingsManager (com.eintosti.buildsystem.manager.SettingsManager)2 NavigatorType (com.eintosti.buildsystem.object.navigator.NavigatorType)2 Color (com.eintosti.buildsystem.object.settings.Color)2 WorldSort (com.eintosti.buildsystem.object.settings.WorldSort)2 BuildWorld (com.eintosti.buildsystem.object.world.BuildWorld)2 FastBoard (fr.mrmicky.fastboard.FastBoard)2 Location (org.bukkit.Location)2 BlockFace (org.bukkit.block.BlockFace)2