summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/BlockPressurePlate.java
diff options
context:
space:
mode:
authorAndrew Ardill <andrew.ardill@gmail.com>2011-01-23 23:23:13 +1100
committerAndrew Ardill <andrew.ardill@gmail.com>2011-01-23 23:23:13 +1100
commita809e4e6e32e194c288723ceb2e1534bbddea174 (patch)
treeceebf1bdff232e048d8d9b669e267a6598d2af13 /src/main/java/net/minecraft/server/BlockPressurePlate.java
parent9cd81ddd6d78d625bab88ee0ab0bc6080447fc96 (diff)
downloadcraftbukkit-a809e4e6e32e194c288723ceb2e1534bbddea174.tar
craftbukkit-a809e4e6e32e194c288723ceb2e1534bbddea174.tar.gz
craftbukkit-a809e4e6e32e194c288723ceb2e1534bbddea174.tar.lz
craftbukkit-a809e4e6e32e194c288723ceb2e1534bbddea174.tar.xz
craftbukkit-a809e4e6e32e194c288723ceb2e1534bbddea174.zip
removed all instances of new CraftEntity* where appropriate.
Entity.getBukkitEntity() is now used instead.
Diffstat (limited to 'src/main/java/net/minecraft/server/BlockPressurePlate.java')
-rw-r--r--src/main/java/net/minecraft/server/BlockPressurePlate.java24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/main/java/net/minecraft/server/BlockPressurePlate.java b/src/main/java/net/minecraft/server/BlockPressurePlate.java
index 211099f4..fcb48af8 100644
--- a/src/main/java/net/minecraft/server/BlockPressurePlate.java
+++ b/src/main/java/net/minecraft/server/BlockPressurePlate.java
@@ -4,9 +4,12 @@ import java.util.List;
import java.util.Random;
// CraftBukkit start
-import org.bukkit.block.BlockFace;import org.bukkit.craftbukkit.block.CraftBlock;
+import org.bukkit.block.BlockFace;import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.craftbukkit.CraftWorld;
+import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.entity.CraftPlayer;
+import org.bukkit.entity.LivingEntity;
import org.bukkit.event.Event.Type;
import org.bukkit.event.block.BlockInteractEvent;
import org.bukkit.event.block.BlockRedstoneEvent;
@@ -76,17 +79,14 @@ public class BlockPressurePlate extends Block {
} else {
// CraftBukkit start - Interact Pressure Plate
if (entity instanceof EntityLiving) {
- CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
- CraftLivingEntity craftEntity = null;
-
- if (entity instanceof EntityPlayerMP) {
- craftEntity = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entity);
- } else {
- craftEntity = new CraftLivingEntity(((WorldServer) world).getServer(), (EntityLiving) entity);
- }
- BlockInteractEvent bie = new BlockInteractEvent(Type.BLOCK_INTERACT, block, craftEntity);
-
- ((WorldServer) world).getServer().getPluginManager().callEvent(bie);
+ CraftServer server = ((WorldServer) world).getServer();
+ CraftWorld craftWorld = ((WorldServer) world).getWorld();
+ Type eventType = Type.BLOCK_INTERACT;
+ CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
+ org.bukkit.entity.LivingEntity who = (entity == null)?null:(LivingEntity) entity.getBukkitEntity();
+
+ BlockInteractEvent bie = new BlockInteractEvent(eventType, block, who);
+ server.getPluginManager().callEvent(bie);
if (bie.isCancelled()) {
return;