当前位置: 首页>>代码示例>>Java>>正文


Java IllegalPluginAccessException类代码示例

本文整理汇总了Java中org.bukkit.plugin.IllegalPluginAccessException的典型用法代码示例。如果您正苦于以下问题:Java IllegalPluginAccessException类的具体用法?Java IllegalPluginAccessException怎么用?Java IllegalPluginAccessException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IllegalPluginAccessException类属于org.bukkit.plugin包,在下文中一共展示了IllegalPluginAccessException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerEvent

import org.bukkit.plugin.IllegalPluginAccessException; //导入依赖的package包/类
@Override
public void registerEvent(Class<? extends Event> event, Listener listener, EventPriority priority, EventExecutor executor, Plugin plugin, boolean ignoreCancelled) {
       Validate.notNull(listener, "Listener cannot be null");
       Validate.notNull(priority, "Priority cannot be null");
       Validate.notNull(executor, "Executor cannot be null");
       Validate.notNull(plugin, "Plugin cannot be null");

       if (!plugin.isEnabled()) {
           throw new IllegalPluginAccessException("Plugin attempted to register " + event + " while not enabled");
       }

       if (useTimings) {
           getEventListeners(event).register(new TimedRegisteredListener(listener, executor, priority, plugin, ignoreCancelled));
       } else {
           getEventListeners(event).register(new RegisteredListener(listener, executor, priority, plugin, ignoreCancelled));
       }
}
 
开发者ID:DevotedMC,项目名称:ExilePearl,代码行数:18,代码来源:TestPluginManager.java

示例2: getRegistrationClass

import org.bukkit.plugin.IllegalPluginAccessException; //导入依赖的package包/类
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());
}
 
开发者ID:VoxelGamesLib,项目名称:VoxelGamesLibv2,代码行数:17,代码来源:LoggedPluginManager.java

示例3: validate

import org.bukkit.plugin.IllegalPluginAccessException; //导入依赖的package包/类
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");
    }
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:8,代码来源:CraftScheduler.java

示例4: getEventListeners

import org.bukkit.plugin.IllegalPluginAccessException; //导入依赖的package包/类
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());
    }
}
 
开发者ID:VoxelGamesLib,项目名称:VoxelGamesLibv2,代码行数:10,代码来源:LoggedPluginManager.java

示例5: getRegistrationClass

import org.bukkit.plugin.IllegalPluginAccessException; //导入依赖的package包/类
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));
        } else {
            throw new IllegalPluginAccessException("Unable to find handler list for event " + clazz.getName() + ". Static getHandlerList method required!");
        }
    }
}
 
开发者ID:DevotedMC,项目名称:ExilePearl,代码行数:15,代码来源:TestPluginManager.java

示例6: getEventListeners

import org.bukkit.plugin.IllegalPluginAccessException; //导入依赖的package包/类
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());
	}
}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:10,代码来源:BukkitEventManager.java

示例7: getRegistrationClass

import org.bukkit.plugin.IllegalPluginAccessException; //导入依赖的package包/类
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));
		} else {
			throw new IllegalPluginAccessException("Unable to find handler list for event " + clazz.getName()
					+ ". Static getHandlerList method required!");
		}
	}
}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:15,代码来源:BukkitEventManager.java

示例8: registerEvents

import org.bukkit.plugin.IllegalPluginAccessException; //导入依赖的package包/类
public void registerEvents(Listener listener, Plugin plugin) {
	if (!plugin.isEnabled()) {
		throw new IllegalPluginAccessException("Plugin attempted to register " + listener + " while not enabled");
	}

	for (Map.Entry<Class<? extends Event>, Set<RegisteredListener>> entry : plugin.getPluginLoader()
			.createRegisteredListeners(listener, plugin).entrySet()) {
		getEventListeners(getRegistrationClass(entry.getKey())).registerAll(entry.getValue());
	}

}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:12,代码来源:BukkitEventManager.java

示例9: getEventListeners

import org.bukkit.plugin.IllegalPluginAccessException; //导入依赖的package包/类
/**
 * 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());
	}
}
 
开发者ID:MarcinWieczorek,项目名称:NovaGuilds,代码行数:17,代码来源:LoggedPluginManager.java

示例10: getRegistrationClass

import org.bukkit.plugin.IllegalPluginAccessException; //导入依赖的package包/类
/**
 * 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());
}
 
开发者ID:MarcinWieczorek,项目名称:NovaGuilds,代码行数:20,代码来源:LoggedPluginManager.java

示例11: getPlugin

import org.bukkit.plugin.IllegalPluginAccessException; //导入依赖的package包/类
/**
 * Gets a Bukkit plugin.
 *
 * @param plugin The name of the plugin to get.
 * @return A Bukkit plugin.
 */
public static Plugin getPlugin(final String plugin) {
	if (!Bukkit.getPluginManager().isPluginEnabled(plugin)) {
		throw new IllegalPluginAccessException(String.format("The plugin [%s] is not enabled!", plugin));
	}
	return Bukkit.getPluginManager().getPlugin(plugin);
}
 
开发者ID:KabOOm356,项目名称:Reporter,代码行数:13,代码来源:BukkitUtil.java

示例12: testGetPluginNotFound

import org.bukkit.plugin.IllegalPluginAccessException; //导入依赖的package包/类
@Test(expected = IllegalPluginAccessException.class)
public void testGetPluginNotFound() {
	final String pluginName = "Test plugin";
	final PluginManager pluginManager = mock(PluginManager.class);
	when(pluginManager.isPluginEnabled(pluginName)).thenReturn(false);
	mockStatic(Bukkit.class);
	when(Bukkit.getPluginManager()).thenReturn(pluginManager);

	try {
		BukkitUtil.getPlugin(pluginName);
	} finally {
		verify(pluginManager).isPluginEnabled(pluginName);
		verifyStatic();
	}
}
 
开发者ID:KabOOm356,项目名称:Reporter,代码行数:16,代码来源:BukkitUtilTest.java

示例13: getRegistrationClass

import org.bukkit.plugin.IllegalPluginAccessException; //导入依赖的package包/类
private 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());
        }
    }
}
 
开发者ID:DPOH-VAR,项目名称:VarScript,代码行数:15,代码来源:BukkitEventTrigger.java

示例14: getHandlerList

import org.bukkit.plugin.IllegalPluginAccessException; //导入依赖的package包/类
private static HandlerList getHandlerList(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());
    }
}
 
开发者ID:DPOH-VAR,项目名称:VarScript,代码行数:10,代码来源:BukkitEventTrigger.java

示例15: validate

import org.bukkit.plugin.IllegalPluginAccessException; //导入依赖的package包/类
private static void validate(Plugin plugin, Object task) {
    Preconditions.checkState(plugin != null, "Plugin is null");
    Preconditions.checkNotNull(task, "task");
    //noinspection ConstantConditions
    if (!plugin.isEnabled()) {
        throw new IllegalPluginAccessException("Plugin attempted to register task while disabled");
    }
}
 
开发者ID:LapisBlue,项目名称:Pore,代码行数:9,代码来源:PoreBukkitScheduler.java


注:本文中的org.bukkit.plugin.IllegalPluginAccessException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。