This PR also adds two new requirements to facilitate most argument validation: is object & string length.
string length is very simple, it takes an input, and either a max, a min, or both. Example:
length:
type: "string length"
input: "{player}"
min: 2
max: 32
deny_commands:
- "[message] Player must be between 2 and 32 characters long."
is object is a bit more complex, but also more useful. It attempts to parse the given input as a certain type of Java object. The current options are int, double, uuid, and player. The first three are self-explanatory. player works for both UUIDs and usernames, and uses Bukkit.getPlayer(UUID) and Bukkit.getPlayerExact(USERNAME) to ensure only real online players are counted. Example:
player:
type: "is object"
input: "{player}"
object: "player"
deny_commands:
- "[message] Must be a player's username or UUID."
Further Discussion
A topic open for discussion is the inclusion of an offlineplayer type for is object. On Spigot, this can be abused to send multiple HTTP requests to Mojang on the main thread, thereby lagging servers heavily. On Paper, there is a method that only accesses local storage and is therefore safe, but DeluxeMenus currently does not have the requisite infrastructure, in my opinion, to do something specifically for Paper only.
This PR adds the ability to list argument validation directly in the arguments list, while also maintaining backwards compatibility.
Example: https://paste.helpch.at/medacemeve.yaml
Requirements
This PR also adds two new requirements to facilitate most argument validation:
is object
&string length
.string length
is very simple, it takes an input, and either amax
, amin
, or both. Example:is object
is a bit more complex, but also more useful. It attempts to parse the given input as a certain type of Java object. The current options areint
,double
,uuid
, andplayer
. The first three are self-explanatory.player
works for both UUIDs and usernames, and usesBukkit.getPlayer(UUID)
andBukkit.getPlayerExact(USERNAME)
to ensure only real online players are counted. Example:Further Discussion
A topic open for discussion is the inclusion of an
offlineplayer
type foris object
. On Spigot, this can be abused to send multiple HTTP requests to Mojang on the main thread, thereby lagging servers heavily. On Paper, there is a method that only accesses local storage and is therefore safe, but DeluxeMenus currently does not have the requisite infrastructure, in my opinion, to do something specifically for Paper only.