mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-26 14:54:12 -04:00
Tilde at start of message sends a message to all human or infected players, using a grave sends a message to all team members.
This commit is contained in:
parent
cb85dab5d4
commit
2ad392819c
@ -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!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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!");
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
@ -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(' ');
|
||||
|
@ -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;
|
||||
|
@ -106,8 +106,7 @@ namespace MCGalaxy.Games {
|
||||
|
||||
List<Player> 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);
|
||||
|
@ -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) ||
|
||||
|
@ -163,7 +163,6 @@
|
||||
<Compile Include="Commands\CPE\CmdCustomColors.cs" />
|
||||
<Compile Include="Commands\CPE\CmdModel.cs" />
|
||||
<Compile Include="Commands\CPE\CmdReachDistance.cs" />
|
||||
<Compile Include="Commands\CPE\CmdXModel.cs" />
|
||||
<Compile Include="Commands\Economy\CmdAward.cs" />
|
||||
<Compile Include="Commands\Economy\CmdAwardMod.cs" />
|
||||
<Compile Include="Commands\Economy\CmdAwards.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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user