mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fix /geyser offhand command on Bukkit (#611)
If CommandSender is not an instance of GeyserSession, we iterate through all GeyserSessions in order to find the sender.
This commit is contained in:
parent
93d15c16f5
commit
61e0e796da
1 changed files with 10 additions and 0 deletions
|
@ -56,6 +56,16 @@ public class OffhandCommand extends GeyserCommand {
|
|||
ClientPlayerActionPacket releaseItemPacket = new ClientPlayerActionPacket(PlayerAction.SWAP_HANDS, new Position(0,0,0),
|
||||
BlockFace.DOWN);
|
||||
session.sendDownstreamPacket(releaseItemPacket);
|
||||
return;
|
||||
}
|
||||
// Needed for Bukkit - sender is not an instance of GeyserSession
|
||||
for (GeyserSession session : connector.getPlayers().values()) {
|
||||
if (sender.getName().equals(session.getPlayerEntity().getUsername())) {
|
||||
ClientPlayerActionPacket releaseItemPacket = new ClientPlayerActionPacket(PlayerAction.SWAP_HANDS, new Position(0,0,0),
|
||||
BlockFace.DOWN);
|
||||
session.sendDownstreamPacket(releaseItemPacket);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue