ConfigurationMaster icon

ConfigurationMaster 1.0.2

Allows developers to add comments, sections and maintain option order in their config file.

68747470733a2f2f692e696d6775722e636f6d2f656f703547366d2e706e67
Developed by » Thatsmusic99
« OVERVIEW »
ConfigurationMaster is one of the first libraries - possibly even the first - to provide actual and efficient comment support for plugins to use.
Beforehand, plugin developers would resort to either using Bukkit's API system for configuration files or writing up the files, copying them from the resources folder into the plugin data folders. However, both have flaws; Bukkit's API system has no comment support, and the adding of new options would jumble up the order of where options appear, making pointing out options had to do, whilst copying files has an even bigger problem looming - how do you update a config file with new options effectively including all options and comments, other than having the end-user do that - which may be tedious and annoying for them?
However, ConfigurationMaster solves all of these and hopes to make them problems of the past.
« FEATURES »
  • Commenting on specific options, or even just about anywhere in the file.
  • Separating options into specific sections.
  • Forcing an order upon options so that new options can be added in the middle, at the bottom or even at the top of the configuration.
  • Add example options/configuration sections which don't reappear unless a new file is generated.
  • Temporarily storing a file which has bad syntax as a separate configuration file.
  • A customisable title, subtitle, description and set of external links to include in the header.
  • The ability to move options around, especially when creating a new configuration format.
  • An option to add a lenient section, where users can add whatever they like inside the section.
  • Easily allows multiple config files with their own names.
  • Relies on a minimal amount of Bukkit's API, making compatibility hardly a concern - whilst it is predicted to work on the majority of versions without requiring updates, the listed versions above confirm their compatibility with CM.
« DEVELOPERS »

If you're a developer looking to use ConfigurationMaster, useful links include:
Github Wiki - A full guide on how to use CM to the best of its ability.
Javadocs - A complete overview of the library's methods.
« PLUGINS »
Using ConfigurationMaster in your plugin? Send me a DM with the plugin that's implemented the library and the version it's effective on!
Advanced Teleport (Niestrat99 and Thatsmusic99) » Effective from v5.4-SNAPSHOT-1. AdvancedTeleport is the first plugin to use CM and acted as the guinea pig in early testing. It helped catch out a lot of bugs that otherwise wouldn't have been found.
SimplePets (brainsynder and Thatsmusic99) » Effective from Experimental Build #44. Doesn't officially use ConfigurationMaster, but implemented some of the early technology into its own library, BSLib.
« SUPPORT »
I'm more than happy to provide support for those who don't quite understand how to use the library or have a bug to report. I am more than happy to answer questions in the discussion thread for CM, but I often find queries easier and quicker to answer on our Discord server. If you have a bug to report though, please open an issue on Github.
And for everyone's sake, here's an example of how the library has been used in AT:

[dropdown=EXAMPLE: AdvancedTeleport v5.4-SNAPSHOT config.yml]
###############################################################################
#                          -<( AdvancedTeleport )>-                           #
#                     Made by Niestrat99 and Thatsmusic99                     #
#                                                                             #
###############################################################################
# A rapidly growing teleportation plugin looking to break the boundaries of   #
# traditional teleport plugins.                                               #
#                                                                             #
# SpigotMC - https://www.spigotmc.org/resources/advanced-teleport.64139/      #
# Wiki - https://github.com/Niestrat99/AT-Rewritten/wiki                      #
# Discord - https://discord.gg/mgWbbN4                                        #
###############################################################################

# Another comment at the very top for all you lads :)

##############
#  Features  #
##############

# Whether basic teleportation features should be enabled or not.
# This includes /tpa, /tpahere, /tpblock, /tpunblock and /back.
# This does not disable the command for other plugins - if you want other plugins to use the provided commands, use Bukkit's commands.yml file.
# Please refer to https://bukkit.gamepedia.com/Commands.yml for this!
use-basic-teleport-features: true

# Whether warps should be enabled in the plugin.
use-warps: true

# Whether the plugin should modify spawn/spawn properties.
use-spawn: true

# Whether the plugin should allow random teleportation.
use-randomtp: true

# Whether homes should be enabled in the plugin.
use-homes: true

# How long tpa and tpahere requests last before expiring.
request-lifetime: 60

####################
#  Warm-Up Timers  #
####################

# The number of seconds it takes for the teleportation to take place following confirmation.
# (i.e. "You will teleport in 3 seconds!")
# This acts as the default option for the per-command warm-ups.
warm-up-timer-duration: 3

# Whether or not teleportation should be cancelled if the player rotates or moves.
cancel-warm-up-on-rotation: false

# Whether or not teleportation should be cancelled upon movement only.
cancel-warm-up-on-movement: true

# Command-specific warm-ups.
per-command-warm-ups:
  # Warm-up timer for /tpa.
  tpa: default
  # Warm-up timer for /tpahere
  tpahere: default
  # Warm-up timer for /tpr, or /rtp.
  tpr: default
  # Warm-up timer for /warp
  warp: default
  # Warm-up timer for /spawn
  spawn: default
  # Warm-up timer for /home
  home: default
  # Warm-up timer for /back
  back: default

###############
#  Cooldowns  #
###############

# How long before the user can use a command again.
# This stops users spamming commands repeatedly.
# This is also the default cooldown period for all commands.
cooldown-duration: 5

# Adds the warm-up duration to the cooldown duration.
# For example, if the cooldown duration was 5 seconds but the warm-up was 3, the cooldown becomes 8 seconds long.
add-cooldown-duration-to-warm-up: true

# Whether or not the cooldown of one command will stop a user from using all commands.
# For example, if a player used /tpa with a cooldown of 10 seconds but then used /tpahere with a cooldown of 5, the 10-second cooldown would still apply.
# On the other hand, if a player used /tpahere, the cooldown of 5 seconds would apply to /tpa and other commands.
apply-cooldown-to-all-commands: false

# When to apply the cooldown
# Options include:
# - request - Cooldown starts as soon as any teleport command is made and still applies even if no teleport takes place (i.e. cancelled by movement or not accepted).
# - accept - Cooldown starts only when the teleport request is accepted (with /tpyes) and still applies even if no teleport takes place (i.e. cancelled by movement).
# - teleport - Cooldown starts only when the teleport actually happens.
# Note:
# 'request' and 'accept' behave the same for /rtp, /back, /spawn, /warp, and /home
# cooldown for /tpall always starts when the command is ran, regardless if any player accepts or teleports
apply-cooldown-after: request

# Command-specific cooldowns.
per-command-cooldowns:
  # Cooldown for /tpa.
  tpa: default
  # Cooldown for /tpahere
  tpahere: default
  # Cooldown for /tpr, or /rtp.
  tpr: default
  # Cooldown for /warp
  warp: default
  # Cooldown for /spawn
  spawn: default
  # Cooldown for /home
  home: default
  # Cooldown for /back
  back: default

#########################
#  Teleportation Costs  #
#########################

# The amount it costs to teleport somewhere.
# If you want to use Vault Economy, use 100.0 to charge $100.
# If you want to use Minecraft EXP points, use 10EXP for 10 EXP Points.
# If you want to use Minecraft EXP levels, use 5LVL for 5 levels.
# To use multiple methods of charging, use a ; - e.g. '100.0;10LVL' for $100 and 10 EXP levels.
cost-amount: 100.0

# Command-specific costs.
per-command-cost:
  # Cost for /tpa.
  tpa: default
  # Cost for /tpahere.
  tpahere: default
  # Cost for /tpr, or /rtp.
  tpr: default
  # Cost for /warp
  warp: default
  # Cost for /spawn
  spawn: default
  # Cost for /home
  home: default
  # Cost for /back
  back: default

##########################
#  Distance Limitations  #
##########################

# Enables the distance limiter to stop players teleporting over a large distance.
# This is only applied when people are teleporting in the same world.
enable-distance-limitations: false

# The maximum distance that a player can teleport.
# This is the default distance applied to all commands when specified.
maximum-teleport-distance: 1000

# Whether or not all teleportations - not just AT's - should be checked for distance.
monitor-all-teleports-distance: false

# Determines the distance limit for each command.
per-command-distance-limitations:
  # Distance limit for /tpa
  tpa: default
  # Distance limit for /tpahere
  tpahere: default
  # Distance limit for /tpr
  tpr: default
  # Distance limit for /warp
  warp: default
  # Distance limit for /spawn
  spawn: default
  # Distance limit for /home
  home: default
  # Distance limit for /back
  back: default

###############################
#  Teleportation Limitations  #
###############################

# WARNING: A lot of the options below are considered advanced and use special syntax that is not often accepted in YAML.
# When using such options, wrap them in quotes: ''
# As an example, 'stop-teleportation-out:world,world_nether'

# Enables teleport limitations. This means cross-world or even world teleportation can be limited within specific worlds.
enable-teleport-limitations: false

# Whether or not all teleportation - not just AT's - should be checked to see if teleportation is allowed.
monitor-all-teleports-limitations: false

# The teleportation rules defined for each world.
# Rules include:
# - stop-teleportation-out - Stops players teleporting to another world when they are in this world.
# - stop-teleportation-within - Stops players teleporting within the world.
# - stop-teleportation-into - Stops players teleporting into this world.
# To combine multiple rules, use a ; - e.g. stop-teleportation-out;stop-teleportation-within
# For out and into rules, you can make it so that rules only initiate when in or going to a specific world using :, e.g. stop-teleportation-out:world stops players teleporting to "world" in the world they're currently in.
# To do the opposite (i.e. initiates the rule when users are not in the specified world), use !, e.g. stop-teleportation-into!world stops teleportation into a specific world if they are not in "world". If ! and : are used in the same rule, then : is given top priority.To make this rule work with multiple worlds, use a comma (,), e.g. stop-teleportation-into:world,world_nether
world-rules:
  default: stop-teleportation-within

# The teleportation rules defined for each AT command.
# Rules include:
# - override - The command will override world rules and run regardless.
# - ignore - The command will refuse to run regardless of world rules.
# To combine multiple rules, use a ;.
# To make rules behave differently in different worlds, use : to initiate the rule in a specific world (e.g. override:world to make the command override "world"'s rules.)
# To initiate rules outside of a specific world, use ! (e.g. override!world to make the command override world rules everywhere but in world)
# To use multiple worlds, use a comma (,).
# By default, all commands will comply with the world rules. If no rules are specified, they will comply.
# All worlds specified will be considered the world in which the player is currently in. For worlds being teleported to, add > to the start of the world name.
# For example, ignore:world,>world_nether will not run if the player is in "world" or if the player is going into the Nether.
command-rules:
  tpa: ''
  tpahere: ''
  tpr: ''
  warp: ''
  spawn: ''
  home: ''
  back: ''

##############
#  RandomTP  #
##############

# The maximum X coordinate to go up to when selecting a random location.
maximum-x: 10000

# The maximum Z coordinate to go up to when selecting a random location.
maximum-z: 10000

# The minimum X coordinate to go down to when selecting a random location.
minimum-x: -10000

# The minimum Z coordinate to go down to when selecting a random location.
minimum-z: -10000

# When WorldBorder is installed, AT will check the border of each world instead rather than using the minimum and maximum coordinates.
use-world-border: true

# Blocks that people must not be able to land in when using /tpr.
avoid-blocks:
- WATER
- LAVA
- STATIONARY_WATER
- STATIONARY_LAVA

# Whether or not /tpr should only be used in the worlds listed below.
whitelist-worlds: false

# Worlds you can use /tpr in.
# If a player uses /tpr in a world that doesn't allow it, they will be teleported in the first world on the list instead.
# To make this feature effective, turn on "whitelist-worlds" above.
allowed-worlds:
- world
- world_nether

###########
#  Homes  #
###########

# The default maximum of homes people can have.
# This can be overridden by giving people permissions such as at.member.homes.10.
# To disable this, use -1 as provided by default.
default-homes-limit: -1

# Whether or not the bed home should be added to /homes.
add-bed-to-homes: true

##########################
#  Notifications/Sounds  #
##########################

# The sound played when a player receives a teleportation (tpa) request.
# For 1.16+, check https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html for a list of sounds you can use
# For 1.15 and below, check https://www.spigotmc.org/threads/sounds-spigot-1-7-1-14-4-sound-enums.340452/ for a list of sounds down to 1.7.
# (Friendly reminder that 1.7.x is not supported though!)
# Set to "none" if you want no sound playing.
tpa-request-received: BLOCK_ANVIL_USE

# The sound played when a player sends a teleportation (tpa) request.
tpa-request-sent: BLOCK_ANVIL_PLACE

# The sound played when a player receives a teleportation (tpahere) request.
tpahere-request-received: BLOCK_PORTAL_TRAVEL

# The sound played when a player sends a teleportation (tpahere) request.
tpahere-request-sent: BLOCK_CHEST_OPEN

##########
#  Back  #
##########

# The teleport causes that the plugin must listen to allow players to teleport back to the previous location.
# You can see a full list of these causes at https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerTeleportEvent.TeleportCause.html
used-teleport-causes:
- COMMAND
- PLUGIN
- SPECTATE

######################
#  Spawn Management  #
######################

# Whether the player should be teleported to the spawnpoint when they join for the first time.
teleport-to-spawn-on-first-join: true

# Whether the player should be teleported to the spawnpoint every time they join.
teleport-to-spawn-on-every-join: false

# Determines how and where players teleport when they die.
# Options include:
# - spawn - Teleports the player to the spawnpoint of either the world or specified by the plugin.
# - bed - Teleports to the player's bed.
# - anchor - 1.16+ only, teleports to the player's respawn anchor. However, due to limitations with Spigot's API, it may or may not always work. (add Player#getRespawnAnchor pls)
# - warp:Warp Name - Teleports the player to a specified warp. For example, if you want to teleport to Hub, you'd type warp:Hub
# - {default} - Uses the default respawn option, which is spawn unless set differently.
# If you're using EssentialsX Spawn and want AT to take over respawn mechanics, set respawn-listener-priority in EssX's config.yml file to lowest.
death-management:
  default: spawn

#################
#  Permissions  #
#################

# The default permissions given to users without OP.
# By default, Advanced Teleport allows users without OP to use all member features.
# This allows for permission management without a permissions plugin, especially if a user doesn't understand how such plugins work.
# However, if you have a permissions plugin and Vault installed, you cannot make admin permissions work by default.
default-permissions:
- at.member.*
- at.member.warp.*

# Allows admin permissions to be allowed as default permissions by default.
# If you want to use admin permissions, it's often recommended to use a permissions plugin such as LuckPerms.
# Do not enable this if you are unsure of the risks this option proposes.
allow-admin-permissions-as-default-perms: false
[/dropdown]