From 4b2db7195b7d174ae3cf5be076d1b8a4669babb8 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 30 Mar 2016 10:17:43 +1100 Subject: [PATCH] Use name without + in SpawnEntity packets, also add /os map texturezip. (Thanks goodlyay) --- Commands/CmdOverseer.cs | 13 ++++++++----- Commands/Moderation/CmdFollow.cs | 4 ++-- Games/CTF/CtfTeam.cs | 2 +- Games/Countdown/CountdownGame.cs | 2 +- Player/Player.Handlers.cs | 4 ++-- Player/Player.cs | 6 +++--- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Commands/CmdOverseer.cs b/Commands/CmdOverseer.cs index 7d09669a9..97f0c8f6c 100644 --- a/Commands/CmdOverseer.cs +++ b/Commands/CmdOverseer.cs @@ -245,13 +245,15 @@ namespace MCGalaxy.Commands Command.all.Find("pervisit").Use(p, rank); } else if (cmd == "TEXTURE") { if (value == "") { - Player.SendMessage(p, "Removing current texture."); Command.all.Find("texture").Use(p, "level normal"); - } else if (!value.EndsWith(".png")) { - Player.SendMessage(p, "Your texture image must end in .png"); } else { Command.all.Find("texture").Use(p, "level " + value); - Player.SendMessage(p, "Your texture has been updated!"); + } + } else if (cmd == "TEXTUREZIP") { + if (value == "") { + Command.all.Find("texture").Use(p, "levelzip normal"); + } else { + Command.all.Find("texture").Use(p, "levelzip " + value); } } else { Player.SendMessage(p, "/os map add [type - default is flat] -- Creates your map (128x64x128)"); @@ -262,7 +264,8 @@ namespace MCGalaxy.Commands Player.SendMessage(p, "/os map motd -- Changes the motd of your map"); Player.SendMessage(p, "/os map guns -- Toggles if guns can be used on your map"); Player.SendMessage(p, "/os map pervisit %b[default is " + Server.defaultRank + "]%S -- Changes the pervisit of you map"); - Player.SendMessage(p, "/os map texture -- Add a texture to your map"); + Player.SendMessage(p, "/os map texture -- Sets terrain.png url for your map"); + Player.SendMessage(p, "/os map texturezip -- Sets texture pack .zip url for your map"); Player.SendMessage(p, " Textures: If your URL is too long, use the \"<\" symbol to continue it on another line."); Player.SendMessage(p, " Map Types: Desert, flat, forest, island, mountians, ocean, pixel, empty and space"); Player.SendMessage(p, " Motd: If no message is provided, the default message will be used."); diff --git a/Commands/Moderation/CmdFollow.cs b/Commands/Moderation/CmdFollow.cs index 8c18ddcde..cfa896938 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.name, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1]); + p.SendSpawn(who.id, who.color + who.truename, 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.name, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1]); + p.SendSpawn(who.id, who.color + who.truename, 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/Games/CTF/CtfTeam.cs b/Games/CTF/CtfTeam.cs index 14cb6369c..60e285bc9 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((byte)0xFF, p.name, x1, y1, z1, (byte)rotx, 0); + p.SendSpawn(0xFF, p.name, x1, y1, z1, (byte)rotx, 0); //p.health = 100; } else diff --git a/Games/Countdown/CountdownGame.cs b/Games/Countdown/CountdownGame.cs index a755b90ff..b1d8a9aac 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.name, x1, y1, z1, (byte)0, (byte)0); + player.SendSpawn(0xFF, player.color + player.truename, x1, y1, z1, (byte)0, (byte)0); } squaresLeft.Clear(); diff --git a/Player/Player.Handlers.cs b/Player/Player.Handlers.cs index 29f62068b..62631e445 100644 --- a/Player/Player.Handlers.cs +++ b/Player/Player.Handlers.cs @@ -999,7 +999,7 @@ return; checkpointX = x; checkpointY = y; checkpointZ = z; int index = level.PosToInt(x, y, z); if (index != lastCheckpointIndex) { - SendSpawn(0xFF, color + name, pos[0], (ushort)((y - 1) * 32 + 51), pos[2], rot[0], rot[1]); + SendSpawn(0xFF, color + truename, pos[0], (ushort)((y - 1) * 32 + 51), pos[2], rot[0], rot[1]); lastCheckpointIndex = index; } } else if ( b1 == Block.checkpoint ) { @@ -1007,7 +1007,7 @@ return; checkpointX = x; checkpointY = (ushort)(y + 1); checkpointZ = z; int index = level.PosToInt(x, (ushort)(y - 1), z); if (index != lastCheckpointIndex) { - SendSpawn(0xFF, color + name, pos[0], (ushort)((y - 1) * 32 + 51), pos[2], rot[0], rot[1]); + SendSpawn(0xFF, color + truename, pos[0], (ushort)((y - 1) * 32 + 51), pos[2], rot[0], rot[1]); lastCheckpointIndex = index; } } diff --git a/Player/Player.cs b/Player/Player.cs index 198d9198d..40414bf5e 100644 --- a/Player/Player.cs +++ b/Player/Player.cs @@ -58,7 +58,7 @@ namespace MCGalaxy { public static bool storeHelp = false; public static string storedHelp = ""; - private string truename; + internal string truename; internal bool dontmindme = false; public Socket socket; System.Timers.Timer timespent = new System.Timers.Timer(1000); @@ -486,13 +486,13 @@ namespace MCGalaxy { internal static void SpawnEntity(Player p, Player dst, 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.name + possession, x, y, z, rotx, roty); return; + dst.SendSpawn(id, p.color + 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); else - dst.SendSpawn(id, Colors.red + p.name + possession, x, y, z, rotx, roty); + dst.SendSpawn(id, Colors.red + p.truename + possession, x, y, z, rotx, roty); if (dst.HasCpeExt(CpeExt.ChangeModel) && id != 0xFF) dst.SendChangeModel(id, "zombie"); }