diff --git a/MCGalaxy/Commands/Moderation/CmdHide.cs b/MCGalaxy/Commands/Moderation/CmdHide.cs index 9d0ee36fd..bbd18c1a2 100644 --- a/MCGalaxy/Commands/Moderation/CmdHide.cs +++ b/MCGalaxy/Commands/Moderation/CmdHide.cs @@ -25,68 +25,63 @@ namespace MCGalaxy.Commands.Moderation { public override LevelPermission defaultRank { get { return LevelPermission.Operator; } } public override bool SuperUseable { get { return false; } } public override CommandPerm[] ExtraPerms { - get { return new[] { new CommandPerm(LevelPermission.Admin, "+ can hide/unhide without showing a message to ops") }; } + get { return new[] { new CommandPerm(LevelPermission.Admin, "+ can hide silently") }; } } public override CommandAlias[] Aliases { get { return new CommandAlias[] { new CommandAlias("XHide", "silent") }; } } public override void Use(Player p, string message) { - if (message.CaselessEq("check")) { - string state = p.hidden ? "" : "not "; - Player.Message(p, "You are " + state + "currently hidden!"); return; - } if (message.Length > 0 && p.possess.Length > 0) { Player.Message(p, "Stop your current possession first."); return; } - bool messageOps = true; + bool announceToOps = true; if (message.CaselessEq("silent")) { if (!CheckExtraPerm(p, 1)) return; - messageOps = false; + announceToOps = false; } Command opchat = Command.all.FindByName("OpChat"); - Command adminchat = Command.all.FindByName("AdminChat"); + Entities.GlobalDespawn(p, false); + p.hidden = !p.hidden; - //Possible to use /hide myrank, but it accomplishes the same as regular /hide if you use it on yourself. if (message.CaselessEq("myrank")) { p.otherRankHidden = !p.otherRankHidden; p.hidden = p.otherRankHidden; } - if (p.hidden) { - Entities.GlobalDespawn(p, false); - if (messageOps && !p.otherRankHidden) + if (p.hidden) { + if (announceToOps && !p.otherRankHidden) { Chat.MessageOps("To Ops -" + p.ColoredName + "%S- is now &finvisible%S."); + } string discMsg = PlayerDB.GetLogoutMessage(p); Chat.MessageGlobal(p, "&c- " + p.FullName + " %S" + discMsg, false); Server.IRC.Say(p.DisplayName + " %Sleft the game (disconnected%S)"); - if (messageOps && !p.opchat) opchat.Use(p, message); + if (announceToOps && !p.opchat) opchat.Use(p, ""); Server.hidden.AddIfNotExists(p.name); - } else { - Entities.GlobalSpawn(p, false); + } else { p.otherRankHidden = false; p.oHideRank = LevelPermission.Null; - if (messageOps) - Chat.MessageAdmins("To Admins -" + p.ColoredName + "%S- is now &fvisible%S."); + if (announceToOps) { + Chat.MessageOps("To Ops -" + p.ColoredName + "%S- is now &fvisible%S."); + } Chat.MessageGlobal(p, "&a+ " + p.FullName + " %S" + PlayerDB.GetLoginMessage(p), false); Server.IRC.Say(p.DisplayName + " %Sjoined the game"); - if (messageOps && p.opchat) opchat.Use(p, message); - if (p.adminchat) adminchat.Use(p, message); + if (announceToOps && p.opchat) opchat.Use(p, ""); Server.hidden.Remove(p.name); } + Entities.GlobalSpawn(p, false); TabList.Add(p, p, Entities.SelfID); Server.hidden.Save(false); } public override void Help(Player p) { Player.Message(p, "%T/Hide %H- Toggles your visibility to other players, also toggles opchat."); - Player.Message(p, "%T/Hide check %H- Checks your hidden status."); - Player.Message(p, "%T/Hide silent %H- hides without sending a message to other ops/admins."); + Player.Message(p, "%T/Hide silent %H- Hides without sending a message to opchat"); Player.Message(p, "%HUse %T/OHide %Hto hide other players."); } } diff --git a/MCGalaxy/Economy/ZombieItems.cs b/MCGalaxy/Economy/ZombieItems.cs index 56da5c1e4..c98958d67 100644 --- a/MCGalaxy/Economy/ZombieItems.cs +++ b/MCGalaxy/Economy/ZombieItems.cs @@ -158,7 +158,7 @@ namespace MCGalaxy.Eco { Player.Message(p, "Lasts for &a{0} %Sseconds. You can buy &a{1} %Smore this round.", Duration, left); Server.zombie.Map.ChatLevel(p.ColoredName + " %Svanished. &a*POOF*"); - Entities.GlobalDespawn(p, false); + Entities.GlobalDespawn(p, false, false); Economy.MakePurchase(p, Price, "%3Invisibility: " + Duration); } diff --git a/MCGalaxy/Entity/Entities.cs b/MCGalaxy/Entity/Entities.cs index fbd70e6d8..bf4fe9169 100644 --- a/MCGalaxy/Entity/Entities.cs +++ b/MCGalaxy/Entity/Entities.cs @@ -30,9 +30,9 @@ namespace MCGalaxy { #region Spawning / Despawning /// Respawns this player to all players (including self) that can see the player in the current world. - public static void GlobalRespawn(Player p) { - GlobalDespawn(p, true); - GlobalSpawn(p, true); + public static void GlobalRespawn(Player p, bool self = true) { + GlobalDespawn(p, self); + GlobalSpawn(p, self); } /// Spawns this player to all other players that can see the player in the current world. @@ -59,9 +59,9 @@ namespace MCGalaxy { } } - /// Despawns this player to all other players that cannot - /// (or can if 'toVisible' is true) see the player in the current world. - public static void GlobalDespawn(Player p, bool self, bool toVisible = false) { + /// Despawns this player to all other players that can + /// (or cannot if 'toVisible' is false) see the player in the current world. + public static void GlobalDespawn(Player p, bool self, bool toVisible = true) { Player[] players = PlayerInfo.Online.Items; TabList.RemoveAll(p, self, toVisible); @@ -116,7 +116,7 @@ namespace MCGalaxy { foreach (Player other in players) { if (p.level == other.level && p != other) Despawn(p, other); } - GlobalDespawn(p, true, true); + GlobalDespawn(p, true); if (!bots) return; PlayerBot[] botsList = p.level.Bots.Items; diff --git a/MCGalaxy/Games/CTF/CtfTeamOld.cs b/MCGalaxy/Games/CTF/CtfTeamOld.cs index 809c5255b..1b0c8ec1e 100644 --- a/MCGalaxy/Games/CTF/CtfTeamOld.cs +++ b/MCGalaxy/Games/CTF/CtfTeamOld.cs @@ -43,7 +43,6 @@ namespace MCGalaxy.Games { if (p.Game.team != null) { p.Game.team.RemoveMember(p); } p.Game.team = this; - Entities.GlobalDespawn(p, false); //p.CTFtempcolor = p.color; //p.CTFtempprefix = p.prefix; p.color = "&" + color; @@ -52,7 +51,7 @@ namespace MCGalaxy.Games p.prefix = p.color + "[" + Colors.Name(color).ToUpper() + "] "; players.Add(p); mapOn.ChatLevel(p.ColoredName + " %Shas joined the " + teamstring + "."); - Entities.GlobalSpawn(p, false); + Entities.GlobalRespawn(p, false); } } @@ -61,14 +60,13 @@ namespace MCGalaxy.Games if (p.Game.team == this) { p.Game.team = null; - Entities.GlobalDespawn(p, false); //p.color = p.CTFtempcolor; //p.prefix = p.CTFtempprefix; //p.carryingFlag = false; p.Game.hasflag = null; players.Remove(p); mapOn.ChatLevel(p.ColoredName + " %Shas left the " + teamstring + "."); - Entities.GlobalSpawn(p, false); + Entities.GlobalRespawn(p, false); } } diff --git a/MCGalaxy/Games/ZombieSurvival/Rewards.cs b/MCGalaxy/Games/ZombieSurvival/Rewards.cs index 19a82978f..21fa2e826 100644 --- a/MCGalaxy/Games/ZombieSurvival/Rewards.cs +++ b/MCGalaxy/Games/ZombieSurvival/Rewards.cs @@ -100,8 +100,7 @@ namespace MCGalaxy.Games.ZS { pl.SetMoney(pl.money + 1); } - Entities.GlobalDespawn(pl, false); - Entities.GlobalSpawn(pl, false); + Entities.GlobalRespawn(pl, false); TabList.Add(pl, pl, Entities.SelfID); HUD.UpdateTertiary(pl); } diff --git a/MCGalaxy/Games/ZombieSurvival/ZSPlugin.cs b/MCGalaxy/Games/ZombieSurvival/ZSPlugin.cs index 616695904..459d02db6 100644 --- a/MCGalaxy/Games/ZombieSurvival/ZSPlugin.cs +++ b/MCGalaxy/Games/ZombieSurvival/ZSPlugin.cs @@ -121,7 +121,7 @@ namespace MCGalaxy.Games.ZS { p.Send(Hacks.MakeHackControl(p)); } else { HandlePlayerDisconnect(p, null); - Entities.GlobalDespawn(p, false, true); + Entities.GlobalDespawn(p, false, false); p.Game.Referee = true; if (p.Supports(CpeExt.HackControl)) @@ -129,7 +129,7 @@ namespace MCGalaxy.Games.ZS { } Entities.GlobalSpawn(p, false, ""); - TabList.Add(p, p, Entities.SelfID); + TabList.Update(p, true); p.SetPrefix(); } diff --git a/MCGalaxy/Games/ZombieSurvival/ZombieGame.Core.cs b/MCGalaxy/Games/ZombieSurvival/ZombieGame.Core.cs index 929326bc9..d9fbcffa2 100644 --- a/MCGalaxy/Games/ZombieSurvival/ZombieGame.Core.cs +++ b/MCGalaxy/Games/ZombieSurvival/ZombieGame.Core.cs @@ -313,8 +313,7 @@ namespace MCGalaxy.Games { static void UpdatePlayerColor(Player p, string color) { if (p.Game.lastSpawnColor == color) return; p.Game.lastSpawnColor = color; - Entities.GlobalDespawn(p, false); - Entities.GlobalSpawn(p, false); + Entities.GlobalRespawn(p, false); TabList.Add(p, p, Entities.SelfID); }