diff --git a/Commands/Chat/CmdMe.cs b/Commands/Chat/CmdMe.cs index 11be11503..8f38662f2 100644 --- a/Commands/Chat/CmdMe.cs +++ b/Commands/Chat/CmdMe.cs @@ -35,7 +35,7 @@ namespace MCGalaxy.Commands if (Server.chatmod && !p.voice) { Player.SendMessage(p, "Chat moderation is on, you cannot emote."); return; } if (Server.worldChat) - Player.GlobalChat(p, p.color + "*" + Colors.StripColours(p.DisplayName) + p.color + " " + message, false); + Player.SendChatFrom(p, p.color + "*" + Colors.StripColours(p.DisplayName) + p.color + " " + message, false); else Chat.GlobalChatLevel(p, p.color + "*" + Colors.StripColours(p.DisplayName) + p.color + " " + message, false); //IRCBot.Say("*" + p.name + " " + message); diff --git a/Commands/Moderation/CmdFreeze.cs b/Commands/Moderation/CmdFreeze.cs index 3e0fad26f..c6b4c34e1 100644 --- a/Commands/Moderation/CmdFreeze.cs +++ b/Commands/Moderation/CmdFreeze.cs @@ -38,13 +38,13 @@ namespace MCGalaxy.Commands if (!who.frozen) { who.frozen = true; - Player.GlobalChat(who, who.color + who.DisplayName + Server.DefaultColor + " has been &bfrozen" + Server.DefaultColor + " by " + frozenby + Server.DefaultColor + ".", false); + Player.SendChatFrom(who, who.color + who.DisplayName + Server.DefaultColor + " has been &bfrozen" + Server.DefaultColor + " by " + frozenby + Server.DefaultColor + ".", false); Server.s.Log(who.name + " has been frozen by " + frozenby); } else { who.frozen = false; - Player.GlobalChat(who, who.color + who.DisplayName + Server.DefaultColor + " has been &adefrosted" + Server.DefaultColor + " by " + frozenby + Server.DefaultColor + ".", false); + Player.SendChatFrom(who, who.color + who.DisplayName + Server.DefaultColor + " has been &adefrosted" + Server.DefaultColor + " by " + frozenby + Server.DefaultColor + ".", false); Server.s.Log(who.name + " has been defrosted by " + frozenby); } } diff --git a/Commands/Moderation/CmdHide.cs b/Commands/Moderation/CmdHide.cs index 1c201ca93..84bc8dfa9 100644 --- a/Commands/Moderation/CmdHide.cs +++ b/Commands/Moderation/CmdHide.cs @@ -57,7 +57,7 @@ namespace MCGalaxy.Commands { 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 + " " + + Player.SendChatFrom(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.DisplayName + " left the game (Disconnected.)"); if (!p.opchat) @@ -70,7 +70,7 @@ namespace MCGalaxy.Commands { Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false); Chat.GlobalMessageOps("To Ops -" + p.color + p.DisplayName + Server.DefaultColor + "- is now &8visible" + Server.DefaultColor + "."); - Player.GlobalChat(p, "&a+ " + p.color + p.prefix + p.DisplayName + Server.DefaultColor + " " + + Player.SendChatFrom(p, "&a+ " + p.color + p.prefix + p.DisplayName + Server.DefaultColor + " " + (File.Exists("text/login/" + p.name + ".txt") ? CP437Reader.ReadAllText("text/login/" + p.name + ".txt") : "joined the game."), false); Server.IRC.Say(p.DisplayName + " joined the game"); if (p.opchat) diff --git a/Commands/Moderation/CmdJail.cs b/Commands/Moderation/CmdJail.cs index d075f8fdc..948f4b0b0 100644 --- a/Commands/Moderation/CmdJail.cs +++ b/Commands/Moderation/CmdJail.cs @@ -57,7 +57,7 @@ namespace MCGalaxy { writer.WriteLine(who.name.ToLower() + " " + who.level.name); } - Player.GlobalChat(who, who.color + who.DisplayName + Server.DefaultColor + " was &8jailed", false); + Player.SendChatFrom(who, who.color + who.DisplayName + Server.DefaultColor + " was &8jailed", false); } else { @@ -66,7 +66,7 @@ namespace MCGalaxy who.jailed = false; Command.all.Find("spawn").Use(who, ""); Player.SendMessage(p, "You freed " + who.name + " from jail"); - Player.GlobalChat(who, who.color + who.DisplayName + Server.DefaultColor + " was &afreed" + Server.DefaultColor + " from jail", false); + Player.SendChatFrom(who, who.color + who.DisplayName + Server.DefaultColor + " was &afreed" + Server.DefaultColor + " from jail", false); } } else diff --git a/Commands/Moderation/CmdJoker.cs b/Commands/Moderation/CmdJoker.cs index 35abee3d8..6988cb41e 100644 --- a/Commands/Moderation/CmdJoker.cs +++ b/Commands/Moderation/CmdJoker.cs @@ -50,13 +50,13 @@ namespace MCGalaxy.Commands { who.joker = true; if (stealth) { Chat.GlobalMessageOps(who.color + who.DisplayName + Server.DefaultColor + " is now STEALTH joker'd. "); return; } - Player.GlobalChat(who, who.color + who.DisplayName + Server.DefaultColor + " is now a &aJ&bo&ck&5e&9r" + Server.DefaultColor + ".", false); + Player.SendChatFrom(who, who.color + who.DisplayName + Server.DefaultColor + " is now a &aJ&bo&ck&5e&9r" + Server.DefaultColor + ".", false); } else { who.joker = false; if (stealth) { Chat.GlobalMessageOps(who.color + who.DisplayName + Server.DefaultColor + " is now STEALTH Unjoker'd. "); return; } - Player.GlobalChat(who, who.color + who.DisplayName + Server.DefaultColor + " is no longer a &aJ&bo&ck&5e&9r" + Server.DefaultColor + ".", false); + Player.SendChatFrom(who, who.color + who.DisplayName + Server.DefaultColor + " is no longer a &aJ&bo&ck&5e&9r" + Server.DefaultColor + ".", false); } } public override void Help(Player p) diff --git a/Commands/Moderation/CmdKick.cs b/Commands/Moderation/CmdKick.cs index 7f64d8907..52e7c779f 100644 --- a/Commands/Moderation/CmdKick.cs +++ b/Commands/Moderation/CmdKick.cs @@ -47,7 +47,7 @@ namespace MCGalaxy.Commands } if (who.group.Permission >= p.group.Permission) { - Player.GlobalChat(p, + Player.SendChatFrom(p, p.color + p.DisplayName + "%S tried to kick " + who.color + who.DisplayName + "%S but failed.", false); diff --git a/Commands/Moderation/CmdMute.cs b/Commands/Moderation/CmdMute.cs index 7c3390fd3..658962391 100644 --- a/Commands/Moderation/CmdMute.cs +++ b/Commands/Moderation/CmdMute.cs @@ -67,7 +67,7 @@ namespace MCGalaxy.Commands if (who.muted) { who.muted = false; - Player.GlobalChat(who, who.color + who.DisplayName + Server.DefaultColor + " has been &bun-muted", false); + Player.SendChatFrom(who, who.color + who.DisplayName + Server.DefaultColor + " has been &bun-muted", false); Extensions.DeleteLineWord("ranks/muted.txt", who.name.ToLower()); } else @@ -77,7 +77,7 @@ namespace MCGalaxy.Commands if (who != p) if (who.group.Permission >= p.group.Permission) { Player.SendMessage(p, "Cannot mute someone of a higher or equal rank."); return; } } who.muted = true; - Player.GlobalChat(who, who.color + who.DisplayName + Server.DefaultColor + " has been &8muted", false); + Player.SendChatFrom(who, who.color + who.DisplayName + Server.DefaultColor + " has been &8muted", false); using (StreamWriter writer = new StreamWriter("ranks/muted.txt", true)) { writer.WriteLine(who.name.ToLower()); diff --git a/Commands/Moderation/CmdReferee.cs b/Commands/Moderation/CmdReferee.cs index e03755219..5a326cb8a 100644 --- a/Commands/Moderation/CmdReferee.cs +++ b/Commands/Moderation/CmdReferee.cs @@ -33,7 +33,7 @@ namespace MCGalaxy.Commands p.referee = false; LevelPermission perm = Group.findPlayerGroup(name).Permission; Player.GlobalDespawn(p, false); - Player.GlobalChat(p, p.color + p.name + Server.DefaultColor + " is no longer a referee", false); + Player.SendChatFrom(p, p.color + p.name + Server.DefaultColor + " is no longer a referee", false); if (Server.zombie.GameInProgess()) { Server.zombie.InfectPlayer(p); @@ -50,7 +50,7 @@ namespace MCGalaxy.Commands else { p.referee = true; - Player.GlobalChat(p, p.color + p.name + Server.DefaultColor + " is now a referee", false); + Player.SendChatFrom(p, p.color + p.name + Server.DefaultColor + " is now a referee", false); Player.GlobalDespawn(p, false); if (Server.zombie.GameInProgess()) { diff --git a/Commands/Moderation/CmdVoteKick.cs b/Commands/Moderation/CmdVoteKick.cs index 62ec90c50..fef00ec2c 100644 --- a/Commands/Moderation/CmdVoteKick.cs +++ b/Commands/Moderation/CmdVoteKick.cs @@ -42,7 +42,7 @@ namespace MCGalaxy.Commands if (who.group.Permission >= p.group.Permission) { - Player.GlobalChat(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 + " " + Server.DefaultColor + "tried to votekick " + who.color + who.DisplayName + " " + Server.DefaultColor + "but failed!", false); return; } diff --git a/Commands/Moderation/CmdXhide.cs b/Commands/Moderation/CmdXhide.cs index 6f2d52121..817e33558 100644 --- a/Commands/Moderation/CmdXhide.cs +++ b/Commands/Moderation/CmdXhide.cs @@ -40,7 +40,7 @@ namespace MCGalaxy.Commands if (p.hidden) { Player.GlobalDespawn(p, true); - Player.GlobalChat(p, "&c- " + p.color + p.prefix + p.DisplayName + Server.DefaultColor + " " + + Player.SendChatFrom(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.)"); if (!p.adminchat) @@ -52,7 +52,7 @@ namespace MCGalaxy.Commands else { Player.GlobalSpawn(p, p.pos[0], p.pos[1], p.pos[2], p.rot[0], p.rot[1], false, ""); - Player.GlobalChat(p, "&a+ " + p.color + p.prefix + p.DisplayName + Server.DefaultColor + " " + + Player.SendChatFrom(p, "&a+ " + p.color + p.prefix + p.DisplayName + Server.DefaultColor + " " + (File.Exists("text/login/" + p.name + ".txt") ? CP437Reader.ReadAllText("text/login/" + p.name + ".txt") : "joined the game."), false); Server.IRC.Say(p.name + " joined the game"); if (p.adminchat) diff --git a/Commands/World/CmdGoto.cs b/Commands/World/CmdGoto.cs index c9cad3c58..74c196fce 100644 --- a/Commands/World/CmdGoto.cs +++ b/Commands/World/CmdGoto.cs @@ -127,9 +127,10 @@ namespace MCGalaxy.Commands { foreach (Player pl in PlayerInfo.players) if (pl.level == oldLevel) { unloadOld = false; break; } if (unloadOld && Server.AutoLoad) oldLevel.Unload(true); } + CheckGamesJoin(p, lvl); if (!p.hidden) { - Player.GlobalChat(p, p.color + "*" + p.DisplayName + Server.DefaultColor + " went to &b" + lvl.name, false); + Player.SendChatFrom(p, p.color + "*" + p.DisplayName + Server.DefaultColor + " went to &b" + lvl.name, false); Server.IRC.Say(p.color + p.DisplayName + " %rwent to &8" + lvl.name, false, true); } } diff --git a/Commands/building/CmdPaste.cs b/Commands/building/CmdPaste.cs index ad6c2986d..bf0dc3f69 100644 --- a/Commands/building/CmdPaste.cs +++ b/Commands/building/CmdPaste.cs @@ -80,7 +80,7 @@ namespace MCGalaxy.Commands if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); } - struct CatchPos { public ushort x, y, z; } + struct CatchPos { } public override void Help(Player p) { diff --git a/Commands/building/CmdUndo.cs b/Commands/building/CmdUndo.cs index 5e4cc5540..9964b74ab 100644 --- a/Commands/building/CmdUndo.cs +++ b/Commands/building/CmdUndo.cs @@ -102,7 +102,7 @@ namespace MCGalaxy.Commands if (p == who) { Player.SendMessage(p, "Undid your actions for the past &b" + seconds + " %Sseconds."); } else { - Player.GlobalChat(who, who.color + who.DisplayName + "%S's actions for the past &b" + seconds + " seconds were undone.", false); + Player.SendChatFrom(who, who.color + who.DisplayName + "%S's actions for the past &b" + seconds + " seconds were undone.", false); } Server.s.Log(who.name + "'s actions for the past " + seconds + " seconds were undone."); if (saveLevel != null) saveLevel.Save(true); diff --git a/Commands/other/CmdColor.cs b/Commands/other/CmdColor.cs index 494f3c56e..1e37afb7f 100644 --- a/Commands/other/CmdColor.cs +++ b/Commands/other/CmdColor.cs @@ -38,7 +38,7 @@ namespace MCGalaxy.Commands { } if (args.Length == 1) { - Player.GlobalChat(who, who.color + who.DisplayName + Server.DefaultColor + " had their color removed.", false); + Player.SendChatFrom(who, who.color + who.DisplayName + Server.DefaultColor + " had their color removed.", false); who.color = who.group.color; Database.AddParams("@Name", who.name); @@ -47,7 +47,7 @@ namespace MCGalaxy.Commands { string color = Colors.Parse(args[1]); if (color == "") { Player.SendMessage(p, "There is no color \"" + message + "\"."); return; } else if (color == who.color) { Player.SendMessage(p, p.DisplayName + " already has that color."); return; } - Player.GlobalChat(who, who.color + who.DisplayName + " %Shad their color changed to " + color + Colors.Name(color) + "%S.", false); + Player.SendChatFrom(who, who.color + who.DisplayName + " %Shad their color changed to " + color + Colors.Name(color) + "%S.", false); who.color = color; Database.AddParams("@Color", Colors.Name(color)); diff --git a/Commands/other/CmdImpersonate.cs b/Commands/other/CmdImpersonate.cs index 1b97d75a3..cd0fff183 100644 --- a/Commands/other/CmdImpersonate.cs +++ b/Commands/other/CmdImpersonate.cs @@ -33,7 +33,7 @@ namespace MCGalaxy.Commands { message = message.Substring(message.IndexOf(' ') + 1); //Player.GlobalMessage(player.color + player.voicestring + player.color + player.prefix + player.name + ": &f" + message); - Player.GlobalChat(player, message); + Player.SendChatFrom(player, message); } else { diff --git a/Commands/other/CmdInvincible.cs b/Commands/other/CmdInvincible.cs index a385317e7..84ccd4810 100644 --- a/Commands/other/CmdInvincible.cs +++ b/Commands/other/CmdInvincible.cs @@ -64,7 +64,7 @@ namespace MCGalaxy.Commands } if (Server.cheapMessage && !p.hidden) - Player.GlobalChat(who, who.color + who.DisplayName + Server.DefaultColor + " has stopped being immortal", false); + Player.SendChatFrom(who, who.color + who.DisplayName + Server.DefaultColor + " has stopped being immortal", false); } else { @@ -78,7 +78,7 @@ namespace MCGalaxy.Commands } who.invincible = true; if (Server.cheapMessage && !p.hidden) - Player.GlobalChat(who, who.color + who.DisplayName + Server.DefaultColor + " " + Server.cheapMessageGiven, false); + Player.SendChatFrom(who, who.color + who.DisplayName + Server.DefaultColor + " " + Server.cheapMessageGiven, false); } } public override void Help(Player p) diff --git a/Commands/other/CmdNick.cs b/Commands/other/CmdNick.cs index eb9c0f4f0..f1e7d5343 100644 --- a/Commands/other/CmdNick.cs +++ b/Commands/other/CmdNick.cs @@ -43,10 +43,10 @@ namespace MCGalaxy.Commands { string newName = parts.Length > 1 ? parts[1] : ""; if (newName == "") { who.DisplayName = who.name; - Player.GlobalChat(who, who.color + who.prefix + who.DisplayName + "%S has reverted their nick to their original name.", false); + Player.SendChatFrom(who, who.color + who.prefix + who.DisplayName + "%S has reverted their nick to their original name.", false); } else { if (newName.Length > 60) { Player.SendMessage(p, "Nick must be under 60 letters."); return; } - Player.GlobalChat(who, who.color + who.DisplayName + "%S has changed their nick to " + who.color + newName + "%S.", false); + Player.SendChatFrom(who, who.color + who.DisplayName + "%S has changed their nick to " + who.color + newName + "%S.", false); who.DisplayName = newName; } diff --git a/Commands/other/CmdTColor.cs b/Commands/other/CmdTColor.cs index 4b32992cb..d9cd44040 100644 --- a/Commands/other/CmdTColor.cs +++ b/Commands/other/CmdTColor.cs @@ -38,7 +38,7 @@ namespace MCGalaxy.Commands { } if (args.Length == 1) { - Player.GlobalChat(who, who.color + who.DisplayName + Server.DefaultColor + " had their title color removed.", false); + Player.SendChatFrom(who, who.color + who.DisplayName + Server.DefaultColor + " had their title color removed.", false); who.titlecolor = ""; Database.AddParams("@Name", who.name); @@ -47,7 +47,7 @@ namespace MCGalaxy.Commands { string color = Colors.Parse(args[1]); if (color == "") { Player.SendMessage(p, "There is no color \"" + args[1] + "\"."); return; } else if (color == who.titlecolor) { Player.SendMessage(p, who.DisplayName + " already has that title color."); return; } - Player.GlobalChat(who, who.color + who.DisplayName + " %Shad their title color changed to " + color + Colors.Name(color) + "%S.", false); + Player.SendChatFrom(who, who.color + who.DisplayName + " %Shad their title color changed to " + color + Colors.Name(color) + "%S.", false); who.titlecolor = color; Database.AddParams("@Color", Colors.Name(color)); diff --git a/Commands/other/CmdTitle.cs b/Commands/other/CmdTitle.cs index c505280e1..aa2837035 100644 --- a/Commands/other/CmdTitle.cs +++ b/Commands/other/CmdTitle.cs @@ -44,11 +44,11 @@ namespace MCGalaxy.Commands { if (newTitle.Length > 17) { Player.SendMessage(p, "Title must be under 17 letters."); return; } if (newTitle == "") { - Player.GlobalChat(who, who.color + who.prefix + who.name + " %Shad their title removed.", false); + Player.SendChatFrom(who, who.color + who.prefix + who.name + " %Shad their title removed.", false); Database.AddParams("@Name", who.name); Database.executeQuery("UPDATE Players SET Title = '' WHERE Name = @Name"); } else { - Player.GlobalChat(who, who.color + who.name + " %Swas given the title of &b[" + newTitle + "%b]", false); + Player.SendChatFrom(who, who.color + who.name + " %Swas given the title of &b[" + newTitle + "%b]", false); Database.AddParams("@Title", newTitle); Database.AddParams("@Name", who.name); Database.executeQuery("UPDATE Players SET Title = @Title WHERE Name = @Name"); diff --git a/Levels/Generator/RealisticMapGen.cs b/Levels/Generator/RealisticMapGen.cs index def6a0438..ae3bb6f94 100644 --- a/Levels/Generator/RealisticMapGen.cs +++ b/Levels/Generator/RealisticMapGen.cs @@ -185,7 +185,7 @@ namespace MCGalaxy { Lvl.SetTile(x, (ushort)(LiquidLevel - yy), z, Block.lava); //better fill the water above me } else if (LiquidLevel - yy > y - 3) { if (overlay[index] < 0.9f) { - byte block = yy < yy ? Block.lava : Block.rock; + byte block = yy < y ? Block.lava : Block.rock; Lvl.SetTile(x, (ushort)(y - yy), z, block); } else { Lvl.SetTile(x, (ushort)(LiquidLevel - yy), (ushort)(z - 5), Block.lava); //killer lava diff --git a/Player/Player.cs b/Player/Player.cs index 078f7c958..94ba5541e 100644 --- a/Player/Player.cs +++ b/Player/Player.cs @@ -1464,7 +1464,7 @@ return; case Block.fishlavashark: Chat.GlobalChatLevel(this, this.FullName + Server.DefaultColor + " was eaten by a ... LAVA SHARK?!", false); break; case Block.rock: if ( explode ) level.MakeExplosion(x, y, z, 1); - GlobalChat(this, this.FullName + Server.DefaultColor + customMessage, false); + SendChatFrom(this, this.FullName + Server.DefaultColor + customMessage, false); break; case Block.stone: if ( explode ) level.MakeExplosion(x, y, z, 1); @@ -1499,7 +1499,8 @@ return; } if ( Server.deathcount ) - if ( overallDeath > 0 && overallDeath % 10 == 0 ) GlobalChat(this, this.FullName + Server.DefaultColor + " has died &3" + overallDeath + " times", false); + if ( overallDeath > 0 && overallDeath % 10 == 0 ) + SendChatFrom(this, this.FullName + Server.DefaultColor + " has died &3" + overallDeath + " times", false); } lastDeath = DateTime.Now; @@ -1647,23 +1648,10 @@ try { SendBlockchange(pos1.x, pos1.y, pos1.z, Block.waterstill); } catch { } return; } } - - //CmdVoteKick core vote recorder - if ( Server.voteKickInProgress && text.Length == 1 ) { - if ( text.ToLower() == "y" ) { - this.voteKickChoice = VoteKickChoice.Yes; - SendMessage("Thanks for voting!"); - return; - } - if ( text.ToLower() == "n" ) { - this.voteKickChoice = VoteKickChoice.No; - SendMessage("Thanks for voting!"); - return; - } - } + if (VoteHandles(text)) return; // Put this after vote collection so that people can vote even when chat is moderated - if ( Server.chatmod && !this.voice ) { this.SendMessage("Chat moderation is on, you cannot speak."); return; } + if ( Server.chatmod && !voice ) { this.SendMessage("Chat moderation is on, you cannot speak."); return; } // Filter out bad words if ( Server.profanityFilter ) { @@ -1785,7 +1773,7 @@ return; newtext = text.Remove(0, 1).Trim(); Chat.GlobalChatWorld(this, newtext, true); } else { - GlobalChat(this, newtext); + SendChatFrom(this, newtext); } Server.s.Log("<" + name + "> " + newtext); //IRCBot.Say("<" + name + "> " + newtext); @@ -1807,7 +1795,7 @@ return; return; } if ( Server.worldChat ) { - GlobalChat(this, text); + SendChatFrom(this, text); } else { Chat.GlobalChatLevel(this, text, true); } @@ -1816,6 +1804,46 @@ return; } catch ( Exception e ) { Server.ErrorLog(e); Player.GlobalMessage("An error occurred: " + e.Message); } } + + bool VoteHandles(string text) { + if (Server.voteKickInProgress && text.Length == 1) { + if (text.ToLower() == "y") { + this.voteKickChoice = VoteKickChoice.Yes; + SendMessage("Thanks for voting!"); + return true; + } else if (text.ToLower() == "n") { + this.voteKickChoice = VoteKickChoice.No; + SendMessage("Thanks for voting!"); + return true; + } + } + + if (Server.lava.HasPlayer(this) && Server.lava.HasVote(text.ToLower()) ) { + if (Server.lava.AddVote(this, text.ToLower())) { + SendMessage("Your vote for &5" + text.ToLower().Capitalize() + Server.DefaultColor + " has been placed. Thanks!"); + Server.lava.map.ChatLevelOps(name + " voted for &5" + text.ToLower().Capitalize() + Server.DefaultColor + "."); + return true; + } else { + SendMessage("&cYou already voted!"); + return true; + } + } + + if (Server.voting) { + string test = text.ToLower(); + if (CheckVote(test, this, "y", "yes", ref Server.YesVotes) || + CheckVote(test, this, "n", "no", ref Server.NoVotes)) return true; + + if (!voice && (test == "y" || test == "n" || test == "yes" || test == "no")) { + SendMessage("Chat moderation is on while voting is on!"); return true; + } + } + + if (Server.votingforlevel && Server.zombie.HandlesChatMessage(this, text)) + return true; + return false; + } + public void HandleCommand(string cmd, string message) { try { if ( Server.verifyadmins ) { @@ -2036,34 +2064,14 @@ return; PlayerInfo.players.ForEach(delegate(Player p) { if ( p.level == level ) { p.SendBlockchange(x, y, z, type, extType); } }); } - // THIS IS NOT FOR SENDING GLOBAL MESSAGES!!! IT IS TO SEND A MESSAGE FROM A SPECIFIED PLAYER!!!!!!!!!!!!!! - public static void GlobalChat(Player from, string message) { GlobalChat(from, message, true); } - public static void GlobalChat(Player from, string message, bool showname) { + [Obsolete("Use SendChatFrom() instead.")] + public static void GlobalChat(Player from, string message) { SendChatFrom(from, message, true); } + [Obsolete("Use SendChatFrom() instead.")] + public static void GlobalChat(Player from, string message, bool showname) { SendChatFrom(from, message, showname); } + + public static void SendChatFrom(Player from, string message) { SendChatFrom(from, message, true); } + public static void SendChatFrom(Player from, string message, bool showname) { if ( from == null ) return; // So we don't fucking derp the hell out! - - if ( Server.lava.HasPlayer(from) && Server.lava.HasVote(message.ToLower()) ) { - if ( Server.lava.AddVote(from, message.ToLower()) ) { - SendMessage(from, "Your vote for &5" + message.ToLower().Capitalize() + Server.DefaultColor + " has been placed. Thanks!"); - Server.lava.map.ChatLevelOps(from.name + " voted for &5" + message.ToLower().Capitalize() + Server.DefaultColor + "."); - return; - } else { - SendMessage(from, "&cYou already voted!"); - return; - } - } - - if (Server.voting) { - string test = message.ToLower(); - if (CheckVote(test, from, "y", "yes", ref Server.YesVotes) || - CheckVote(test, from, "n", "no", ref Server.NoVotes)) return; - - if (!from.voice && (test == "y" || test == "n" || test == "yes" || test == "no")) { - from.SendMessage("Chat moderation is on while voting is on!"); return; - } - } - - if (Server.votingforlevel && Server.zombie.HandlesChatMessage(from, message)) - return; if (Last50Chat.Count() == 50) Last50Chat.RemoveAt(0); @@ -2319,7 +2327,7 @@ return; } else { totalKicked++; - GlobalChat(this, "&c- " + color + prefix + DisplayName + Server.DefaultColor + " kicked (" + kickString + Server.DefaultColor + ").", false); + SendChatFrom(this, "&c- " + color + prefix + DisplayName + Server.DefaultColor + " kicked (" + kickString + Server.DefaultColor + ").", false); //IRCBot.Say(name + " kicked (" + kickString + ")."); Server.s.Log(name + " kicked (" + kickString + ")."); }