本文整理汇总了Java中org.bukkit.plugin.IllegalPluginAccessException类的典型用法代码示例。如果您正苦于以下问题:Java IllegalPluginAccessException类的具体用法?Java IllegalPluginAccessException怎么用?Java IllegalPluginAccessException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IllegalPluginAccessException类属于org.bukkit.plugin包,在下文中一共展示了IllegalPluginAccessException类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: setState
import org.bukkit.plugin.IllegalPluginAccessException; //导入依赖的package包/类
public void setState(Player p, UserState state) {
p.teleport(state.getLocation());
p.setFallDistance(state.getFallDistance());
p.setGameMode(state.getGameMode());
p.setAllowFlight(state.getAllowFlight());
p.setFlying(state.isFlying());
p.setLevel(state.getLevel());
p.setExp(state.getExp());
p.setFireTicks(state.getFireTicks());
p.setMaxHealth(state.getMaxHealth());
p.setHealth(state.getHealth());
p.setFoodLevel(state.getFoodLevel());
p.setWalkSpeed(state.getWalkSpeed());
p.setFlySpeed(state.getFlySpeed());
for (Iterator<PotionEffect> i = p.getActivePotionEffects().iterator(); i.hasNext();) {
p.removePotionEffect(i.next().getType());
}
p.addPotionEffects(state.getActivePotionEffects());
p.getInventory().setHeldItemSlot(state.getHeldItemSlot());
final String name = p.getName();
final ItemStack[] contents = state.getContents();
final ItemStack[] armorcontents = state.getArmorContents();
try {
Bukkit.getScheduler().scheduleSyncDelayedTask(SurvivalGames.instance, new Runnable() {
public void run() {
Player fp = Bukkit.getPlayer(name);
if(fp != null) {
fp.getInventory().setContents(contents);
fp.getInventory().setArmorContents(armorcontents);
fp.updateInventory();
}
}
}, 2L);
} catch(IllegalPluginAccessException e) {
p.getInventory().setContents(contents);
p.getInventory().setArmorContents(armorcontents);
p.updateInventory();
}
}
开发者ID:maker56,项目名称:UltimateSurvivalGames,代码行数:44,代码来源:UserManager.java
示例17: registerEvent
import org.bukkit.plugin.IllegalPluginAccessException; //导入依赖的package包/类
/**
* Registers the given event to the specified listener using a directly
* passed EventExecutor
*
* @param event
* Event class to register
* @param listener
* PlayerListener to register
* @param priority
* Priority of this event
* @param executor
* EventExecutor to register
* @param plugin
* Plugin to register
* @param ignoreCancelled
* Do not call executor if event was already cancelled
*/
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");
}
getEventListeners(event)
.register(new RegisteredListener(listener, executor, priority, plugin, ignoreCancelled));
}
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:32,代码来源:BukkitEventManager.java
注:本文中的org.bukkit.plugin.IllegalPluginAccessException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论