Add "optional" option in Executor/Placeholder validation
Sayakie opened this issue ยท 1 comments
It would be great if we could control the need for these parameters.
For example, #VELOCITY
Executor accepts 3 arguments for x, y, z. Buf what if we want to handle the target entity?
Current:
validation = {
overloads: [
{ name: 'x', type: 'number' },
{ name: 'y', type: 'number' },
{ name: 'z', type: 'number' }
]
}
// Could not handle target entity. Target is fixed the running player.
#VELOCITY 64, 128, 64
Feature:
var Entity = Java.type('org.spongepowered.api.entity.Entity')
validation = {
overloads: [
{ name: 'x', type: 'number' },
{ name: 'y', type: 'number' },
{ name: 'z', type: 'number' },
{ name: 'target', type: Entity.class, optional: true }
]
}
// Target is the running player
#VELOCITY 64, 128, 64
// Target is the onlined player, "Sayakie"
target = Sponge.getGame().getServer().getPlayer("Sayakie").orElse(null)
#VELOCITY 64, 128, 64, target