summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/src/com/earth2me/essentials/TNTExplodeListener.java7
-rw-r--r--Essentials/src/com/earth2me/essentials/craftbukkit/FakeExplosion.java51
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java7
3 files changed, 8 insertions, 57 deletions
diff --git a/Essentials/src/com/earth2me/essentials/TNTExplodeListener.java b/Essentials/src/com/earth2me/essentials/TNTExplodeListener.java
index 54e49ad5f..4187f835d 100644
--- a/Essentials/src/com/earth2me/essentials/TNTExplodeListener.java
+++ b/Essentials/src/com/earth2me/essentials/TNTExplodeListener.java
@@ -1,6 +1,5 @@
package com.earth2me.essentials;
-import com.earth2me.essentials.craftbukkit.FakeExplosion;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -46,8 +45,12 @@ public class TNTExplodeListener implements Listener, Runnable
{
return;
}
- FakeExplosion.createExplosion(event, ess.getServer(), ess.getServer().getOnlinePlayers());
+ if (event.blockList().size() < 1)
+ {
+ return;
+ }
event.setCancelled(true);
+ event.getLocation().getWorld().createExplosion(event.getLocation(), 0F);
}
@Override
diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/FakeExplosion.java b/Essentials/src/com/earth2me/essentials/craftbukkit/FakeExplosion.java
deleted file mode 100644
index 934d94fa2..000000000
--- a/Essentials/src/com/earth2me/essentials/craftbukkit/FakeExplosion.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.earth2me.essentials.craftbukkit;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import net.minecraft.server.ChunkPosition;
-import net.minecraft.server.Packet60Explosion;
-import org.bukkit.Location;
-import org.bukkit.Server;
-import org.bukkit.block.Block;
-import org.bukkit.craftbukkit.CraftServer;
-import org.bukkit.craftbukkit.CraftWorld;
-import org.bukkit.entity.Player;
-import org.bukkit.event.entity.EntityExplodeEvent;
-
-
-public class FakeExplosion
-{
- public static void createExplosion(final EntityExplodeEvent event, final Server server, final Player[] players)
- {
- try
- {
- final Set<ChunkPosition> set = new HashSet<ChunkPosition>(event.blockList().size());
- final List<ChunkPosition> blocksUnderPlayers = new ArrayList<ChunkPosition>(players.length);
- final Location loc = event.getLocation();
- for (Player player : players)
- {
- if (player.getWorld().equals(loc.getWorld()))
- {
- blocksUnderPlayers.add(new ChunkPosition(player.getLocation().getBlockX(), player.getLocation().getBlockY() - 1, player.getLocation().getBlockZ()));
- }
- }
- for (Block block : event.blockList())
- {
- final ChunkPosition cp = new ChunkPosition(block.getX(), block.getY(), block.getZ());
- if (!blocksUnderPlayers.contains(cp))
- {
- set.add(cp);
- }
- }
- ((CraftServer)server).getHandle().sendPacketNearby(loc.getX(), loc.getY(), loc.getZ(), 64.0, ((CraftWorld)loc.getWorld()).getHandle().worldProvider.dimension, new Packet60Explosion(loc.getX(), loc.getY(), loc.getZ(), 3.0F, set));
- }
- catch (Throwable ex)
- {
- Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex);
- }
- }
-}
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
index d19f48abb..fe3cadbbe 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
@@ -2,7 +2,6 @@ package com.earth2me.essentials.protect;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.craftbukkit.FakeExplosion;
import java.util.Locale;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -204,11 +203,11 @@ public class EssentialsProtectEntityListener implements Listener
if (event.getEntity() instanceof EnderDragon
&& prot.getSettingBool(ProtectConfig.prevent_enderdragon_blockdmg))
{
+ event.setCancelled(true);
if (prot.getSettingBool(ProtectConfig.enderdragon_fakeexplosions))
{
- FakeExplosion.createExplosion(event, ess.getServer(), ess.getServer().getOnlinePlayers());
+ event.getLocation().getWorld().createExplosion(event.getLocation(), 0F);
}
- event.setCancelled(true);
return;
}
else if (event.getEntity() instanceof Creeper
@@ -217,8 +216,8 @@ public class EssentialsProtectEntityListener implements Listener
|| (maxHeight >= 0 && event.getLocation().getBlockY() > maxHeight)))
{
//Nicccccccccce plaaacccccccccce..
- FakeExplosion.createExplosion(event, ess.getServer(), ess.getServer().getOnlinePlayers());
event.setCancelled(true);
+ event.getLocation().getWorld().createExplosion(event.getLocation(), 0F);
return;
}
else if (event.getEntity() instanceof TNTPrimed