@Nullable public static CommandBookWarps create(Plugin plugin) { if (plugin instanceof CommandBook) { ComponentManager<BukkitComponent> componentManager = ((CommandBook)plugin).getComponentManager(); WarpsComponent component = componentManager.getComponent(WarpsComponent.class); if (component == null) return null; RootLocationManager<NamedLocation> locationManager = component.getManager(); return locationManager != null ? new CommandBookWarps(locationManager) : null; } return null; }
@Command(aliases = {"reload"}, usage = "", desc = "Reload CommandBook's settings", min = 0, max = 0) @CommandPermissions({"commandbook.reload"}) public static void reload(CommandContext args, CommandSender sender) throws CommandException { try { CommandBook.inst().getGlobalConfiguration().load(); } catch (IOException e) { sender.sendMessage(ChatColor.RED + "Error reolading configuration: " + e.getMessage()); sender.sendMessage(ChatColor.RED + "See console for details!"); CommandBook.logger().log(Level.WARNING, "Error reloading configuration: " + e, e); } CommandBook.inst().loadConfiguration(); CommandBook.inst().getComponentManager().reloadComponents(); sender.sendMessage(ChatColor.YELLOW + "CommandBook's configuration has been reloaded."); }
return entry.getInformation().friendlyName() + " - " + entry.getInformation().desc(); }.display(sender, CommandBook.inst().getComponentManager().getComponents(), args.getFlagInteger('p', 1)); AbstractComponent component = CommandBook.inst().getComponentManager().getComponent(componentName); if (component == null) { throw new CommandException("No such component: " + componentName);
CommandBook.inst().checkPermission(source, "commandbook.locations." + type); LocationsComponent component = type.equalsIgnoreCase("warp") ? CommandBook.inst().getComponentManager().getComponent(WarpsComponent.class) : CommandBook.inst().getComponentManager().getComponent(HomesComponent.class); if (component == null) { throw new CommandException("This type of location is not enabled!");