Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +01:00
Added PlayerVelocityEvent. Thanks Evenprime!
Dieser Commit ist enthalten in:
Ursprung
57e0a106fe
Commit
e2e4d7f4ca
@ -127,7 +127,28 @@ public class EntityTrackerEntry {
|
||||
}
|
||||
|
||||
if (this.tracker.velocityChanged) {
|
||||
this.b((Packet) (new Packet28EntityVelocity(this.tracker)));
|
||||
// CraftBukkit start - create PlayerVelocity event
|
||||
boolean cancelled = false;
|
||||
|
||||
if(this.tracker instanceof EntityPlayer) {
|
||||
org.bukkit.entity.Player player = (org.bukkit.entity.Player) this.tracker.getBukkitEntity();
|
||||
org.bukkit.util.Vector velocity = player.getVelocity();
|
||||
|
||||
org.bukkit.event.player.PlayerVelocityEvent event = new org.bukkit.event.player.PlayerVelocityEvent(player, velocity);
|
||||
this.tracker.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if(event.isCancelled()) {
|
||||
cancelled = true;
|
||||
}
|
||||
else if(!velocity.equals(event.getVelocity())) {
|
||||
player.setVelocity(velocity);
|
||||
}
|
||||
}
|
||||
|
||||
if(!cancelled) {
|
||||
this.b((Packet) (new Packet28EntityVelocity(this.tracker)));
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.tracker.velocityChanged = false;
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren