石橋を叩いて壊すブログ

bukkitでイベントリスナを登録するとIllegalPluginAccessExceptionが出る

一部のイベントのリスナを登録しようとすると、以下のエラーが出る。

[SEVERE] Error occurred while enabling AllEventListening v1.6.2 (Is it up to date?)
org.bukkit.plugin.IllegalPluginAccessException: 
Unable to find handler list for event org.bukkit.event.*****.*****Event

なんでエラーが出るのか理由は不明。
サブクラスがあるイベントクラスはエラー…とするとBlockExpEventが説明できないし、
コンストラクタがProtectedのイベントクラスはエラー…とするとBlockPistonEventが説明できないし。
うーん。

でもクラス名で、なんとなくこのクラスはエラーになりそうだというのはわかる。
WorldEventはエラーでもWorldInitEventはエラーにならないように、
ネーミングからして明らかにサブクラスがあるイベントはエラーになるようだ。

エラーが出るイベントリスナの一覧を作ってみた。
非推奨クラスは調べていない。

■org.bukkit.event
Event
■org.bukkit.event.block
BlockEvent
BlockPistonEvent
■org.bukkit.event.enchantment
なし
■org.bukkit.event.entity
EntityEvent
■org.bukkit.event.hanging
HangingEvent
■org.bukkit.event.inventory
なし
■org.bukkit.event.painting
全イベントが非推奨クラスなので調べてない
■org.bukkit.event.player
PlayerBucketEvent
PlayerEvent
■org.bukkit.event.server
PluginEvent
ServerEvent
ServiceEvent
■org.bukkit.event.vehicle
VehicleCollisionEvent
VehicleEvent
■org.bukkit.event.weather
WeatherEvent
■org.bukkit.event.world
ChunkEvent
WorldEvent

そんなわけで、何をすると、どんなイベントが発生するのかを勉強するため、
ありとあらゆるイベントをキャッチしてログに出すコードを書いてみた。
なお1箇所だけ、VehicleUpdateEventイベントは、
サーバーに誰もログインしていない状態でもなぜか
鬼のように常時大量発生し、他のログを押し流してしまうため、コメントアウトしてある。

//org.bukkit.event.block

@EventHandler
public void onEvent(BlockBreakEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(BlockBurnEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(BlockCanBuildEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(BlockDamageEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(BlockDispenseEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(BlockExpEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(BlockFadeEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(BlockFormEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(BlockFromToEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(BlockGrowEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(BlockIgniteEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(BlockPhysicsEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(BlockPistonExtendEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(BlockPistonRetractEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(BlockPlaceEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(BlockRedstoneEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(BlockSpreadEvent e) {log.info(e.toString());}

//org.bukkit.event.enchantment

@EventHandler
public void onEvent(EnchantItemEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PrepareItemEnchantEvent e) {log.info(e.toString());}

//org.bukkit.event.entity

@EventHandler
public void onEvent(CreatureSpawnEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(CreeperPowerEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(EntityBreakDoorEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(EntityChangeBlockEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(EntityCombustByBlockEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(EntityCombustByEntityEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(EntityCombustEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(EntityCreatePortalEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(EntityDamageByBlockEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(EntityDamageByEntityEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(EntityDamageEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(EntityDeathEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(EntityExplodeEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(EntityInteractEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(EntityPortalEnterEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(EntityPortalEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(EntityPortalExitEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(EntityRegainHealthEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(EntityShootBowEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(EntityTameEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(EntityTargetEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(EntityTargetLivingEntityEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(EntityTeleportEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(ExpBottleEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(ExplosionPrimeEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(FoodLevelChangeEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(ItemDespawnEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(ItemSpawnEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PigZapEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerDeathEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PotionSplashEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(ProjectileHitEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(ProjectileLaunchEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(SheepDyeWoolEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(SheepRegrowWoolEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(SlimeSplitEvent e) {log.info(e.toString());}

//org.bukkit.event.hanging

@EventHandler
public void onEvent(HangingBreakByEntityEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(HangingBreakEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(HangingPlaceEvent e) {log.info(e.toString());}

//org.bukkit.event.inventory

@EventHandler
public void onEvent(BrewEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(CraftItemEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(FurnaceBurnEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(FurnaceExtractEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(FurnaceSmeltEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(InventoryClickEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(InventoryCloseEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(InventoryCreativeEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(InventoryDragEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(InventoryEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(InventoryInteractEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(InventoryMoveItemEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(InventoryOpenEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(InventoryPickupItemEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PrepareItemCraftEvent e) {log.info(e.toString());}

//org.bukkit.event.player

@EventHandler
public void onEvent(AsyncPlayerChatEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(AsyncPlayerPreLoginEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerAnimationEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerBedEnterEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerBedLeaveEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerBucketEmptyEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerBucketFillEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerChangedWorldEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerChannelEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerChatTabCompleteEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerCommandPreprocessEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerDropItemEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerEditBookEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerEggThrowEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerExpChangeEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerFishEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerGameModeChangeEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerInteractEntityEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerInteractEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerItemBreakEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerItemConsumeEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerItemHeldEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerJoinEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerKickEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerLevelChangeEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerLoginEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerMoveEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerPickupItemEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerPortalEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerQuitEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerRegisterChannelEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerRespawnEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerShearEntityEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerTeleportEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerToggleFlightEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerToggleSneakEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerToggleSprintEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerUnregisterChannelEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PlayerVelocityEvent e) {log.info(e.toString());}

//org.bukkit.event.server

@EventHandler
public void onEvent(MapInitializeEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PluginDisableEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PluginEnableEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(RemoteServerCommandEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(ServerCommandEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(ServerListPingEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(ServiceRegisterEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(ServiceUnregisterEvent e) {log.info(e.toString());}

//org.bukkit.event.vehicle

@EventHandler
public void onEvent(VehicleBlockCollisionEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(VehicleCreateEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(VehicleDamageEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(VehicleDestroyEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(VehicleEnterEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(VehicleEntityCollisionEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(VehicleExitEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(VehicleMoveEvent e) {log.info(e.toString());}
//@EventHandler
//public void onEvent(VehicleUpdateEvent e) {log.info(e.toString());}

//org.bukkit.event.weather

@EventHandler
public void onEvent(LightningStrikeEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(ThunderChangeEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(WeatherChangeEvent e) {log.info(e.toString());}

//org.bukkit.event.world

@EventHandler
public void onEvent(ChunkLoadEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(ChunkPopulateEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(ChunkUnloadEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(PortalCreateEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(SpawnChangeEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(StructureGrowEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(WorldInitEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(WorldLoadEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(WorldSaveEvent e) {log.info(e.toString());}
@EventHandler
public void onEvent(WorldUnloadEvent e) {log.info(e.toString());}

これを使って、火を左クリックで消火するとき、どんなイベントが起きるか見てみた。

PlayerInteractEvent     プレイヤーが右クリック(火打石でブロックを着火する)
BlockIgniteEvent        ブロックが着火される
BlockPhysicsEvent       ブロックが重力で落下するかチェックされる
BlockPlaceEvent         ブロックが設置される
PlayerAnimationEvent    プレイヤーがアニメーションする
PlayerAnimationEvent    プレイヤーがアニメーションする
PlayerInteractEvent     プレイヤーが左クリック(火を左クリックで消化する)
BlockPhysicsEvent       ブロックが重力で落下するかチェックされる
PlayerAnimationEvent    プレイヤーがアニメーションする

「火が消える」というイベントは無いようだ。残念。

この記事を評価

5 5

コメント

【この記事にコメント】
お名前:
コメント:

295,349

記事カテゴリー

最近の記事

  1. FF14を翻訳したら国によって結構特色が違った[12/11]
  2. ゼロから始めるFactorioの回路構築(実践例編)[7/24]
  3. ゼロから始めるFactorioの回路構築(条件回路・論理演算編)[7/24]
  4. ゼロから始めるFactorioの回路構築(定数回路・算術回路編)[7/24]
  5. ゼロから始めるFactorioの回路構築(入力・出力・混合編)[7/24]

RSS1.0 RSS2.0

最近のコメント

  1. おー、お役に立てたようでなによりです。再起…[9/11]
  2. この記事が非常の役立ちました。おかげさまで…[9/9]
  3. 1.14.2のAPIで試しましたが、MapInitializeEv…[9/9]
  4. 天晴れ!押したらポーションのモヤモヤでまし…[5/26]
  5. 習うより慣れろって感じで。この記事は記事冒…[4/7]

記事を検索


管理人

石橋

2014年から
神奈川県秦野市市民