diff options
author | snowleo <schneeleo@gmail.com> | 2011-11-22 03:02:08 +0100 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-11-22 03:02:08 +0100 |
commit | 63991cb38d02edf6dbaf21cd16b8af8083afb4be (patch) | |
tree | 9e6a512429b24d28bc0b6c3a37117f3e2b8137bb /EssentialsProtect | |
parent | 94b70e1ee9d564e33b9009ecb875cb0dc71d7428 (diff) | |
download | Essentials-63991cb38d02edf6dbaf21cd16b8af8083afb4be.tar Essentials-63991cb38d02edf6dbaf21cd16b8af8083afb4be.tar.gz Essentials-63991cb38d02edf6dbaf21cd16b8af8083afb4be.tar.lz Essentials-63991cb38d02edf6dbaf21cd16b8af8083afb4be.tar.xz Essentials-63991cb38d02edf6dbaf21cd16b8af8083afb4be.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')
-rw-r--r-- | EssentialsProtect/nbproject/project.properties | 6 | ||||
-rw-r--r-- | EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java | 45 |
2 files changed, 5 insertions, 46 deletions
diff --git a/EssentialsProtect/nbproject/project.properties b/EssentialsProtect/nbproject/project.properties index d0bbb3ce2..5e8639402 100644 --- a/EssentialsProtect/nbproject/project.properties +++ b/EssentialsProtect/nbproject/project.properties @@ -63,16 +63,16 @@ dist.jar=${dist.dir}/original-EssentialsProtect.jar dist.javadoc.dir=${dist.dir}/javadoc endorsed.classpath= excludes= +file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar=../lib/bukkit-1.0.0-R1-SNAPSHOT.jar file.reference.c3p0-0.9.1.2.jar=..\\lib\\c3p0-0.9.1.2.jar -file.reference.craftbukkit-1.0.0-SNAPSHOT.jar=..\\lib\\craftbukkit-1.0.0-SNAPSHOT.jar includes=** jar.archive.disabled=${jnlp.enabled} jar.compress=true jar.index=${jnlp.enabled} javac.classpath=\ ${reference.Essentials.jar}:\ - ${file.reference.craftbukkit-1.0.0-SNAPSHOT.jar}:\ - ${file.reference.c3p0-0.9.1.2.jar} + ${file.reference.c3p0-0.9.1.2.jar}:\ + ${file.reference.bukkit-1.0.0-R1-SNAPSHOT.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false 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; } |