Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-20 05:20:07 +01:00
Implemented Sneak event
Dieser Commit ist enthalten in:
Ursprung
1a983aceb3
Commit
6ad4ca2a42
@ -24,6 +24,7 @@ import org.bukkit.event.player.PlayerItemEvent;
|
|||||||
import org.bukkit.event.player.PlayerItemHeldEvent;
|
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||||
import org.bukkit.event.player.PlayerKickEvent;
|
import org.bukkit.event.player.PlayerKickEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
|
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -652,6 +653,17 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(Packet19EntityAction packet19entityaction) {
|
public void a(Packet19EntityAction packet19entityaction) {
|
||||||
|
// CraftBukkit: Toggle Sneak
|
||||||
|
if (packet19entityaction.b == 1 || packet19entityaction.b == 2) {
|
||||||
|
Player player = getPlayer();
|
||||||
|
PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(Type.PLAYER_TOGGLE_SNEAK, player);
|
||||||
|
server.getPluginManager().callEvent(event);
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// CraftBukkit: Set Sneaking
|
||||||
|
|
||||||
if (packet19entityaction.b == 1) {
|
if (packet19entityaction.b == 1) {
|
||||||
this.e.b(true);
|
this.e.b(true);
|
||||||
} else if (packet19entityaction.b == 2) {
|
} else if (packet19entityaction.b == 2) {
|
||||||
|
@ -150,4 +150,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||||||
entity.a.a(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
entity.a.a(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSneaking(boolean sneak) {
|
||||||
|
entity.b(sneak);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSneaking() {
|
||||||
|
return entity.J();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren