Implemented WorldUnloadEvent and unloadWorld().

By: Rigby <rigby@onarandombox.com>
This commit is contained in:
Bukkit/Spigot
2011-06-04 06:46:21 +01:00
parent 1dca6874d8
commit 516d253953
5 changed files with 57 additions and 0 deletions

View File

@@ -479,6 +479,10 @@ public abstract class Event implements Serializable {
* Called when a World is loaded
*/
WORLD_LOAD (Category.WORLD),
/**
* Called when a World is unloaded
*/
WORLD_UNLOAD (Category.WORLD),
/**
* ENTITY EVENTS

View File

@@ -57,6 +57,13 @@ public class WorldListener implements Listener {
throw new AuthorNagException("onWorldLoad has been replaced with a new signature, (WorldLoadEvent)");
}
/**
* Called when a World is unloaded
*
* @param event Relevant event details
*/
public void onWorldUnload(WorldUnloadEvent event) { }
// TODO: Remove after RB
@Deprecated public void onWorldLoad(WorldEvent event) {}
@Deprecated public void onWorldSave(WorldEvent event) {}

View File

@@ -0,0 +1,21 @@
package org.bukkit.event.world;
import org.bukkit.World;
import org.bukkit.event.Cancellable;
public class WorldUnloadEvent extends WorldEvent implements Cancellable {
private boolean isCancelled;
public WorldUnloadEvent(World world) {
super(Type.WORLD_UNLOAD, world);
}
public boolean isCancelled() {
return this.isCancelled;
}
public void setCancelled(boolean cancel) {
this.isCancelled = cancel;
}
}