diff --git a/Commands/Command.All.cs b/Commands/Command.All.cs index 1073c00e6..554511c05 100644 --- a/Commands/Command.All.cs +++ b/Commands/Command.All.cs @@ -93,7 +93,6 @@ namespace MCGalaxy all.Add(new CmdFakePay()); all.Add(new CmdFakeRank()); all.Add(new CmdFaq()); - all.Add(new CmdFetch()); all.Add(new CmdFill()); all.Add(new CmdFixGrass()); all.Add(new CmdFlipHead()); diff --git a/Commands/CommandKeywords.cs b/Commands/CommandKeywords.cs index 6b609ede9..34e1b2701 100644 --- a/Commands/CommandKeywords.cs +++ b/Commands/CommandKeywords.cs @@ -92,7 +92,6 @@ namespace MCGalaxy.Commands new CommandKeywords((new CmdFakePay()), "fake troll pay " + Server.moneys); new CommandKeywords((new CmdFakeRank()), "rank mod fake troll"); new CommandKeywords((new CmdFaq()), "freq ask question"); - new CommandKeywords((new CmdFetch()), "summon move"); new CommandKeywords((new CmdFill()), "cuboid edit"); new CommandKeywords((new CmdFixGrass()), "grass fix"); new CommandKeywords((new CmdFlipHead()), "head fix flip troll"); diff --git a/Commands/Games/CmdCountdown.cs b/Commands/Games/CmdCountdown.cs index 19a398f72..3c1759efe 100644 --- a/Commands/Games/CmdCountdown.cs +++ b/Commands/Games/CmdCountdown.cs @@ -299,13 +299,10 @@ namespace MCGalaxy.Commands while (p.Loading) { Thread.Sleep(250); } p.level.permissionbuild = LevelPermission.Nobody; p.level.motd = "Welcome to the Countdown map!!!! -hax"; - ushort x = System.Convert.ToUInt16(8); - ushort y = System.Convert.ToUInt16(23); - ushort z = System.Convert.ToUInt16(17); - x *= 32; x += 16; - y *= 32; y += 32; - z *= 32; z += 16; - unchecked { p.SendPos((byte)-1, x, y, z, p.rot[0], p.rot[1]); } + const ushort x = 8 * 32 + 16; + const ushort y = 23 * 32 + 32; + const ushort z = 17 * 32 + 16; + p.SendPos(0xFF, x, y, z, p.rot[0], p.rot[1]); } else if (par0 == "enable") diff --git a/Commands/Moderation/CmdAka.cs b/Commands/Moderation/CmdAka.cs index d60f3b23c..a0cc1748d 100644 --- a/Commands/Moderation/CmdAka.cs +++ b/Commands/Moderation/CmdAka.cs @@ -35,16 +35,16 @@ namespace MCGalaxy.Commands p.Loading = true; foreach (Player pl in Player.players) - if (p.level == pl.level && p != pl) p.SendDie(pl.id); + if (p.level == pl.level && p != pl) p.SendDespawn(pl.id); foreach (PlayerBot b in PlayerBot.playerbots) - if (p.level == b.level) p.SendDie(b.id); + if (p.level == b.level) p.SendDespawn(b.id); - Player.GlobalDie(p, true); + Player.GlobalDespawn(p, true); p.SendUserMOTD(); p.SendMap(); if (!p.hidden) { - Player.GlobalDie(p, false); + Player.GlobalDespawn(p, false); Player.GlobalSpawn(p, x, y, z, p.level.rotx, p.level.roty, true); } else { p.SendPos(0xFF, x, y, z, p.level.rotx, p.level.roty); diff --git a/Commands/Moderation/CmdBan.cs b/Commands/Moderation/CmdBan.cs index d95f25bd0..81ecaff25 100644 --- a/Commands/Moderation/CmdBan.cs +++ b/Commands/Moderation/CmdBan.cs @@ -121,7 +121,7 @@ namespace MCGalaxy.Commands { } who.group = Group.findPerm(LevelPermission.Banned); who.color = who.group.color; - Player.GlobalDie(who, false); + Player.GlobalDespawn(who, false); Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false); Group.findPerm(LevelPermission.Banned).playerList.Add(who.name); Ban.Banplayer(p, who.name.ToLower(), reason, stealth, oldgroup); diff --git a/Commands/Moderation/CmdFetch.cs b/Commands/Moderation/CmdFetch.cs deleted file mode 100644 index 0868850bc..000000000 --- a/Commands/Moderation/CmdFetch.cs +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright 2011 MCGalaxy - - Author: SebbiUltimate - - Dual-licensed under the Educational Community License, Version 2.0 and - the GNU General Public License, Version 3 (the "Licenses"); you may - not use this file except in compliance with the Licenses. You may - obtain a copy of the Licenses at - - http://www.opensource.org/licenses/ecl2.php - http://www.gnu.org/licenses/gpl-3.0.html - - Unless required by applicable law or agreed to in writing, - software distributed under the Licenses are distributed on an "AS IS" - BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - or implied. See the Licenses for the specific language governing - permissions and limitations under the Licenses. -*/ -using System.Threading; -namespace MCGalaxy.Commands -{ - public sealed class CmdFetch : Command - { - public override string name { get { return "fetch"; } } - public override string shortcut { get { return "fb"; } } - public override string type { get { return CommandTypes.Moderation; } } - public override bool museumUsable { get { return false; } } - public override LevelPermission defaultRank { get { return LevelPermission.Operator; } } - public override void Use(Player p, string message) - { - if (p == null) - { - Player.SendMessage(p, "Console cannot use this command. Try using /move instead."); - return; - } - - Player who = Player.Find(message); - if (who == null || who.hidden) - { - Player.SendMessage(p, "Could not find player."); - return; - } - - if (p.group.Permission <= who.group.Permission) - { - Player.SendMessage(p, "You cannot fetch a player of equal or greater rank!"); - return; - } - - if (p.level != who.level) - { - Player.SendMessage(p, who.DisplayName + " is in a different Level. Forcefetching has started!"); - Level where = p.level; - Command.all.Find("goto").Use(who, where.name); - Thread.Sleep(1000); - // Sleep for a bit while they load - while (who.Loading) { Thread.Sleep(250); } - } - - unchecked - { - who.SendPos((byte)-1, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0); - } - } - public override void Help(Player p) - { - Player.SendMessage(p, "/fetch - Fetches Player forced!"); - Player.SendMessage(p, "Moves Player to your Level first"); - } - } -} diff --git a/Commands/Moderation/CmdFollow.cs b/Commands/Moderation/CmdFollow.cs index a4ddcba6a..fc6df1a9f 100644 --- a/Commands/Moderation/CmdFollow.cs +++ b/Commands/Moderation/CmdFollow.cs @@ -115,7 +115,7 @@ namespace MCGalaxy.Commands who = Player.Find(message); p.following = who.name; Player.SendMessage(p, "Following " + who.color + who.DisplayName + Server.DefaultColor + ". Use \"/follow\" to stop."); - p.SendDie(who.id); + p.SendDespawn(who.id); } catch (Exception e) { Server.ErrorLog(e); Player.SendMessage(p, "Error occured"); } } diff --git a/Commands/Moderation/CmdHide.cs b/Commands/Moderation/CmdHide.cs index 425c6ec3f..05cf40d6a 100644 --- a/Commands/Moderation/CmdHide.cs +++ b/Commands/Moderation/CmdHide.cs @@ -55,7 +55,7 @@ namespace MCGalaxy.Commands p.hidden = !p.hidden; if (p.hidden) { - Player.GlobalDie(p, true); + Player.GlobalDespawn(p, true); Chat.GlobalMessageOps("To Ops -" + p.color + p.DisplayName + Server.DefaultColor + "- is now &finvisible" + Server.DefaultColor + "."); Player.GlobalChat(p, "&c- " + p.color + p.prefix + p.DisplayName + Server.DefaultColor + " " + (File.Exists("text/logout/" + p.name + ".txt") ? CP437Reader.ReadAllText("text/logout/" + p.name + ".txt") : "Disconnected."), false); diff --git a/Commands/Moderation/CmdJail.cs b/Commands/Moderation/CmdJail.cs index 5b490c455..fc44e1979 100644 --- a/Commands/Moderation/CmdJail.cs +++ b/Commands/Moderation/CmdJail.cs @@ -48,7 +48,7 @@ namespace MCGalaxy if (who.group.Permission >= p.group.Permission) { Player.SendMessage(p, "Cannot jail someone of equal or greater rank."); return; } Player.SendMessage(p, "You jailed " + who.DisplayName); } - Player.GlobalDie(who, false); + Player.GlobalDespawn(who, false); who.jailed = true; Player.GlobalSpawn(who, who.level.jailx, who.level.jaily, who.level.jailz, who.level.jailrotx, who.level.jailroty, true); if (!File.Exists("ranks/jailed.txt")) File.Create("ranks/jailed.txt").Close(); diff --git a/Commands/Moderation/CmdPossess.cs b/Commands/Moderation/CmdPossess.cs index 125492a2e..9d5fa1fc0 100644 --- a/Commands/Moderation/CmdPossess.cs +++ b/Commands/Moderation/CmdPossess.cs @@ -144,7 +144,7 @@ namespace MCGalaxy.Commands { return; } - p.SendDie(who.id); + p.SendDespawn(who.id); who.canBuild = false; Player.SendMessage(p, "Successfully possessed " + who.color + who.name + Server.DefaultColor + "."); } diff --git a/Commands/Moderation/CmdReferee.cs b/Commands/Moderation/CmdReferee.cs index 2fd89ad60..a330d777a 100644 --- a/Commands/Moderation/CmdReferee.cs +++ b/Commands/Moderation/CmdReferee.cs @@ -32,7 +32,7 @@ namespace MCGalaxy.Commands { p.referee = false; LevelPermission perm = Group.findPlayerGroup(name).Permission; - Player.GlobalDie(p, false); + Player.GlobalDespawn(p, false); Player.GlobalChat(p, p.color + p.name + Server.DefaultColor + " is no longer a referee", false); if (Server.zombie.GameInProgess()) { @@ -40,7 +40,7 @@ namespace MCGalaxy.Commands } else { - Player.GlobalDie(p, false); + Player.GlobalDespawn(p, false); Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); ZombieGame.infectd.Remove(p); ZombieGame.alive.Add(p); @@ -51,7 +51,7 @@ namespace MCGalaxy.Commands { p.referee = true; Player.GlobalChat(p, p.color + p.name + Server.DefaultColor + " is now a referee", false); - Player.GlobalDie(p, false); + Player.GlobalDespawn(p, false); if (Server.zombie.GameInProgess()) { p.color = p.group.color; diff --git a/Commands/Moderation/CmdReveal.cs b/Commands/Moderation/CmdReveal.cs index 83f035f38..9058e06c7 100644 --- a/Commands/Moderation/CmdReveal.cs +++ b/Commands/Moderation/CmdReveal.cs @@ -67,11 +67,11 @@ namespace MCGalaxy.Commands { void ReloadMap(Player p, Player who) { who.Loading = true; - foreach (Player pl in Player.players.ToArray()) if (who.level == pl.level && who != pl) who.SendDie(pl.id); - foreach (PlayerBot b in PlayerBot.playerbots.ToArray()) if (who.level == b.level) who.SendDie(b.id); + foreach (Player pl in Player.players.ToArray()) if (who.level == pl.level && who != pl) who.SendDespawn(pl.id); + foreach (PlayerBot b in PlayerBot.playerbots.ToArray()) if (who.level == b.level) who.SendDespawn(b.id); ushort x = who.pos[0], y = who.pos[1], z = who.pos[2]; - Player.GlobalDie(who, true); + Player.GlobalDespawn(who, true); who.SendUserMOTD(); who.SendMap(); if (!who.hidden) diff --git a/Commands/Moderation/CmdSetRank.cs b/Commands/Moderation/CmdSetRank.cs index 2923a740c..903c30cb4 100644 --- a/Commands/Moderation/CmdSetRank.cs +++ b/Commands/Moderation/CmdSetRank.cs @@ -119,7 +119,7 @@ namespace MCGalaxy.Commands who.color = who.group.color; who.SetPrefix(); - Player.GlobalDie(who, false); + Player.GlobalDespawn(who, false); who.SendMessage("You are now ranked " + newRank.color + newRank.name + Server.DefaultColor + ", type /help for your new set of commands."); who.SendUserType(Block.canPlace(who.group.Permission, Block.blackrock)); diff --git a/Commands/Moderation/CmdUnban.cs b/Commands/Moderation/CmdUnban.cs index befad5e23..12b4e4f07 100644 --- a/Commands/Moderation/CmdUnban.cs +++ b/Commands/Moderation/CmdUnban.cs @@ -135,7 +135,7 @@ namespace MCGalaxy.Commands Server.s.Log("UNBANNED: by console"); Server.IRC.Say(message + " was unbanned by console."); } - who.group = Group.standard; who.color = who.group.color; Player.GlobalDie(who, false); + who.group = Group.standard; who.color = who.group.color; Player.GlobalDespawn(who, false); Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false); Group.findPerm(LevelPermission.Banned).playerList.Remove(message); } diff --git a/Commands/Moderation/CmdXhide.cs b/Commands/Moderation/CmdXhide.cs index a9d4dc3b1..db34c88a4 100644 --- a/Commands/Moderation/CmdXhide.cs +++ b/Commands/Moderation/CmdXhide.cs @@ -39,7 +39,7 @@ namespace MCGalaxy.Commands p.hidden = !p.hidden; if (p.hidden) { - Player.GlobalDie(p, true); + Player.GlobalDespawn(p, true); Player.GlobalChat(p, "&c- " + p.color + p.prefix + p.DisplayName + Server.DefaultColor + " " + (File.Exists("text/logout/" + p.name + ".txt") ? CP437Reader.ReadAllText("text/logout/" + p.name + ".txt") : "Disconnected."), false); Server.IRC.Say(p.name + " left the game (Disconnected.)"); diff --git a/Commands/World/CmdGoto.cs b/Commands/World/CmdGoto.cs index 6ba5f6dc8..1637f656b 100644 --- a/Commands/World/CmdGoto.cs +++ b/Commands/World/CmdGoto.cs @@ -54,10 +54,10 @@ namespace MCGalaxy.Commands { p.Loading = true; - foreach (Player pl in Player.players) if (p.level == pl.level && p != pl) p.SendDie(pl.id); - foreach (PlayerBot b in PlayerBot.playerbots) if (p.level == b.level) p.SendDie(b.id); + foreach (Player pl in Player.players) if (p.level == pl.level && p != pl) p.SendDespawn(pl.id); + foreach (PlayerBot b in PlayerBot.playerbots) if (p.level == b.level) p.SendDespawn(b.id); - Player.GlobalDie(p, true); + Player.GlobalDespawn(p, true); p.level = foundLevel; p.SendUserMOTD(); p.SendMap(); GC.Collect(); @@ -67,7 +67,7 @@ namespace MCGalaxy.Commands ushort z = (ushort)((0.5 + foundLevel.spawnz) * 32); if (!p.hidden) Player.GlobalSpawn(p, x, y, z, foundLevel.rotx, foundLevel.roty, true, ""); - else unchecked { p.SendPos((byte)-1, x, y, z, foundLevel.rotx, foundLevel.roty); } + else p.SendPos(0xFF, x, y, z, foundLevel.rotx, foundLevel.roty); foreach (Player pl in Player.players) if (pl.level == p.level && p != pl && !pl.hidden) diff --git a/Commands/World/CmdMuseum.cs b/Commands/World/CmdMuseum.cs index 045b3bf2c..be124864f 100644 --- a/Commands/World/CmdMuseum.cs +++ b/Commands/World/CmdMuseum.cs @@ -58,10 +58,10 @@ namespace MCGalaxy.Commands level.jailrotx = level.rotx; level.jailroty = level.roty; p.Loading = true; - foreach (Player pl in Player.players) if (p.level == pl.level && p != pl) p.SendDie(pl.id); - foreach (PlayerBot b in PlayerBot.playerbots) if (p.level == b.level) p.SendDie(b.id); + foreach (Player pl in Player.players) if (p.level == pl.level && p != pl) p.SendDespawn(pl.id); + foreach (PlayerBot b in PlayerBot.playerbots) if (p.level == b.level) p.SendDespawn(b.id); - Player.GlobalDie(p, true); + Player.GlobalDespawn(p, true); p.level = level; p.SendMotd(); diff --git a/Commands/building/CmdOutline.cs b/Commands/building/CmdOutline.cs index 834618acd..21d206dcf 100644 --- a/Commands/building/CmdOutline.cs +++ b/Commands/building/CmdOutline.cs @@ -64,7 +64,8 @@ namespace MCGalaxy.Commands { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; - unchecked { if (cpos.type != (byte)-1) { type = cpos.type; } } + if (cpos.type != Block.Zero) + type = cpos.type; List buffer = new List(); Pos pos; diff --git a/Commands/other/CmdAscend.cs b/Commands/other/CmdAscend.cs index 0e4d76bce..6ac8d28e7 100644 --- a/Commands/other/CmdAscend.cs +++ b/Commands/other/CmdAscend.cs @@ -49,7 +49,7 @@ namespace MCGalaxy.Commands if (p.level.GetTile(xpos, blockunder, zpos) != Block.air && p.level.GetTile(xpos, blockunder, zpos) != Block.air_switch && p.level.GetTile(xpos, blockunder, zpos) != Block.air_door && p.level.GetTile(xpos, blockunder, zpos) != Block.air_flood && p.level.GetTile(xpos, blockunder, zpos) != Block.air_flood_down && p.level.GetTile(xpos, blockunder, zpos) != Block.air_flood_layer && p.level.GetTile(xpos, blockunder, zpos) != Block.air_flood_up && p.level.GetTile(xpos, blockunder, zpos) != Block.air_portal && p.level.GetTile(xpos, blockunder, zpos) != Block.redflower && p.level.GetTile(xpos, blockunder, zpos) != Block.yellowflower && p.level.GetTile(xpos, blockunder, zpos) != Block.finiteWater && p.level.GetTile(xpos, blockunder, zpos) != Block.finiteLava && p.level.GetTile(xpos, blockunder, zpos) != Block.fire && p.level.GetTile(xpos, blockunder, zpos) != Block.water && p.level.GetTile(xpos, blockunder, zpos) != Block.water_door && p.level.GetTile(xpos, blockunder, zpos) != Block.water_portal && p.level.GetTile(xpos, blockunder, zpos) != Block.WaterDown && p.level.GetTile(xpos, blockunder, zpos) != Block.WaterFaucet && p.level.GetTile(xpos, blockunder, zpos) != Block.lava && p.level.GetTile(xpos, blockunder, zpos) != Block.lava_door && p.level.GetTile(xpos, blockunder, zpos) != Block.lava_fast && p.level.GetTile(xpos, blockunder, zpos) != Block.lava_portal && p.level.GetTile(xpos, blockunder, zpos) != Block.LavaDown && p.level.GetTile(xpos, blockunder, zpos) != Block.lavastill && p.level.GetTile(xpos, blockunder, zpos) != Block.Zero) { Player.SendMessage(p, "Teleported you up!"); - unchecked { p.SendPos((byte)-1, p.pos[0], (ushort)((posy + 1) * 32), p.pos[2], p.rot[0], p.rot[1]); } + p.SendPos(0xFF, p.pos[0], (ushort)((posy + 1) * 32), p.pos[2], p.rot[0], p.rot[1]); found = true; } } diff --git a/Commands/other/CmdBack.cs b/Commands/other/CmdBack.cs index d371b0159..46e863503 100644 --- a/Commands/other/CmdBack.cs +++ b/Commands/other/CmdBack.cs @@ -35,7 +35,7 @@ namespace MCGalaxy.Commands } if (p.level.name.ToLower() != p.beforeTeleportMap.ToLower()) Command.all.Find("goto").Use(p, p.beforeTeleportMap); - unchecked { p.SendPos((byte)-1, p.beforeTeleportPos[0], p.beforeTeleportPos[1], p.beforeTeleportPos[2], 0, 0); } + p.SendPos(0xFF, p.beforeTeleportPos[0], p.beforeTeleportPos[1], p.beforeTeleportPos[2], 0, 0); } public override void Help(Player p) { diff --git a/Commands/other/CmdColor.cs b/Commands/other/CmdColor.cs index 1ef5f2186..27d5c9098 100644 --- a/Commands/other/CmdColor.cs +++ b/Commands/other/CmdColor.cs @@ -41,7 +41,7 @@ namespace MCGalaxy.Commands { Player.GlobalChat(who, who.color + "*" + Name(who.DisplayName) + " color reverted to " + who.group.color + "their group's default" + Server.DefaultColor + ".", false); who.color = who.group.color; - Player.GlobalDie(who, false); + Player.GlobalDespawn(who, false); Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false); who.SetPrefix(); return; @@ -63,7 +63,7 @@ namespace MCGalaxy.Commands { } who.color = color; - Player.GlobalDie(who, false); + Player.GlobalDespawn(who, false); Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false); who.SetPrefix(); } @@ -77,7 +77,7 @@ namespace MCGalaxy.Commands { Player.GlobalChat(p, p.color + "*" + Name(p.DisplayName) + " color reverted to " + p.group.color + "their group's default" + Server.DefaultColor + ".", false); p.color = p.group.color; - Player.GlobalDie(p, false); + Player.GlobalDespawn(p, false); Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); p.SetPrefix(); return; @@ -93,7 +93,7 @@ namespace MCGalaxy.Commands { Player.GlobalChat(p, p.color + "*" + Name(p.DisplayName) + " color changed to " + color + c.Name(color) + Server.DefaultColor + ".", false); p.color = color; - Player.GlobalDie(p, false); + Player.GlobalDespawn(p, false); Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); p.SetPrefix(); } diff --git a/Commands/other/CmdDescend.cs b/Commands/other/CmdDescend.cs index 5188e6f16..818479cf5 100644 --- a/Commands/other/CmdDescend.cs +++ b/Commands/other/CmdDescend.cs @@ -45,7 +45,7 @@ namespace MCGalaxy.Commands if (p.level.GetTile(xpos, blockunder, zpos) != Block.air && p.level.GetTile(xpos, blockunder, zpos) != Block.air_switch && p.level.GetTile(xpos, blockunder, zpos) != Block.air_door && p.level.GetTile(xpos, blockunder, zpos) != Block.air_flood && p.level.GetTile(xpos, blockunder, zpos) != Block.air_flood_down && p.level.GetTile(xpos, blockunder, zpos) != Block.air_flood_layer && p.level.GetTile(xpos, blockunder, zpos) != Block.air_flood_up && p.level.GetTile(xpos, blockunder, zpos) != Block.air_portal && p.level.GetTile(xpos, blockunder, zpos) != Block.redflower && p.level.GetTile(xpos, blockunder, zpos) != Block.yellowflower && p.level.GetTile(xpos, blockunder, zpos) != Block.finiteWater && p.level.GetTile(xpos, blockunder, zpos) != Block.finiteLava && p.level.GetTile(xpos, blockunder, zpos) != Block.fire && p.level.GetTile(xpos, blockunder, zpos) != Block.water && p.level.GetTile(xpos, blockunder, zpos) != Block.water_door && p.level.GetTile(xpos, blockunder, zpos) != Block.water_portal && p.level.GetTile(xpos, blockunder, zpos) != Block.WaterDown && p.level.GetTile(xpos, blockunder, zpos) != Block.WaterFaucet && p.level.GetTile(xpos, blockunder, zpos) != Block.lava && p.level.GetTile(xpos, blockunder, zpos) != Block.lava_door && p.level.GetTile(xpos, blockunder, zpos) != Block.lava_fast && p.level.GetTile(xpos, blockunder, zpos) != Block.lava_portal && p.level.GetTile(xpos, blockunder, zpos) != Block.LavaDown && p.level.GetTile(xpos, blockunder, zpos) != Block.lavastill && p.level.GetTile(xpos, blockunder, zpos) != Block.Zero) { Player.SendMessage(p, "Teleported you down!"); - unchecked { p.SendPos((byte)-1, p.pos[0], (ushort)((posy + 1) * 32), p.pos[2], p.rot[0], p.rot[1]); } + p.SendPos(0xFF, p.pos[0], (ushort)((posy + 1) * 32), p.pos[2], p.rot[0], p.rot[1]); found = true; } } diff --git a/Commands/other/CmdGun.cs b/Commands/other/CmdGun.cs index 93e9fee7b..cd6d9e869 100644 --- a/Commands/other/CmdGun.cs +++ b/Commands/other/CmdGun.cs @@ -280,7 +280,7 @@ namespace MCGalaxy.Commands if (bp.ending == -1) try { - unchecked { p.SendPos((byte)-1, (ushort)(previous[previous.Count - 3].x * 32), (ushort)(previous[previous.Count - 3].y * 32 + 32), (ushort)(previous[previous.Count - 3].z * 32), p.rot[0], p.rot[1]); } + p.SendPos(0xFF, (ushort)(previous[previous.Count - 3].x * 32), (ushort)(previous[previous.Count - 3].y * 32 + 32), (ushort)(previous[previous.Count - 3].z * 32), p.rot[0], p.rot[1]); } catch { } if (bp.ending == 3) Thread.Sleep(400); diff --git a/Commands/other/CmdMove.cs b/Commands/other/CmdMove.cs index 634f1be88..d7603299e 100644 --- a/Commands/other/CmdMove.cs +++ b/Commands/other/CmdMove.cs @@ -86,7 +86,7 @@ namespace MCGalaxy.Commands x *= 32; x += 16; y *= 32; y += 32; z *= 32; z += 16; - unchecked { who.SendPos((byte)-1, x, y, z, p.rot[0], p.rot[1]); } + who.SendPos(0xFF, x, y, z, p.rot[0], p.rot[1]); if (p != who) Player.SendMessage(p, "Moved " + who.color + who.name); } catch { Player.SendMessage(p, "Invalid co-ordinates"); } diff --git a/Commands/other/CmdNick.cs b/Commands/other/CmdNick.cs index 34d1afd65..86cc88cb1 100644 --- a/Commands/other/CmdNick.cs +++ b/Commands/other/CmdNick.cs @@ -31,7 +31,7 @@ namespace MCGalaxy.Commands { who.DisplayName = who.name; Player.GlobalChat(who, who.color + who.prefix + who.DisplayName + "&g has reverted their nick to their original name.", false); - Player.GlobalDie(p, false); + Player.GlobalDespawn(p, false); Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); return; } @@ -40,7 +40,7 @@ namespace MCGalaxy.Commands if (newName != "") Player.GlobalChat(who, who.color + who.DisplayName + "&g has changed their nick to " + newName + "&g.", false); who.DisplayName = newName; - Player.GlobalDie(who, false); + Player.GlobalDespawn(who, false); Player.GlobalSpawn(who, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1], false); PlayerDB.Save(who); } diff --git a/Commands/other/CmdSlap.cs b/Commands/other/CmdSlap.cs index 3c269a77c..a406e5286 100644 --- a/Commands/other/CmdSlap.cs +++ b/Commands/other/CmdSlap.cs @@ -104,9 +104,8 @@ namespace MCGalaxy.Commands who.level.ChatLevel(who.color + who.DisplayName + Server.DefaultColor + " was slapped sky high by " + "the Console."); } foundHeight = 1000; - } - - unchecked { who.SendPos((byte)-1, who.pos[0], (ushort)(foundHeight * 32), who.pos[2], who.rot[0], who.rot[1]); } + } + who.SendPos(0xFF, who.pos[0], (ushort)(foundHeight * 32), who.pos[2], who.rot[0], who.rot[1]); } public override void Help(Player p) { diff --git a/Commands/other/CmdSpawn.cs b/Commands/other/CmdSpawn.cs index bc0fabe17..db6a48095 100644 --- a/Commands/other/CmdSpawn.cs +++ b/Commands/other/CmdSpawn.cs @@ -54,13 +54,9 @@ namespace MCGalaxy.Commands return; } } - unchecked - { - p.SendPos((byte)-1, x, y, z, - p.level.rotx, - p.level.roty); - } + p.SendPos(0xFF, x, y, z, p.level.rotx, p.level.roty); } + public override void Help(Player p) { Player.SendMessage(p, "/spawn - Teleports yourself to the spawn location."); diff --git a/Commands/other/CmdSummon.cs b/Commands/other/CmdSummon.cs index be4977d28..2cd674bc8 100644 --- a/Commands/other/CmdSummon.cs +++ b/Commands/other/CmdSummon.cs @@ -40,7 +40,7 @@ namespace MCGalaxy.Commands { if (pl.level == p.level && pl != p && p.group.Permission > pl.group.Permission) { - unchecked { pl.SendPos((byte)-1, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0); } + pl.SendPos(0xFF, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0); pl.SendMessage("You were summoned by " + p.color + p.DisplayName + Server.DefaultColor + "."); } } @@ -63,14 +63,13 @@ namespace MCGalaxy.Commands if (p.level != who.level) { Player.SendMessage(p, who.DisplayName + " is in a different Level. Forcefetching has started!"); - Level where = p.level; - Command.all.Find("goto").Use(who, where.name); + Command.all.Find("goto").Use(who, p.level.name); Thread.Sleep(1000); // Sleep for a bit while they load while (who.Loading) { Thread.Sleep(250); } } - unchecked { who.SendPos((byte)-1, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0); } + who.SendPos(0xFF, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0); who.SendMessage("You were summoned by " + p.color + p.DisplayName + Server.DefaultColor + "."); } public override void Help(Player p) diff --git a/Commands/other/CmdTp.cs b/Commands/other/CmdTp.cs index 11ccc731f..348c1a20b 100644 --- a/Commands/other/CmdTp.cs +++ b/Commands/other/CmdTp.cs @@ -74,7 +74,7 @@ namespace MCGalaxy.Commands while (who.Loading) { } } while (p.Loading) { } //Wait for player to spawn in new map - unchecked { p.SendPos((byte)-1, who.pos[0], who.pos[1], who.pos[2], who.rot[0], 0); } + p.SendPos(0xFF, who.pos[0], who.pos[1], who.pos[2], who.rot[0], 0); } return; } @@ -96,7 +96,7 @@ namespace MCGalaxy.Commands while (who.Loading) { } } while (p.Loading) { } //Wait for player to spawn in new map - unchecked { p.SendPos((byte)-1, who.pos[0], who.pos[1], who.pos[2], who.rot[0], 0); } + p.SendPos(0xFF, who.pos[0], who.pos[1], who.pos[2], who.rot[0], 0); } } } diff --git a/Commands/other/CmdTpA.cs b/Commands/other/CmdTpA.cs index 676956fc8..b6054dc85 100644 --- a/Commands/other/CmdTpA.cs +++ b/Commands/other/CmdTpA.cs @@ -109,7 +109,7 @@ namespace MCGalaxy.Commands while (who.Loading) { Thread.Sleep(250); } } - unchecked { who.SendPos((byte)-1, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0); } + who.SendPos(0xFF, p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0); } } public override void Help(Player p) diff --git a/Commands/other/CmdTpZone.cs b/Commands/other/CmdTpZone.cs index 41592300d..4cea9e899 100644 --- a/Commands/other/CmdTpZone.cs +++ b/Commands/other/CmdTpZone.cs @@ -88,7 +88,7 @@ namespace MCGalaxy.Commands } Level.Zone zone = p.level.ZoneList[zoneID]; - unchecked { p.SendPos((byte)-1, (ushort)(zone.bigX * 32 + 16), (ushort)(zone.bigY * 32 + 32), (ushort)(zone.bigZ * 32 + 16), p.rot[0], p.rot[1]); } + p.SendPos(0xFF, (ushort)(zone.bigX * 32 + 16), (ushort)(zone.bigY * 32 + 32), (ushort)(zone.bigZ * 32 + 16), p.rot[0], p.rot[1]); Player.SendMessage(p, "Teleported to zone &c" + zoneID + " &b(" + zone.bigX + ", " + zone.bigY + ", " + zone.bigZ + ") &f" + diff --git a/Commands/other/CmdWarp.cs b/Commands/other/CmdWarp.cs index be378c3c7..93d8a468b 100644 --- a/Commands/other/CmdWarp.cs +++ b/Commands/other/CmdWarp.cs @@ -146,7 +146,7 @@ namespace MCGalaxy.Commands Command.all.Find("goto").Use(p, lvl.name); while (p.Loading) { Thread.Sleep(250); } } - unchecked { p.SendPos((byte)-1, w.x, w.y, w.z, w.rotx, w.roty); } + p.SendPos(0xFF, w.x, w.y, w.z, w.rotx, w.roty); return; } else diff --git a/Commands/other/CmdXColor.cs b/Commands/other/CmdXColor.cs index 4ae8597a5..d43417f94 100644 --- a/Commands/other/CmdXColor.cs +++ b/Commands/other/CmdXColor.cs @@ -36,7 +36,7 @@ namespace MCGalaxy.Commands Player.GlobalChat(p, p.color + "*" + p.DisplayName + Server.DefaultColor + "'s color reverted to " + p.group.color + "their group's default" + Server.DefaultColor + ".", false); p.color = p.group.color; - Player.GlobalDie(p, false); + Player.GlobalDespawn(p, false); Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); p.SetPrefix(); return; @@ -53,7 +53,7 @@ namespace MCGalaxy.Commands Player.GlobalChat(p, p.color + "*" + p.DisplayName + Server.DefaultColor + "'s color changed to " + color + c.Name(color) + Server.DefaultColor + ".", false); p.color = color; - Player.GlobalDie(p, false); + Player.GlobalDespawn(p, false); Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); p.SetPrefix(); } diff --git a/Commands/other/CmdXNick.cs b/Commands/other/CmdXNick.cs index a74a58e8e..6af21fc6b 100644 --- a/Commands/other/CmdXNick.cs +++ b/Commands/other/CmdXNick.cs @@ -18,7 +18,7 @@ namespace MCGalaxy.Commands { p.DisplayName = p.name; Player.GlobalChat(p, p.color + p.prefix + p.DisplayName + "&g has reverted their nick to their original name.", false); - Player.GlobalDie(p, false); + Player.GlobalDespawn(p, false); Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); return; } @@ -30,7 +30,7 @@ namespace MCGalaxy.Commands if (newName != "") Player.GlobalChat(p, p.color + p.DisplayName + "&g has changed their nick to " + newName + "&g.", false); p.DisplayName = newName; - Player.GlobalDie(p, false); + Player.GlobalDespawn(p, false); Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); PlayerDB.Save(p); } diff --git a/GUI/PropertyWindow.Designer.cs b/GUI/PropertyWindow.Designer.cs index 7693c85a5..3f93aa843 100644 --- a/GUI/PropertyWindow.Designer.cs +++ b/GUI/PropertyWindow.Designer.cs @@ -251,7 +251,6 @@ namespace MCGalaxy.Gui this.chkRestart = new System.Windows.Forms.CheckBox(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.label7 = new System.Windows.Forms.Label(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); @@ -436,7 +435,6 @@ namespace MCGalaxy.Gui this.groupBox4.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); - ( (System.ComponentModel.ISupportInitialize) ( this.pictureBox1 ) ).BeginInit(); this.groupBox1.SuspendLayout(); this.groupBox17.SuspendLayout(); ( (System.ComponentModel.ISupportInitialize) ( this.updateTimeNumeric ) ).BeginInit(); @@ -2534,7 +2532,6 @@ namespace MCGalaxy.Gui this.tabPage1.Controls.Add( this.groupBox4 ); this.tabPage1.Controls.Add( this.groupBox2 ); this.tabPage1.Controls.Add( this.groupBox3 ); - this.tabPage1.Controls.Add( this.pictureBox1 ); this.tabPage1.Controls.Add( this.groupBox1 ); this.tabPage1.Controls.Add( this.groupBox17 ); this.tabPage1.Controls.Add( this.groupBox6 ); @@ -2759,16 +2756,6 @@ namespace MCGalaxy.Gui this.label7.TabIndex = 3; this.label7.Text = "Depth:"; // - // pictureBox1 - // - this.pictureBox1.Location = new System.Drawing.Point( 417, 35 ); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size( 68, 68 ); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.pictureBox1.TabIndex = 27; - this.pictureBox1.TabStop = false; - this.pictureBox1.Click += new System.EventHandler( this.pictureBox1_Click ); - // // groupBox1 // this.groupBox1.AutoSize = true; @@ -4529,7 +4516,6 @@ namespace MCGalaxy.Gui this.groupBox2.PerformLayout(); this.groupBox3.ResumeLayout( false ); this.groupBox3.PerformLayout(); - ( (System.ComponentModel.ISupportInitialize) ( this.pictureBox1 ) ).EndInit(); this.groupBox1.ResumeLayout( false ); this.groupBox1.PerformLayout(); this.groupBox17.ResumeLayout( false ); @@ -4733,7 +4719,6 @@ namespace MCGalaxy.Gui private System.Windows.Forms.GroupBox grpIRC; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.GroupBox groupBox6; private System.Windows.Forms.GroupBox groupBox4; private System.Windows.Forms.GroupBox groupBox3; diff --git a/GUI/PropertyWindow.cs b/GUI/PropertyWindow.cs index b0c783117..bbcd03c8a 100644 --- a/GUI/PropertyWindow.cs +++ b/GUI/PropertyWindow.cs @@ -1413,28 +1413,6 @@ txtBackupLocation.Text = folderDialog.SelectedPath; }*/ } - private void pictureBox1_Click(object sender, EventArgs e) { - try { - if ( !Directory.Exists("extra/images") ) - Directory.CreateDirectory("extra/images"); - if ( !File.Exists( "extra/images/mcpony.png" ) ) { - using ( WebClient WEB = new WebClient () ) { - WEB.DownloadFileAsync ( new Uri ( "http://comingsoon.tk/uploads/images/mcpony.png" ), "extra/images/mcpony.png" ); - WEB.DownloadFileCompleted += ( ea, args ) => { - if ( File.Exists ( "extra/images/mcpony.png" ) ) { - Image img = Image.FromFile ( "extra/images/mcpony.png" ); - pictureBox1.Image = img; - } - }; - } - } else { - Image img = Image.FromFile( "extra/images/mcpony.png" ); - pictureBox1.Image = img; - } - } - catch { } - } - private void cmbGlobalChatColor_SelectedIndexChanged(object sender, EventArgs e) { lblGlobalChatColor.BackColor = Color.FromName(cmbGlobalChatColor.Items[cmbGlobalChatColor.SelectedIndex].ToString()); } diff --git a/GUI/Window.cs b/GUI/Window.cs index 29a1e66d1..ee848e1c3 100644 --- a/GUI/Window.cs +++ b/GUI/Window.cs @@ -1647,12 +1647,7 @@ namespace MCGalaxy.Gui ushort x = (ushort)((0.5 + p.level.spawnx) * 32); ushort y = (ushort)((1 + p.level.spawny) * 32); ushort z = (ushort)((0.5 + p.level.spawnz) * 32); - unchecked - { - p.SendPos((byte)-1, x, y, z, - p.level.rotx, - p.level.roty); - } + p.SendPos(0xFF, x, y, z, p.level.rotx, p.level.roty); PlayersTextBox.AppendTextAndScroll("Sent player to spawn"); } diff --git a/Games/CTF/Auto_CTF.cs b/Games/CTF/Auto_CTF.cs index eadd5f1fb..be5a34e67 100644 --- a/Games/CTF/Auto_CTF.cs +++ b/Games/CTF/Auto_CTF.cs @@ -101,10 +101,10 @@ namespace MCGalaxy yy = (ushort)(rand.Next(0, mainlevel.Height)); zz = (ushort)(rand.Next(0, mainlevel.Length)); } - unchecked { p1.SendPos((byte)-1, (ushort)(xx * 32), (ushort)(yy * 32), (ushort)(zz * 32), p1.rot[0], p1.rot[1]); } + p1.SendPos(0xFF, (ushort)(xx * 32), (ushort)(yy * 32), (ushort)(zz * 32), p1.rot[0], p1.rot[1]); } else - unchecked { p1.SendPos((byte)-1, spawnx, spawny, spawnz, p1.rot[0], p1.rot[1]); } + p1.SendPos(0xFF, spawnx, spawny, spawnz, p1.rot[0], p1.rot[1]); } public Base(ushort x, ushort y, ushort z, Teams team) diff --git a/Games/CountdownGame.cs b/Games/CountdownGame.cs index 6edc3a83f..62e19fe53 100644 --- a/Games/CountdownGame.cs +++ b/Games/CountdownGame.cs @@ -107,9 +107,9 @@ namespace MCGalaxy } mapon.ChatLevel("Countdown is about to start!!"); mapon.permissionbuild = LevelPermission.Nobody; - ushort x1 = (ushort)((15.5) * 32); - ushort y1 = (ushort)((30) * 32); - ushort z1 = (ushort)((15.5) * 32); + ushort x1 = (ushort)(15.5 * 32); + ushort y1 = (ushort)(30 * 32); + ushort z1 = (ushort)(15.5 * 32); foreach (Player player in players) { if (player.level != mapon) @@ -120,10 +120,7 @@ namespace MCGalaxy // Sleep for a bit while they load while (player.Loading) { Thread.Sleep(250); } } - unchecked - { - player.SendSpawn((byte)-1, player.name, x1, y1, z1, (byte)0, (byte)0); - } + player.SendSpawn(0xFF, player.name, x1, y1, z1, (byte)0, (byte)0); } { CountdownGame.squaresleft.Clear(); diff --git a/Games/ZombieGame.cs b/Games/ZombieGame.cs index 6b4dffd69..b0ae04d1d 100644 --- a/Games/ZombieGame.cs +++ b/Games/ZombieGame.cs @@ -151,7 +151,7 @@ namespace MCGalaxy Player.GlobalMessage(player.color + player.name + Server.DefaultColor + " started the infection!"); player.infected = true; player.color = c.red; - Player.GlobalDie(player, false); + Player.GlobalDespawn(player, false); Player.GlobalSpawn(player, player.pos[0], player.pos[1], player.pos[2], player.rot[0], player.rot[1], false); Server.zombieRound = true; @@ -184,7 +184,7 @@ namespace MCGalaxy if (player1.color != c.red) { player1.color = c.red; - Player.GlobalDie(player1, false); + Player.GlobalDespawn(player1, false); Player.GlobalSpawn(player1, player1.pos[0], player1.pos[1], player1.pos[2], player1.rot[0], player1.rot[1], false); } alive.ForEach(delegate(Player player2) @@ -192,7 +192,7 @@ namespace MCGalaxy if (player2.color != player2.group.color) { player2.color = player2.group.color; - Player.GlobalDie(player2, false); + Player.GlobalDespawn(player2, false); Player.GlobalSpawn(player2, player2.pos[0], player2.pos[1], player2.pos[2], player2.rot[0], player2.rot[1], false); } if (player2.pos[0] / 32 == player1.pos[0] / 32 || player2.pos[0] / 32 == player1.pos[0] / 32 + 1 || player2.pos[0] / 32 == player1.pos[0] / 32 - 1) @@ -239,7 +239,7 @@ namespace MCGalaxy } player2.color = c.red; player1.playersInfected = player1.playersInfected++; - Player.GlobalDie(player2, false); + Player.GlobalDespawn(player2, false); Player.GlobalSpawn(player2, player2.pos[0], player2.pos[1], player2.pos[2], player2.rot[0], player2.rot[1], false); Thread.Sleep(500); } @@ -319,7 +319,7 @@ namespace MCGalaxy { if (!winners.CheckIfInsideBlock() && aliveCount == 0 && winners.level.name == currentLevelName) { - Player.GlobalDie(winners, false); + Player.GlobalDespawn(winners, false); Player.GlobalSpawn(winners, winners.pos[0], winners.pos[1], winners.pos[2], winners.rot[0], winners.rot[1], false); Random random2 = new Random(); int randomInt = 0; @@ -338,7 +338,7 @@ namespace MCGalaxy } else if (!winners.CheckIfInsideBlock() && (aliveCount == 1 && !winners.infected) && winners.level.name == currentLevelName) { - Player.GlobalDie(winners, false); + Player.GlobalDespawn(winners, false); Player.GlobalSpawn(winners, winners.pos[0], winners.pos[1], winners.pos[2], winners.rot[0], winners.rot[1], false); Random random2 = new Random(); int randomInt = 0; @@ -358,7 +358,7 @@ namespace MCGalaxy { player.infected = false; player.color = player.group.color; - Player.GlobalDie(player, false); + Player.GlobalDespawn(player, false); Player.GlobalSpawn(player, player.pos[0], player.pos[1], player.pos[2], player.rot[0], player.rot[1], false); if (player.level.name == currentLevelName) { @@ -493,7 +493,7 @@ namespace MCGalaxy } Player.GlobalMessage(alive[firstinfect].color + alive[firstinfect].name + Server.DefaultColor + " continued the infection!"); alive[firstinfect].color = c.red; - Player.GlobalDie(alive[firstinfect], false); + Player.GlobalDespawn(alive[firstinfect], false); Player.GlobalSpawn(alive[firstinfect], alive[firstinfect].pos[0], alive[firstinfect].pos[1], alive[firstinfect].pos[2], alive[firstinfect].rot[0], alive[firstinfect].rot[1], false); infectd.Add(alive[firstinfect]); alive.Remove(alive[firstinfect]); @@ -534,7 +534,7 @@ namespace MCGalaxy alive.Remove(p); p.infected = true; p.color = c.red; - Player.GlobalDie(p, false); + Player.GlobalDespawn(p, false); Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); aliveCount = alive.Count; } @@ -547,7 +547,7 @@ namespace MCGalaxy alive.Add(p); p.infected = false; p.color = p.group.color; - Player.GlobalDie(p, false); + Player.GlobalDespawn(p, false); Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); aliveCount = alive.Count; } diff --git a/MCGalaxy_.csproj b/MCGalaxy_.csproj index 09a9dc75a..d4dfe61f8 100644 --- a/MCGalaxy_.csproj +++ b/MCGalaxy_.csproj @@ -256,7 +256,6 @@ - diff --git a/Network/Player.Networking.cs b/Network/Player.Networking.cs index f08fd7236..96d1d06a2 100644 --- a/Network/Player.Networking.cs +++ b/Network/Player.Networking.cs @@ -450,7 +450,7 @@ namespace MCGalaxy { } //TODO: Figure a way to SendPos without changing rotation - public void SendDie(byte id) { + public void SendDespawn(byte id) { SendRaw(Opcode.RemoveEntity, id); } diff --git a/Player/Player.CPE.cs b/Player/Player.CPE.cs index b266885d4..3b2e8ab48 100644 --- a/Player/Player.CPE.cs +++ b/Player/Player.CPE.cs @@ -88,7 +88,7 @@ namespace MCGalaxy if (HasExtension("ChangeModel")) { if (p == this) - unchecked { SendChangeModel((byte)-1, model); } + SendChangeModel(0xFF, model); else SendChangeModel(p.id, p.model); } } diff --git a/Player/Player.cs b/Player/Player.cs index b55537d8b..63745cead 100644 --- a/Player/Player.cs +++ b/Player/Player.cs @@ -1456,7 +1456,7 @@ namespace MCGalaxy { return; /*if (CheckIfInsideBlock()) { -unchecked { this.SendPos((byte)-1, (ushort)(clippos[0] - 18), (ushort)(clippos[1] - 18), (ushort)(clippos[2] - 18), cliprot[0], cliprot[1]); } +this.SendPos(0xFF, (ushort)(clippos[0] - 18), (ushort)(clippos[1] - 18), (ushort)(clippos[2] - 18), cliprot[0], cliprot[1]); return; }*/ byte thisid = message[0]; @@ -1477,7 +1477,7 @@ return; pos = new ushort[3] { x, y, z }; rot = new byte[2] { rotx, roty }; if ( countdowntempx != NetUtils.ReadU16(message, 1) || countdowntempz != NetUtils.ReadU16(message, 5) ) { - unchecked { this.SendPos((byte)-1, pos[0], pos[1], pos[2], rot[0], rot[1]); } + this.SendPos(0xFF, pos[0], pos[1], pos[2], rot[0], rot[1]); } } else { ushort x = NetUtils.ReadU16(message, 1); @@ -1486,11 +1486,11 @@ return; if ( !this.referee && Server.noRespawn && Server.ZombieModeOn ) { if ( this.pos[0] >= x + 70 || this.pos[0] <= x - 70 ) { - unchecked { SendPos((byte)-1, pos[0], pos[1], pos[2], rot[0], rot[1]); } + SendPos(0xFF, pos[0], pos[1], pos[2], rot[0], rot[1]); return; } if ( this.pos[2] >= z + 70 || this.pos[2] <= z - 70 ) { - unchecked { SendPos((byte)-1, pos[0], pos[1], pos[2], rot[0], rot[1]); } + SendPos(0xFF, pos[0], pos[1], pos[2], rot[0], rot[1]); return; } } @@ -1506,7 +1506,7 @@ return; PlayerRotate(this, rot); PlayerRotateEvent.Call(this, rot); if ( cancelmove ) { - unchecked { SendPos((byte)-1, pos[0], pos[1], pos[2], rot[0], rot[1]); } + SendPos(0xFF, pos[0], pos[1], pos[2], rot[0], rot[1]); return; } byte rotx = message[7]; @@ -2233,6 +2233,7 @@ return; case "colour": cmd = "color"; break; case "materials": cmd = "blocks"; break; case "zz": cmd = "static"; message = "cuboid"; break; + case "fetch": cmd = "summon"; break; default: retry = false; break; //Unknown command, then } @@ -2506,16 +2507,16 @@ return; { p.pos = new ushort[3] { x, y, z }; p.rot = new byte[2] { rotx, roty }; p.oldpos = p.pos; p.basepos = p.pos; p.oldrot = p.rot; - unchecked { p.SendSpawn((byte)-1, from.color + from.name + possession, x, y, z, rotx, roty); } + p.SendSpawn(0xFF, from.color + from.name + possession, x, y, z, rotx, roty); } } }); } - public static void GlobalDie(Player from, bool self) { + public static void GlobalDespawn(Player from, bool self) { players.ForEach(delegate(Player p) { if ( p.level != from.level || ( from.hidden && !self ) ) { return; } - if ( p != from ) { p.SendDie(from.id); } - else if ( self ) { p.SendDie(255); } + if ( p != from ) { p.SendDespawn(from.id); } + else if ( self ) { p.SendDespawn(255); } }); } @@ -2527,7 +2528,7 @@ return; } marker = " (" + controller.color + controller.name + color + ")"; } - GlobalDie(this, true); + GlobalDespawn(this, true); GlobalSpawn(this, pos[0], pos[1], pos[2], rot[0], rot[1], true, marker); return true; } @@ -2633,7 +2634,7 @@ return; tntwarsgame.SendAllPlayersMessage("TNT Wars: " + color + name + Server.DefaultColor + " has left TNT Wars!"); } - GlobalDie(this, false); + GlobalDespawn(this, false); if ( kickString == "Disconnected." || kickString.IndexOf("Server shutdown") != -1 || kickString == Server.customShutdownMessage ) { if ( !Directory.Exists("text/logout") ) { Directory.CreateDirectory("text/logout"); @@ -2829,7 +2830,7 @@ foreach (Player p in players) if (p.id == i) { goto Next; } } return i; Next: continue; -} unchecked { return (byte)-1; }*/ +} unchecked { return 0xFF; }*/ for ( byte i = 0; i < 255; i++ ) { bool used = players.Any(p => p.id == i); diff --git a/Player/PlayerBot.cs b/Player/PlayerBot.cs index 64153f7b0..9a7f6cbaf 100644 --- a/Player/PlayerBot.cs +++ b/Player/PlayerBot.cs @@ -407,7 +407,7 @@ namespace MCGalaxy Player.players.ForEach(delegate(Player p) { if (p.level != level) { return; } - p.SendDie(id); + p.SendDespawn(id); }); playerbots.Remove(this); //dont know if this is allowed really calling itself to kind of die } diff --git a/Player/Team.cs b/Player/Team.cs index c9c19c985..aa78c639f 100644 --- a/Player/Team.cs +++ b/Player/Team.cs @@ -43,7 +43,7 @@ namespace MCGalaxy { if (p.team != null) { p.team.RemoveMember(p); } p.team = this; - Player.GlobalDie(p, false); + Player.GlobalDespawn(p, false); //p.CTFtempcolor = p.color; //p.CTFtempprefix = p.prefix; p.color = "&" + color; @@ -61,7 +61,7 @@ namespace MCGalaxy if (p.team == this) { p.team = null; - Player.GlobalDie(p, false); + Player.GlobalDespawn(p, false); //p.color = p.CTFtempcolor; //p.prefix = p.CTFtempprefix; //p.carryingFlag = false; @@ -89,10 +89,7 @@ namespace MCGalaxy ushort y1 = (ushort)((1 + y) * 32); ushort z1 = (ushort)((0.5 + z) * 32); rotx = spawns[rnd].rotx; - unchecked - { - p.SendSpawn((byte)-1, p.name, x1, y1, z1, (byte)rotx, 0); - } + p.SendSpawn((byte)0xFF, p.name, x1, y1, z1, (byte)rotx, 0); //p.health = 100; } else @@ -102,11 +99,7 @@ namespace MCGalaxy ushort z = (ushort)((0.5 + mapOn.spawnz) * 32); ushort rotx = mapOn.rotx; ushort roty = mapOn.roty; - - unchecked - { - p.SendSpawn((byte)-1, p.name, x, y, z, (byte)rotx, (byte)roty); - } + p.SendSpawn(0xFF, p.name, x, y, z, (byte)rotx, (byte)roty); } //p.spawning = false; } diff --git a/Player/Waypoint.cs b/Player/Waypoint.cs index 7083b0e4a..16b53d1c0 100644 --- a/Player/Waypoint.cs +++ b/Player/Waypoint.cs @@ -54,7 +54,7 @@ namespace MCGalaxy { Command.all.Find("goto").Use(p, lvl.name); while ( p.Loading ) { Thread.Sleep(250); } } - unchecked { p.SendPos((byte)-1, wp.x, wp.y, wp.z, wp.rotx, wp.roty); } + p.SendPos(0xFF, wp.x, wp.y, wp.z, wp.rotx, wp.roty); Player.SendMessage(p, "Sent you to waypoint"); } else { Player.SendMessage(p, "The map that that waypoint is on isn't loaded right now (" + wp.lvlname + ")"); return; } diff --git a/Server/Server.cs b/Server/Server.cs index 8b5ba5e1e..e3e673d95 100644 --- a/Server/Server.cs +++ b/Server/Server.cs @@ -937,7 +937,7 @@ namespace MCGalaxy if (p.frozen) { - unchecked { p.SendPos((byte)-1, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1]); } continue; + p.SendPos(0xFF, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1]); continue; } else if (p.following != "") { @@ -957,11 +957,11 @@ namespace MCGalaxy } if (p.canBuild) { - unchecked { p.SendPos((byte)-1, who.pos[0], (ushort)(who.pos[1] - 16), who.pos[2], who.rot[0], who.rot[1]); } + p.SendPos(0xFF, who.pos[0], (ushort)(who.pos[1] - 16), who.pos[2], who.rot[0], who.rot[1]); } else { - unchecked { p.SendPos((byte)-1, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1]); } + p.SendPos(0xFF, who.pos[0], who.pos[1], who.pos[2], who.rot[0], who.rot[1]); } } else if (p.possess != "")