summaryrefslogtreecommitdiffstats
path: root/EssentialsProtect/src/com/earth2me/essentials
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-11-22 03:02:08 +0100
committersnowleo <schneeleo@gmail.com>2011-11-22 03:02:08 +0100
commit390ef73897856f4217049f39d753c4d2c7e58978 (patch)
tree4bdb21eef1f02bb636eca629413d37c2e8d73b09 /EssentialsProtect/src/com/earth2me/essentials
parent7c23f67545bc7efd0ea1ae74ad3f9a89eb157725 (diff)
downloadEssentials-390ef73897856f4217049f39d753c4d2c7e58978.tar
Essentials-390ef73897856f4217049f39d753c4d2c7e58978.tar.gz
Essentials-390ef73897856f4217049f39d753c4d2c7e58978.tar.lz
Essentials-390ef73897856f4217049f39d753c4d2c7e58978.tar.xz
Essentials-390ef73897856f4217049f39d753c4d2c7e58978.zip
Moved all dependency on craftbukkit to one package in the main jar. The rest is now clean bukkit code. Also cleaned PlayerExtension class.
Diffstat (limited to 'EssentialsProtect/src/com/earth2me/essentials')
-rw-r--r--EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java45
1 files changed, 2 insertions, 43 deletions
diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
index b0a6b8521..2c4d1dbab 100644
--- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
+++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
@@ -2,19 +2,11 @@ package com.earth2me.essentials.protect;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
-import java.util.HashSet;
+import com.earth2me.essentials.craftbukkit.FakeExplosion;
import java.util.Locale;
-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.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
-import org.bukkit.craftbukkit.CraftServer;
-import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.entity.*;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
@@ -204,40 +196,7 @@ public class EssentialsProtectEntityListener extends EntityListener
|| prot.getSettingBool(ProtectConfig.prevent_creeper_blockdmg)
|| (maxHeight >= 0 && event.getLocation().getBlockY() > maxHeight)))
{
- try
- {
- final Set<ChunkPosition> set = new HashSet<ChunkPosition>(event.blockList().size());
- final Player[] players = ess.getServer().getOnlinePlayers();
- final Set<ChunkPosition> blocksUnderPlayers = new HashSet<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()));
- }
- }
- ChunkPosition cp;
- for (Block block : event.blockList())
- {
- cp = new ChunkPosition(block.getX(), block.getY(), block.getZ());
- if (!blocksUnderPlayers.contains(cp))
- {
- set.add(cp);
- }
- }
-
- ((CraftServer)ess.getServer()).getHandle().sendPacketNearby(loc.getX(), loc.getY(), loc.getZ(), 64.0D, ((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);
- }
+ FakeExplosion.createExplosion(event, ess.getServer(), ess.getServer().getOnlinePlayers());
event.setCancelled(true);
return;
}