mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
Now more chat commands will auto-mute for them being used to spam.
This commit is contained in:
parent
4d37af2c34
commit
6170b46491
@ -39,9 +39,7 @@ namespace MCGalaxy.Commands {
|
|||||||
Player.Message(p, "You need to have at least 1 &3" + Server.moneys +
|
Player.Message(p, "You need to have at least 1 &3" + Server.moneys +
|
||||||
" %Sto purchase a snack."); return;
|
" %Sto purchase a snack."); return;
|
||||||
}
|
}
|
||||||
if (p.muted) {
|
if (p.muted) { Player.Message(p, "You cannot use this command while muted."); return; }
|
||||||
Player.Message(p, "You cannot use this command while muted."); return;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.NextEat = DateTime.UtcNow.AddSeconds(10);
|
p.NextEat = DateTime.UtcNow.AddSeconds(10);
|
||||||
if (Economy.Enabled) {
|
if (Economy.Enabled) {
|
||||||
@ -60,7 +58,8 @@ namespace MCGalaxy.Commands {
|
|||||||
Chat.GlobalChatLevel(p, "<Level>" + p.ColoredName + " %S" + action, false);
|
Chat.GlobalChatLevel(p, "<Level>" + p.ColoredName + " %S" + action, false);
|
||||||
} else {
|
} else {
|
||||||
Player.SendChatFrom(p, p.ColoredName + " %S" + action, false);
|
Player.SendChatFrom(p, p.ColoredName + " %S" + action, false);
|
||||||
}
|
}
|
||||||
|
p.CheckForMessageSpam();
|
||||||
}
|
}
|
||||||
|
|
||||||
static string[] defMessages = { "guzzled a grape", "chewed a cherry", "ate an avocado" };
|
static string[] defMessages = { "guzzled a grape", "chewed a cherry", "ate an avocado" };
|
||||||
|
@ -35,6 +35,7 @@ namespace MCGalaxy.Commands {
|
|||||||
string giver = (p == null) ? "(console)" : p.ColoredName;
|
string giver = (p == null) ? "(console)" : p.ColoredName;
|
||||||
Player.Message(who, giver + " just highfived you");
|
Player.Message(who, giver + " just highfived you");
|
||||||
Player.GlobalMessage(p, giver + " %Sjust highfived " + who.ColoredName);
|
Player.GlobalMessage(p, giver + " %Sjust highfived " + who.ColoredName);
|
||||||
|
p.CheckForMessageSpam();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
|
@ -43,7 +43,8 @@ namespace MCGalaxy.Commands {
|
|||||||
type = args[1];
|
type = args[1];
|
||||||
}
|
}
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
Player.GlobalMessage(p, giver + " %Shugged " + who.ColoredName + "."); return;
|
Player.GlobalMessage(p, giver + " %Shugged " + who.ColoredName + ".");
|
||||||
|
p.CheckForMessageSpam(); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == "deadly") {
|
if (type == "deadly") {
|
||||||
@ -56,6 +57,7 @@ namespace MCGalaxy.Commands {
|
|||||||
who.HandleDeath(Block.rock, " died from a %cdeadly hug.");
|
who.HandleDeath(Block.rock, " died from a %cdeadly hug.");
|
||||||
}
|
}
|
||||||
Player.GlobalMessage(p, giver + " %Sgave " + who.ColoredName + " %Sa " + type + " hug.");
|
Player.GlobalMessage(p, giver + " %Sgave " + who.ColoredName + " %Sa " + type + " hug.");
|
||||||
|
p.CheckForMessageSpam();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
|
@ -16,30 +16,29 @@
|
|||||||
permissions and limitations under the Licenses.
|
permissions and limitations under the Licenses.
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
namespace MCGalaxy.Commands
|
namespace MCGalaxy.Commands {
|
||||||
{
|
public sealed class CmdMe : Command {
|
||||||
public sealed class CmdMe : Command
|
|
||||||
{
|
|
||||||
public override string name { get { return "me"; } }
|
public override string name { get { return "me"; } }
|
||||||
public override string shortcut { get { return ""; } }
|
public override string shortcut { get { return ""; } }
|
||||||
public override string type { get { return CommandTypes.Chat; } }
|
public override string type { get { return CommandTypes.Chat; } }
|
||||||
public override bool museumUsable { get { return true; } }
|
public override bool museumUsable { get { return true; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
|
||||||
public CmdMe() { }
|
public CmdMe() { }
|
||||||
public override void Use(Player p, string message)
|
|
||||||
{
|
public override void Use(Player p, string message) {
|
||||||
if (message == "") { Player.Message(p, "You"); return; }
|
if (message == "") { Player.Message(p, "You"); return; }
|
||||||
if (p == null) { MessageInGameOnly(p); return; }
|
if (p == null) { MessageInGameOnly(p); return; }
|
||||||
|
|
||||||
if (p.joker || p.muted) { Player.Message(p, "Cannot use /me while muted or jokered."); return; }
|
if (p.joker || p.muted) { Player.Message(p, "Cannot use /me while muted or jokered."); return; }
|
||||||
if (Server.chatmod && !p.voice) { Player.Message(p, "Chat moderation is on, you cannot emote."); return; }
|
if (Server.chatmod && !p.voice) { Player.Message(p, "Chat moderation is on, you cannot emote."); return; }
|
||||||
|
|
||||||
if (!p.level.worldChat) {
|
if (!p.level.worldChat) {
|
||||||
Chat.GlobalChatLevel(p, "<Level>" + p.color + "*" + Colors.StripColors(p.DisplayName) + " " + message, false);
|
Chat.GlobalChatLevel(p, "<Level>" + p.color + "*" + Colors.StripColors(p.DisplayName) + " " + message, false);
|
||||||
} else {
|
} else {
|
||||||
Player.SendChatFrom(p, p.color + "*" + Colors.StripColors(p.DisplayName) + " " + message, false);
|
Player.SendChatFrom(p, p.color + "*" + Colors.StripColors(p.DisplayName) + " " + message, false);
|
||||||
Player.RaisePlayerAction(p, PlayerAction.Me, message);
|
Player.RaisePlayerAction(p, PlayerAction.Me, message);
|
||||||
}
|
}
|
||||||
|
p.CheckForMessageSpam();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
|
@ -37,6 +37,7 @@ namespace MCGalaxy.Commands {
|
|||||||
if (min > max) { int a = min; min = max; max = a; }
|
if (min > max) { int a = min; min = max; max = a; }
|
||||||
|
|
||||||
Player.GlobalMessage(p, p.ColoredName + " %Srolled a &a" + rand.Next(min, max + 1) + " %S(" + min + "|" + max + ")");
|
Player.GlobalMessage(p, p.ColoredName + " %Srolled a &a" + rand.Next(min, max + 1) + " %S(" + min + "|" + max + ")");
|
||||||
|
p.CheckForMessageSpam();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
|
@ -46,7 +46,7 @@ namespace MCGalaxy.Commands {
|
|||||||
p.afkMessage = p.IsAfk ? message : null;
|
p.afkMessage = p.IsAfk ? message : null;
|
||||||
TabList.Update(p, true);
|
TabList.Update(p, true);
|
||||||
p.LastAction = DateTime.UtcNow;
|
p.LastAction = DateTime.UtcNow;
|
||||||
|
|
||||||
bool send = !Server.chatmod && !p.muted;
|
bool send = !Server.chatmod && !p.muted;
|
||||||
if (p.IsAfk) {
|
if (p.IsAfk) {
|
||||||
if (send) {
|
if (send) {
|
||||||
@ -61,12 +61,13 @@ namespace MCGalaxy.Commands {
|
|||||||
OnPlayerAFKEvent.Call(p);
|
OnPlayerAFKEvent.Call(p);
|
||||||
} else {
|
} else {
|
||||||
if (send) {
|
if (send) {
|
||||||
Player.GlobalMessage("-" + p.ColoredName + "%S- is no longer AFK");
|
Player.GlobalMessage("-" + p.ColoredName + "%S- is no longer AFK");
|
||||||
Player.RaisePlayerAction(p, PlayerAction.UnAFK, message);
|
Player.RaisePlayerAction(p, PlayerAction.UnAFK, message);
|
||||||
} else {
|
} else {
|
||||||
Player.Message(p, "You are no longer marked as being AFK.");
|
Player.Message(p, "You are no longer marked as being AFK.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
p.CheckForMessageSpam();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
|
@ -186,11 +186,8 @@ namespace MCGalaxy {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
PlayerBot.UnloadFromLevel(this);
|
PlayerBot.UnloadFromLevel(this);
|
||||||
//physChecker.Stop();
|
|
||||||
//physChecker.Dispose();
|
|
||||||
physThread.Abort();
|
physThread.Abort();
|
||||||
physThread.Join();
|
physThread.Join();
|
||||||
|
|
||||||
} catch {
|
} catch {
|
||||||
} finally {
|
} finally {
|
||||||
Dispose();
|
Dispose();
|
||||||
|
@ -558,7 +558,7 @@ try { SendBlockchange(pos1.x, pos1.y, pos1.z, Block.waterstill); } catch { }
|
|||||||
}
|
}
|
||||||
hello:
|
hello:
|
||||||
// People who are muted can't speak or vote
|
// People who are muted can't speak or vote
|
||||||
if ( muted ) { this.SendMessage("You are muted."); return; } //Muted: Only allow commands
|
if (muted) { SendMessage("You are muted."); return; } //Muted: Only allow commands
|
||||||
|
|
||||||
// Lava Survival map vote recorder
|
// Lava Survival map vote recorder
|
||||||
if ( Server.lava.HasPlayer(this) && Server.lava.HasVote(text.ToLower()) ) {
|
if ( Server.lava.HasPlayer(this) && Server.lava.HasVote(text.ToLower()) ) {
|
||||||
@ -578,28 +578,10 @@ try { SendBlockchange(pos1.x, pos1.y, pos1.z, Block.waterstill); } catch { }
|
|||||||
if (IsHandledMessage(text)) return;
|
if (IsHandledMessage(text)) return;
|
||||||
|
|
||||||
// Put this after vote collection so that people can vote even when chat is moderated
|
// 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; }
|
if (Server.chatmod && !voice) { SendMessage("Chat moderation is on, you cannot speak."); return; }
|
||||||
|
CheckForMessageSpam();
|
||||||
|
|
||||||
if (Server.checkspam) {
|
if (Chat.HandleModes(this, text)) return;
|
||||||
if (Player.lastMSG == name) {
|
|
||||||
consecutivemessages++;
|
|
||||||
} else {
|
|
||||||
consecutivemessages--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (consecutivemessages >= Server.spamcounter) {
|
|
||||||
muteCooldown = Server.mutespamtime;
|
|
||||||
Command.all.Find("mute").Use(null, name);
|
|
||||||
Player.GlobalMessage(color + DisplayName + " %Shas been &0muted &efor spamming!");
|
|
||||||
muteTimer.Elapsed += MuteTimerElapsed;
|
|
||||||
muteTimer.Start();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Player.lastMSG = this.name;
|
|
||||||
|
|
||||||
if( Chat.HandleModes(this, text) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ( text[0] == ':' ) {
|
if ( text[0] == ':' ) {
|
||||||
if ( PlayingTntWars ) {
|
if ( PlayingTntWars ) {
|
||||||
@ -678,6 +660,26 @@ return;
|
|||||||
catch ( Exception e ) { Server.ErrorLog(e); Player.GlobalMessage("An error occurred: " + e.Message); }
|
catch ( Exception e ) { Server.ErrorLog(e); Player.GlobalMessage("An error occurred: " + e.Message); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CheckForMessageSpam() {
|
||||||
|
if (!Server.checkspam || ircNick != null) { Player.lastMSG = name; return; }
|
||||||
|
|
||||||
|
if (Player.lastMSG == name) {
|
||||||
|
consecutivemessages++;
|
||||||
|
} else {
|
||||||
|
consecutivemessages--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (consecutivemessages >= Server.spamcounter) {
|
||||||
|
muteCooldown = Server.mutespamtime;
|
||||||
|
Command.all.Find("mute").Use(null, name);
|
||||||
|
Player.GlobalMessage(color + DisplayName + " %Shas been &0muted &efor spamming!");
|
||||||
|
muteTimer.Elapsed += MuteTimerElapsed;
|
||||||
|
muteTimer.Start();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Player.lastMSG = name;
|
||||||
|
}
|
||||||
|
|
||||||
string HandleJoker(string text) {
|
string HandleJoker(string text) {
|
||||||
if (!joker) return text;
|
if (!joker) return text;
|
||||||
if (!File.Exists("text/joker.txt")) {
|
if (!File.Exists("text/joker.txt")) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user