CreateYourOwnMenus
Hiding scripts is no longer possible from Minecraft 1.16 due to changes in item lore formatting
As the name suggests, this plugin allows you to create your own menus. The menus are based on inventories, with each slot holding a clickable menu item. When a player clicks on a menu item, it performs all of the commands listed in the item's lore (the text underneath its name) in a similar manner to command blocks. You can design the menu in-game by selecting any item, naming it in an anvil, modifying its lore using a command, and using commands to create and open a menu for editing to place it anywhere in the inventory that you wish. You can modify your menus any time you want.
Thanks to TheMobCave for providing the video tutorial. Please like and subscribe!
The video tutorial was of CreateYourOwnMenus v0.2, so the latest version has even more features! One major change is that the /menu script command now has sub-commands. E.g. /menu script add [text] instead of /menu script [text]. As well as: insert, delete, replace, clear, show and hide.
Screenshots
See the gallery for screenshots.
User Reviews
"This looks amazing and would make my role playing server a lot easier for players so they don't have to remember a lot of commands." - Ccamm
"This looks amazing! I'm sure that we'll be able to use this in my new server project." - parrothead1337
"This plugin allow so much things :o" - TheNemesisA5
Features
- Use commands to manage all of your menus
- Use any in-game item as a menu item
- Edit menus in-game using inventories
- Open menus using commands, command blocks or other menus
- Activate any menu item simply by clicking it in an open menu
- Alternatively, activate menu items by holding in hand and right-clicking (can be used to open menus and more)
- Modify the lore of any item using commands /menu script clear and /menu script [comment/command] commands
- Add, remove, modify and share menus using their .yml files in the "plugins/CreateYourOwnMenus/menus" folder
- Optionally run the command as the player instead of console by using the /sudo command E.g. /sudo @p kill
- Show/hide menu script commands using the /menu script show and /menu script hide commands
- Delay execute of commands in a script using the /delay [ticks] menu script command
- Use {curly braces} to add dynamic arguments to commands (prompts the clicking player)
- If you have Vault installed you can use /requirecurrency to check if a player has a given amount of currency
- Translate into other languages using LanguageAPI
What it does not do
- This is not intended to include a full-fledged scripting language. It simply executes commands in series and is interrupted on failure. For more complex actions, conditions and program flow you should be using a plugin like Skript to run scripts on menu item clicks.
- It cannot run commands as a player with "elevated permissions". There is currently no safe way to do this within the Bukkit API without introducing errors, compatibility issues and/or require updates every build of Minecraft, CraftBukkit or even Bukkit. You can work around this by granting the permissions, performing the actions and then revoking them again, or by calling out to another plugin that supports this. I do not intend to add this feature until there is a safe way to achieve it.
Plugin Suggestions
This is a list of plugins that work well with CreateYourOwnMenus.
- Use the MicroJump plugin for BungeeCord /server command support for BungeeCord users
- Use the Skript plugin to open menus on player joining, or various other events, and create advanced scripts that you can run when clicking a menu item
- Use the Vault plugin to provide currency support using the /requirecurrency menu script command
Commands and Permissions
A full list of commands and permissions is available on the Commands and Permissions page.
Detailed command help is available in-game by typing /menu
Sharing
Find and share pre-created menus on our forums!
Scripting
A basic scripting guide is available on the Basic Command Scripting thread.
Other tutorials and guides are available on the forum
Security Considerations
The menu scripts always run as console. By default, this is not a problem as only operators have the ability to create menu items and modify menus, however if you give other players permissions to do this, be aware that it will also give them the ability to effectively run any command they wish as console.
Development
Sources are available on GitHub: https://github.com/XHawk87/CreateYourOwnMenus
Ideas
- Add internationalisation support
- Add a "cyom.menu.edit.[menu id]" permission to allow editing of a specific menu only
- Add "cyom.script.allow.all" permission to allow adding any command to a menu script, except those specifically denied (Default op)
- Add "cyom.script.allow.[command name]" permission to allow adding specific commands to menu scripts (child of cyom.script.allow.all)
- Add /menu script import [file] and /menu script export [file] for quickly importing or exporting the lore of a menu item to a simple text file
- Add "cyom.slot.lock.#" to lock specific inventory slots in a player's inventory and treat it as a menu
- Modify /menu grab command to place items into the same slots in a player's inventory where applicable, displacing other items, and otherwise finding any free slot
- Trigger a menu item when it is used to attack or break blocks with
- Add /use special command to allow the item to be used as a normal item (this cannot be used after a delay or prompt)
- Organise menus into folders, and accessed in the form "folder.menu"
- Store menu items in a format that is easier to edit manually, marking lines as hidden without the section symbols all over it
- Provide a faux creative mode for non-op creative players so that server owners can grant creative abilities to non-op players without introducing security risks
- Command support for tab-autocompletion
- Add escape character for {input prompts} so you can still use datatags
Bugs
- Items in locked slots are still dropped on death instead of remaining in their slots
- Items with the /consume command will only be removed if the stack size is 1
Deprecated Features
- To reduce the number of special menu item commands, the /GiveChest, /TakeChest and /CountChest commands will be removed and less complex and easier to understand Skript alternatives will be provided in their place
Help
This plugin uses Java 7
If you get the followed error on starting up the server with this plugin installed "Unsupported major.minor version 51.0". This means you are using an out of date version of Java. If you don't know how to upgrade, please contact your server hosting provider and ask them for help in upgrading to Java 7, or contact Oracle customer support. Mac OS X users require JDK 7 instead of JRE 7.
Very wide text boxes on menu items
Due to a Minecraft client formatting error, the invisible characters on the first line can cause the lore text box width to be increased despite taking up no space when there is visible text on the same line. This can be mitigated when hidden by keeping the first line empty using /menu script insert 0 &a. When commands are shown, it may become difficult to read them.
Non-op Creative Players spawning menu items without permission
Warning: A new security loop-hole has been discovered in the Minecraft server. It is possible for players with certain modified clients to create items for themselves that contain any lore that they want so long as they are in Creative Mode. This does not require operator status or permissions, only Creative Mode. If you have Non-operator creative players on your server be advised that if they use a modified client, it is possible for them to create any menu item that they want without needing permissions.
You can alleviate this somewhat by adding commands to the "blacklist-commands:" section in the config.yml. This will stop anyone but operators from using menu items with those commands on them. E.g.
blacklist-commands: - op - stop - kick - grantperms etc etc
Another option is to keep those players in Survival mode, but use other plugins to give them creative-like powers such as infinite resources, fast breaking and flight.
Ghost items appearing on clicking a menu item
If you are experiencing ghost items in 1.7.2 using this plugin, it is due to the client-side Minecraft bug (https://mojang.atlassian.net/browse/MC-41165). This only affects 1.7.2 and is fixed in 1.7.4. The bug is not dangerous as it is not a real item. Any attempts to move the item out of the inventory, place it, or fill the same slot will result in it disappearing. Since this is a client-side only bug, it is recommended that players be urged to update from 1.7.2 to 1.7.4 as soon as possible. Note: it is possible to play on CB 1.7.2 R0.1 beta using a Minecraft 1.7.4 client.
After restart, my menus all have weird characters wherever there were hidden commands or colours
This is a text-encoding issue caused by the some CraftBukkit servers attempting to read menu files in the wrong text encoding by default. You can fix this by telling Java to use UTF-8 by default for CraftBukkit.
For users of McMyAdmin, MultiCraft and other server launchers, there should be an option to specify text-encoding in your settings and switch to UTF-8. If not, you should have a way to add optional command line arguments, and follow the advice below for a startup script.
If you are using a startup script you will have something along the lines of:
java -Xmx1024m -jar CraftBukkit.jar
You need to add the following option somewhere after java and before -jar. E.g.
java -Xmx1024m -Dfile.encoding=UTF8 -jar CraftBukkit.jar
After updating CraftBukkit (build #3009+), my Skript custom commands aren't working from menu items
Changes in CraftBukkit build #3009 (1.7.2-R0.3-SNAPSHOT) have updated the Bukkit plugin command system that broke Skripts custom command handler. This prevented Skript from receiving commands that had been directly dispatched by other plugins. This issue was fixed in Skript 2.1.1+, so downloading the latest version of Skript should correct the problem.
It says @a or @w instead of the player's name
If a @a or @w target selector is the last character in a command, it is not currently replaced correctly. This will be fixed in the next dev build. In the meantime, attempt to ensure there is a non-whitespace character after the last target selector.
Every time I click an item in my inventory it activates it like it was a menu item
You may have inadvertently locked all of your inventory slots by misuse of the '*' permission node. This will grant you all permissions, including 'cyom.slot.lock.*' which is used for locking inventory slots so that they can be used as menus. The best solution for this is to stop using the '*' node and instead only grant yourself the specific extra permissions that you need. However if you insist on using the '*' node you will need to grant yourself the negative permission '-cyom.slot.lock.*' in order to prevent your slots from getting locked.
Every time I restart my server, all changes I made to my menus are undone
There is a time-related bug with previous builds of CYOM that prevent file saving. To fix this you must update to the latest dev build: http://dev.bukkit.org/bukkit-plugins/createyourownmenus/files/18-create-your-own-menus-v0-5-8-dev/
I can't use {NBT data tags} in my commands
Unfortunately, we already have a use for the {curly braces} as dynamic arguments that predate their use in Minecraft, so you can't use NBT data tags in your menu commands. However, you can get around this in a couple of ways:
Any items that you need to be given to a player with data tags can be pre-created and placed in a menu, then you can use the /menu grab command to give them to the player. Since you can grab multiple items at once, and edit the menu visually, it makes for a rather convenient way of setting up item kits on a server.
You can also use a custom scripting plugin like Skript to set up a custom command to run the commands for you. Using Skript in this way allows a great deal more flexibility for your menu scripts by adding logic, variables, persistence and program flow, and if you need help with them they have a lot of friendly people on their forums who are always happy to help.
Donations
If you'd like to contribute towards the continued development, support and maintenance of this project, please consider joining me on Patreon, and making a one-time or recurring pledge.
Support Channel
If you need help you can leave a comment below and I will get back to you as soon as I can. You can also join my IRC chatroom using the following link, but please read the tutorial first. http://webchat.esper.net/?channels=XHawk87&prompt=1
I am happy to give support, but repeatedly answering the same question that is explained in bold red on the plugin page is highly tedious. Don't be lazy, read first, then ask questions. It's the polite thing to do
Hey, Firstly, I really love this plugin, best one out there, recommend this plugin. I just have 1 question, is there a way to close the GUI menu after you select something? It would be really helpful :D
@XHawk87
Sounds good :) Btw, thanks for the quick feedback and active development on CYOM. Bravo!
@Omanoctoa
I have thought about silent commands/operators, but I am not sure on the best approach yet. I intend to look into it again, but it will have to wait until the new year.
I had an idea... any chance of adding a silent operator? Basically, a command would be run normally, but no output-text is sent to the player, allowing for silent command execution. For example, if I type something like
/menu script append ?/give @p stone 1
the menu would give me one block of stone, silently - with no "Giving 1 stone to Omanoctoa" messages. Basically I figure it may need to intercept plugin outputs...not sure. While some higher-level commands, such as permission changes, are invisible to regular players, other commands are not and can often interupt the ambience and immersion of the moment.Alternatives to ? before the command (though this would be most useful IMO)... !/command /runsilent /notextoutput
For some other, though likely challenging, ideas for operators. Take a look at the plugin Command Signs. Not to create teh scripting elements, just for the concept of operators. Your 2 plugins work just beautifully together, complimenting each other's faults, with only a few exceptions. Please note, there are a few similar (and highly inferior) plugins with the name CommandSigns - you want the one that I've linked above.
@Omanoctoa
Menus are stored just fine in memory, as they are stored in native Minecraft format that supports all new features. The problem occurs as they are written to and retrieved from disk.
Bukkit doesn't provide direct access to Minecraft formats, as this would require plugins to be updated every new minecraft build, instead it implements its own separate system that continues to work between updates. The trade-off is that the API itself has to be updated to support format changes in native Minecraft.
This is why they can be retrieved just fine until a menu is reloaded from disk, which will only occur on restart, reload, or menu reload.
This is a slippery slope I learned to avoid earlier in CYOM development. If I try to create everything that would allow CYOM to be independent, then I'd have to build in a fully fledged scripting language, and provide additional commands and special menu commands to help accomplish it.
Skript and similar plugins already accomplish this, in a way that has been well tested, documented, has a whole community behind it, supported and moderated with tutorials and guides and help forums, actively developed, patched and modded to support new and more diverse features. Any solution that requires that level of coding inside a menu item, will end up far harder to read and code than it would be in Skript. If your needs reach the level where you need those kind of advanced features, its far better to use Skript instead.
My time is far better spent making sure that CYOM is more compatible with Skript and other scripting plugins than to try to replicate its features.
@XHawk87
Strange. Oh well. Oddly, unless I'm mistaken this only appears to effect the menu that are opened for Editing. Simply opening a menu with a HideFlags tag does not appear to clear the tag. I have a menu made completely of HideFlag-enchanted glass panes (the whole inventory shimmers) and it has not changed. (0.5.9).
As for the Skript loop, that's a good idea. I'm just thinking of additions that would allow CYOM to be more independent. With 0.5.10 it is nearly possibly to create fully dynamic menus using CYOM itself.
@Omanoctoa
The issue with enchants with hideFlags disappearing appears to be due to Bukkit not yet fully supporting the new 1.8 item flags. As the item stacks are being serialized to menus, only parts of the item known to the current Bukkit API can be stored and retrieved, so any additional data, such as the new item flags, are lost. The Spigot team seem to be working on it, so it should only be a matter of time before support for this new feature is added.
Unfortunately, not yet, for the same reason. Bukkit doesn't fully support this new feature yet, so we don't have any safe way to achieve this that wouldn't require making updates every new release.
It should be possible to do this, however it can also be done quite trivially using Skript. E.g.
@XHawk87
Ok I have found a bug in dev 0.5.10. Items placed inside a menu lose their enchanted status after using /menu reload or restarting the server. All other lore, scripting and data remains (I think) however the
{ench:[{id:9}],hideflags:1}
tag used when the item was initially spawned to make an invisible enchantment appears to be lost.Is there any way to add a command-based node to enable the enchanted appearance on an item without having to manually spawn in a falsely-enchanted item? Even better, if the enchanted state could be toggled on and off - now that would be cool, and make it easier to show menu items being toggled on/off.
I also have another, unrelated thought. Any chance of allowing the /menu set command to accept a slot-range? For instance...
/menu set testmenu 1-4 source_menuB 3
...which would set item slots 1, 2, 3 and 4 to the item in slot 3. This could be achieved by using the - symbol as a range placeholder, allowing the script to parse the same command in a FOR statement to set each slot...if that makes sense. This would allow batch-editing multiple menu slots in one command, without cluttering menu space. If it is too complicated than no worries, I just figure that in some cases, such as clearing a menu or created simple layered menus, it would make things much faster.
@Omanoctoa
Thanks for the feedback. I'll make a note of those minor changes, and post a dev build for general usage when I next get a chance.
Tested dev version, have yet to find any bugs besides that one to do with items losing the enchanted-hideflags state, which I'm pretty sure was not to do with CYOM.
Comments directed towards CYOM dev-0.5.10
However in using the
/menu reload <menu name>
I realized that a target-self variable would be useful here. Basically something like/menu reload ~
to make it reload the menu it is being used in, rather than having to hardcode a menu's name into the item's script. This is in case a menu item is used in multiple menus and imported using the new /menu set command (which is awesome!). Reloading all menus (instead of just the one in use) using a generic/menu reload
is possible on smaller servers and will work fine for me for now, but if many users are using menus (and if there are a lot of menus) then this will no longer be practical.The
/menu set <target-menu> <slot#> <to-menu> <to-menu-slot#>
works awesome, and the description is fine, however you should make the example code look like this.../menu set <target-menu> <slot#> <source-menu> <source-menu-slot#>
...to avoid confusion :D@MinecraftersKnow
Oh, try hiding the scripts on the item first (/menu script hide) then deleting the lines of lore using the /menu script delete <line#> command. That will protect the commands while allowing you to change the written lore.
I know that, but then it will delete the command from the item. That is my problem.
@darkrush789
If your non-OP players have the permission cyom.commands.menu.open (or a specific menu permission), check to make sure you didn't grant the permission for a specific world only (if at all possible). Depending how advanced the scripts on the item area, some require the user to actually hold an item, rather than use it in a menu (I've run into this issue a few times). Specifically, any scripts that modify the item itself (/menu script replace, or /menu script hide, for instance) must be run with the item in hand.
What scripts are on the items in question? Can you show them?
@MinecraftersKnow
The command /menu script clear should work for this, however it will also remove any scripts, even hidden ones. To manually remove a single line, just hide the scripts (so only written lores are visible) and use /menu script delete #, replacing # with the line number.
Hello, I am just wondering how to delete the lore off the item, its kinda annoying. Thanks!
First of all, thank you for dedicating your time to make an awesome plugin for our community, we all really appreciate it even if not everyone verbalises it.
Basically I'm having a problem with my default users being able to run scripts when they are placed in menus. Out of menus is fine but when they are placed in the menus they stop working. I've tried both @p/ and from console, and the problem isn't in the permissions. For ops they work fine. Any help will be appreciated thank you!
@Skielyker
I don't know what you mean by default, but you can open a menu for all players like this:
/menu open @a my_menu_id
When you activate that menu item, it will open the "my_menu_id" menu for all currently online players.
If you want to open menus for players as they join the server, you'll need a scripting/triggers plugin such as Skript or VariableTriggers to run the /menu open [player] [menu] command for that player, or use a cleverly targeted command block to run the command.
This sounds like you need to use the slot locking feature. Grant the players the permission cyom.slot.lock.# where # is the numerical ID of the slot you want to lock. That slot will then be treated as if it is a menu item, can't be dropped or moved and will activate if clicked, or used to right-click/attack with.
To ensure they have a particular item in that slot, you can either use some kind of kits plugin, Skript/VariableTriggers, or run the /menu grab [player] [kit menu] for that player. All items in the menu get placed in their corresponding slots in the player's inventory. I believe the hotbar is the first row of the menu.
@XHawk87
How can I specify the script "/menu open ([default]) [ID] " for all players? And how can I stack a Item forever into the Item Bar on the bottom?
Sry for the bad English '
@Dalek12
Are you talking about running commands from command blocks in a menu item?
CYOM menus use a simpler parser than current command blocks (which was written in the early days of command blocks). Although you can do some of the same things, you can't use all of the new command block features in a menu item.
If you want to do more complex stuff from menu items, I recommend using Skript custom commands for full program flow, calculations, variable support and aliases etc. It should be able to do everything command blocks can do and more.
You should be able to use commands from any plugin, but it is important to remember that commands are run as the console, not as a player. If the command can only be run by a player, then you have to use the /sudo command E.g. /sudo @p bend clear
I am using this plugin to create a menu and a block that I assigned a command to work fine but the second i put it inside the menu the command stopped working any idea why this happened and how to fix it.
Also is there away to use commands from other plugins because when i try to use another command /bend clear nothing happens