From 11740c49bc93f84dc940c6e1104cf49c71ff9185 Mon Sep 17 00:00:00 2001 From: ementalo Date: Tue, 3 May 2011 21:37:36 +0000 Subject: [trunk/protect] Adding warning for changes coming soon to protect in regards to worldguard git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1332 e251c2fe-e539-e718-e476-b85c1f46cddb --- .../essentials/protect/EssentialsProtect.java | 15 +++++++++- .../protect/EssentialsProtectPlayerListener.java | 3 -- .../protect/EssentialsProtectServerListener.java | 34 ++++++++++++++++++++++ 3 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectServerListener.java (limited to 'EssentialsProtect') diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java index 6458558e0..b4ee458f9 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java @@ -21,6 +21,7 @@ public class EssentialsProtect extends JavaPlugin private EssentialsProtectPlayerListener playerListener = null; private EssentialsProtectEntityListener entityListener = null; private EssentialsProtectWeatherListener weatherListener = null; + private EssentialsProtectServerListener serverListener = null; public static final String AUTHORS = Essentials.AUTHORS; private static final Logger logger = Logger.getLogger("Minecraft"); public static HashMap genSettings = null; @@ -49,19 +50,31 @@ public class EssentialsProtect extends JavaPlugin blockListener = new EssentialsProtectBlockListener(this); entityListener = new EssentialsProtectEntityListener(this); weatherListener = new EssentialsProtectWeatherListener(this); + serverListener = new EssentialsProtectServerListener(this); + pm.registerEvent(Type.PLAYER_INTERACT, playerListener, Priority.Low, this); + + //blocklistener pm.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Highest, this); pm.registerEvent(Type.BLOCK_FROMTO, blockListener, Priority.Highest, this); pm.registerEvent(Type.BLOCK_IGNITE, blockListener, Priority.Highest, this); pm.registerEvent(Type.BLOCK_BURN, blockListener, Priority.Highest, this); + pm.registerEvent(Type.BLOCK_BREAK, blockListener, Priority.Highest, this); + + //entitylistener pm.registerEvent(Type.ENTITY_EXPLODE, entityListener, Priority.Highest, this); pm.registerEvent(Type.ENTITY_DAMAGE, entityListener, Priority.Highest, this); pm.registerEvent(Type.ENTITY_TARGET, entityListener, Priority.Highest, this); - pm.registerEvent(Type.BLOCK_BREAK, blockListener, Priority.Highest, this); pm.registerEvent(Type.CREATURE_SPAWN, entityListener, Priority.Highest, this); + + //weatherlistener pm.registerEvent(Type.WEATHER_CHANGE, weatherListener, Priority.Highest, this); pm.registerEvent(Type.THUNDER_CHANGE, weatherListener, Priority.Highest, this); pm.registerEvent(Type.LIGHTNING_STRIKE, weatherListener, Priority.Highest, this); + + //serverlistener + pm.registerEvent(Type.PLUGIN_ENABLE, serverListener, Priority.Highest, this); + loadSettings(); if (!this.getDescription().getVersion().equals(Essentials.getStatic().getDescription().getVersion())) { diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java index b3f6b09a0..8b3a32aa5 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java @@ -12,9 +12,6 @@ import org.bukkit.inventory.ItemStack; public class EssentialsProtectPlayerListener extends PlayerListener { private EssentialsProtect parent; - private int signBlockX; - private int signBlockY; - private int signBlockZ; private EssentialsProtectData spData = null; public EssentialsProtectPlayerListener(EssentialsProtect parent) diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectServerListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectServerListener.java new file mode 100644 index 000000000..5642ef0dd --- /dev/null +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectServerListener.java @@ -0,0 +1,34 @@ +package com.earth2me.essentials.protect; + +import java.util.logging.Level; +import java.util.logging.Logger; +import org.bukkit.event.server.PluginEnableEvent; +import org.bukkit.event.server.ServerListener; + + +public class EssentialsProtectServerListener extends ServerListener +{ + private EssentialsProtect parent; + Logger log = Logger.getLogger("minecraft"); + + public EssentialsProtectServerListener(EssentialsProtect parent) + { + this.parent = parent; + } + + @Override + public void onPluginEnable(PluginEnableEvent event) + { + if ("WorldGuard".equals(event.getPlugin().getDescription().getName())) + { + String[] features = new String[] {"disable water flow", "disable lava flow", "disable water bucket flow", "disable all fire spread", "disable tnt explosion", "disable creeper explosion", "disable all damage types"}; + log.log(Level.WARNING, "[EssentialsProtect] WorldGuard was detected, in the near future the following features of Protect will be disabled in favor of WorldGuard's versions"); + + for (String s : features) + { + log.log(Level.WARNING, s); + } + + } + } +} -- cgit v1.2.3