Repository navigation
Menu Data & States
You can use the menus to store data which will be saved to file.
This is a simple key-value object storage.
You can also store player-specific values or assign a TTL value.
It also supports array storage of data entries.
Check the Javadocs for all methods.
Examples:
menu.data.put("myKey", myValue); - saves a persistent value until it is removed.
menu.data.put("myPlayerKey", player, myValue, 10000) - saves a value for the player, which expires after 10 seconds.
menu.data.putArray("myArray", myValue, 5000) - adds a value to the array, which expires after 5 seconds.
menu.data.has("myKey") - check if a simple value is stored.
menu.data.has("myKey", player) - check if a player value is stored.
menu.data.get("myKey") - get a simple value.
menu.data.get("myPlayerKey", player) - get a player specific value.
menu.data.getArray("myArray", 10) - get a value from the array at position #10.
menu.data.getArray("myArray") - get the whole array.
menu.data.remove("myKey") - removes a simple value. This also works for arrays.
menu.data.remove("myPlayerKey", player) - removes a player value.
menu.data.removeArray("myArray", 4) - removes the array value at position #4.
States are specifically for Boolean values. The functions are similar to data functions, but they have no value parameters.
Check the Javadocs for all methods.
Examples:
menu.states.put("myKey", player, 2000) - sets the player's state to true and expires (set to false) after 2 seconds.
menu.states.get("myKey", player) - get the player's state.
menu.states.toggle("myKey", player) - toggles a state and returns the new value.