Examples
Open a sofyCore menu
Open the built-in VIP shop or a custom menu from your own command or NPC with MenuService.
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) return true;
Player player = (Player) sender;
SofyCoreApi api = Bukkit.getServicesManager().load(SofyCoreApi.class);
boolean opened = api != null && api.service(MenuService.class)
.map(menus -> menus.open(player.getUniqueId(), "vip-shop"))
.orElse(false);
if (!opened) player.sendMessage("The shop is not available right now.");
return true;
}Commands run on the server thread, which is where MenuService.open must be called. The menu applies the same permissions as /vipshop.