/** * @deprecated This method is legacy and will be removed - it must be * replaced by the specially provided constructor(s). */ @Deprecated protected final void initialize(PluginLoader loader, Server server, PluginDescriptionFile description, File dataFolder, File file, ClassLoader classLoader) { if (server.getWarningState() == WarningState.OFF) { return; } getLogger().log(Level.WARNING, getClass().getName() + " is already initialized", server.getWarningState() == WarningState.DEFAULT ? null : new AuthorNagException("Explicit initialization")); }
/** * Registers a new {@link IRangeGroupType}, with the given name. * * @param id * The ID to register under. * @param rangeGroupType * The {@link IRangeGroupType} to register. * @throws IllegalArgumentException * If there already is a registration for the given ID * @throws IllegalArgumentException * If either id or rangeProducer are null. */ public void addRegistration(String id, IRangeGroupType<?> rangeGroupType) throws IllegalArgumentException { if (finished) { // Well, I'm not 100% sure if this is what AuthorNagException is for // but I think this will do. It doesn't seem to be thrown anywhere // else (EVER), but it looks like bukkit uses it to write a log // message to go "nag" at the author of the plugin (with their name // as found in plugin.yml). Seems perfect for something that should // not happen unless someone is TRYING to break WDLCompanion. throw new AuthorNagException( "Group type registrations have already finished! Did you " + "grab on to this event to try and add new " + "registrations later on? Please don't do " + "that, thanks. The config has already been " + "parsed and your new type would be ignored. " + "(Attempted to add a IRangeGroupType, " + rangeGroupType + ", with an ID of " + id + ", to WDLCompanion's rangeGroup map in a " + "RangeGroupTypeRegistrationEvent)"); } if (id == null) { throw new IllegalArgumentException("id must not be null!"); } if (rangeGroupType == null) { throw new IllegalArgumentException("rangeProducer must not be null!"); } if (plugin.registeredRangeGroupTypes.containsKey(id)) { throw new IllegalArgumentException( "RangeProducer already registered for id '" + id + "'; tried to register " + rangeGroupType + " over it (currently registered: " + plugin.registeredRangeGroupTypes.get(id) + ")"); } plugin.registeredRangeGroupTypes.put(id, rangeGroupType); plugin.getLogger().fine( "Registered IRangeProducer " + rangeGroupType + " under '" + id + "'."); }