diff --git a/Commands/CPE/CmdModel.cs b/Commands/CPE/CmdModel.cs index 1f7db1809..1904fa585 100644 --- a/Commands/CPE/CmdModel.cs +++ b/Commands/CPE/CmdModel.cs @@ -76,4 +76,25 @@ namespace MCGalaxy.Commands { Player.SendMessage(p, "You can also place a block ID instead of a model name, to change your model into a block!"); } } + + public class CmdXModel : Command { + + public override string name { get { return "xmodel"; } } + public override string shortcut { get { return "xm"; } } + public override string type { get { return CommandTypes.Other; } } + public override bool museumUsable { get { return true; } } + public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } } + + public override void Use(Player p, string message) { + if (p == null) { MessageInGameOnly(p); } + string model = message == "" ? "normal" : message; + Command.all.Find("model").Use(p, p.name + " " + model); + } + + public override void Help(Player p) { + Player.SendMessage(p, "/xm [model] - Sets your own model."); + Player.SendMessage(p, "Available models: Chibi, Chicken, Creeper, Croc, Humanoid, Pig, Printer, Sheep, Spider, Skeleton, Zombie."); + Player.SendMessage(p, "You can also place a block ID instead of a model name, to change your model into a block!"); + } + } } diff --git a/Commands/CPE/CmdXModel.cs b/Commands/CPE/CmdXModel.cs deleted file mode 100644 index 4a7950da5..000000000 --- a/Commands/CPE/CmdXModel.cs +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright 2015 MCGalaxy - - 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; - -namespace MCGalaxy.Commands { - - public class CmdXModel : Command { - - public override string name { get { return "xmodel"; } } - public override string shortcut { get { return "xm"; } } - public override string type { get { return CommandTypes.Other; } } - public override bool museumUsable { get { return true; } } - public override LevelPermission defaultRank { get { return LevelPermission.AdvBuilder; } } - - public override void Use(Player p, string message) { - if (p == null) { MessageInGameOnly(p); } - string model = message == "" ? "normal" : message; - Command.all.Find("model").Use(p, p.name + " " + model); - } - - public override void Help(Player p) { - Player.SendMessage(p, "/xm [model] - Changes your player model."); - Player.SendMessage(p, "Available models: Chicken, Creeper, Croc, Humanoid, Pig, Printer, Sheep, Spider, Skeleton, Zombie."); - Player.SendMessage(p, "You can also place a block ID instead of a model name, to change your model into a block!"); - } - } -} diff --git a/Commands/Fun/CmdTeam.cs b/Commands/Fun/CmdTeam.cs index 80184b715..d077d3867 100644 --- a/Commands/Fun/CmdTeam.cs +++ b/Commands/Fun/CmdTeam.cs @@ -135,7 +135,7 @@ namespace MCGalaxy.Commands { if (team != null) { Player.SendMessage(p, "You need to leave your current team before you can join another one."); return; } team = Team.FindTeam(p.GameTeamInvite); - if (team == null ) { Player.SendMessage(p, "The team you were invited to no longer exists."); return; } + if (team == null) { Player.SendMessage(p, "The team you were invited to no longer exists."); return; } team.Members.Add(p.name); team.Action(p, "joined the team."); p.GameTeam = team; @@ -152,7 +152,7 @@ namespace MCGalaxy.Commands { Player who = PlayerInfo.FindOrShowMatches(p, args[1]); if (who == null) return; - Player.SendMessage(p, "Invited " + who.FullName + " %S to join your team."); + Player.SendMessage(p, "Invited " + who.FullName + " %Sto join your team."); Player.SendMessage(who, p.color + p.DisplayName + " %Sinvited you to join the " + team.Color + team.Name + " %Steam."); who.GameTeamInvite = team.Name; } diff --git a/Commands/Fun/ZombieSurvival/CmdBounty.cs b/Commands/Fun/ZombieSurvival/CmdBounty.cs index 62574f14b..7f6d539fb 100644 --- a/Commands/Fun/ZombieSurvival/CmdBounty.cs +++ b/Commands/Fun/ZombieSurvival/CmdBounty.cs @@ -27,7 +27,6 @@ namespace MCGalaxy.Commands { public override bool museumUsable { get { return true; } } public override LevelPermission defaultRank { get { return LevelPermission.Banned; } } public override bool Enabled { get { return Server.ZombieModeOn; } } - public CmdBounty() { } public override void Use(Player p, string message) { string[] args = message.Split(' '); diff --git a/Games/Team.cs b/Games/Team.cs index 8d7a3a17a..f4e6dbb83 100644 --- a/Games/Team.cs +++ b/Games/Team.cs @@ -38,7 +38,7 @@ namespace MCGalaxy.Games { } public void Chat(Player source, string message) { - string toSend = source.FullName + " %Sto team: " + message; + string toSend = source.color + source.DisplayName + " %Sto team: " + message; foreach (string name in Members) { Player p = PlayerInfo.FindExact(name); if (p == null) continue; diff --git a/Games/ZombieSurvival/ZombieGame.Core.cs b/Games/ZombieSurvival/ZombieGame.Core.cs index f3872bed8..e9e89bddc 100644 --- a/Games/ZombieSurvival/ZombieGame.Core.cs +++ b/Games/ZombieSurvival/ZombieGame.Core.cs @@ -106,8 +106,7 @@ namespace MCGalaxy.Games { List DoRoundCountdown() { while (true) { - string logMessage = Convert.ToString(ChangeLevels) + " " + Convert.ToString(Server.ZombieOnlyServer) + - " " + Convert.ToString(UseLevelList) + " " + string.Join(",", LevelList.ToArray()); + string logMessage = ChangeLevels + " " + Server.ZombieOnlyServer + " " + UseLevelList; Server.s.Log(logMessage); RoundStart = DateTime.UtcNow.AddSeconds(30); diff --git a/Games/ZombieSurvival/ZombieGame.Game.cs b/Games/ZombieSurvival/ZombieGame.Game.cs index 72bf6b393..f9f289d1b 100644 --- a/Games/ZombieSurvival/ZombieGame.Game.cs +++ b/Games/ZombieSurvival/ZombieGame.Game.cs @@ -71,6 +71,27 @@ namespace MCGalaxy.Games { } public override bool HandlesChatMessage(Player p, string message) { + if (Status == ZombieGameStatus.NotStarted + || (p.level == null || !p.level.name.CaselessEq(CurrentLevelName))) return false; + if (Server.votingforlevel && HandleVote(p, message)) return true; + + if (message[0] == '~' && message.Length > 1) { + Player[] players = p.infected ? Infected.Items : Alive.Items; + string type = p.infected ? " &cto zombies%S: " : " &ato humans%S: "; + foreach (Player pl in players) + pl.SendMessage(p.color + p.DisplayName + type + message); + return true; + } else if (message[0] == '`' && message.Length > 1) { + if (p.GameTeam == null) { + p.SendMessage("You are not on a team, so cannot send a team message."); return true; + } + p.GameTeam.Chat(p, message.Substring(1)); + return true; + } + return false; + } + + bool HandleVote(Player p, string message) { message = message.ToLower(); if (Player.CheckVote(message, p, "1", "one", ref Level1Vote) || Player.CheckVote(message, p, "2", "two", ref Level2Vote) || diff --git a/MCGalaxy_.csproj b/MCGalaxy_.csproj index bb5936a3b..f688734c6 100644 --- a/MCGalaxy_.csproj +++ b/MCGalaxy_.csproj @@ -163,7 +163,6 @@ - diff --git a/Player/Player.Handlers.cs b/Player/Player.Handlers.cs index ba78e0c3f..8ad6e8648 100644 --- a/Player/Player.Handlers.cs +++ b/Player/Player.Handlers.cs @@ -1250,16 +1250,14 @@ try { SendBlockchange(pos1.x, pos1.y, pos1.z, Block.waterstill); } catch { } return; } } - if (VoteHandles(text)) return; + // Filter out bad words + if (Server.profanityFilter) text = ProfanityFilter.Parse(text); + + if (IsHandledMessage(text)) return; // Put this after vote collection so that people can vote even when chat is moderated if ( Server.chatmod && !voice ) { this.SendMessage("Chat moderation is on, you cannot speak."); return; } - // Filter out bad words - if ( Server.profanityFilter ) { - text = ProfanityFilter.Parse(text); - } - if ( Server.checkspam ) { //if (consecutivemessages == 0) //{ @@ -1402,7 +1400,7 @@ return; catch ( Exception e ) { Server.ErrorLog(e); Player.GlobalMessage("An error occurred: " + e.Message); } } - bool VoteHandles(string text) { + bool IsHandledMessage(string text) { if (Server.voteKickInProgress && text.Length == 1) { if (text.ToLower() == "y") { this.voteKickChoice = VoteKickChoice.Yes; @@ -1425,10 +1423,8 @@ return; } } - if (Server.lava.HandlesChatMessage(this, text)) - return false; - if (Server.votingforlevel && Server.zombie.HandlesChatMessage(this, text)) - return true; + if (Server.lava.HandlesChatMessage(this, text)) return true; + if (Server.zombie.HandlesChatMessage(this, text)) return true; return false; }