mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-25 18:47:44 +01:00
Made SNOW_FORM be registered programatically so it can be used on CraftBukkit versions lacking that.
This commit is contained in:
parent
b62ada53c3
commit
87a43e8e8f
@ -37,6 +37,9 @@
|
|||||||
import com.sk89q.worldguard.LocalPlayer;
|
import com.sk89q.worldguard.LocalPlayer;
|
||||||
import com.sk89q.worldguard.blacklist.events.*;
|
import com.sk89q.worldguard.blacklist.events.*;
|
||||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||||
|
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import static com.sk89q.worldguard.bukkit.BukkitUtil.*;
|
import static com.sk89q.worldguard.bukkit.BukkitUtil.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,6 +48,10 @@
|
|||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class WorldGuardBlockListener extends BlockListener {
|
public class WorldGuardBlockListener extends BlockListener {
|
||||||
|
/**
|
||||||
|
* Logger for messages.
|
||||||
|
*/
|
||||||
|
private static final Logger logger = Logger.getLogger("Minecraft.WorldGuard");
|
||||||
|
|
||||||
private WorldGuardPlugin plugin;
|
private WorldGuardPlugin plugin;
|
||||||
|
|
||||||
@ -72,11 +79,21 @@ public void registerEvents() {
|
|||||||
pm.registerEvent(Event.Type.BLOCK_BURN, this, Priority.High, plugin);
|
pm.registerEvent(Event.Type.BLOCK_BURN, this, Priority.High, plugin);
|
||||||
pm.registerEvent(Event.Type.SIGN_CHANGE, this, Priority.High, plugin);
|
pm.registerEvent(Event.Type.SIGN_CHANGE, this, Priority.High, plugin);
|
||||||
pm.registerEvent(Event.Type.REDSTONE_CHANGE, this, Priority.High, plugin);
|
pm.registerEvent(Event.Type.REDSTONE_CHANGE, this, Priority.High, plugin);
|
||||||
pm.registerEvent(Event.Type.SNOW_FORM, this, Priority.High, plugin);
|
registerEventSafe("SNOW_FORM", Priority.High);
|
||||||
pm.registerEvent(Event.Type.LEAVES_DECAY, this, Priority.High, plugin);
|
pm.registerEvent(Event.Type.LEAVES_DECAY, this, Priority.High, plugin);
|
||||||
pm.registerEvent(Event.Type.BLOCK_FORM, this, Priority.High, plugin);
|
pm.registerEvent(Event.Type.BLOCK_FORM, this, Priority.High, plugin);
|
||||||
pm.registerEvent(Event.Type.BLOCK_SPREAD, this, Priority.High, plugin);
|
pm.registerEvent(Event.Type.BLOCK_SPREAD, this, Priority.High, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void registerEventSafe(String typeName, Priority priority) {
|
||||||
|
try {
|
||||||
|
Event.Type type = Event.Type.valueOf(typeName);
|
||||||
|
PluginManager pm = plugin.getServer().getPluginManager();
|
||||||
|
pm.registerEvent(type, this, priority, plugin);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
logger.info("WorldGuard: Unable to register missing event type " + typeName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the world configuration given a world.
|
* Get the world configuration given a world.
|
||||||
|
Loading…
Reference in New Issue
Block a user