diff --git a/MCGalaxy/Blocks/Block.Convert.cs b/MCGalaxy/Blocks/Block.Convert.cs index 4d9f2896c..6f1bd6f71 100644 --- a/MCGalaxy/Blocks/Block.Convert.cs +++ b/MCGalaxy/Blocks/Block.Convert.cs @@ -99,7 +99,7 @@ public static partial class Block { case Crate: block = Wood; break; case StoneBrick: block = Stone; break; } - if (p.version >= Server.VERSION_0030) return block; + if (p.ProtocolVersion >= Server.VERSION_0030) return block; // protocol version 6 only supports up to Gold block switch (block) { @@ -112,13 +112,13 @@ public static partial class Block { case MossyRocks: block = Cobblestone; break; case Obsidian: block = Cobblestone; break; } - if (p.version >= Server.VERSION_0020) return block; + if (p.ProtocolVersion >= Server.VERSION_0020) return block; // protocol version 5 only supports up to Glass block if (block == Block.Gold) block = Block.Sponge; if (block >= Block.Dandelion) block = Block.Sapling; if (block >= Block.Red) block = Block.Sand; - if (p.version >= Server.VERSION_0019) return block; + if (p.ProtocolVersion >= Server.VERSION_0019) return block; // protocol version 4 only supports up to Leaves block if (block == Block.Glass) block = Block.Leaves; diff --git a/MCGalaxy/Commands/Moderation/ModActionCmd.cs b/MCGalaxy/Commands/Moderation/ModActionCmd.cs index 24625eb99..3b2dfce35 100644 --- a/MCGalaxy/Commands/Moderation/ModActionCmd.cs +++ b/MCGalaxy/Commands/Moderation/ModActionCmd.cs @@ -89,7 +89,7 @@ public static class ModActionCmd { Entities.DespawnEntities(who, false); // this packet doesn't exist before protocol version 7 - if (who.version >= Server.VERSION_0030) + if (who.ProtocolVersion >= Server.VERSION_0030) who.Send(Packet.UserType(who.UserType())); who.SendCurrentBlockPermissions(); diff --git a/MCGalaxy/Network/Packets/Packet.cs b/MCGalaxy/Network/Packets/Packet.cs index 7cfd67eda..a9e4d509c 100644 --- a/MCGalaxy/Network/Packets/Packet.cs +++ b/MCGalaxy/Network/Packets/Packet.cs @@ -29,10 +29,10 @@ public static class Packet #region Classic public static byte[] Motd(Player p, string motd) { - bool type = p.version >= Server.VERSION_0020; + bool type = p.ProtocolVersion >= Server.VERSION_0020; byte[] buffer = new byte[130 + (type ? 1 : 0)]; buffer[0] = Opcode.Handshake; - buffer[1] = p.version; + buffer[1] = p.ProtocolVersion; if (motd.Length > NetUtils.StringSize) { NetUtils.Write(motd, buffer, 2, p.hasCP437); diff --git a/MCGalaxy/Network/Utils/BufferedBlockSender.cs b/MCGalaxy/Network/Utils/BufferedBlockSender.cs index f9805f728..b85bb6849 100644 --- a/MCGalaxy/Network/Utils/BufferedBlockSender.cs +++ b/MCGalaxy/Network/Utils/BufferedBlockSender.cs @@ -111,7 +111,7 @@ public sealed class BufferedBlockSender // supports all 255 blocks (classicube enhanced client) if (normal == null) normal = MakeNormal(); return normal; - } else if (!p.hasCustomBlocks && p.version == Server.VERSION_0030) { + } else if (!p.hasCustomBlocks && p.ProtocolVersion == Server.VERSION_0030) { // support original 45 blocks (classic client) if (classic == null) classic = MakeLimited(p.fallback); return classic; diff --git a/MCGalaxy/Player/Player.Fields.cs b/MCGalaxy/Player/Player.Fields.cs index 099138cfd..f9ba1aefa 100644 --- a/MCGalaxy/Player/Player.Fields.cs +++ b/MCGalaxy/Player/Player.Fields.cs @@ -224,7 +224,7 @@ public partial class Player : IDisposable { public bool verifiedName; bool gotSQLData; - internal byte version; // protocol version + public byte ProtocolVersion; internal byte[] fallback = new byte[256]; // fallback for classic+CPE block IDs diff --git a/MCGalaxy/Player/Player.Login.cs b/MCGalaxy/Player/Player.Login.cs index 9b6939e2b..2923eaf62 100644 --- a/MCGalaxy/Player/Player.Login.cs +++ b/MCGalaxy/Player/Player.Login.cs @@ -38,14 +38,14 @@ public partial class Player : IDisposable // the packet must be at least old_size long if (left < old_size) return 0; - LastAction = DateTime.UtcNow; - version = buffer[offset + 1]; - if (version > Server.VERSION_0030) { + LastAction = DateTime.UtcNow; + ProtocolVersion = buffer[offset + 1]; + if (ProtocolVersion > Server.VERSION_0030) { Leave(null, "Unsupported protocol version", true); return -1; } // check size now that know whether usertype field is included or not - int size = version >= Server.VERSION_0020 ? new_size : old_size; + int size = ProtocolVersion >= Server.VERSION_0020 ? new_size : old_size; if (left < size) return 0; if (loggedIn) return size;