类org.bukkit.plugin.IllegalPluginAccessException源码实例Demo

下面列出了怎么用org.bukkit.plugin.IllegalPluginAccessException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: QuickShop-Reremake   文件: DatabaseManager.java
/**
 * Queued database manager. Use queue to solve run SQL make server lagg issue.
 *
 * @param plugin plugin main class
 * @param db     database
 */
public DatabaseManager(@NotNull QuickShop plugin, @NotNull Database db) {
    this.plugin = plugin;
    this.warningSender = new WarningSender(plugin, 600000);
    this.database = db;
    this.useQueue = plugin.getConfig().getBoolean("database.queue");

    if (!useQueue) {
        return;
    }
    try {
        task =
                new BukkitRunnable() {
                    @Override
                    public void run() {
                        plugin.getDatabaseManager().runTask();
                    }
                }.runTaskTimerAsynchronously(plugin, 1, plugin.getConfig().getLong("database.queue-commit-interval") * 20);
    } catch (IllegalPluginAccessException e) {
        Util.debugLog("Plugin is disabled but trying create database task, move to Main Thread...");
        plugin.getDatabaseManager().runTask();
    }
}
 
源代码2 项目: VoxelGamesLibv2   文件: LoggedPluginManager.java
private Class<? extends Event> getRegistrationClass(Class<? extends Event> clazz) {
    try {
        clazz.getDeclaredMethod("getHandlerList");
        return clazz;

    } catch (NoSuchMethodException e) {
        if ((clazz.getSuperclass() != null)
                && (!clazz.getSuperclass().equals(Event.class))
                && (Event.class.isAssignableFrom(clazz.getSuperclass()))) {
            return getRegistrationClass(clazz.getSuperclass().asSubclass(
                    Event.class));
        }
    }
    throw new IllegalPluginAccessException(
            "Unable to find handler list for event " + clazz.getName());
}
 
源代码3 项目: PGM   文件: Events.java
static HandlerList getEventListeners(Class<? extends Event> type) {
  try {
    Method method = getRegistrationClass(type).getDeclaredMethod("getHandlerList");
    method.setAccessible(true);
    return (HandlerList) method.invoke(null);
  } catch (Exception e) {
    throw new IllegalPluginAccessException(e.toString());
  }
}
 
源代码4 项目: PGM   文件: Events.java
static Class<? extends Event> getRegistrationClass(Class<? extends Event> clazz) {
  try {
    clazz.getDeclaredMethod("getHandlerList");
    return clazz;
  } catch (NoSuchMethodException e) {
    if (clazz.getSuperclass() != null
        && !clazz.getSuperclass().equals(Event.class)
        && Event.class.isAssignableFrom(clazz.getSuperclass())) {
      return getRegistrationClass(clazz.getSuperclass().asSubclass(Event.class));
    } else {
      throw new IllegalPluginAccessException(
          "Unable to find handler list for event " + clazz.getName());
    }
  }
}
 
源代码5 项目: Kettle   文件: CraftScheduler.java
private static void validate(final Plugin plugin, final Object task) {
    Validate.notNull(plugin, "Plugin cannot be null");
    Validate.notNull(task, "Task cannot be null");
    if (!plugin.isEnabled()) {
        throw new IllegalPluginAccessException("Plugin attempted to register task while disabled");
    }
}
 
源代码6 项目: helper   文件: HelperMergedEventListener.java
private static Class<? extends Event> getRegistrationClass(Class<? extends Event> clazz) {
    try {
        clazz.getDeclaredMethod("getHandlerList");
        return clazz;
    } catch (NoSuchMethodException var2) {
        if (clazz.getSuperclass() != null && !clazz.getSuperclass().equals(Event.class) && Event.class.isAssignableFrom(clazz.getSuperclass())) {
            return getRegistrationClass(clazz.getSuperclass().asSubclass(Event.class));
        } else {
            throw new IllegalPluginAccessException("Unable to find handler list for event " + clazz.getName() + ".");
        }
    }
}
 
源代码7 项目: VoxelGamesLibv2   文件: LoggedPluginManager.java
private HandlerList getEventListeners(Class<? extends Event> type) {
    try {
        Method method = getRegistrationClass(type).getDeclaredMethod("getHandlerList");
        method.setAccessible(true);
        return (HandlerList) method.invoke(null);
    } catch (Exception e) {
        throw new IllegalPluginAccessException(e.toString());
    }
}
 
源代码8 项目: Thermos   文件: CraftScheduler.java
private static void validate(final Plugin plugin, final Object task) {
    Validate.notNull(plugin, "Plugin cannot be null");
    Validate.notNull(task, "Task cannot be null");
    if (!plugin.isEnabled()) {
        throw new IllegalPluginAccessException("Plugin attempted to register task while disabled");
    }
}
 
源代码9 项目: NovaGuilds   文件: LoggedPluginManager.java
/**
 * Gets event listeners
 *
 * @param type event type
 * @return handler list
 */
private HandlerList getEventListeners(Class<? extends Event> type) {
	try {
		Method method = Reflections.getMethod(type, "getHandlerList");
		method.setAccessible(true);
		return (HandlerList) method.invoke(null);
	}
	catch(Exception e) {
		throw new IllegalPluginAccessException(e.toString());
	}
}
 
源代码10 项目: NovaGuilds   文件: LoggedPluginManager.java
/**
 * Gets registration class
 *
 * @param clazz event class
 * @return the class
 */
private Class<? extends Event> getRegistrationClass(Class<? extends Event> clazz) {
	try {
		clazz.getDeclaredMethod("getHandlerList");
		return clazz;

	}
	catch(NoSuchMethodException e) {
		if((clazz.getSuperclass() != null) && (!clazz.getSuperclass().equals(Event.class)) && (Event.class.isAssignableFrom(clazz.getSuperclass()))) {
			return getRegistrationClass(clazz.getSuperclass().asSubclass(Event.class));
		}
	}
	throw new IllegalPluginAccessException("Unable to find handler list for event " + clazz.getName());
}
 
源代码11 项目: BetonQuest   文件: Conversation.java
/**
 * Instead of ending the conversation it saves it to the database, from
 * where it will be resumed after the player logs in again.
 */
public void suspend() {
    if (inOut == null) {
        LogUtils.getLogger().log(Level.WARNING, "Conversation IO is not loaded, conversation will end for player "
                + PlayerConverter.getName(playerID));
        list.remove(playerID);
        HandlerList.unregisterAll(this);
        return;
    }
    inOut.end();

    // save the conversation to the database
    String loc = location.getX() + ";" + location.getY() + ";" + location.getZ() + ";"
            + location.getWorld().getName();
    plugin.getSaver().add(new Record(UpdateType.UPDATE_CONVERSATION,
            new String[]{convID + " " + option + " " + loc, playerID}));

    // End interceptor
    if (interceptor != null) {
        interceptor.end();
    }

    // delete conversation
    list.remove(playerID);
    HandlerList.unregisterAll(this);

    try {
        new BukkitRunnable() {

            @Override
            public void run() {
                Bukkit.getServer().getPluginManager().callEvent(new PlayerConversationEndEvent(player, Conversation.this));
            }
        }.runTask(BetonQuest.getInstance());
    } catch (IllegalPluginAccessException e) {
        LogUtils.logThrowableIgnore(e);
    }

}
 
 类所在包
 类方法
 同包方法