XHawk87 / CreateYourOwnMenus

A Bukkit plugin to allow server owners to design and create their own menus in-game
6 stars 8 forks source link

chat messages as arguments in commands #23

Closed dhgameryt closed 5 years ago

dhgameryt commented 5 years ago

could create a menu that when you click on an item execute a command like "/ban %v1% Reason: use of hacks" and that a configurable message appears in the chat, and that the next thing that the player writes is replaced in %v1% running the command with this argument, and then open the menu again.

XHawk87 commented 5 years ago

Both of those features are already in the plugin.

See Dynamic Arguments in https://dev.bukkit.org/projects/createyourownmenus/pages/commands-and-permissions

In your example, the menu script would be something like:

/ban {player} Reason: use of hacks
/menu open @p my_menu_id

It would prompt you "Please enter player:"

Then it bans the player you entered

And opens the menu named 'my_menu_id' for you. Just replace that with your menu.

You can also fully customise any of the text that CYOM displays using lang-eng.yml under languages in the plugin folder.

The relevant line is: dynamic-arg-prompt: Please enter {0}:

This is part of our localisation features that allow you to support many different languages simultaneously on your server. If you have need of that you can download: https://dev.bukkit.org/projects/languageapi