use of fr.minuskube.inv.content.InventoryProvider in project Nexus by ProjectEdenGG.
the class MinigamesMenus method openCustomSettingsMenu.
@SneakyThrows
public void openCustomSettingsMenu(Player player, Arena arena) {
Class<? extends InventoryProvider> provider = null;
customMenus: for (Class<? extends InventoryProvider> menu : new Reflections("gg.projecteden.nexus.features.minigames.menus.custom").getSubTypesOf(InventoryProvider.class)) {
for (Class<? extends Mechanic> superclass : arena.getMechanic().getSuperclasses()) {
if (menu.getAnnotation(CustomMechanicSettings.class) != null) {
List<Class<? extends Mechanic>> classes = Arrays.asList(menu.getAnnotation(CustomMechanicSettings.class).value());
if (classes.contains(superclass)) {
provider = menu;
break customMenus;
}
}
}
}
if (provider == null) {
player.playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1, 1);
return;
}
SmartInventory INV = SmartInventory.builder().id("customSettingsMenu").provider(provider.getDeclaredConstructor(Arena.class).newInstance(arena)).title("Custom Settings Menu").size(3, 9).build();
INV.open(player);
}
Aggregations