-
Notifications
You must be signed in to change notification settings - Fork 1
Config
The main goal for SlimyGuis is to make the Gui creation as customizable as possible, that's why we added support for a well-thinked action system, the script system and the optimized placeholder system.
The gui config files must be in the folder "guis", written in yaml. The name of the file (without the extension) will be the gui id, The gui configuration has those fields:
- title (required, placehodlers)
- items (required)
- type
- size
- update-interval The title explains himself and the items will be explained in the apposite section. The type field specifies the gui type, if it isn't specified the gui will be a chest, The size field specifies the chest size, if both "type" and "size" aren't specified an error will be thrown. The update interval specifies how often the placeholders in this gui should be updated, by default the item will never be updated
The hotbar config files must be in the folder "hotbars", written in yaml. The name of the file (without the extension) will be the hotbar id. The hotbar configuration has those fields:
- TODO: add hotbar fields
The items used in all the hotbars are described here, The current loading system can load any item up to the 1.12 version. The item config has those fields:
- slot|slots
- item
- click The item stots are the slots where whe specified item will be stored in the hotbar|gui, if you are writing in a hotbar and the slot isn't specified the item will be added in the first slot available. The item will specify the ItemStack that will be displayed to the player The click will specify what the item will do when a player clicks it
The itemstacks in this plugin use a custom loading system different from the bukkit's default one, the only thing different from the bukkit loading system is the meta loading, that will be explained in detail.
The general itemstack configuration has those fields:
- type (required)
- data (placeholder)
- amount (placeholder)
- lore (placeholder)
- name (placeholder)
- flags
- enchantments
The enchantments field is a field that describes the item's encahtments and is described as a map of enchantment with their level, example:
enchantments:
thorns: 2
luck: 3
silk touck: %player_silk_ability%
NOTE: only the enchantment level can have placehodlers
All the possible enchantments are listed here, and all possible flags are listed here
In the item other fields can be specified when special items are being configured, Here's a list of all the special items with their fields:
- Banner
- color (possible values)
- patterns: a list of (colors) and (banner pattern ids) Example:
color: orange
patterns:
- color: blue
pattern: tts
- color: red
pattern: bts
-
Skull
- owner (placeholder)
Example:
owner: "%player_name%"
-
Leather armor
- color (placeholder)
The color must be a rgb value written as "R;G;B"
Example:
color: 0;122;255
will paint the armor -
Potion & Tipped arrows
- potion-type (possible values)
- color (placeholder, R;G;B)
- effects:
- effect (id of the effect, explained here)
- duration (int)
- amplifier (bool)
- ambient (bool)
- has-particles (bool) Example:
potion-type: night vision
color: 90;41;113
effects:
- effect: 3
duration: 40
amplifier: 2
ambient: true
has-particles: false
- SpawnEgg
- egg-type (possible values)
- Enchanted book
- stored-enchantments (name:level, as normal enchantments)
- Firework Charge
- effect
- type (possible values)
- flicker (bool)
- trail (bool)
- colors (list of R;G;B colors, placeholder)
- fade-colors (list of R;G;B colors, placeholder) Example:
- effect
effect:
type: ball large
flicker: false
trail: true
colors:
- 27;26;18
- 25;25;25
fadeColors:
- 0;255;0
- 255;0;255
- Firework
- effects (same as firework charge, but with a list of effects)
- power (int) Example:
effects:
- type: star
flicker: true
trail: false
colors:
- 0;0;0
- 15;15;15
- 255;255;255
fadeColors:
- 255;0;0
- 0;0;255
power: 120
Here's an item example:
item:
type: banner
name: test banner
lore:
- 'some'
- 'random'
- 'lore'
color: orange
patterns:
- color: blue
pattern: tts
- color: red
pattern: bts
An item click describes the actions that get executed when a player clicks a certain item. The itemclick configuration has the following fields:
- permission (the permission to check before executing the click)
- no-permission-message (placeholder)
- no-permission-sound
- cost (placeholder, the vault cost to withdraw before executing the click)
- no-money-error
- no-money-sound
- actions (A list of actions that will be described in the appropriate section)
Example:
click:
permission: permission.example.canbuy
cost: 15.0
actions:
- closeGui
SlimyGuis provides a powerful action system that can interact with a lot of features and, thanks to the script support, even with spigot code.
The system has a set of actions (other plugins can register their own too) that can interact with the server or execute other actions.
When writing an action you can write it in multiple ways, the default one is to write the action with all the parameters specified like so:
actionName:
parameter1: value1
parameter2: value2
...
But there are two special cases where you can write it in a different way:
- if you only need to write one parameter (and it doesn't have a default value) you can write the action using
actionName: value
, real example:gui-open: guiId
that is the same as
gui-open:
id: guiId
Another shortcut is applied when the action doesn't need any parameter to be specified, in that case you just need to write the action name, Example:
actions:
- closeGui
- message: "Message Test"
- openGui:
- id: guiId
- clear-history: true
If you don't understand any of those actions please read the Gui Chronology explaination
- gui-open: opens the gui to the player, and, if clear-history is false, appends it to the chronology
- id: the gui id (placeholder)
- clear-history: if set to true the past chronology gets deleted (default: false)
- gui-back: closes current gui, opening the previous one in the chronology, if it exists
- gui-close: closes the current gui, clearing the player's chronology
- gui-change: replaces the player's open gui (if any) with the gui specified as argument
- id: the gui id (placeholder)
- gui-reload: reloads the player's currently open gui (if any), reprinting the placeholders
- hotbar-give: tries to add the hotbar with the given id to the player
- id: the id of the hotbar to add (placeholder)
- actions: list of actions to execute on success (default: None)
- fail: list of actions to execute on fail (if the hotbar is full) (default: None)
- hotbar-remove: tries to remove the hotbar with the given id from the player
- id: the id of the hotbar to remove
If these actions are runned without the Vault plugin they will display an error in the console but they will continue to run.
- vault-give: gives an amount of money to the player
- value: how much to give to the player (placeholder)
- vault-take: tries to remove an amount of money to the player
- value: how much to remove (placholder)
- actions: actions to execute on success (default: None)
- fail: actions to execute on failure (default: None)
- broadcast: Broadcasts a message to all the players
- message: the message to broadcast
- permission: filters the player based on permission (default: None)
- raw: if true the message will be parsed as json
- message: Sends a message to the player
- message: the message to be sent
- raw: if true the message will be parsed as json
- play-sound: Plays a sound to the player
- sound: the id of the sound to play
- volume: the volume of the sound (default: 1.0)
- pitch: the pitch of the sound (default: 1.0)
- give-item: Gives an item to the player
- item: the item to give
- script: executes a script
- id: the script id
- require: checks some variables about the player before continuing
- permission: checks if the player has a certain permission (default: None)
- hotbar: checks if the player has a hotbar (placeholder, default: None)
- script: uses the result of the script as a check (default: None)
- actions: list of actions to execute on success (default: None)
- fail: list of actions to execute on failure (default: None)
- command: executes a command
- command: command to execute (placeholder)
- executor: command executor (player | console) (default: player)
SlimyGuis supports the PlaceholderAPI in all the fields that have "(placeholder)" written.
If the PlaceholderAPI isn't found the plugin still has some default placeholders that can be used, those are:
- player_name
- player_displayname
- player_food_level
- player_health
- player_level
- player_saturation
- player_world
- vault_eco_balance
If you need more of them we suggest to install the PlaceholderAPI
This plugin supports scripts to be executed with various engines, the engines used are defined by the script extension and the script_engine.yml
config that is created on the first plugin loading, the plugin gets the file extension and searches his engine name within the script_engine config file.
Some default values are added into the Script to help the script development:
- Bukkit: Bukkit's server implementation
- player: the player executing the script
- balance: an instace of a class that helps manage vault's balance
- double get(): returns the player's balance
- void give(double): gives an amount to the player
- boolean take(double): tries to take a certain amount from the player
- boolean has(double): returns true only if the player has the amount given as argument
- String placeholder(String): a method that processes the placeholders in the string passed as argument
By default there is only the nashorn js engine that is included by default in the java JRE. if you want to use another engine you just need to put its standalone into the folder "engines" in the plugin folder (you need to create it), so if you want, for example to use jython, just put the jython file in plugins/SlimyGuis/engines/<jython-file>.jar
and in the next reload the engine will be registered. If your new engine isn't in the script_engine file you need to add it, for example if we were to add a scala script i would add in the script_engine scala: scala
(because the soruces in scala have the .scala extension)