pass args with dm open command#259
Conversation
|
Hello @BlitzOffline , as you said i break down each change into its own PR, this one need to be accepted because default value is on top of this |
|
hello @BlitzOffline , what you think ? |
|
hi @BlitzOffline , any news ? |
|
Hi. I will take a look at this by the end of the week. |
| for (String arg : arguments) { | ||
| if (arg.startsWith("-p:")) { | ||
| if (!sender.hasPermission("deluxemenus.placeholdersfor")) { | ||
| plugin.sms(sender, Messages.NO_PERMISSION_PLAYER_ARGUMENT); | ||
| return; | ||
| } | ||
|
|
||
| viewer = Bukkit.getPlayerExact(arguments.get(1)); | ||
|
|
||
| placeholderPlayer = arg.substring(3); | ||
| } else { |
There was a problem hiding this comment.
Here, the last argument starting with -p: is taken as a placeholder player. This will break backwards compatibility, if, for example, one of the arguments is also -p:SOMETHING, for some reason.
The command schema should be strictly respected:
/dm open <menu> - open menu for you
/dm open <menu> -p:<target> - open menu for you, but parse placeholders of another player
/dm open <menu> <viewer> - open menu for a player
/dm open <menu> <viewer> -p:<target> - open menu for a player, but parse placeholders of another player.
So, in the end, it should probably have this structure:
/dm open <menu> [args] - open menu for you
/dm open <menu> -p:<target> [args] - open menu for you, but parse placeholders of another player
/dm open <menu> <viewer> [args] - open menu for a player
/dm open <menu> <viewer> -p:<target> [args] - open menu for a player, but parse placeholders of another player.
I'm not sure how to actually do this, because some arguments here are optional, but are in the middle of the argument list.
Maybe we should have a new command for this? I am open to suggestions.
added arguments to /dm open command so you can pass arguments for that player
like this:
/dm open punish_menu target -p:me arg1 arg2 arg3 ...
or
/dm open punish_menu target arg1 arg2 arg3 -p:me ...