From bf7c54c618c5a3c85e6a14670de73afdd50a45f0 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 14 Aug 2017 23:23:21 +1000 Subject: [PATCH] Fix bug where drawops showed wrong blocks to some players This happened if player A joined (using classic mode), then B joined (using enhanced mode), then B tried drawing a cuboid with custom blocks. The fallback blocks would be shown to both players. --- MCGalaxy/Commands/Moderation/CmdSetRank.cs | 12 +++++----- MCGalaxy/Commands/World/CmdFixGrass.cs | 24 +++++++++---------- MCGalaxy/Network/Utils/BufferedBlockSender.cs | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/MCGalaxy/Commands/Moderation/CmdSetRank.cs b/MCGalaxy/Commands/Moderation/CmdSetRank.cs index fbb4840f2..45bc9422a 100644 --- a/MCGalaxy/Commands/Moderation/CmdSetRank.cs +++ b/MCGalaxy/Commands/Moderation/CmdSetRank.cs @@ -35,18 +35,18 @@ namespace MCGalaxy.Commands.Moderation { public override void Use(Player p, string message) { string[] args = message.SplitSpaces(3); if (args.Length < 2) { Help(p); return; } - string rank = null, name = null; + string rankName = null, name = null; string reason = args.Length > 2 ? args[2] : null; if (args[0].CaselessEq("+up")) { - rank = args[0]; + rankName = args[0]; name = ModActionCmd.FindName(p, "promote", "Promote", "", args[1], ref reason); } else if (args[0].CaselessEq("-down")) { - rank = args[0]; + rankName = args[0]; name = ModActionCmd.FindName(p, "demote", "Demote", "", args[1], ref reason); } else { - rank = args[1]; - name = ModActionCmd.FindName(p, "rank", "Rank", " " + rank, args[0], ref reason); + rankName = args[1]; + name = ModActionCmd.FindName(p, "rank", "Rank", " " + rankName, args[0], ref reason); } if (name == null) return; @@ -54,7 +54,7 @@ namespace MCGalaxy.Commands.Moderation { if (p == who && who != null) { Player.Message(p, "Cannot change your own rank."); return; } Group curRank = who != null ? who.group : PlayerInfo.GetGroup(name); - Group newRank = TargetRank(p, rank.ToLower(), curRank); + Group newRank = TargetRank(p, rankName, curRank); if (newRank == null) return; if (curRank == newRank) { diff --git a/MCGalaxy/Commands/World/CmdFixGrass.cs b/MCGalaxy/Commands/World/CmdFixGrass.cs index 1c4f1b5a9..a5fedc56c 100644 --- a/MCGalaxy/Commands/World/CmdFixGrass.cs +++ b/MCGalaxy/Commands/World/CmdFixGrass.cs @@ -31,21 +31,21 @@ namespace MCGalaxy.Commands.World { int totalFixed = 0; Level lvl = p.level; if (!lvl.BuildAccess.CheckDetailed(p)) { - Player.Message(p, "Hence you cannot use /fixgrass on this map"); return; + Player.Message(p, "Hence you cannot use %T/fixgrass %Son this map"); return; } - switch (message.ToLower()) { - case "": - FixDirtAndGrass(p, lvl, ref totalFixed); break; - case "light": - FixLight(p, lvl, ref totalFixed); break; - case "grass": - FixGrass(p, lvl, ref totalFixed); break; - case "dirt": - FixDirt(p, lvl, ref totalFixed); break; - default: - Help(p); return; + if (message.Length == 0) { + FixDirtAndGrass(p, lvl, ref totalFixed); + } else if (message.CaselessEq("light")) { + FixLight(p, lvl, ref totalFixed); + } else if (message.CaselessEq("grass")) { + FixGrass(p, lvl, ref totalFixed); + } else if (message.CaselessEq("dirt")) { + FixDirt(p, lvl, ref totalFixed); + } else { + Help(p); return; } + Player.Message(p, "Fixed " + totalFixed + " blocks."); } diff --git a/MCGalaxy/Network/Utils/BufferedBlockSender.cs b/MCGalaxy/Network/Utils/BufferedBlockSender.cs index fe44c9947..378363f0d 100644 --- a/MCGalaxy/Network/Utils/BufferedBlockSender.cs +++ b/MCGalaxy/Network/Utils/BufferedBlockSender.cs @@ -164,7 +164,7 @@ namespace MCGalaxy.Network { data[j++] = (byte)(x >> 8); data[j++] = (byte)x; data[j++] = (byte)(y >> 8); data[j++] = (byte)y; data[j++] = (byte)(z >> 8); data[j++] = (byte)z; - data[j++] = types[i] = Block.ConvertCPE(level.RawFallback(types[i])); + data[j++] = Block.ConvertCPE(level.RawFallback(types[i])); } return data; }