Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-19 04:50:06 +01:00
Added PlayerToggleSprint event and sprinting related API.
Dieser Commit ist enthalten in:
Ursprung
1da2d1f5b6
Commit
e6e9cec1e9
@ -28,6 +28,7 @@ import org.bukkit.event.player.PlayerKickEvent;
|
|||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||||
|
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public class NetServerHandler extends NetHandler implements ICommandListener {
|
public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||||
@ -846,6 +847,15 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (packet19entityaction.animation == 4 || packet19entityaction.animation == 5) {
|
||||||
|
PlayerToggleSprintEvent event = new PlayerToggleSprintEvent(this.getPlayer(), packet19entityaction.animation == 4);
|
||||||
|
this.server.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
if (packet19entityaction.animation == 1) {
|
if (packet19entityaction.animation == 1) {
|
||||||
|
@ -298,6 +298,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||||||
return getHandle().isSneaking();
|
return getHandle().isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSprinting() {
|
||||||
|
return getHandle().at();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSprinting(boolean sprinting) {
|
||||||
|
getHandle().g(sprinting);
|
||||||
|
}
|
||||||
|
|
||||||
public void loadData() {
|
public void loadData() {
|
||||||
server.getHandle().playerFileData.b(getHandle());
|
server.getHandle().playerFileData.b(getHandle());
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren