diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2013-03-13 17:33:27 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2013-03-15 13:28:59 -0500 |
commit | 83d29e461c85733f0113b6eb19db6e3b42da2949 (patch) | |
tree | b3063a1c28f478ab368d5ba3413a842def68c28f /src/main/java/net/minecraft/server/BlockPressurePlateBinary.java | |
parent | ba6e4c38cfa98ad291974195cc46d70a4f138ac1 (diff) | |
download | craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar.gz craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar.lz craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar.xz craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.zip |
Update CraftBukkit to Minecraft 1.5
Diffstat (limited to 'src/main/java/net/minecraft/server/BlockPressurePlateBinary.java')
-rw-r--r-- | src/main/java/net/minecraft/server/BlockPressurePlateBinary.java | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java b/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java new file mode 100644 index 00000000..ba7b6605 --- /dev/null +++ b/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java @@ -0,0 +1,71 @@ +package net.minecraft.server; + +import java.util.Iterator; +import java.util.List; + +import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit + +public class BlockPressurePlateBinary extends BlockPressurePlateAbstract { + + private EnumMobType a; + + protected BlockPressurePlateBinary(int i, String s, Material material, EnumMobType enummobtype) { + super(i, s, material); + this.a = enummobtype; + } + + protected int d(int i) { + return i > 0 ? 1 : 0; + } + + protected int c(int i) { + return i == 1 ? 15 : 0; + } + + protected int e(World world, int i, int j, int k) { + List list = null; + + if (this.a == EnumMobType.EVERYTHING) { + list = world.getEntities((Entity) null, this.a(i, j, k)); + } + + if (this.a == EnumMobType.MOBS) { + list = world.a(EntityLiving.class, this.a(i, j, k)); + } + + if (this.a == EnumMobType.PLAYERS) { + list = world.a(EntityHuman.class, this.a(i, j, k)); + } + + if (!list.isEmpty()) { + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) { + Entity entity = (Entity) iterator.next(); + + // CraftBukkit start + org.bukkit.World bworld = world.getWorld(); + org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager(); + org.bukkit.event.Cancellable cancellable; + + if (entity instanceof EntityHuman) { + cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null); + } else { + cancellable = new EntityInteractEvent(entity.getBukkitEntity(), bworld.getBlockAt(i, j, k)); + manager.callEvent((EntityInteractEvent) cancellable); + } + + if (cancellable.isCancelled()) { + return 0; + } + // CraftBukkit end + + if (!entity.at()) { + return 15; + } + } + } + + return 0; + } +} |