201 lines
9.8 KiB
Java
201 lines
9.8 KiB
Java
package net.t2code.commandguiv2.Spigot.config.config;
|
|
|
|
import net.t2code.commandguiv2.Spigot.Main;
|
|
import net.t2code.commandguiv2.Spigot.config.languages.SelectMessages;
|
|
import net.t2code.commandguiv2.Spigot.enums.StorageEnum;
|
|
import net.t2code.commandguiv2.Util;
|
|
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
|
import org.bukkit.Material;
|
|
import org.bukkit.Sound;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
|
|
public enum ConfigValues {
|
|
|
|
configVersion("configVersion", 6),
|
|
debug("plugins.debug", false),
|
|
updateCheckOnJoin("plugin.updateCheck.onJoin", true),
|
|
updateCheckSeePreReleaseUpdates("plugin.updateCheck.seePreReleaseUpdates", true),
|
|
updateCheckTimeInterval("plugin.updateCheck.timeInterval", 60),
|
|
helpAlias("plugin.helpAlias", true),
|
|
adminSubCommand("plugin.adminSubCommand", "admin"),
|
|
language("plugin.language", "english"),
|
|
currency("plugin.currency", "$"),
|
|
defaultGUI("plugin.defaultGUI", "default"),
|
|
|
|
|
|
storage("storage.type", StorageEnum.SQLITE.name()),
|
|
mysqlIp("storage.mySQL.ip", "localhost"),
|
|
mysqlPort("storage.mySQL.port", 3306),
|
|
mysqlDatabase("storage.mySQL.database", "database"),
|
|
mysqlUser("storage.mySQL.user", "root"),
|
|
mysqlPassword("storage.mySQL.password", "password"),
|
|
mysqlSSL("storage.mySQL.ssl", false),
|
|
|
|
|
|
useItemEnable("useItem.enable", true),
|
|
useItemAllowToggle("useItem.allowToggle", true),
|
|
useItemAllowSetSlot("useItem.allowSetSlot", true),
|
|
useItemBlockMoveAndDrop("useItem.blockMoveAndDrop", true),
|
|
useItemOpenGUI("useItem.openGUI", "default"),
|
|
useItemPermission("useItem.permission.neededToUse", true),
|
|
useItemKeepAtCommandClear("useItem.keepAtCommandClear", true),
|
|
useItemInventorySlotFreeSlot("useItem.inventorySlot.freeSlot", 1),
|
|
useItemInventorySlot("useItem.inventorySlot.slot", 1),
|
|
useItemInventorySlotEnforce("useItem.inventorySlot.slotEnforce", false),
|
|
useItemMaterial("useItem.item.material", "paper"),
|
|
|
|
useItemPlayerHeadEnable("useItem.item.playerHead.enable", false),
|
|
useItemBase64Enable("useItem.item.playerHead.base64.enable", false),
|
|
useItemBase64value("useItem.item.playerHead.base64.base64Value", ""),
|
|
useItemPlayerWhoHasOpenedTheGUI("useItem.item.playerHead.playerWhoHasOpenedTheGUI", false),
|
|
useItemPlayerName("useItem.item.playerHead.playerName", ""),
|
|
useItemName("useItem.item.name", "&bDefault &6GUI"),
|
|
useItemLore("useItem.item.lore", Collections.singletonList("&eThis is an example GUI")),
|
|
useItemGiveOnEveryJoin("useItem.join.giveOnEveryJoin", true),
|
|
useItemGiveOnlyOnFirstJoin("useItem.join.giveOnlyOnFirstJoin", false),
|
|
cursorToGUIItemOnLogin("useItem.join.cursor.toGUIItem.onLogin.enable", true),
|
|
cursorToGUIItemOnlyOnFirstLogin("useItem.join.cursor.toGUIItem.spigot.onlyOnFirstLogin", true),
|
|
useItemServerChange("useItem.join.cursor.toGUIItem.bungee.onServerChange", false),
|
|
|
|
|
|
toggleItemOnOrYesBase64("toggle.items.onOrYes.item.base64.enable", false),
|
|
toggleItemOnOrYesBase64Value("toggle.items.onOrYes.item.base64.base64Value", ""),
|
|
toggleItemOnOrYesMaterial("toggle.items.onOrYes.item.material", Main.legacy ? "WOOL,5" : T2CitemVersion.getGreenWool().getType().toString()),
|
|
toggleItemOffOrNoBase64("toggle.items.offOrNo.item.base64.enable", false),
|
|
toggleItemOffOrNoBase64Value("toggle.items.offOrNo.item.base64.base64Value", T2CitemVersion.getGreenWool().getType().toString()),
|
|
toggleItemOffOrNoMaterial("toggle.items.offOrNo.item.material", Main.legacy ? "WOOL,14" : T2CitemVersion.getRedWool().getType().toString()),
|
|
|
|
|
|
togglePermTrue("toggle.permission.commands.true", "luckperms user [player] permission set [perm] true"),
|
|
togglePermFalse("toggle.permission.commands.false", "luckperms user [player] permission set [perm] false"),
|
|
placeholderTrue("placeholder.True", "&2true"),
|
|
placeholderFalse("placeholder.False", "&4false"),
|
|
|
|
|
|
soundEnable("sound.enable", true),
|
|
soundOpenInventoryEnable("sound.openInventory.enable", true),
|
|
soundOpenInventoryInput("sound.openInventory.sound", getOpenInventory().toString()),
|
|
soundClickEnable("sound.click.enable", true),
|
|
soundClickInput("sound.click.sound", getClick().toString()),
|
|
soundNoMoneyEnable("sound.noMoney.enable", true),
|
|
soundNoMoneyInput("sound.noMoney.sound", getNoMoney().toString()),
|
|
soundNoInventorySpaceEnable("sound.noInventorySpace.enable", true),
|
|
soundNoInventorySpaceInput("sound.noInventorySpace.sound", getNoInventorySpace().toString()),
|
|
soundGiveEnable("sound.give.enable", true),
|
|
soundGiveInput("sound.give.sound", getGive().toString()),
|
|
soundPlayerNotFoundEnable("sound.playerNotFound.enable", true),
|
|
soundPlayerNotFoundInput("sound.playerNotFound.sound", getPlayerNotFound().toString()),
|
|
|
|
|
|
useItemGameModeChangeEnable("advanced.useItem.gameMode.change.enable", true),
|
|
useItemGameModeChangeDelayInTicks("advanced.useItem.gameMode.change.delayInTicks", 1),
|
|
useItemGameModeProtection("advanced.useItem.gameMode.protection.enable", false),
|
|
useItemGameModeRemoveItemWhenItIsDisabled("advanced.useItem.gameMode.protection.removeItemWhenItIsDisabled", false),
|
|
useItemGameModeMode("advanced.useItem.gameMode.protection.mode", "blacklist"),
|
|
useItemGameModeList("advanced.useItem.gameMode.protection.list", Arrays.asList("CREATIVE", "Spectator")),
|
|
|
|
useItemWorldChangeEnable("advanced.useItem.world.change.enable", true),
|
|
useItemWorldChangeDelayInTicks("advanced.useItem.world.change.delayInTicks", 1),
|
|
useItemWorldProtection("advanced.useItem.world.protection.enable", false),
|
|
useItemWorldRemoveItemWhenItIsDisabled("advanced.useItem.world.protection.removeItemWhenItIsDisabled", false),
|
|
useItemWorldMode("advanced.useItem.world.protection.mode", "blacklist"),
|
|
useItemWorldList("advanced.useItem.world.protection.list", Arrays.asList("World1", "World2")),
|
|
|
|
|
|
disableInfoBySneak("advanced.useItem.disableInfoBySneak", false),
|
|
useItemItemBlockBlacklist("advanced.useItem.itemBlockBlacklist", getItemBlockBlacklist());
|
|
|
|
|
|
public final String path;
|
|
public Object value;
|
|
|
|
ConfigValues(String path, Object defaultValue) {
|
|
this.path = path;
|
|
this.value = defaultValue;
|
|
}
|
|
|
|
public static void sound() {
|
|
check(soundOpenInventoryInput,getOpenInventory());
|
|
check(soundNoMoneyInput,getNoMoney());
|
|
check(soundNoInventorySpaceInput,getNoInventorySpace());
|
|
check(soundGiveInput,getGive());
|
|
check(soundPlayerNotFoundInput,getPlayerNotFound());
|
|
}
|
|
|
|
private static void check(ConfigValues object, Sound defaultSound){
|
|
try {
|
|
Sound sound = Sound.valueOf(String.valueOf(object.value));
|
|
if (sound != null) {
|
|
object.value = defaultSound;
|
|
}
|
|
} catch (Exception e) {
|
|
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Util.getPrefix())
|
|
.replace("[sound]", "§8OpenInventory: §6" + object.value) + "§4\n§4\n§4\n");
|
|
object.value = defaultSound;
|
|
}
|
|
}
|
|
|
|
private static Sound getOpenInventory() {
|
|
if (T2CmcVersion.isMc1_8()) {
|
|
return Sound.valueOf("CHEST_OPEN");
|
|
} else return Sound.valueOf("BLOCK_CHEST_OPEN");
|
|
}
|
|
|
|
private static Sound getClick() {
|
|
if (T2CmcVersion.isMc1_8()) {
|
|
return Sound.valueOf("NOTE_STICKS");
|
|
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
|
return Sound.valueOf("BLOCK_NOTE_HAT");
|
|
} else return Sound.valueOf("BLOCK_NOTE_BLOCK_HAT");
|
|
}
|
|
|
|
private static Sound getNoMoney() {
|
|
if (T2CmcVersion.isMc1_8()) {
|
|
return Sound.valueOf("NOTE_PIANO");
|
|
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
|
return Sound.valueOf("BLOCK_NOTE_HARP");
|
|
} else return Sound.valueOf("BLOCK_NOTE_BLOCK_HARP");
|
|
}
|
|
|
|
private static Sound getNoInventorySpace() {
|
|
if (T2CmcVersion.isMc1_8()) {
|
|
return Sound.valueOf("NOTE_PIANO");
|
|
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
|
return Sound.valueOf("BLOCK_NOTE_HARP");
|
|
} else return Sound.valueOf("BLOCK_NOTE_BLOCK_HARP");
|
|
}
|
|
|
|
private static Sound getGive() {
|
|
if (T2CmcVersion.isMc1_8()) {
|
|
return Sound.valueOf("LEVEL_UP");
|
|
} else return Sound.valueOf("ENTITY_PLAYER_LEVELUP");
|
|
}
|
|
|
|
private static Sound getPlayerNotFound() {
|
|
if (T2CmcVersion.isMc1_8()) {
|
|
return Sound.valueOf("NOTE_PIANO");
|
|
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
|
return Sound.valueOf("BLOCK_NOTE_HARP");
|
|
} else return Sound.valueOf("BLOCK_NOTE_BLOCK_HARP");
|
|
}
|
|
|
|
private static List<String> getItemBlockBlacklist() {
|
|
List<String> materialList = Arrays.asList("BUTTON", "DOOR", "FENCE", "CHEST", "FURNACE", "NOTE_BLOCK", "CRAFTING_TABLE", "WORKBENCH",
|
|
"ANVIL", "LOOM", "COMPOSTER", "BARREL", "SMOKER", "BLAST_FURNACE", "CARTOGRAPHY_TABLE", "FLETCHING_TABLE", "GRINDSTONE",
|
|
"SMITHING_TABLE", "STONECUTTER", "HOPPER", "DISPENSER", "DROPPER", "REPEATER", "COMPARATOR", "LEVER", "DAYLIGHT_DETECTOR", "BREWING_STAND", "TRAPDOOR", "BEACON"
|
|
);
|
|
|
|
List<String> materialBlacklist = new ArrayList<>();
|
|
for (Material material : Material.values()) {
|
|
if (materialList.contains(material.toString())) materialBlacklist.add(material.toString());
|
|
}
|
|
return materialBlacklist;
|
|
}
|
|
}
|