Extra Events

Extra Events

3.7k Downloads

Anyone who has been active on the main forums in the last few days must surely have already heard the news.

I'm not going to comment on why and how, but the short version is that Bukkit is almost certainly not getting passed this.

Consequently, the future of BukkitDev is very uncertain. Even if the legal matters were resolved tomorrow there isn't really anybody left to deal with file submissions anyway. There's no indication about how long the site will stay up and what will happen to the files.


Anyway, while I will continue updating and developing my plugins you will need to look for updates somewhere else, namely the wiki. I will be updating this wiki in the next few days to facilitate better communication (forums, email, etc.) and adding any documentation that's missing.

I will also, of course, be looking into porting the plugins over to whichever API emerges from the ashes!


Extra Events


This is a plugin to easily allow devs to add some extra events not found in Bukkit


Time Events

HourChangeEvent
Called every Minecraft hour
Members - hour
SecondTickEvent
Called every real life second
DawnEvent
Called when the Minecraft time is 0
MiddayEvent
Called when the Minecraft time is 6000
DuskEvent
Called when the Minecraft time is 12000
NightEvent
Called when the Minecraft time is 12500
MidnightEvent
Called when the Minecraft time is 18000
TimerActivateEvent
Called when a timer goes off (see below)
Members - timer

Area Events

PlayerEnterAreaEvent
Called when a player enters an area (either WorldGuard region or Area)
Members - player, area
PlayerLeaveAreaEvent
Called when a player leaves an area (either WorldGuard region or Area)
Members - player, area
PlayerInAreaEvent
Called every half a second a player is inside an area (either WorldGuard region or Area)
Members - player, area

Entity Events

LivingEntityBlockEvent
Called when a LivingEntity is hit whilst invincible
Members - entity, attacker, cause
LivingEntityDamageEvent
Called when a LivingEntity is hit and not invincible
Members - entity, attacker, cause, damage
PlayerApproachLivingEntityEvent
Called when a Player gets near a LivingEntity
Members - entity, player
The range is customizable (see below)
PlayerLeaveLivingEntityEvent
Called when a Player moves away from a LivingEntity
Members - entity, player
The range is customizable (see below)
PlayerNearLivingEntityEvent
Called every half a second when a Player is near a LivingEntity
Members - entity, player
The range is customizable (see below)
PlayerTargetedEvent
Called when a hostile mob targets a player
Members - entity,player, reason

Timers

It's possible to set up events to be fired every x seconds. See below or in the config file for an example.

If you're a Mobs user you can set timers here and use the timer.txt event file to react to them. Use the if_timer condition to check the timer's name if you have more than one.


Config

approach:
  x: 10
  y: 4
  z: 10
leave:
  x: 10
  y: 4
  z: 10
near:
  x: 5
  y: 4
  z: 5
areas:
  world_name:
    area_name:
      x:
        from: 10
        to: 20
      y:
        from: 55
        to: 58
      z:
        from: 100
        to: 120
timers:
  example:
    interval_in_seconds: 300
    enabled: no
    world: world_name

These are the defaults for the entity events.

The top section controls how close a Player must be to a LivingEntity to call the PlayerApproachLivingEntityEvent.
The middle section controls how close a Player must be to a LivingEntity to call the PlayerLeaveLivingEntityEvent.
The bottom section controls how close a Player must be to a LivingEntity to call the PlayerNearLivingEntityEvent.

The middle section deals with areas. Use this to add areas without needing WorldGuard. The areas are only markers for convenience and don't offer any protection, owners, etc.

The last section deals with timers. Each timer needs a unique name ('example' above), and a valid world name or it will be disabled. You can control the timers from in game with the /timers command (see below).


Commands

/reload_extraevents, or /ree
Reloads the config without reloading the server.
Needs the permission extraevents.can_reload_config, or op.
/timers, or /t
Allows timers to be disabled, paused, etc.
Needs the permission extraevents.can_change_timers, or op.
/timers
Shows a report of the current status.
/timers pause
Stops the plugin from activating any timers automatically.
/timers unpause
Reverses the above.
/timers enable
Enables all timers.
/timers enable [name]
Enables the timer called [name].
/timers disable
Disables all timers.
/timers disable [name]
Disables the timer called [name].
/timers activate
Activates all timers, as if they had reached 0.
/timers activate [name]
Activates the timer called [name], as if it had reached 0.
/timers check
Shows a report of all timers.
/timers check [name]
Shows a report of the timer called [name].
/timers set_interval x
Sets the interval of all timers to x.
/timers set_interval x [name]
Sets the interval of the timer called [name] to x.

Note that none of these commands changes the config itself, so all timers will be reset to their original values after reloading.


How To Use

Add this plugin to the project in exactly the same way as you add Bukkit, and use the events in the same way as normal Bukkit events.


Donate

Plugins take a lot of time to maintain, and Pepsi Max helps me think. So if your server enjoys the effects of this plugin please consider sending some Pepsi Max my way!

Donate

If you're penniless or like the plugin but not that much I'm also partial to TF2 items. Send any you don't want my way! STEAM id: coldandtired

If you don't know what TF2 is, then start playing! It's free and fun!