mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-21 15:41:38 +01:00
add refreshCommands()
This commit is contained in:
parent
6b151c1f7c
commit
c71ea517a2
@ -246,15 +246,8 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
|||||||
this.playerConnection.sendPacket(player.getAddPlayerToList());
|
this.playerConnection.sendPacket(player.getAddPlayerToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commands start
|
// Commands
|
||||||
{
|
refreshCommands();
|
||||||
CommandManager commandManager = MinecraftServer.getCommandManager();
|
|
||||||
DeclareCommandsPacket declareCommandsPacket = commandManager.createDeclareCommandsPacket(this);
|
|
||||||
|
|
||||||
playerConnection.sendPacket(declareCommandsPacket);
|
|
||||||
}
|
|
||||||
// Commands end
|
|
||||||
|
|
||||||
|
|
||||||
// Recipes start
|
// Recipes start
|
||||||
{
|
{
|
||||||
@ -432,6 +425,17 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
|||||||
teleport(respawnEvent.getRespawnPosition()).thenRun(this::refreshAfterTeleport);
|
teleport(respawnEvent.getRespawnPosition()).thenRun(this::refreshAfterTeleport);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refreshes the command list for this player. This checks the
|
||||||
|
* {@link net.minestom.server.command.builder.condition.CommandCondition}s
|
||||||
|
* again, and any changes will be visible to the player.
|
||||||
|
*/
|
||||||
|
public void refreshCommands() {
|
||||||
|
CommandManager commandManager = MinecraftServer.getCommandManager();
|
||||||
|
DeclareCommandsPacket declareCommandsPacket = commandManager.createDeclareCommandsPacket(this);
|
||||||
|
playerConnection.sendPacket(declareCommandsPacket);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOnGround() {
|
public boolean isOnGround() {
|
||||||
return onGround;
|
return onGround;
|
||||||
|
Loading…
Reference in New Issue
Block a user