Search in sources :

Example 1 with Settings

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

the class BuildSystem method onEnable.

@Override
public void onEnable() {
    this.getConfig().options().copyDefaults(true);
    this.saveConfig();
    this.configValues = new ConfigValues(this);
    initClasses();
    if (!initVersionedClasses()) {
        getLogger().severe("BuildSystem does not support your server version: " + version);
        getLogger().severe("Disabling plugin... ");
        this.setEnabled(false);
        return;
    }
    registerCommands();
    registerTabCompleter();
    registerListeners();
    registerStats();
    registerExpansions();
    performUpdateCheck();
    worldManager.load();
    settingsManager.load();
    spawnManager.load();
    Bukkit.getOnlinePlayers().forEach(pl -> {
        getSkullCache().cacheSkull(pl.getName());
        Settings settings = settingsManager.createSettings(pl);
        settingsManager.startScoreboard(pl, settings);
        noClipManager.startNoClip(pl, settings);
    });
    Bukkit.getConsoleSender().sendMessage(ChatColor.RESET + "BuildSystem ยป Plugin " + ChatColor.GREEN + "enabled" + ChatColor.RESET + "!");
}
Also used : ConfigValues(com.eintosti.buildsystem.util.ConfigValues) Settings(com.eintosti.buildsystem.object.settings.Settings)

Example 2 with Settings

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

the class InventoryManager method getColouredGlassPane.

public XMaterial getColouredGlassPane(BuildSystem plugin, Player player) {
    SettingsManager settingsManager = plugin.getSettingsManager();
    Settings settings = settingsManager.getSettings(player);
    Optional<XMaterial> glass = XMaterial.matchXMaterial(settings.getGlassColor().name() + "_STAINED_GLASS_PANE");
    return glass.orElse(XMaterial.BLACK_STAINED_GLASS_PANE);
}
Also used : XMaterial(com.cryptomorin.xseries.XMaterial) Settings(com.eintosti.buildsystem.object.settings.Settings)

Example 3 with Settings

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

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, XMaterial.SMOOTH_STONE_SLAB, 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 4 with Settings

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

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 5 with Settings

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

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)

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