Search in sources :

Example 1 with RewardScheme

use of au.com.mineauz.minigames.minigame.reward.scheme.RewardScheme in project Minigames by AddstarMC.

the class RewardsModule method createSubMenu.

private Menu createSubMenu(final Menu parent) {
    final Menu submenu = new Menu(6, "Reward Settings", parent.getViewer());
    scheme.addMenuItems(submenu);
    submenu.addItem(RewardSchemes.newMenuItem("Reward Scheme", Material.PAPER, new Callback<Class<? extends RewardScheme>>() {

        @Override
        public void setValue(Class<? extends RewardScheme> value) {
            scheme = RewardSchemes.createScheme(value);
            // Update the menu
            Menu menu = createSubMenu(parent);
            menu.displayMenu(submenu.getViewer());
        }

        @Override
        public Class<? extends RewardScheme> getValue() {
            return scheme.getClass();
        }
    }), submenu.getSize() - 1);
    submenu.addItem(new MenuItemBack(parent), submenu.getSize() - 9);
    return submenu;
}
Also used : Callback(au.com.mineauz.minigames.menu.Callback) MenuItemBack(au.com.mineauz.minigames.menu.MenuItemBack) RewardScheme(au.com.mineauz.minigames.minigame.reward.scheme.RewardScheme) StandardRewardScheme(au.com.mineauz.minigames.minigame.reward.scheme.StandardRewardScheme) Menu(au.com.mineauz.minigames.menu.Menu)

Aggregations

Callback (au.com.mineauz.minigames.menu.Callback)1 Menu (au.com.mineauz.minigames.menu.Menu)1 MenuItemBack (au.com.mineauz.minigames.menu.MenuItemBack)1 RewardScheme (au.com.mineauz.minigames.minigame.reward.scheme.RewardScheme)1 StandardRewardScheme (au.com.mineauz.minigames.minigame.reward.scheme.StandardRewardScheme)1