Commits

Thinkofname authored f060bba1ca5
SPIGOT-2043: Ensure VehicleMoveEvent is always fired for boats
No tags

nms-patches/EntityBoat.patch

Modified
94 94 + VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
95 95 + this.world.getServer().getPluginManager().callEvent(event);
96 96 +
97 97 + if (event.isCancelled()) {
98 98 + return;
99 99 + }
100 100 + // CraftBukkit end
101 101 super.collide(entity);
102 102 }
103 103
104 -@@ -172,6 +228,10 @@
104 +@@ -151,6 +207,8 @@
105 + return this.getDirection().e();
106 + }
107 +
108 ++ private Location lastLocation; // CraftBukkit
109 ++
110 + public void m() {
111 + this.aG = this.aF;
112 + this.aF = this.t();
113 +@@ -171,7 +229,6 @@
114 + if (this.n() > 0.0F) {
105 115 this.setDamage(this.n() - 1.0F);
106 116 }
107 -
108 -+ // CraftBukkit start
109 -+ float prevYaw = this.yaw;
110 -+ float prevPitch = this.pitch;
111 -+ // CraftBukkit end
117 +-
112 118 this.lastX = this.locX;
113 119 this.lastY = this.locY;
114 120 this.lastZ = this.locZ;
115 -@@ -189,6 +249,22 @@
116 - }
121 +@@ -195,6 +252,22 @@
122 + this.motZ = 0.0D;
123 + }
117 124
118 - this.move(this.motX, this.motY, this.motZ);
119 -+ // CraftBukkit start
120 -+ // PAIL: CHECK ME
121 -+ org.bukkit.Server server = this.world.getServer();
122 -+ org.bukkit.World bworld = this.world.getWorld();
125 ++ // CraftBukkit start
126 ++ org.bukkit.Server server = this.world.getServer();
127 ++ org.bukkit.World bworld = this.world.getWorld();
123 128 +
124 -+ Location from = new Location(bworld, this.lastX, this.lastY, this.lastZ, prevYaw, prevPitch);
125 -+ Location to = new Location(bworld, this.locX, this.locY, this.locZ, this.yaw, this.pitch);
126 -+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
129 ++ Location to = new Location(bworld, this.locX, this.locY, this.locZ, this.yaw, this.pitch);
130 ++ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
127 131 +
128 -+ server.getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleUpdateEvent(vehicle));
132 ++ server.getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleUpdateEvent(vehicle));
129 133 +
130 -+ if (!from.equals(to)) {
131 -+ VehicleMoveEvent event = new VehicleMoveEvent(vehicle, from, to);
132 -+ server.getPluginManager().callEvent(event);
133 -+ }
134 -+ // CraftBukkit end
135 - } else {
136 - this.motX = 0.0D;
137 - this.motY = 0.0D;
138 -@@ -591,6 +667,11 @@
134 ++ if (lastLocation != null && !lastLocation.equals(to)) {
135 ++ VehicleMoveEvent event = new VehicleMoveEvent(vehicle, lastLocation, to);
136 ++ server.getPluginManager().callEvent(event);
137 ++ }
138 ++ lastLocation = vehicle.getLocation();
139 ++ // CraftBukkit end
140 ++
141 + for (int i = 0; i <= 1; ++i) {
142 + if (this.a(i)) {
143 + this.f[i] = (float) ((double) this.f[i] + 0.01D);
144 +@@ -591,6 +664,11 @@
139 145
140 146 this.e(this.fallDistance, 1.0F);
141 147 if (!this.world.isClientSide && !this.dead) {
142 148 + // CraftBukkit start
143 149 + Vehicle vehicle = (Vehicle) this.getBukkitEntity();
144 150 + VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, null);
145 151 + this.world.getServer().getPluginManager().callEvent(destroyEvent);
146 152 + if (!destroyEvent.isCancelled()) {
147 153 this.die();
148 154 if (this.world.getGameRules().getBoolean("doEntityDrops")) {
149 155 int i;
150 -@@ -604,6 +685,7 @@
156 +@@ -604,6 +682,7 @@
151 157 }
152 158 }
153 159 }
154 160 + } // CraftBukkit end
155 161 }
156 162
157 163 this.fallDistance = 0.0F;

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut