From 01b2907b01237f8692a233df7e9ed7860baf53de Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Tue, 9 Nov 2021 01:59:54 +0100 Subject: [PATCH] Adds an enum containing information about all config options --- .../stargate/config/ConfigOption.java | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 src/main/java/net/knarcraft/stargate/config/ConfigOption.java diff --git a/src/main/java/net/knarcraft/stargate/config/ConfigOption.java b/src/main/java/net/knarcraft/stargate/config/ConfigOption.java new file mode 100644 index 0000000..f497f98 --- /dev/null +++ b/src/main/java/net/knarcraft/stargate/config/ConfigOption.java @@ -0,0 +1,143 @@ +package net.knarcraft.stargate.config; + +/** + * A ConfigOption represents one of the available config options + */ +public enum ConfigOption { + + /** + * The language used for player-interface text + */ + LANGUAGE("language", "The language used for all signs and all messages to players", "en"), + /** + * The folder for portal files + */ + PORTAL_FOLDER("folders.portalFolder", "The folder containing the portal databases", "plugins/Stargate/portals/"), + /** + * The folder for gate files + */ + GATE_FOLDER("folders.gateFolder", "The folder containing all gate files", "plugins/Stargate/gates/"), + /** + * The max number of portals on a single network + */ + MAX_GATES_EACH_NETWORK("gates.maxGatesEachNetwork", "The max number of stargates in a single network", "0"), + /** + * The network used if not specified + */ + DEFAULT_GATE_NETWORK("gates.defaultGateNetwork", "The network used when no network is specified", "central"), + /** + * Whether to remember the lastly used destination + */ + REMEMBER_DESTINATION("gates.cosmetic.rememberDestination", "Whether to remember the last destination used", "false"), + /** + * Whether to sort the network destinations + */ + SORT_NETWORK_DESTINATIONS("gates.cosmetic.sortNetworkDestinations", "Whether to sort destinations by name", "false"), + /** + * The main color to use for all signs + */ + MAIN_SIGN_COLOR("gates.cosmetic.mainSignColor", "The main text color of all stargate signs", "BLACK"), + /** + * The color to use for highlighting sign text + */ + HIGHLIGHT_SIGN_COLOR("gates.cosmetic.highlightSignColor", "The text color used for highlighting stargate signs", "WHITE"), + /** + * Whether to destroy portals when any blocks are broken by explosions + */ + DESTROYED_BY_EXPLOSION("gates.integrity.destroyedByExplosion", "Whether stargates should be destroyed by explosions", "false"), + /** + * Whether to verify each portal's gate layout after each load + */ + VERIFY_PORTALS("gates.integrity.verifyPortals", "Whether to verify that portals match their gate layout on load", "false"), + /** + * Whether to protect the entrance of portals + */ + PROTECT_ENTRANCE("gates.integrity.protectEntrance", "Whether to protect stargates' entrances", "false"), + /** + * Whether to enable BungeeCord support + */ + ENABLE_BUNGEE("gates.functionality.enableBungee", "Whether to enable BungeeCord support", "false"), + /** + * Whether to enable vehicle teleportation + */ + HANDLE_VEHICLES("gates.functionality.handleVehicles", "Whether to enable vehicle teleportation", "true"), + /** + * Whether to enable teleportation of empty vehicles + */ + HANDLE_EMPTY_VEHICLES("gates.functionality.handleEmptyVehicles", "Whether to enable teleportation of empty vehicles", "true"), + /** + * Whether to enable teleportation of creatures using vehicles + */ + HANDLE_CREATURE_TELEPORTATION("gates.functionality.handleCreatureTransportation", + "Whether to enable teleportation of vehicles containing non-player creatures", "true"), + /** + * Whether to allow creatures to teleport alone, bypassing any access restrictions + */ + HANDLE_NON_PLAYER_VEHICLES("gates.functionality.handleNonPlayerVehicles", + "Whether to enable teleportation of non-empty vehicles without a player", "true"), + /** + * Whether to enable teleportations of creatures on a leash + */ + HANDLE_LEASHED_CREATURES("gates.functionality.handleLeashedCreatures", + "Whether to enable players to teleport a creature on a leash", "true"), + USE_ECONOMY("economy.useEconomy", "Whether to use economy to incur fees when stargates are used, created or destroyed", "false"), + CREATE_COST("economy.createCost", "The cost of creating a new stargate", "0"), + DESTROY_COST("economy.destroyCost", "The cost of destroying a stargate. Negative to refund", "0"), + USE_COST("economy.useCost", "The cost of using (teleporting through) a stargate", "0"), + TO_OWNER("economy.toOwner", "Whether any teleportation fees should go to the owner of the used stargate", "false"), + CHARGE_FREE_DESTINATION("economy.chargeFreeDestination", + "Whether to require payment if the destination is free, but the entrance stargate is not", "true"), + FREE_GATES_GREEN("economy.freeGatesGreen", "Whether to use green coloring to mark all free stargates", "false"), + DEBUG("debugging.debug", "Whether to enable debugging output", "false"), + PERMISSION_DEBUG("debugging.permissionDebug", "Whether to enable permission debugging output", "false"); + + + private final String configNode; + private final String description; + private final String defaultValue; + + /** + * Instantiates a new config option + * + * @param configNode

The full path of this config option's config node

+ * @param description

The description of what this config option does

+ * @param defaultValue

The default value of this config option

+ */ + ConfigOption(String configNode, String description, String defaultValue) { + this.configNode = configNode; + this.description = description; + this.defaultValue = defaultValue; + } + + /** + * Gets the name of this config option + * + * @return

The name of this config option

+ */ + public String getName() { + if (!this.configNode.contains(".")) { + return this.configNode; + } + String[] pathParts = this.configNode.split("\\."); + return pathParts[pathParts.length - 1]; + } + + /** + * Gets the description of what this config option does + * + * @return

The description of this config option

+ */ + public String getDescription() { + return this.description; + } + + /** + * Gets this config option's default value + * + * @return

This config option's default value

+ */ + public String getDefaultValue() { + return this.defaultValue; + } + +}