mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
Fix /hide not updating tab list. (Thanks VenkSociety)
This commit is contained in:
parent
c36334e64f
commit
b152ca9726
@ -25,30 +25,26 @@ namespace MCGalaxy.Commands.Moderation {
|
|||||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||||
public override bool SuperUseable { get { return false; } }
|
public override bool SuperUseable { get { return false; } }
|
||||||
public override CommandPerm[] ExtraPerms {
|
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 {
|
public override CommandAlias[] Aliases {
|
||||||
get { return new CommandAlias[] { new CommandAlias("XHide", "silent") }; }
|
get { return new CommandAlias[] { new CommandAlias("XHide", "silent") }; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
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) {
|
if (message.Length > 0 && p.possess.Length > 0) {
|
||||||
Player.Message(p, "Stop your current possession first."); return;
|
Player.Message(p, "Stop your current possession first."); return;
|
||||||
}
|
}
|
||||||
bool messageOps = true;
|
bool announceToOps = true;
|
||||||
if (message.CaselessEq("silent")) {
|
if (message.CaselessEq("silent")) {
|
||||||
if (!CheckExtraPerm(p, 1)) return;
|
if (!CheckExtraPerm(p, 1)) return;
|
||||||
messageOps = false;
|
announceToOps = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Command opchat = Command.all.FindByName("OpChat");
|
Command opchat = Command.all.FindByName("OpChat");
|
||||||
Command adminchat = Command.all.FindByName("AdminChat");
|
Entities.GlobalDespawn(p, false);
|
||||||
p.hidden = !p.hidden;
|
|
||||||
|
|
||||||
|
p.hidden = !p.hidden;
|
||||||
//Possible to use /hide myrank, but it accomplishes the same as regular /hide if you use it on yourself.
|
//Possible to use /hide myrank, but it accomplishes the same as regular /hide if you use it on yourself.
|
||||||
if (message.CaselessEq("myrank")) {
|
if (message.CaselessEq("myrank")) {
|
||||||
p.otherRankHidden = !p.otherRankHidden;
|
p.otherRankHidden = !p.otherRankHidden;
|
||||||
@ -56,37 +52,36 @@ namespace MCGalaxy.Commands.Moderation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (p.hidden) {
|
if (p.hidden) {
|
||||||
Entities.GlobalDespawn(p, false);
|
if (announceToOps && !p.otherRankHidden) {
|
||||||
if (messageOps && !p.otherRankHidden)
|
|
||||||
Chat.MessageOps("To Ops -" + p.ColoredName + "%S- is now &finvisible%S.");
|
Chat.MessageOps("To Ops -" + p.ColoredName + "%S- is now &finvisible%S.");
|
||||||
|
}
|
||||||
|
|
||||||
string discMsg = PlayerDB.GetLogoutMessage(p);
|
string discMsg = PlayerDB.GetLogoutMessage(p);
|
||||||
Chat.MessageGlobal(p, "&c- " + p.FullName + " %S" + discMsg, false);
|
Chat.MessageGlobal(p, "&c- " + p.FullName + " %S" + discMsg, false);
|
||||||
Server.IRC.Say(p.DisplayName + " %Sleft the game (disconnected%S)");
|
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);
|
Server.hidden.AddIfNotExists(p.name);
|
||||||
} else {
|
} else {
|
||||||
Entities.GlobalSpawn(p, false);
|
|
||||||
p.otherRankHidden = false;
|
p.otherRankHidden = false;
|
||||||
p.oHideRank = LevelPermission.Null;
|
p.oHideRank = LevelPermission.Null;
|
||||||
if (messageOps)
|
if (announceToOps) {
|
||||||
Chat.MessageAdmins("To Admins -" + p.ColoredName + "%S- is now &fvisible%S.");
|
Chat.MessageOps("To Ops -" + p.ColoredName + "%S- is now &fvisible%S.");
|
||||||
|
}
|
||||||
|
|
||||||
Chat.MessageGlobal(p, "&a+ " + p.FullName + " %S" + PlayerDB.GetLoginMessage(p), false);
|
Chat.MessageGlobal(p, "&a+ " + p.FullName + " %S" + PlayerDB.GetLoginMessage(p), false);
|
||||||
Server.IRC.Say(p.DisplayName + " %Sjoined the game");
|
Server.IRC.Say(p.DisplayName + " %Sjoined the game");
|
||||||
if (messageOps && p.opchat) opchat.Use(p, message);
|
if (announceToOps && p.opchat) opchat.Use(p, "");
|
||||||
if (p.adminchat) adminchat.Use(p, message);
|
|
||||||
Server.hidden.Remove(p.name);
|
Server.hidden.Remove(p.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Entities.GlobalSpawn(p, false);
|
||||||
TabList.Add(p, p, Entities.SelfID);
|
TabList.Add(p, p, Entities.SelfID);
|
||||||
Server.hidden.Save(false);
|
Server.hidden.Save(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
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 %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 opchat");
|
||||||
Player.Message(p, "%T/Hide silent %H- hides without sending a message to other ops/admins.");
|
|
||||||
Player.Message(p, "%HUse %T/OHide %Hto hide other players.");
|
Player.Message(p, "%HUse %T/OHide %Hto hide other players.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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);
|
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*");
|
Server.zombie.Map.ChatLevel(p.ColoredName + " %Svanished. &a*POOF*");
|
||||||
Entities.GlobalDespawn(p, false);
|
Entities.GlobalDespawn(p, false, false);
|
||||||
Economy.MakePurchase(p, Price, "%3Invisibility: " + Duration);
|
Economy.MakePurchase(p, Price, "%3Invisibility: " + Duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,9 +30,9 @@ namespace MCGalaxy {
|
|||||||
#region Spawning / Despawning
|
#region Spawning / Despawning
|
||||||
|
|
||||||
/// <summary> Respawns this player to all players (including self) that can see the player in the current world. </summary>
|
/// <summary> Respawns this player to all players (including self) that can see the player in the current world. </summary>
|
||||||
public static void GlobalRespawn(Player p) {
|
public static void GlobalRespawn(Player p, bool self = true) {
|
||||||
GlobalDespawn(p, true);
|
GlobalDespawn(p, self);
|
||||||
GlobalSpawn(p, true);
|
GlobalSpawn(p, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Spawns this player to all other players that can see the player in the current world. </summary>
|
/// <summary> Spawns this player to all other players that can see the player in the current world. </summary>
|
||||||
@ -59,9 +59,9 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Despawns this player to all other players that cannot
|
/// <summary> Despawns this player to all other players that can
|
||||||
/// (or can if 'toVisible' is true) see the player in the current world. </summary>
|
/// (or cannot if 'toVisible' is false) see the player in the current world. </summary>
|
||||||
public static void GlobalDespawn(Player p, bool self, bool toVisible = false) {
|
public static void GlobalDespawn(Player p, bool self, bool toVisible = true) {
|
||||||
Player[] players = PlayerInfo.Online.Items;
|
Player[] players = PlayerInfo.Online.Items;
|
||||||
TabList.RemoveAll(p, self, toVisible);
|
TabList.RemoveAll(p, self, toVisible);
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ namespace MCGalaxy {
|
|||||||
foreach (Player other in players) {
|
foreach (Player other in players) {
|
||||||
if (p.level == other.level && p != other) Despawn(p, other);
|
if (p.level == other.level && p != other) Despawn(p, other);
|
||||||
}
|
}
|
||||||
GlobalDespawn(p, true, true);
|
GlobalDespawn(p, true);
|
||||||
|
|
||||||
if (!bots) return;
|
if (!bots) return;
|
||||||
PlayerBot[] botsList = p.level.Bots.Items;
|
PlayerBot[] botsList = p.level.Bots.Items;
|
||||||
|
@ -43,7 +43,6 @@ namespace MCGalaxy.Games
|
|||||||
{
|
{
|
||||||
if (p.Game.team != null) { p.Game.team.RemoveMember(p); }
|
if (p.Game.team != null) { p.Game.team.RemoveMember(p); }
|
||||||
p.Game.team = this;
|
p.Game.team = this;
|
||||||
Entities.GlobalDespawn(p, false);
|
|
||||||
//p.CTFtempcolor = p.color;
|
//p.CTFtempcolor = p.color;
|
||||||
//p.CTFtempprefix = p.prefix;
|
//p.CTFtempprefix = p.prefix;
|
||||||
p.color = "&" + color;
|
p.color = "&" + color;
|
||||||
@ -52,7 +51,7 @@ namespace MCGalaxy.Games
|
|||||||
p.prefix = p.color + "[" + Colors.Name(color).ToUpper() + "] ";
|
p.prefix = p.color + "[" + Colors.Name(color).ToUpper() + "] ";
|
||||||
players.Add(p);
|
players.Add(p);
|
||||||
mapOn.ChatLevel(p.ColoredName + " %Shas joined the " + teamstring + ".");
|
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)
|
if (p.Game.team == this)
|
||||||
{
|
{
|
||||||
p.Game.team = null;
|
p.Game.team = null;
|
||||||
Entities.GlobalDespawn(p, false);
|
|
||||||
//p.color = p.CTFtempcolor;
|
//p.color = p.CTFtempcolor;
|
||||||
//p.prefix = p.CTFtempprefix;
|
//p.prefix = p.CTFtempprefix;
|
||||||
//p.carryingFlag = false;
|
//p.carryingFlag = false;
|
||||||
p.Game.hasflag = null;
|
p.Game.hasflag = null;
|
||||||
players.Remove(p);
|
players.Remove(p);
|
||||||
mapOn.ChatLevel(p.ColoredName + " %Shas left the " + teamstring + ".");
|
mapOn.ChatLevel(p.ColoredName + " %Shas left the " + teamstring + ".");
|
||||||
Entities.GlobalSpawn(p, false);
|
Entities.GlobalRespawn(p, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,8 +100,7 @@ namespace MCGalaxy.Games.ZS {
|
|||||||
pl.SetMoney(pl.money + 1);
|
pl.SetMoney(pl.money + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Entities.GlobalDespawn(pl, false);
|
Entities.GlobalRespawn(pl, false);
|
||||||
Entities.GlobalSpawn(pl, false);
|
|
||||||
TabList.Add(pl, pl, Entities.SelfID);
|
TabList.Add(pl, pl, Entities.SelfID);
|
||||||
HUD.UpdateTertiary(pl);
|
HUD.UpdateTertiary(pl);
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ namespace MCGalaxy.Games.ZS {
|
|||||||
p.Send(Hacks.MakeHackControl(p));
|
p.Send(Hacks.MakeHackControl(p));
|
||||||
} else {
|
} else {
|
||||||
HandlePlayerDisconnect(p, null);
|
HandlePlayerDisconnect(p, null);
|
||||||
Entities.GlobalDespawn(p, false, true);
|
Entities.GlobalDespawn(p, false, false);
|
||||||
p.Game.Referee = true;
|
p.Game.Referee = true;
|
||||||
|
|
||||||
if (p.Supports(CpeExt.HackControl))
|
if (p.Supports(CpeExt.HackControl))
|
||||||
@ -129,7 +129,7 @@ namespace MCGalaxy.Games.ZS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Entities.GlobalSpawn(p, false, "");
|
Entities.GlobalSpawn(p, false, "");
|
||||||
TabList.Add(p, p, Entities.SelfID);
|
TabList.Update(p, true);
|
||||||
p.SetPrefix();
|
p.SetPrefix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,8 +313,7 @@ namespace MCGalaxy.Games {
|
|||||||
static void UpdatePlayerColor(Player p, string color) {
|
static void UpdatePlayerColor(Player p, string color) {
|
||||||
if (p.Game.lastSpawnColor == color) return;
|
if (p.Game.lastSpawnColor == color) return;
|
||||||
p.Game.lastSpawnColor = color;
|
p.Game.lastSpawnColor = color;
|
||||||
Entities.GlobalDespawn(p, false);
|
Entities.GlobalRespawn(p, false);
|
||||||
Entities.GlobalSpawn(p, false);
|
|
||||||
TabList.Add(p, p, Entities.SelfID);
|
TabList.Add(p, p, Entities.SelfID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user