Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-19 04:50:06 +01:00
Added VEHICLE_DESTROY event
Dieser Commit ist enthalten in:
Ursprung
325f4e0c22
Commit
39972530f2
@ -9,6 +9,7 @@ import org.bukkit.craftbukkit.CraftWorld;
|
|||||||
import org.bukkit.entity.Vehicle;
|
import org.bukkit.entity.Vehicle;
|
||||||
import org.bukkit.event.vehicle.VehicleCreateEvent;
|
import org.bukkit.event.vehicle.VehicleCreateEvent;
|
||||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||||
|
import org.bukkit.event.vehicle.VehicleDestroyEvent;
|
||||||
import org.bukkit.event.vehicle.VehicleEnterEvent;
|
import org.bukkit.event.vehicle.VehicleEnterEvent;
|
||||||
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
|
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
|
||||||
import org.bukkit.event.vehicle.VehicleMoveEvent;
|
import org.bukkit.event.vehicle.VehicleMoveEvent;
|
||||||
@ -116,6 +117,17 @@ public class EntityBoat extends Entity {
|
|||||||
this.a += i * 10;
|
this.a += i * 10;
|
||||||
this.W();
|
this.W();
|
||||||
if (this.a > 40) {
|
if (this.a > 40) {
|
||||||
|
|
||||||
|
// CraftBukkit start
|
||||||
|
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
|
||||||
|
((WorldServer) this.world).getServer().getPluginManager().callEvent(destroyEvent);
|
||||||
|
|
||||||
|
if (destroyEvent.isCancelled()) {
|
||||||
|
this.a = 40; // Maximize damage so this doesn't get triggered again right away
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (j = 0; j < 3; ++j) {
|
for (j = 0; j < 3; ++j) {
|
||||||
|
@ -120,6 +120,17 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||||||
this.W();
|
this.W();
|
||||||
this.a += i * 10;
|
this.a += i * 10;
|
||||||
if (this.a > 40) {
|
if (this.a > 40) {
|
||||||
|
|
||||||
|
// CraftBukkit start
|
||||||
|
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger);
|
||||||
|
((WorldServer) this.world).getServer().getPluginManager().callEvent(destroyEvent);
|
||||||
|
|
||||||
|
if (destroyEvent.isCancelled()) {
|
||||||
|
this.a = 40; // Maximize damage so this doesn't get triggered again right away
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
this.a(Item.MINECART.id, 1, 0.0F);
|
this.a(Item.MINECART.id, 1, 0.0F);
|
||||||
if (this.d == 1) {
|
if (this.d == 1) {
|
||||||
this.a(Block.CHEST.id, 1, 0.0F);
|
this.a(Block.CHEST.id, 1, 0.0F);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren