summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/BlockPressurePlate.java
diff options
context:
space:
mode:
authorErik Broes <erikbroes@grum.nl>2011-03-23 12:22:13 +0100
committerErik Broes <erikbroes@grum.nl>2011-03-23 16:51:43 +0100
commitf33de669fb1cb86ba668d60ba2f2352fd63b4417 (patch)
tree0b713c8318cb327e564ab94951c2f1e9324cfe14 /src/main/java/net/minecraft/server/BlockPressurePlate.java
parentbb9558adec41922473de87718a53f5d3533deb7a (diff)
downloadcraftbukkit-f33de669fb1cb86ba668d60ba2f2352fd63b4417.tar
craftbukkit-f33de669fb1cb86ba668d60ba2f2352fd63b4417.tar.gz
craftbukkit-f33de669fb1cb86ba668d60ba2f2352fd63b4417.tar.lz
craftbukkit-f33de669fb1cb86ba668d60ba2f2352fd63b4417.tar.xz
craftbukkit-f33de669fb1cb86ba668d60ba2f2352fd63b4417.zip
Major overhaul implementing PLAYER_INTERACT, removing PLAYER_ITEM, BLOCK_INTERACT, BLOCK_RIGHT_CLICK
Diffstat (limited to 'src/main/java/net/minecraft/server/BlockPressurePlate.java')
-rw-r--r--src/main/java/net/minecraft/server/BlockPressurePlate.java23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/main/java/net/minecraft/server/BlockPressurePlate.java b/src/main/java/net/minecraft/server/BlockPressurePlate.java
index de3a0f69..d6abf5cf 100644
--- a/src/main/java/net/minecraft/server/BlockPressurePlate.java
+++ b/src/main/java/net/minecraft/server/BlockPressurePlate.java
@@ -7,10 +7,10 @@ import java.util.Random;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.CraftBlock;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.event.Event.Type;
-import org.bukkit.event.block.BlockInteractEvent;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockRedstoneEvent;
+import org.bukkit.event.player.PlayerInteractEvent;
// CraftBukkit end
public class BlockPressurePlate extends Block {
@@ -96,20 +96,11 @@ public class BlockPressurePlate extends Block {
}
// CraftBukkit start - Interact Pressure Plate
- CraftServer server = ((WorldServer) world).getServer();
- CraftWorld craftWorld = ((WorldServer) world).getWorld();
- CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
-
if (flag != flag1) {
if (flag1) {
for (Object object: list) {
- if (object != null && object instanceof EntityLiving) {
- EntityLiving entity = (EntityLiving) object;
- Type eventType = Type.BLOCK_INTERACT;
- org.bukkit.entity.LivingEntity who = (LivingEntity) entity.getBukkitEntity();
-
- BlockInteractEvent event = new BlockInteractEvent(eventType, block, who);
- server.getPluginManager().callEvent(event);
+ if (object != null && object instanceof EntityHuman) {
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent((EntityHuman) object, Action.PHYSICAL, i, j, k, -1, null);
if (event.isCancelled()) {
return;
@@ -118,6 +109,10 @@ public class BlockPressurePlate extends Block {
}
}
+ CraftServer server = ((WorldServer) world).getServer();
+ CraftWorld craftWorld = ((WorldServer) world).getWorld();
+ CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
+
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 1 : 0, flag1 ? 1 : 0);
server.getPluginManager().callEvent(eventRedstone);