summaryrefslogtreecommitdiffstats
path: root/EssentialsProtect/src
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-01-26 21:21:13 +0000
committerKHobbits <rob@khobbits.co.uk>2012-01-26 21:21:13 +0000
commit9b58b2b9c0d29819db903801a51dac91a46627f1 (patch)
tree33ea66fcd7de8e35960f553a9a284df6188bd31b /EssentialsProtect/src
parentb8944d0b254130aeb50d582b1ab733c1a6d19160 (diff)
downloadEssentials-9b58b2b9c0d29819db903801a51dac91a46627f1.tar
Essentials-9b58b2b9c0d29819db903801a51dac91a46627f1.tar.gz
Essentials-9b58b2b9c0d29819db903801a51dac91a46627f1.tar.lz
Essentials-9b58b2b9c0d29819db903801a51dac91a46627f1.tar.xz
Essentials-9b58b2b9c0d29819db903801a51dac91a46627f1.zip
Revert emergency listener to old style
Stops peoples world world burning down if they throw in 2.8, on a 1.0 server.
Diffstat (limited to 'EssentialsProtect/src')
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyBlockListener.java36
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyEntityListener.java22
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyPlayerListener.java16
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java20
4 files changed, 92 insertions, 2 deletions
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyBlockListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyBlockListener.java
new file mode 100644
index 000000000..7ff17b381
--- /dev/null
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyBlockListener.java
@@ -0,0 +1,36 @@
+package com.earth2me.essentials.protect;
+
+import org.bukkit.event.block.BlockBreakEvent;
+import org.bukkit.event.block.BlockBurnEvent;
+import org.bukkit.event.block.BlockFromToEvent;
+import org.bukkit.event.block.BlockIgniteEvent;
+import org.bukkit.event.block.BlockListener;
+
+@Deprecated
+public class EmergencyBlockListener extends BlockListener
+{
+
+ @Override
+ public void onBlockBurn(final BlockBurnEvent event)
+ {
+ event.setCancelled(true);
+ }
+
+ @Override
+ public void onBlockIgnite(final BlockIgniteEvent event)
+ {
+ event.setCancelled(true);
+ }
+
+ @Override
+ public void onBlockFromTo(final BlockFromToEvent event)
+ {
+ event.setCancelled(true);
+ }
+
+ @Override
+ public void onBlockBreak(final BlockBreakEvent event)
+ {
+ event.setCancelled(true);
+ }
+}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyEntityListener.java
new file mode 100644
index 000000000..08b04aae1
--- /dev/null
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyEntityListener.java
@@ -0,0 +1,22 @@
+package com.earth2me.essentials.protect;
+
+import org.bukkit.event.entity.EntityDamageEvent;
+import org.bukkit.event.entity.EntityExplodeEvent;
+import org.bukkit.event.entity.EntityListener;
+
+@Deprecated
+public class EmergencyEntityListener extends EntityListener
+{
+
+ @Override
+ public void onEntityExplode(final EntityExplodeEvent event)
+ {
+ event.setCancelled(true);
+ }
+
+ @Override
+ public void onEntityDamage(final EntityDamageEvent event)
+ {
+ event.setCancelled(true);
+ }
+}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyPlayerListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyPlayerListener.java
new file mode 100644
index 000000000..169e9af79
--- /dev/null
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyPlayerListener.java
@@ -0,0 +1,16 @@
+package com.earth2me.essentials.protect;
+
+import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.event.player.PlayerListener;
+
+@Deprecated
+public class EmergencyPlayerListener extends PlayerListener
+{
+
+ @Override
+ public void onPlayerJoin(PlayerJoinEvent event)
+ {
+ event.getPlayer().sendMessage("Essentials Protect is in emergency mode. Check your log for errors.");
+ }
+
+}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
index 983ba0f80..af80647a6 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java
@@ -9,6 +9,8 @@ import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import org.bukkit.entity.Player;
+import org.bukkit.event.Event.Priority;
+import org.bukkit.event.Event.Type;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
@@ -63,8 +65,22 @@ public class EssentialsProtect extends JavaPlugin implements IProtect
private void enableEmergencyMode(final PluginManager pm)
{
- final EmergencyListener emListener = new EmergencyListener();
- pm.registerEvents(emListener, this);
+ //final EmergencyListener emListener = new EmergencyListener();
+ //pm.registerEvents(emListener, this);
+
+ //TODO: Remove deprecated listners in a few weeks.
+
+ final EmergencyBlockListener emBlockListener = new EmergencyBlockListener();
+ final EmergencyEntityListener emEntityListener = new EmergencyEntityListener();
+ final EmergencyPlayerListener emPlayerListener = new EmergencyPlayerListener();
+ pm.registerEvent(Type.PLAYER_JOIN, emPlayerListener, Priority.Low, this);
+ pm.registerEvent(Type.BLOCK_BURN, emBlockListener, Priority.Low, this);
+ pm.registerEvent(Type.BLOCK_IGNITE, emBlockListener, Priority.Low, this);
+ pm.registerEvent(Type.BLOCK_FROMTO, emBlockListener, Priority.Low, this);
+ pm.registerEvent(Type.BLOCK_BREAK, emBlockListener, Priority.Low, this);
+ pm.registerEvent(Type.ENTITY_DAMAGE, emEntityListener, Priority.Low, this);
+ pm.registerEvent(Type.ENTITY_EXPLODE, emEntityListener, Priority.Low, this);
+
for (Player player : getServer().getOnlinePlayers())
{
player.sendMessage("Essentials Protect is in emergency mode. Check your log for errors.");