Commits
Dinnerbone authored 36b95edc0c9 Merge
55 55 | iteminworldmanager.a = this; |
56 56 | aw = s1; |
57 57 | c = iteminworldmanager; |
58 58 | H = 0.0F; |
59 59 | |
60 60 | server = minecraftserver.server; // Craftbukkit |
61 61 | oldLocation = new Location(server.getWorld(b.e), 0,0,-1); // Craftbukkit |
62 62 | } |
63 63 | |
64 64 | /** |
65 - | * Craftbukkit: Overloaded version of b(double,double,double,float) |
65 + | * Craftbukkit: Overloaded version of b(double,double,double,float, float) |
66 66 | * |
67 67 | * Enables monitoring of PLAYER_MOVE events. |
68 68 | */ |
69 69 | public void b(double x, double y, double z, float rotation, float pitch) { |
70 - | super.b(x,y,z,pitch,rotation); |
71 - | |
72 - | // Only send an event if player position has changed. |
73 - | if (x == oldLocation.getX() && y == oldLocation.getY() && z == oldLocation.getZ()) |
74 - | return; |
75 - | |
76 70 | Location newLocation = new Location(server.getWorld(b.e),x,y,z); |
77 - | PlayerMoveEvent pm = new PlayerMoveEvent(Event.Type.PLAYER_MOVE, server.getPlayer(this), |
78 - | oldLocation, newLocation); |
79 - | |
80 - | server.getPluginManager().callEvent(pm); |
71 + | |
72 + | // Only send an event if player position has changed. |
73 + | if (x != oldLocation.getX() || y != oldLocation.getY() || z != oldLocation.getZ()) { |
74 + | PlayerMoveEvent pm = new PlayerMoveEvent(Event.Type.PLAYER_MOVE, server.getPlayer(this), |
75 + | oldLocation, newLocation); |
76 + | |
77 + | server.getPluginManager().callEvent(pm); |
78 + | if (pm.isCancelled()) |
79 + | newLocation = pm.getFrom(); |
80 + | } |
81 81 | oldLocation = newLocation; |
82 + | super.b(newLocation.getX(),newLocation.getY(),newLocation.getZ(),rotation, pitch); |
82 83 | } |
83 84 | |
84 85 | public void k() { |
85 86 | ap.a((ICrafting)this); |
86 87 | } |
87 88 | |
88 89 | public int[] E() { |
89 90 | return bG; |
90 91 | } |
91 92 | |