Revamped Game Rewards Configuration, added Environment Variables
- You can now set environment variables for the MySQL data that will take precedence over the config values. This is a more secure alternative than putting credentials in the config file. The plugin will log that it used environment variables on startup if they are set up correctly.
- Completely revamped how rewards and console commands are handled after a game completes. There will now be a
rewards.yml in the plugin folder, which allows for much more flexibility in configuring which commands should run when. New features include being able to give a reward to a player only once, give a reward on the condition of a maximum or minimum score, and more options for multiplayer games. PlaceholderAPI is supported in the command strings. The legacy commands set in config.yml will continue to be supported as well, but these offer far fewer capabilities.
Code (Text):
#----------------------------------------------------------------------------------------------------------------------#
#
# This is the LobbyGames rewards file. Use this to configure how games will handle running
# commands after a player finishes a game.
#
#----------------------------------------------------------------------------------------------------------------------#
snake:
any-reward-name-here:
enabled: false
min-score: 40
console-commands:
- "broadcast &2&l%player%&a got a score of %score% in snake!"
- "eco give %player% 10000"
first-time-reward-example:
enabled: false
one-time: true #A player can only ever get this reward once with this option
msg: "&bYou completed your first snake game!"
console-commands:
- "eco give %player% 100"
pool:
simple-multiplayer-example:
enabled: false
for-winning-player: true #only give this reward for the player who won (default is false)
console-commands:
- "eco give %player% 100"
soccer:
teleport-to-spawn-example:
enabled: false
per-player: true #'true' runs this command for each player in the game when the game ends (default)
run-on-quit: true #if the reward/command should be given every time the player leaves the game, even if it has not started (ex. for teleporting player back to spawn)
console-commands:
- "minecraft:tp %player% 100 100 100 0 0"
no-per-player-example:
enabled: false
per-player: false #run once when the game ends instead of for every player. Can not use %player% when this is set to false
console-commands:
- "broadcast &b%winners% won against %losers% in Soccer!"