Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeluxeMenus add-on #39

Open
Dreygz opened this issue Sep 20, 2021 · 1 comment
Open

DeluxeMenus add-on #39

Dreygz opened this issue Sep 20, 2021 · 1 comment

Comments

@Dreygz
Copy link

Dreygz commented Sep 20, 2021

Hello everyone! Please help me finish the addon to DeluxeMenus, because most of the servers use this plugin and I think it is useful for users

credits = 'Chorus';
version = '1.0.0';
description = 'This add-on brings Deluxemenus support to Chorus by loading GUIs from selection.'
image = 'https://i.imgur.com/U3wp1qq.png'

function onInit() {
    const format = new GUIFormat(
        function getName(map) {
            return settings ? settings.get('menu_title') : 'No title';
        },
        function getRows(map) {
            return settings ? settings.get('size') : 1;
        },
        function getItems(map) {
            const items = [];
            map.keySet().forEach(key => {
                if (key = 'items') {
                    const itemSection = map.get(key);
                    let item = itemSection.get('ID');
                    if(!item) item = itemSection.get('material'); // If ID is not found, look for MATERIAL
                    item = item ? item.toString().split(",")[0] : item.toString(); // Remove amounts (wool:3, 10 -> wool:3)
                    const itemName = item ? item.indexOf(':') != -1 ? item.split(':')[0] : item : 'BEDROCK'; // If item is null, use Bedrock. Otherwise, remove meta
                    const position = itemSection.get('slot');

                    items.push(new GUIFormatItem(new GUIFormatPosition(position), itemName));
                }
			});
            return items;
        });
    format.setActive('DeluxeMenus');
}
@iamgio
Copy link
Owner

iamgio commented Sep 21, 2021

I'll look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants