Search in sources :

Example 26 with Settings

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

the class SettingsInventory method addWorldSortItem.

private void addWorldSortItem(Inventory inventory, Player player) {
    Settings settings = settingsManager.getSettings(player);
    String url;
    List<String> lore;
    switch(settings.getWorldSort()) {
        default:
            // NAME_A_TO_Z
            url = "https://textures.minecraft.net/texture/a67d813ae7ffe5be951a4f41f2aa619a5e3894e85ea5d4986f84949c63d7672e";
            lore = plugin.getStringList("settings_worldsort_lore_alphabetically_name_az");
            break;
        case NAME_Z_TO_A:
            url = "https://textures.minecraft.net/texture/90582b9b5d97974b11461d63eced85f438a3eef5dc3279f9c47e1e38ea54ae8d";
            lore = plugin.getStringList("settings_worldsort_lore_alphabetically_name_za");
            break;
        case PROJECT_A_TO_Z:
            url = "https://textures.minecraft.net/texture/2ac58b1a3b53b9481e317a1ea4fc5eed6bafca7a25e741a32e4e3c2841278c";
            lore = plugin.getStringList("settings_worldsort_lore_alphabetically_project_az");
            break;
        case PROJECT_Z_TO_A:
            url = "https://textures.minecraft.net/texture/4e91200df1cae51acc071f85c7f7f5b8449d39bb32f363b0aa51dbc85d133e";
            lore = plugin.getStringList("settings_worldsort_lore_alphabetically_project_za");
            break;
        case NEWEST_FIRST:
            url = "https://textures.minecraft.net/texture/71bc2bcfb2bd3759e6b1e86fc7a79585e1127dd357fc202893f9de241bc9e530";
            lore = plugin.getStringList("settings_worldsort_lore_date_newest");
            break;
        case OLDEST_FIRST:
            url = "https://textures.minecraft.net/texture/e67caf7591b38e125a8017d58cfc6433bfaf84cd499d794f41d10bff2e5b840";
            lore = plugin.getStringList("settings_worldsort_lore_date_oldest");
            break;
    }
    ItemStack itemStack = inventoryManager.getUrlSkull(plugin.getString("settings_worldsort_item"), url);
    ItemMeta itemMeta = itemStack.getItemMeta();
    if (itemMeta != null) {
        itemMeta.setLore(lore);
    }
    itemStack.setItemMeta(itemMeta);
    inventory.setItem(33, itemStack);
}
Also used : ItemStack(org.bukkit.inventory.ItemStack) Settings(com.eintosti.buildsystem.object.settings.Settings) ItemMeta(org.bukkit.inventory.meta.ItemMeta)

Example 27 with Settings

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

the class SettingsInventory method addClearInventoryItem.

private void addClearInventoryItem(Inventory inventory, Player player) {
    Settings settings = settingsManager.getSettings(player);
    XMaterial xMaterial = settings.isClearInventory() ? XMaterial.MINECART : XMaterial.CHEST_MINECART;
    addSettingsItem(inventory, 12, xMaterial, settings.isClearInventory(), plugin.getString("settings_clear_inventory_item"), plugin.getStringList("settings_clear_inventory_lore"));
}
Also used : XMaterial(com.cryptomorin.xseries.XMaterial) Settings(com.eintosti.buildsystem.object.settings.Settings)

Example 28 with Settings

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

the class NavigatorListener method openNavigator.

private void openNavigator(Player player) {
    Settings settings = settingsManager.getSettings(player);
    if (settings.getNavigatorType() == NavigatorType.OLD) {
        plugin.getNavigatorInventory().openInventory(player);
        XSound.BLOCK_CHEST_OPEN.play(player);
    } else {
        // NEW
        if (playerManager.getOpenNavigator().contains(player)) {
            player.sendMessage(plugin.getString("worlds_navigator_open"));
            return;
        }
        summonNewNavigator(player);
        String findItemName = plugin.getString("navigator_item");
        ItemStack replaceItem = inventoryManager.getItemStack(XMaterial.BARRIER, plugin.getString("barrier_item"));
        inventoryManager.replaceItem(player, findItemName, configValues.getNavigatorItem(), replaceItem);
    }
}
Also used : ItemStack(org.bukkit.inventory.ItemStack) Settings(com.eintosti.buildsystem.object.settings.Settings)

Example 29 with Settings

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

the class PlayerInteractListener method manageDisabledInteractSetting.

@EventHandler
public void manageDisabledInteractSetting(PlayerInteractEvent event) {
    Player player = event.getPlayer();
    if (player.isSneaking() || event.getAction() != Action.RIGHT_CLICK_BLOCK) {
        return;
    }
    Settings settings = settingsManager.getSettings(player);
    if (!settings.isDisableInteract()) {
        return;
    }
    Block block = event.getClickedBlock();
    if (block == null) {
        return;
    }
    ItemStack itemStack = event.getItem();
    if (itemStack == null) {
        return;
    }
    Material material = itemStack.getType();
    XMaterial xMaterial = XMaterial.matchXMaterial(material);
    if (xMaterial == configValues.getWorldEditWand()) {
        return;
    }
    cachePlayers.add(player.getUniqueId());
    event.setCancelled(true);
    event.setUseItemInHand(Event.Result.DENY);
    event.setUseInteractedBlock(Event.Result.DENY);
    if (!XMaterial.supports(13) && XTag.isItem(xMaterial)) {
        material = Material.valueOf(material.toString().replace("_ITEM", ""));
    }
    if (XTag.SIGNS.isTagged(xMaterial)) {
        if (!XMaterial.supports(13)) {
            material = Material.valueOf("WALL_SIGN");
        } else {
            String[] splitMaterial = material.toString().split("_");
            material = Material.valueOf(splitMaterial[0] + "_WALL_SIGN");
        }
    }
    if (!material.isBlock()) {
        return;
    }
    Block adjacent = block.getRelative(event.getBlockFace());
    adjacent.setType(material);
    XBlock.setColor(adjacent, getItemColor(itemStack));
    plugin.getCustomBlocks().rotate(adjacent, player, null);
}
Also used : Player(org.bukkit.entity.Player) Block(org.bukkit.block.Block) XBlock(com.cryptomorin.xseries.XBlock) Material(org.bukkit.Material) XMaterial(com.cryptomorin.xseries.XMaterial) ItemStack(org.bukkit.inventory.ItemStack) XMaterial(com.cryptomorin.xseries.XMaterial) Settings(com.eintosti.buildsystem.object.settings.Settings) EventHandler(org.bukkit.event.EventHandler)

Example 30 with Settings

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

the class PlayerInteractListener method onPlacePlantsPlayerInteract.

@EventHandler
public void onPlacePlantsPlayerInteract(PlayerInteractEvent event) {
    if (event.isCancelled() || event.getAction() != Action.RIGHT_CLICK_BLOCK || !isValid(event)) {
        return;
    }
    ItemStack itemStack = event.getItem();
    if (itemStack == null) {
        return;
    }
    Material material = itemStack.getType();
    if (!XTag.FLOWERS.isTagged(XMaterial.matchXMaterial(material))) {
        return;
    }
    Player player = event.getPlayer();
    Settings settings = settingsManager.getSettings(player);
    if (!settings.isPlacePlants()) {
        return;
    }
    event.setCancelled(true);
    plugin.getCustomBlocks().setPlant(event);
}
Also used : Player(org.bukkit.entity.Player) Material(org.bukkit.Material) XMaterial(com.cryptomorin.xseries.XMaterial) ItemStack(org.bukkit.inventory.ItemStack) 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