Encode enums as integers

This commit is contained in:
games647
2018-03-16 15:15:54 +01:00
parent c1cb28c996
commit ac5820bb75

View File

@ -36,7 +36,7 @@ public class LoginActionMessage implements ChannelMessage {
@Override
public void readFrom(ByteArrayDataInput input) {
this.type = Type.valueOf(input.readUTF());
this.type = Type.values()[input.readInt()];
this.playerName = input.readUTF();
@ -48,7 +48,7 @@ public class LoginActionMessage implements ChannelMessage {
@Override
public void writeTo(ByteArrayDataOutput output) {
output.writeUTF(type.name());
output.writeInt(type.ordinal());
//Data is sent through a random player. We have to tell the Bukkit version of this plugin the target
output.writeUTF(playerName);