Commands not showing at all
kvetinac97 opened this issue · comments
When I join the server and open chat, I cannot see any commands. This is because AvailableCommandsPacket is not sent properly
I tried to copy and modify that packet, and this code worked:
@Override
public void encode() {
this.reset();
//Aliases - not working (even in Steadfast)
this.putVarInt(0); //Not important
this.putVarInt(0); //Not important
this.putVarInt(0); //Not important
//Put commands data
this.putVarInt(commands.size());
commands.forEach((name, versions) -> {
if (name.equals("help")) return;
this.putString(name);
this.putString(versions.versions.get(0).description);
this.putByte((byte) 0);
this.putByte((byte) 0);
this.putLInt(-1); //Aliases not working, so we can just put -1 there
this.putVarInt(versions.versions.get(0).overloads.size());
for (CommandOverload overload : versions.versions.get(0).overloads.values()) {
this.putVarInt(overload.input.parameters.length);
for (CommandParameter parameter : overload.input.parameters) {
this.putString(parameter.name);
this.putLInt(0); //Unknown
this.putBoolean(parameter.optional);
}
}
});
}
However, only for one command. This means, that after parameter.optional, there must be more data like parameter type. Also, when sending packet like this, I get [unknown] type with the CommandParameter.
As always, I hope I at least gave you the clue.