Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-16 21:10:17 +01:00
Fire PlayerToggleFlightEvent. Fixes BUKKIT-1696
Dieser Commit ist enthalten in:
Ursprung
478654351a
Commit
01fe76733f
@ -42,6 +42,7 @@ import org.bukkit.event.player.PlayerToggleSprintEvent;
|
|||||||
import org.bukkit.event.player.PlayerPortalEvent;
|
import org.bukkit.event.player.PlayerPortalEvent;
|
||||||
import org.bukkit.event.inventory.*;
|
import org.bukkit.event.inventory.*;
|
||||||
import org.bukkit.event.inventory.InventoryType.SlotType;
|
import org.bukkit.event.inventory.InventoryType.SlotType;
|
||||||
|
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||||
import org.bukkit.inventory.CraftingInventory;
|
import org.bukkit.inventory.CraftingInventory;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.InventoryView;
|
import org.bukkit.inventory.InventoryView;
|
||||||
@ -1292,7 +1293,18 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(Packet202Abilities packet202abilities) {
|
public void a(Packet202Abilities packet202abilities) {
|
||||||
this.player.abilities.isFlying = packet202abilities.b && this.player.abilities.canFly;
|
// CraftBukkit start
|
||||||
|
if (this.player.abilities.canFly && this.player.abilities.isFlying != packet202abilities.b) {
|
||||||
|
PlayerToggleFlightEvent event = new PlayerToggleFlightEvent(this.server.getPlayer(this.player), packet202abilities.b);
|
||||||
|
this.server.getPluginManager().callEvent(event);
|
||||||
|
if (!event.isCancelled()) {
|
||||||
|
this.player.abilities.isFlying = packet202abilities.b; // Actually set the player's flying status
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.player.updateAbilities(); // Tell the player their ability was reverted
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren