Added event for when a world is saved (EyvindRM)

This commit is contained in:
Dinnerbone 2011-02-09 12:53:33 +00:00
parent 6ba990ecfd
commit 2db95ba0b9
3 changed files with 19 additions and 0 deletions

View File

@ -445,6 +445,12 @@ public abstract class Event {
* @todo: add javadoc see comment * @todo: add javadoc see comment
*/ */
ITEM_SPAWN (Category.WORLD), ITEM_SPAWN (Category.WORLD),
/**
* Called when a world is saved
*
*/
WORLD_SAVED (Category.WORLD),
/** /**
* Called when a World is loaded * Called when a World is loaded

View File

@ -23,6 +23,14 @@ public class WorldListener implements Listener {
public void onChunkUnloaded(ChunkUnloadEvent event) { public void onChunkUnloaded(ChunkUnloadEvent event) {
} }
/**
* Called when a world is saved
*
* param event Relevant event details
*/
public void onWorldSaved(WorldEvent event) {
}
/** /**
* Called when a World is loaded * Called when a World is loaded
* *

View File

@ -291,6 +291,11 @@ public final class JavaPluginLoader implements PluginLoader {
((WorldListener)listener).onChunkUnloaded( (ChunkUnloadEvent)event ); ((WorldListener)listener).onChunkUnloaded( (ChunkUnloadEvent)event );
} }
}; };
case WORLD_SAVED:
return new EventExecutor() { public void execute( Listener listener, Event event ) {
((WorldListener)listener).onWorldSaved( (WorldEvent)event );
}
};
case WORLD_LOADED: case WORLD_LOADED:
return new EventExecutor() { public void execute( Listener listener, Event event ) { return new EventExecutor() { public void execute( Listener listener, Event event ) {
((WorldListener)listener).onWorldLoaded( (WorldEvent)event ); ((WorldListener)listener).onWorldLoaded( (WorldEvent)event );