Extra Events
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!
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!
Updated the description. Please read.
@TiffanyValenti I believe so. I haven't messed around with players spawning mobs much but you would have to look at the Bukkit docs and see if there is a way to determine which player spawned the mob, and then block the event.
So for the PlayerTargetedEvent it would be possible for me to say spawn a creeper and have it not target the person who spawned it?
@nateku2 Do you mean the spawn timer (how many mobs per tick)? You can adjust that in the bukkit properties file (or the server one, I forget).
Just what I was looking for, works perfectly ;3
can I make the minecraft timer slower with this plugin?
Make sure to delete any old version before updating to 1.7.2 b1.
@Relicum This would still be thread safe though as long as the timers also ran on the main thread.
Undesirable, sure, but safe :)
@coldandtired
he is incorrect, running something on the Main Thread does not make it thread safe, unless their is still the potential of blocking the thread or overloading it with time tasks. Imagine starting a Timer every time this event ran LivingEntityDamageEvent . You'd soon have trhe server grinding to a halt. So be warned.
@flybelette There's no need. Every world on the server has the same time (or at least it worked this way when I wrote it).
Hi ! How can i get the World with The MidnightEvent ? Thanks :)
Thanks for the decent reply. I'm using this for one of my private plugins! :D
@Skyost I put most of my plugins as All Rights Reserved because I don't have the time or energy at the moment to research the multiple open licences you can choose from when you submit a plugin. Generally it's open source though.
@Quackster_ Sorry, I didn't get a notification about your comment for some reason :(
Yes, it's thread safe. The timer runs on the main thread so you can use all the Bukkit stuff there.
Just : Your lib is under license "All rights reserved" but you leave your repo free...
Hello are these events thread safe? Like is possible to use the Bukkit API once SecondTickEvent is called?
@coldandtired
Name is enough it is for portal plugin and it needs just name. ;) but THX
<<reply 1678883="">>
Sorry, I was just getting to this this morning :)
You don't need to cast to Area as it returns an Area now. I thought this was easier as you can still use the WorldEdit API if you need the owner, etc. properties but if you just want the name and limits Area is easy enough.
@coldandtired
Nevermind got it ;)
@coldandtired
So what is the solution ? :S