diff --git a/Blocks/Behaviour/Block.Behaviour.cs b/Blocks/Behaviour/Block.Behaviour.cs index ef516a112..38a431c38 100644 --- a/Blocks/Behaviour/Block.Behaviour.cs +++ b/Blocks/Behaviour/Block.Behaviour.cs @@ -33,7 +33,7 @@ namespace MCGalaxy { internal static HandlePlace[] placeHandlers = new Block.HandlePlace[256]; /// Returns whether this block handles the player walking through this block at the given coordinates. - /// If this returns true, the usual 'checking dirt/grass below' behaviour is skipped. + /// If this returns true, the usual 'death check' behaviour is skipped. public delegate bool HandleWalkthrough(Player p, byte block, ushort x, ushort y, ushort z); internal static HandleWalkthrough[] walkthroughHandlers = new Block.HandleWalkthrough[256]; diff --git a/Blocks/Behaviour/WalkthroughBehaviour.cs b/Blocks/Behaviour/WalkthroughBehaviour.cs index 8942c57dd..77b9cffa4 100644 --- a/Blocks/Behaviour/WalkthroughBehaviour.cs +++ b/Blocks/Behaviour/WalkthroughBehaviour.cs @@ -83,7 +83,7 @@ namespace MCGalaxy.BlockBehaviour { p.checkpointX = x; p.checkpointY = y; p.checkpointZ = z; int index = p.level.PosToInt(x, y, z); if (index != p.lastCheckpointIndex) { - p.SendSpawn(0xFF, p.color + p.truename, p.pos[0], (ushort)((y - 1) * 32 + 51), p.pos[2], p.rot[0], p.rot[1]); + p.SpawnEntity(p, 0xFF, p.pos[0], (ushort)((y - 1) * 32 + 51), p.pos[2], p.rot[0], p.rot[1]); p.lastCheckpointIndex = index; } return true; diff --git a/Commands/Chat/CmdChatRoom.cs b/Commands/Chat/CmdChatRoom.cs index b734ca305..8251bd652 100644 --- a/Commands/Chat/CmdChatRoom.cs +++ b/Commands/Chat/CmdChatRoom.cs @@ -105,7 +105,7 @@ namespace MCGalaxy.Commands { } void HandleCreate(Player p, string[] parts) { - if (!CheckAdditionalPerm(p, 1)) { MessageNeedPerms(p, "can create a chatroom.", 1); return; } + if (!CheckAdditionalPerm(p, 1)) { MessageNeedPerms(p, "can create a chatroom.", 1); return; } if (parts.Length <= 1) { Player.SendMessage(p, "You need to provide a new chatroom name."); return; @@ -139,7 +139,7 @@ namespace MCGalaxy.Commands { } if (!canDeleteForce) { - Player[] players = PlayerInfo.Online.Items; + Player[] players = PlayerInfo.Online.Items; foreach (Player pl in players) { if (pl != p && pl.Chatroom == room) { Player.SendMessage(p, "Sorry, someone else is in the chatroom"); diff --git a/Commands/Command.cs b/Commands/Command.cs index 9f2c60334..002da5913 100644 --- a/Commands/Command.cs +++ b/Commands/Command.cs @@ -63,7 +63,7 @@ namespace MCGalaxy } protected void MessageNeedPerms(Player p, string action, int num = 1) { - int perm = CommandOtherPerms.GetPerm(this, num) + int perm = CommandOtherPerms.GetPerm(this, num); Group grp = Group.findPermInt(perm); if (grp == null) Player.SendMessage(p, "Onlys rank with a permission level greater than &a" + perm + "%Scan " + action); diff --git a/Commands/Fun/CmdAka.cs b/Commands/Fun/CmdAka.cs index 431b015c7..061c5b36a 100644 --- a/Commands/Fun/CmdAka.cs +++ b/Commands/Fun/CmdAka.cs @@ -35,7 +35,7 @@ namespace MCGalaxy.Commands { foreach (Player pl in players) { if (pl.level != p.level || p == pl || !Player.CanSee(p, pl) || pl.Game.Referee) continue; p.SendDespawn(pl.id); - Player.SpawnEntity(pl, p, pl.id, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1], ""); + p.SpawnEntity(pl, pl.id, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1], ""); } } diff --git a/Commands/Fun/CmdTntWars.cs b/Commands/Fun/CmdTntWars.cs index 751d75871..03d58a635 100644 --- a/Commands/Fun/CmdTntWars.cs +++ b/Commands/Fun/CmdTntWars.cs @@ -269,7 +269,7 @@ namespace MCGalaxy.Commands case "lvl": case "map": case "m": - if ((CheckAdditionalPerm(p)) + if (CheckAdditionalPerm(p)) { foreach (Player who in p.level.players) { @@ -289,7 +289,7 @@ namespace MCGalaxy.Commands case "pls": case "pl": case "p": - if CheckAdditionalPerm(p)) + if (CheckAdditionalPerm(p)) { TntWarsGame gm = TntWarsGame.GetTntWarsGame(p); if (gm == null) diff --git a/Commands/Moderation/CmdFollow.cs b/Commands/Moderation/CmdFollow.cs index cfa896938..71bb6763e 100644 --- a/Commands/Moderation/CmdFollow.cs +++ b/Commands/Moderation/CmdFollow.cs @@ -74,7 +74,7 @@ namespace MCGalaxy.Commands if (p.hidden) { if (who != null) - p.SendSpawn(who.id, who.color + who.truename, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1]); + p.SpawnEntity(who, who.id, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1]); if (!stealth) { Command.all.Find("hide").Use(p, ""); @@ -104,7 +104,7 @@ namespace MCGalaxy.Commands if (p.following != "") { who = PlayerInfo.Find(p.following); - p.SendSpawn(who.id, who.color + who.truename, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1]); + p.SpawnEntity(who, who.id, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1]); } who = PlayerInfo.Find(message); p.following = who.name; diff --git a/Commands/World/CmdGoto.cs b/Commands/World/CmdGoto.cs index 4e46aa434..7b760653d 100644 --- a/Commands/World/CmdGoto.cs +++ b/Commands/World/CmdGoto.cs @@ -144,7 +144,7 @@ namespace MCGalaxy.Commands { Player[] players = PlayerInfo.Online.Items; foreach (Player pl in players) { if (pl.level != p.level || pl.hidden || p == pl) continue; - Player.SpawnEntity(pl, p, pl.id, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1], ""); + p.SpawnEntity(pl, pl.id, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1], ""); } Player.GlobalSpawn(p, x, y, z, rotX, rotY, true); diff --git a/Games/CTF/CtfTeam.cs b/Games/CTF/CtfTeam.cs index 60e285bc9..ca3534312 100644 --- a/Games/CTF/CtfTeam.cs +++ b/Games/CTF/CtfTeam.cs @@ -89,7 +89,7 @@ namespace MCGalaxy.Games ushort y1 = (ushort)((1 + y) * 32); ushort z1 = (ushort)((0.5 + z) * 32); rotx = spawns[rnd].rotx; - p.SendSpawn(0xFF, p.name, x1, y1, z1, (byte)rotx, 0); + p.SpawnEntity(p, 0xFF, x1, y1, z1, (byte)rotx, 0); //p.health = 100; } else @@ -99,7 +99,7 @@ namespace MCGalaxy.Games ushort z = (ushort)((0.5 + mapOn.spawnz) * 32); ushort rotx = mapOn.rotx; ushort roty = mapOn.roty; - p.SendSpawn(0xFF, p.name, x, y, z, (byte)rotx, (byte)roty); + p.SpawnEntity(p, 0xFF, x, y, z, (byte)rotx, (byte)roty); } //p.spawning = false; } diff --git a/Games/Countdown/CountdownGame.cs b/Games/Countdown/CountdownGame.cs index 1712f935d..0b61d4b87 100644 --- a/Games/Countdown/CountdownGame.cs +++ b/Games/Countdown/CountdownGame.cs @@ -65,7 +65,7 @@ namespace MCGalaxy.Games { player.SendMessage("Sending you to the correct map."); Command.all.Find("goto").Use(player, mapon.name); } - player.SendSpawn(0xFF, player.color + player.truename, x1, y1, z1, (byte)0, (byte)0); + p.SpawnEntity(p, 0xFF, x1, y1, z1, 0, 0); } squaresLeft.Clear(); diff --git a/Player/Player.cs b/Player/Player.cs index 0c5f39089..9c6763def 100644 --- a/Player/Player.cs +++ b/Player/Player.cs @@ -475,27 +475,30 @@ namespace MCGalaxy { if ((p.hidden || p.Game.Referee) && !self) continue; if (p != other) { - SpawnEntity(p, other, p.id, x, y, z, rotx, roty, possession); + other.SpawnEntity(p, p.id, x, y, z, rotx, roty, possession); } else if (self) { other.pos = new ushort[3] { x, y, z }; other.rot = new byte[2] { rotx, roty }; other.oldpos = other.pos; other.basepos = other.pos; other.oldrot = other.rot; - SpawnEntity(p, other, 0xFF, x, y, z, rotx, roty, possession); + other.SpawnEntity(other, 0xFF, x, y, z, rotx, roty, possession); } } } - internal static void SpawnEntity(Player p, Player dst, byte id, ushort x, ushort y, ushort z, + internal void SpawnEntity(Player p, byte id, ushort x, ushort y, ushort z, byte rotx, byte roty, string possession = "") { if (!Server.zombie.Running || !p.Game.Infected) { - dst.SendSpawn(id, p.color + p.truename + possession, x, y, z, rotx, roty); return; + string col = p.color; + if (col.Length >= 2 && !Colors.IsStandardColor(col[1]) && !HasCpeExt(CpeExt.TextColors)) + col = "&" + Colors.GetFallback(col[1]); + SendSpawn(id, col + p.truename + possession, x, y, z, rotx, roty); return; } - if (Server.zombie.ZombieName != "" && !dst.Game.Aka) - dst.SendSpawn(id, Colors.red + Server.zombie.ZombieName + possession, x, y, z, rotx, roty); + if (Server.zombie.ZombieName != "" && !Game.Aka) + SendSpawn(id, Colors.red + Server.zombie.ZombieName + possession, x, y, z, rotx, roty); else - dst.SendSpawn(id, Colors.red + p.truename + possession, x, y, z, rotx, roty); - if (dst.HasCpeExt(CpeExt.ChangeModel) && id != 0xFF) - dst.SendChangeModel(id, "zombie"); + SendSpawn(id, Colors.red + p.truename + possession, x, y, z, rotx, roty); + if (HasCpeExt(CpeExt.ChangeModel) && id != 0xFF) + SendChangeModel(id, "zombie"); } public static void GlobalDespawn(Player p, bool self) {