Do not change the direct color field of players, only change in the spawn packet.

This commit is contained in:
UnknownShadow200 2016-03-20 23:31:51 +11:00
parent e34e306363
commit 90c4dedf27
6 changed files with 22 additions and 28 deletions

View File

@ -33,7 +33,6 @@ namespace MCGalaxy.Commands {
if (p.referee) {
p.referee = false;
LevelPermission perm = Group.findPlayerGroup(name).Permission;
Player.GlobalDespawn(p, false);
Player.SendChatFrom(p, p.FullName + " %Sis no longer a referee", false);
if (Server.zombie.RoundInProgress) {
@ -44,7 +43,6 @@ namespace MCGalaxy.Commands {
Server.zombie.Infected.Remove(p);
Server.zombie.Alive.Add(p);
Server.zombie.UpdateAllPlayerStatus();
p.color = p.group.color;
}
} else {
p.referee = true;
@ -52,8 +50,7 @@ namespace MCGalaxy.Commands {
Player.GlobalDespawn(p, false);
Server.zombie.Alive.Remove(p);
Server.zombie.Infected.Remove(p);
Server.zombie.UpdateAllPlayerStatus();
p.color = p.group.color;
Server.zombie.UpdateAllPlayerStatus();
if (Server.zombie.RoundInProgress)
Server.zombie.AssignFirstZombie();
}

View File

@ -38,13 +38,13 @@ namespace MCGalaxy.Commands
if (who.group.Permission >= p.group.Permission)
{
Player.SendChatFrom(p, p.color + p.DisplayName + " " + Server.DefaultColor + "tried to votekick " + who.color + who.DisplayName + " " + Server.DefaultColor + "but failed!", false);
Player.SendChatFrom(p, p.color + p.DisplayName + " %Stried to votekick " + who.color + who.DisplayName + " %Sbut failed!", false);
return;
}
Chat.GlobalMessageOps(p.color + p.DisplayName + Server.DefaultColor + " used &a/votekick");
Player.GlobalMessage("&9A vote to kick " + who.color + who.DisplayName + " " + Server.DefaultColor + "has been called!");
Player.GlobalMessage("&9Type &aY " + Server.DefaultColor + "or &cN " + Server.DefaultColor + "to vote.");
Chat.GlobalMessageOps(p.color + p.DisplayName + " %Sused &a/votekick");
Player.GlobalMessage("&9A vote to kick " + who.color + who.DisplayName + " %Shas been called!");
Player.GlobalMessage("&9Type &aY %Sor &cN %Sto vote.");
// 1/3rd of the players must vote or nothing happens
// Keep it at 0 to disable min number of votes
@ -88,7 +88,7 @@ namespace MCGalaxy.Commands
}
else
{
Player.GlobalMessage(who.color + who.DisplayName + " " + Server.DefaultColor + "shall remain!");
Player.GlobalMessage(who.color + who.DisplayName + " %Sshall remain!");
}
voteTimer.Dispose();

View File

@ -49,7 +49,7 @@ namespace MCGalaxy.Commands {
} else if (who.warn == 1) {
Player.SendMessage(who, "Do it one more time and you will get kicked!");
} else if (who.warn == 2) {
Player.GlobalMessage(who.color + who.DisplayName + " " + "%Swas warn-kicked by " + warnedby);
Player.GlobalMessage(who.color + who.DisplayName + " %Swas warn-kicked by " + warnedby);
who.Kick("KICKED BECAUSE " + reason + "");
}
who.warn++;

View File

@ -130,10 +130,7 @@ namespace MCGalaxy.Games {
Player[] online = PlayerInfo.Online.Items;
foreach (Player p in online) {
if (p.referee) {
p.color = p.group.color;
} else if (p.level.name.CaselessEq(CurrentLevelName)) {
p.color = p.group.color;
if (!p.referee && p.level.name.CaselessEq(CurrentLevelName)) {
players.Add(p);
nonRefPlayers++;
}
@ -203,8 +200,8 @@ namespace MCGalaxy.Games {
}
static void UpdatePlayerColor(Player p, string color) {
if (p.color == color) return;
p.color = color;
if (p.lastSpawnColor == color) return;
p.lastSpawnColor = color;
Player.GlobalDespawn(p, false);
Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false);
}
@ -273,7 +270,6 @@ namespace MCGalaxy.Games {
pl.playersInfected = 0;
pl.money += money;
pl.infected = false;
pl.color = pl.group.color;
if (pl.referee) {
pl.SendMessage("You gained one " + Server.moneys + " because you're a ref. Would you like a medal as well?");
pl.money++;
@ -289,10 +285,8 @@ namespace MCGalaxy.Games {
p.infected = false;
p.playersInfected = 0;
if (p.level.name.CaselessEq(CurrentLevelName)) {
p.color = p.group.color;
playersString += p.group.color + p.DisplayName + Colors.white + ", ";
}
if (p.level.name.CaselessEq(CurrentLevelName))
playersString += p.color + p.DisplayName + Colors.white + ", ";
}
void ChooseNextLevel() {

View File

@ -133,7 +133,7 @@ namespace MCGalaxy.Games {
}
Player zombie = alive[index];
Player.GlobalMessage(zombie.FullName + " %Scontinued the infection!");
CurrentLevel.ChatLevel(zombie.FullName + " %Scontinued the infection!");
InfectPlayer(zombie);
}
@ -156,21 +156,22 @@ namespace MCGalaxy.Games {
}
void ChangeLevel(string next) {
if (CurrentLevel != null) {
CurrentLevel.ChatLevel("The next map has been chosen - " + Colors.red + next.ToLower());
CurrentLevel.ChatLevel("Please wait while you are transfered.");
}
CurrentLevelName = next;
queLevel = false;
nextLevel = "";
Command.all.Find("load").Use(null, next.ToLower() + " 0");
CurrentLevel = LevelInfo.Find(next);
Player.GlobalMessage("The next map has been chosen - " + Colors.red + next.ToLower());
Player.GlobalMessage("Please wait while you are transfered.");
string oldLevel = Server.mainLevel.name;
if (Server.ZombieOnlyServer)
Server.mainLevel = CurrentLevel;
Player[] online = PlayerInfo.Online.Items;
foreach (Player pl in online) {
if (!pl.level.name.CaselessEq(next) && pl.level.name.CaselessEq(LastLevelName)) {
if (!pl.level.name.CaselessEq(next) && pl.level.name.CaselessEq(LastLevelName)) {
pl.SendMessage("Going to the next map!");
Command.all.Find("goto").Use(pl, next);
}

View File

@ -198,6 +198,7 @@ namespace MCGalaxy {
public bool aka = false;
public bool flipHead = true;
public int playersInfected = 0;
internal string lastSpawnColor = "";
//Tnt Wars
public bool PlayingTntWars = false;
@ -487,7 +488,8 @@ namespace MCGalaxy {
public static void GlobalSpawn(Player p, ushort x, ushort y, ushort z,
byte rotx, byte roty, bool self, string possession = "") {
Player[] players = PlayerInfo.Online.Items;
Player[] players = PlayerInfo.Online.Items;
p.lastSpawnColor = p.infected ? Colors.red : p.color;
foreach (Player other in players) {
if (other.Loading && p != other) continue;
if (p.level != other.level || (p.hidden && !self)) continue;