Move logic for determining user type into player class, change Packet.UserType to allow user type as an argument

This commit is contained in:
UnknownShadow200 2019-09-08 13:30:03 +10:00
parent cbbca857d4
commit 1beb8de57b
3 changed files with 7 additions and 7 deletions

View File

@ -90,7 +90,8 @@ namespace MCGalaxy.Commands.Moderation {
who.SetPrefix();
Entities.DespawnEntities(who, false);
who.Send(Packet.UserType(who));
who.Send(Packet.UserType(who, who.UserType()));
who.SendCurrentBlockPermissions();
Entities.SpawnEntities(who, false);
CheckBlockBindings(who);

View File

@ -40,7 +40,7 @@ namespace MCGalaxy.Network {
NetUtils.Write(motd, buffer, 66, p.hasCP437);
}
buffer[130] = p.group.Blocks[Block.Bedrock] ? (byte)100 : (byte)0;
buffer[130] = p.UserType();
return buffer;
}
@ -108,11 +108,8 @@ namespace MCGalaxy.Network {
return buffer;
}
public static byte[] UserType(Player p) {
byte[] buffer = new byte[2];
buffer[0] = Opcode.SetPermission;
buffer[1] = p.group.Blocks[Block.Bedrock] ? (byte)100 : (byte)0;
return buffer;
public static byte[] UserType(Player p, byte type) {
return new byte[] { Opcode.SetPermission, type };
}
#endregion

View File

@ -311,6 +311,8 @@ namespace MCGalaxy {
return true;
}
internal byte UserType() { return group.Blocks[Block.Bedrock] ? (byte)100 : (byte)0; }
#endregion
public void BlockUntilLoad(int sleep) {