mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 03:55:18 -04:00
Modularise Chat.cs into Chat.cs, ChatTokens.cs and ChatModes.cs
This commit is contained in:
parent
1092b1dc1c
commit
f96e0ad499
224
Chat/Chat.cs
224
Chat/Chat.cs
@ -13,14 +13,8 @@ or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using TokenParser = System.Func<MCGalaxy.Player, string>;
|
||||
|
||||
namespace MCGalaxy {
|
||||
|
||||
public static class Chat {
|
||||
|
||||
public static void GlobalChatLevel(Player from, string message, bool showname) {
|
||||
@ -67,30 +61,6 @@ namespace MCGalaxy {
|
||||
Server.s.Log("<ChatRoom " + chatroom + ">" + from.name + ": " + rawMessage);
|
||||
}
|
||||
|
||||
public static void GlobalMessageLevel(Level l, string message) {
|
||||
Player[] players = PlayerInfo.Online.Items;
|
||||
foreach (Player p in players) {
|
||||
if (p.level == l && p.Chatroom == null)
|
||||
Player.Message(p, message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void GlobalMessageMinPerms(string message, LevelPermission minPerm) {
|
||||
Player[] players = PlayerInfo.Online.Items;
|
||||
foreach (Player p in players) {
|
||||
if (p.Rank >= minPerm)
|
||||
Player.Message(p, message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void GlobalMessageOps(string message) {
|
||||
GlobalMessageMinPerms(message, Server.opchatperm);
|
||||
}
|
||||
|
||||
public static void GlobalMessageAdmins(string message) {
|
||||
GlobalMessageMinPerms(message, Server.adminchatperm);
|
||||
}
|
||||
|
||||
static void SendMessage(Player p, Player from, string message) {
|
||||
if (from != null && p.listignored.Contains(from.name)) return;
|
||||
|
||||
@ -98,174 +68,60 @@ namespace MCGalaxy {
|
||||
Player.Message(p, Server.DefaultColor + message);
|
||||
}
|
||||
|
||||
public static string ApplyTokens(string text, Player p) {
|
||||
if (text.IndexOf('$') == -1) return text;
|
||||
StringBuilder sb = new StringBuilder(text);
|
||||
ApplyTokens(sb, p);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static void ApplyTokens(StringBuilder sb, Player p) {
|
||||
// only apply standard $tokens when necessary
|
||||
for (int i = 0; i < sb.Length; i++) {
|
||||
if (sb[i] != '$') continue;
|
||||
|
||||
foreach (var token in standardTokens) {
|
||||
if (Server.disabledChatTokens.Contains(token.Key)) continue;
|
||||
string value = token.Value(p);
|
||||
if (value == null) continue;
|
||||
sb.Replace(token.Key, value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
foreach (var token in CustomTokens)
|
||||
sb.Replace(token.Key, token.Value);
|
||||
}
|
||||
|
||||
internal static Dictionary<string, TokenParser> standardTokens = new Dictionary<string, TokenParser> {
|
||||
{ "$name", p => p.DisplayName == null ? null :
|
||||
(Server.dollarNames ? "$" : "") + Colors.StripColors(p.DisplayName) },
|
||||
{ "$truename", p => p.truename == null ? null :
|
||||
(Server.dollarNames ? "$" : "") + p.truename },
|
||||
{ "$date", p => DateTime.Now.ToString("yyyy-MM-dd") },
|
||||
{ "$time", p => DateTime.Now.ToString("HH:mm:ss") },
|
||||
{ "$ip", p => p.ip },
|
||||
{ "$serverip", p => Player.IsLocalIpAddress(p.ip) ? p.ip : Server.IP },
|
||||
{ "$color", p => p.color },
|
||||
{ "$rank", p => p.group == null ? null : p.group.name },
|
||||
{ "$level", p => p.level == null ? null : p.level.name },
|
||||
|
||||
{ "$deaths", p => p.overallDeath.ToString() },
|
||||
{ "$money", p => p.money.ToString() },
|
||||
{ "$blocks", p => p.overallBlocks.ToString() },
|
||||
{ "$first", p => p.firstLogin.ToString() },
|
||||
{ "$kicked", p => p.totalKicked.ToString() },
|
||||
{ "$server", p => Server.name },
|
||||
{ "$motd", p => Server.motd },
|
||||
{ "$banned", p => Player.GetBannedCount().ToString() },
|
||||
{ "$irc", p => Server.ircServer + " > " + Server.ircChannel },
|
||||
|
||||
{ "$infected", p => p.Game.TotalInfected.ToString() },
|
||||
{ "$survived", p => p.Game.TotalRoundsSurvived.ToString() },
|
||||
};
|
||||
public static Dictionary<string, string> CustomTokens = new Dictionary<string, string>();
|
||||
|
||||
internal static void LoadCustomTokens() {
|
||||
CustomTokens.Clear();
|
||||
if (File.Exists("text/custom$s.txt")) {
|
||||
using (CP437Reader r = new CP437Reader("text/custom$s.txt")) {
|
||||
string line;
|
||||
while ((line = r.ReadLine()) != null) {
|
||||
if (line.StartsWith("//")) continue;
|
||||
string[] split = line.Split(new[] { ':' }, 2);
|
||||
if (split.Length == 2 && !String.IsNullOrEmpty(split[0]))
|
||||
CustomTokens.Add(split[0], split[1]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Server.s.Log("custom$s.txt does not exist, creating");
|
||||
using (CP437Writer w = new CP437Writer("text/custom$s.txt")) {
|
||||
w.WriteLine("// This is used to create custom $s");
|
||||
w.WriteLine("// If you start the line with a // it wont be used");
|
||||
w.WriteLine("// It should be formatted like this:");
|
||||
w.WriteLine("// $website:http://example.org");
|
||||
w.WriteLine("// That would replace '$website' in any message to 'http://example.org'");
|
||||
w.WriteLine("// It must not start with a // and it must not have a space between the 2 sides and the colon (:)");
|
||||
}
|
||||
/// <summary> Sends a message to all players who are on the given level. </summary>
|
||||
public static void MessageLevel(Level lvl, string message) {
|
||||
Player[] players = PlayerInfo.Online.Items;
|
||||
foreach (Player p in players) {
|
||||
if (p.level == lvl && p.Chatroom == null)
|
||||
Player.Message(p, message);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool HandleModes(Player p, string text) {
|
||||
if (text.Length >= 2 && text[0] == '@' && text[1] == '@') {
|
||||
text = text.Remove(0, 2);
|
||||
if (text.Length < 1) { Player.Message(p, "No message entered"); return true; }
|
||||
|
||||
Player.Message(p, "[<] Console: &f" + text);
|
||||
string name = p == null ? "(console)" : p.name;
|
||||
Server.s.Log("[>] " + name + ": " + text);
|
||||
return true;
|
||||
/// <summary> Sends a message to all players who are ranked minPerm or above. </summary>
|
||||
public static void MessageAllMinPerm(string message, LevelPermission minPerm) {
|
||||
Player[] players = PlayerInfo.Online.Items;
|
||||
foreach (Player p in players) {
|
||||
if (p.Rank >= minPerm)
|
||||
Player.Message(p, message);
|
||||
}
|
||||
|
||||
if (text[0] == '@' || (p != null && p.whisper)) {
|
||||
if (text[0] == '@') text = text.Remove(0, 1).Trim();
|
||||
|
||||
if (p == null || p.whisperTo == "") {
|
||||
int pos = text.IndexOf(' ');
|
||||
if ( pos != -1 ) {
|
||||
string to = text.Substring(0, pos);
|
||||
string msg = text.Substring(pos + 1);
|
||||
HandleWhisper(p, to, msg);
|
||||
} else {
|
||||
Player.Message(p, "No message entered");
|
||||
}
|
||||
} else {
|
||||
HandleWhisper(p, p.whisperTo, text);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (text[0] == '#' || (p != null && p.opchat)) {
|
||||
if (text[0] == '#') text = text.Remove(0, 1).Trim();
|
||||
MessageOps(p, text);
|
||||
return true;
|
||||
}
|
||||
if (text[0] == '+' || (p != null && p.adminchat)) {
|
||||
if (text[0] == '+') text = text.Remove(0, 1).Trim();
|
||||
MessageAdmins(p, text);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void MessageOps(Player p, string message) {
|
||||
string displayName = p == null ? "(console)" : p.ColoredName;
|
||||
string name = p == null ? "(console)" : p.name;
|
||||
GlobalMessageOps("To Ops &f-" + displayName + "&f- " + message);
|
||||
if (p != null && p.Rank < Server.opchatperm )
|
||||
p.SendMessage("To Ops &f-" + displayName + "&f- " + message);
|
||||
|
||||
Server.s.Log("(OPs): " + name + ": " + message);
|
||||
Server.IRC.Say(displayName + "%S: " + message, true);
|
||||
}
|
||||
|
||||
public static void MessageAdmins(Player p, string message) {
|
||||
string displayName = p == null ? "(console)" : p.ColoredName;
|
||||
string name = p == null ? "(console)" : p.name;
|
||||
Chat.GlobalMessageAdmins("To Admins &f-" + displayName + "&f- " + message);
|
||||
if (p != null && p.Rank < Server.adminchatperm)
|
||||
p.SendMessage("To Admins &f-" + displayName + "&f- " + message);
|
||||
|
||||
Server.s.Log("(Admins): " + name + ": " + message);
|
||||
Server.IRC.Say(displayName + "%S: " + message, true);
|
||||
/// <summary> Sends a message to all players who are have the permission to read opchat. </summary>
|
||||
public static void MessageOps(string message) {
|
||||
MessageAllMinPerm(message, Server.opchatperm);
|
||||
}
|
||||
|
||||
static void HandleWhisper(Player p, string target, string message) {
|
||||
Player who = PlayerInfo.FindMatches(p, target);
|
||||
if (who == null) return;
|
||||
if (who == p) { Player.Message(p, "Trying to talk to yourself, huh?"); return; }
|
||||
|
||||
if (who.ignoreAll) {
|
||||
DoFakePM(p, who, message); return;
|
||||
}
|
||||
if (p != null && who.listignored.Contains(p.name)) {
|
||||
DoFakePM(p, who, message); return;
|
||||
/// <summary> Sends a message to all players who are have the permission to read adminchat. </summary>
|
||||
public static void MessageAdmins(string message) {
|
||||
MessageAllMinPerm(message, Server.adminchatperm);
|
||||
}
|
||||
|
||||
/// <summary> Sends a message to all players, who do not have
|
||||
/// isolated level/level only chat and are not in a chatroom. </summary>
|
||||
public static void MessageAll(string message) {
|
||||
message = Colors.EscapeColors(message);
|
||||
Player[] players = PlayerInfo.Online.Items;
|
||||
foreach (Player p in players) {
|
||||
if (!p.ignoreAll && p.level.worldChat && p.Chatroom == null)
|
||||
p.SendMessage(message, true);
|
||||
}
|
||||
DoPM(p, who, message);
|
||||
}
|
||||
|
||||
static void DoFakePM(Player p, Player who, string message) {
|
||||
string name = p == null ? "(console)" : p.name;
|
||||
Server.s.Log(name + " @" + who.name + ": " + message);
|
||||
Player.Message(p, "[<] " + who.ColoredName + ": &f" + message);
|
||||
public static void MessageAll(string message, object a0) {
|
||||
MessageAll(String.Format(message, a0));
|
||||
}
|
||||
|
||||
static void DoPM(Player p, Player who, string message) {
|
||||
string name = p == null ? "(console)" : p.name;
|
||||
string fullName = p == null ? "%S(console)" : p.ColoredName;
|
||||
|
||||
Server.s.Log(name + " @" + who.name + ": " + message);
|
||||
Player.Message(p, "[<] " + who.ColoredName + ": &f" + message);
|
||||
Player.Message(who, "&9[>] " + fullName + ": &f" + message);
|
||||
public static void MessageAll(string message, object a0, object a1) {
|
||||
MessageAll(String.Format(message, a0, a1));
|
||||
}
|
||||
|
||||
public static void MessageAll(string message, object a0, object a1, object a2) {
|
||||
MessageAll(String.Format(message, a0, a1, a2));
|
||||
}
|
||||
|
||||
public static void MessageAll(string message, params object[] args) {
|
||||
MessageAll(String.Format(message, args));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
113
Chat/ChatModes.cs
Normal file
113
Chat/ChatModes.cs
Normal file
@ -0,0 +1,113 @@
|
||||
/*
|
||||
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/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 {
|
||||
public static class ChatModes {
|
||||
|
||||
public static bool Handle(Player p, string text) {
|
||||
if (text.Length >= 2 && text[0] == '@' && text[1] == '@') {
|
||||
text = text.Remove(0, 2);
|
||||
if (text.Length < 1) { Player.Message(p, "No message entered"); return true; }
|
||||
|
||||
Player.Message(p, "[<] Console: &f" + text);
|
||||
string name = p == null ? "(console)" : p.name;
|
||||
Server.s.Log("[>] " + name + ": " + text);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (text[0] == '@' || (p != null && p.whisper)) {
|
||||
if (text[0] == '@') text = text.Remove(0, 1).Trim();
|
||||
|
||||
if (p == null || p.whisperTo == "") {
|
||||
int pos = text.IndexOf(' ');
|
||||
if ( pos != -1 ) {
|
||||
string to = text.Substring(0, pos);
|
||||
string msg = text.Substring(pos + 1);
|
||||
HandleWhisper(p, to, msg);
|
||||
} else {
|
||||
Player.Message(p, "No message entered");
|
||||
}
|
||||
} else {
|
||||
HandleWhisper(p, p.whisperTo, text);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (text[0] == '#' || (p != null && p.opchat)) {
|
||||
if (text[0] == '#') text = text.Remove(0, 1).Trim();
|
||||
MessageOps(p, text);
|
||||
return true;
|
||||
}
|
||||
if (text[0] == '+' || (p != null && p.adminchat)) {
|
||||
if (text[0] == '+') text = text.Remove(0, 1).Trim();
|
||||
MessageAdmins(p, text);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void MessageOps(Player p, string message) {
|
||||
string displayName = p == null ? "(console)" : p.ColoredName;
|
||||
string name = p == null ? "(console)" : p.name;
|
||||
Chat.MessageOps("To Ops &f-" + displayName + "&f- " + message);
|
||||
if (p != null && p.Rank < Server.opchatperm )
|
||||
p.SendMessage("To Ops &f-" + displayName + "&f- " + message);
|
||||
|
||||
Server.s.Log("(OPs): " + name + ": " + message);
|
||||
Server.IRC.Say(displayName + "%S: " + message, true);
|
||||
}
|
||||
|
||||
public static void MessageAdmins(Player p, string message) {
|
||||
string displayName = p == null ? "(console)" : p.ColoredName;
|
||||
string name = p == null ? "(console)" : p.name;
|
||||
Chat.MessageAdmins("To Admins &f-" + displayName + "&f- " + message);
|
||||
if (p != null && p.Rank < Server.adminchatperm)
|
||||
p.SendMessage("To Admins &f-" + displayName + "&f- " + message);
|
||||
|
||||
Server.s.Log("(Admins): " + name + ": " + message);
|
||||
Server.IRC.Say(displayName + "%S: " + message, true);
|
||||
}
|
||||
|
||||
static void HandleWhisper(Player p, string target, string message) {
|
||||
Player who = PlayerInfo.FindMatches(p, target);
|
||||
if (who == null) return;
|
||||
if (who == p) { Player.Message(p, "Trying to talk to yourself, huh?"); return; }
|
||||
|
||||
if (who.ignoreAll) {
|
||||
DoFakePM(p, who, message); return;
|
||||
}
|
||||
if (p != null && who.listignored.Contains(p.name)) {
|
||||
DoFakePM(p, who, message); return;
|
||||
}
|
||||
DoPM(p, who, message);
|
||||
}
|
||||
|
||||
static void DoFakePM(Player p, Player who, string message) {
|
||||
string name = p == null ? "(console)" : p.name;
|
||||
Server.s.Log(name + " @" + who.name + ": " + message);
|
||||
Player.Message(p, "[<] " + who.ColoredName + ": &f" + message);
|
||||
}
|
||||
|
||||
static void DoPM(Player p, Player who, string message) {
|
||||
string name = p == null ? "(console)" : p.name;
|
||||
string fullName = p == null ? "%S(console)" : p.ColoredName;
|
||||
|
||||
Server.s.Log(name + " @" + who.name + ": " + message);
|
||||
Player.Message(p, "[<] " + who.ColoredName + ": &f" + message);
|
||||
Player.Message(who, "&9[>] " + fullName + ": &f" + message);
|
||||
}
|
||||
}
|
||||
}
|
101
Chat/ChatTokens.cs
Normal file
101
Chat/ChatTokens.cs
Normal file
@ -0,0 +1,101 @@
|
||||
/*
|
||||
Copyright 2010 MCSharp team (Modified for use with MCZall/MCLawl/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;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using TokenParser = System.Func<MCGalaxy.Player, string>;
|
||||
|
||||
namespace MCGalaxy {
|
||||
public static class ChatTokens {
|
||||
|
||||
public static string Apply(string text, Player p) {
|
||||
if (text.IndexOf('$') == -1) return text;
|
||||
StringBuilder sb = new StringBuilder(text);
|
||||
Apply(sb, p);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static void Apply(StringBuilder sb, Player p) {
|
||||
// only apply standard $tokens when necessary
|
||||
for (int i = 0; i < sb.Length; i++) {
|
||||
if (sb[i] != '$') continue;
|
||||
|
||||
foreach (var token in standardTokens) {
|
||||
if (Server.disabledChatTokens.Contains(token.Key)) continue;
|
||||
string value = token.Value(p);
|
||||
if (value == null) continue;
|
||||
sb.Replace(token.Key, value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
foreach (var token in CustomTokens)
|
||||
sb.Replace(token.Key, token.Value);
|
||||
}
|
||||
|
||||
internal static Dictionary<string, TokenParser> standardTokens = new Dictionary<string, TokenParser> {
|
||||
{ "$name", p => p.DisplayName == null ? null :
|
||||
(Server.dollarNames ? "$" : "") + Colors.StripColors(p.DisplayName) },
|
||||
{ "$truename", p => p.truename == null ? null :
|
||||
(Server.dollarNames ? "$" : "") + p.truename },
|
||||
{ "$date", p => DateTime.Now.ToString("yyyy-MM-dd") },
|
||||
{ "$time", p => DateTime.Now.ToString("HH:mm:ss") },
|
||||
{ "$ip", p => p.ip },
|
||||
{ "$serverip", p => Player.IsLocalIpAddress(p.ip) ? p.ip : Server.IP },
|
||||
{ "$color", p => p.color },
|
||||
{ "$rank", p => p.group == null ? null : p.group.name },
|
||||
{ "$level", p => p.level == null ? null : p.level.name },
|
||||
|
||||
{ "$deaths", p => p.overallDeath.ToString() },
|
||||
{ "$money", p => p.money.ToString() },
|
||||
{ "$blocks", p => p.overallBlocks.ToString() },
|
||||
{ "$first", p => p.firstLogin.ToString() },
|
||||
{ "$kicked", p => p.totalKicked.ToString() },
|
||||
{ "$server", p => Server.name },
|
||||
{ "$motd", p => Server.motd },
|
||||
{ "$banned", p => Player.GetBannedCount().ToString() },
|
||||
{ "$irc", p => Server.ircServer + " > " + Server.ircChannel },
|
||||
|
||||
{ "$infected", p => p.Game.TotalInfected.ToString() },
|
||||
{ "$survived", p => p.Game.TotalRoundsSurvived.ToString() },
|
||||
};
|
||||
|
||||
public static Dictionary<string, string> CustomTokens = new Dictionary<string, string>();
|
||||
internal static void LoadCustom() {
|
||||
CustomTokens.Clear();
|
||||
if (File.Exists("text/custom$s.txt")) {
|
||||
using (CP437Reader r = new CP437Reader("text/custom$s.txt")) {
|
||||
string line;
|
||||
while ((line = r.ReadLine()) != null) {
|
||||
if (line.StartsWith("//")) continue;
|
||||
string[] split = line.Split(new[] { ':' }, 2);
|
||||
if (split.Length == 2 && !String.IsNullOrEmpty(split[0]))
|
||||
CustomTokens.Add(split[0], split[1]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Server.s.Log("custom$s.txt does not exist, creating");
|
||||
using (CP437Writer w = new CP437Writer("text/custom$s.txt")) {
|
||||
w.WriteLine("// This is used to create custom $s");
|
||||
w.WriteLine("// If you start the line with a // it wont be used");
|
||||
w.WriteLine("// It should be formatted like this:");
|
||||
w.WriteLine("// $website:http://example.org");
|
||||
w.WriteLine("// That would replace '$website' in any message to 'http://example.org'");
|
||||
w.WriteLine("// It must not start with a // and it must not have a space between the 2 sides and the colon (:)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -22,7 +22,7 @@ namespace MCGalaxy.Commands {
|
||||
public CmdAdminChat() { }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (message != "") { Chat.MessageAdmins(p, message); return; }
|
||||
if (message != "") { ChatModes.MessageAdmins(p, message); return; }
|
||||
|
||||
p.adminchat = !p.adminchat;
|
||||
if (p.adminchat) Player.Message(p, "All messages will now be sent to Admins only");
|
||||
|
@ -25,7 +25,7 @@ namespace MCGalaxy.Commands {
|
||||
public CmdOpChat() { }
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (message != "") { Chat.MessageOps(p, message); return; }
|
||||
if (message != "") { ChatModes.MessageOps(p, message); return; }
|
||||
|
||||
p.opchat = !p.opchat;
|
||||
if (p.opchat) Player.Message(p, "All messages will now be sent to OPs only");
|
||||
|
@ -194,11 +194,11 @@ namespace MCGalaxy.Commands {
|
||||
Player.Message(p, "Countdown rules sent to everyone");
|
||||
return;
|
||||
} else if (target == "map") {
|
||||
Chat.GlobalMessageLevel(p.level, "Countdown Rules being sent to " + p.level.name + " by " + p.ColoredName + ":");
|
||||
Chat.GlobalMessageLevel(p.level, "The aim of the game is to stay alive the longest.");
|
||||
Chat.GlobalMessageLevel(p.level, "Don't fall in the lava!!");
|
||||
Chat.GlobalMessageLevel(p.level, "Blocks on the ground will disapear randomly, first going yellow, then orange, then red and finally disappering.");
|
||||
Chat.GlobalMessageLevel(p.level, "The last person alive will win!!");
|
||||
Chat.MessageLevel(p.level, "Countdown Rules being sent to " + p.level.name + " by " + p.ColoredName + ":");
|
||||
Chat.MessageLevel(p.level, "The aim of the game is to stay alive the longest.");
|
||||
Chat.MessageLevel(p.level, "Don't fall in the lava!!");
|
||||
Chat.MessageLevel(p.level, "Blocks on the ground will disapear randomly, first going yellow, then orange, then red and finally disappering.");
|
||||
Chat.MessageLevel(p.level, "The last person alive will win!!");
|
||||
Player.Message(p, "Countdown rules sent to: " + p.level.name);
|
||||
return;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ namespace MCGalaxy.Commands.Moderation {
|
||||
} else {
|
||||
if (stealth) {
|
||||
banMsg = who.ColoredName + " %Swas STEALTH &8banned %Sby " + banner + "%S." + banReason;
|
||||
Chat.GlobalMessageOps(banMsg);
|
||||
Chat.MessageOps(banMsg);
|
||||
} else {
|
||||
banMsg = who.ColoredName + " %Swas &8banned %Sby " + banner + "%S." + banReason;
|
||||
Player.GlobalMessage(banMsg);
|
||||
|
@ -62,7 +62,7 @@ namespace MCGalaxy.Commands
|
||||
Entities.GlobalDespawn(p, false);
|
||||
TabList.Add(p, p, 0xFF);
|
||||
if (messageOps && !p.otherRankHidden)
|
||||
Chat.GlobalMessageOps("To Ops -" + p.ColoredName + "%S- is now &finvisible%S.");
|
||||
Chat.MessageOps("To Ops -" + p.ColoredName + "%S- is now &finvisible%S.");
|
||||
string discMsg = PlayerDB.GetLogoutMessage(p);
|
||||
Player.SendChatFrom(p, "&c- " + p.FullName + " %S" + discMsg, false);
|
||||
Server.IRC.Say(p.DisplayName + " left the game (" + discMsg + ")");
|
||||
@ -74,7 +74,7 @@ namespace MCGalaxy.Commands
|
||||
p.otherRankHidden = false;
|
||||
p.oHideRank = LevelPermission.Null;
|
||||
if (messageOps)
|
||||
Chat.GlobalMessageAdmins("To Admins -" + p.ColoredName + "%S- is now &fvisible%S.");
|
||||
Chat.MessageAdmins("To Admins -" + p.ColoredName + "%S- is now &fvisible%S.");
|
||||
|
||||
Player.SendChatFrom(p, "&a+ " + p.FullName + " %S" + PlayerDB.GetLoginMessage(p), false);
|
||||
Server.IRC.Say(p.DisplayName + " joined the game");
|
||||
|
@ -41,14 +41,14 @@ namespace MCGalaxy.Commands {
|
||||
|
||||
if (!who.joker) {
|
||||
if (stealth) {
|
||||
Chat.GlobalMessageOps(who.ColoredName + " %Sis now STEALTH jokered.");
|
||||
Chat.MessageOps(who.ColoredName + " %Sis now STEALTH jokered.");
|
||||
} else {
|
||||
Player.SendChatFrom(who, who.ColoredName + " %Sis now a &aJ&bo&ck&5e&9r%S.", false);
|
||||
}
|
||||
Player.RaisePlayerAction(p, PlayerAction.Joker, null, stealth);
|
||||
} else {
|
||||
if (stealth) {
|
||||
Chat.GlobalMessageOps(who.ColoredName + " %Sis now STEALTH unjokered.");
|
||||
Chat.MessageOps(who.ColoredName + " %Sis now STEALTH unjokered.");
|
||||
} else {
|
||||
Player.SendChatFrom(who, who.ColoredName + " %Sis no longer a &aJ&bo&ck&5e&9r%S.", false);
|
||||
}
|
||||
|
@ -88,8 +88,8 @@ namespace MCGalaxy.Commands {
|
||||
Player.Message(p, msg);
|
||||
|
||||
string start = pos > 0 ? "There are now &c" + (pos + 1) + " %Speople" : "There is now &c1 %Sperson";
|
||||
Chat.GlobalMessageMinPerms(p.color + p.name + " %Sentered the review queue", nextPerm);
|
||||
Chat.GlobalMessageMinPerms(start + " waiting for a &creview!", nextPerm);
|
||||
Chat.MessageAllMinPerm(p.ColoredName + " %Sentered the review queue", nextPerm);
|
||||
Chat.MessageAllMinPerm(start + " waiting for a &creview!", nextPerm);
|
||||
p.NextReviewTime = DateTime.UtcNow.AddSeconds(Server.reviewcooldown);
|
||||
Player.RaisePlayerAction(p, PlayerAction.Review, null, true);
|
||||
}
|
||||
@ -157,8 +157,8 @@ namespace MCGalaxy.Commands {
|
||||
|
||||
static void MessageNoPerm(Player p, LevelPermission perm) {
|
||||
Player.Message(p, "There is something wrong with the system. A message has been sent to the admin to fix");
|
||||
Chat.GlobalMessageAdmins(p.name + " tryed to use /review, but a system error occurred. Make sure your groups are formatted correctly");
|
||||
Chat.GlobalMessageAdmins("The group permission that is messed up is: " + perm + " (" + (int)perm+ ")");
|
||||
Chat.MessageAdmins(p.name + " tryed to use /review, but a system error occurred. Make sure your groups are formatted correctly");
|
||||
Chat.MessageAdmins("The group permission that is messed up is: " + perm + " (" + (int)perm+ ")");
|
||||
}
|
||||
|
||||
static void MessageReviewPosChanged() {
|
||||
|
@ -41,7 +41,7 @@ namespace MCGalaxy.Commands {
|
||||
return;
|
||||
}
|
||||
|
||||
Chat.GlobalMessageOps(p.ColoredName + " %Sused &a/votekick");
|
||||
Chat.MessageOps(p.ColoredName + " %Sused &a/votekick");
|
||||
Player.GlobalMessage("&9A vote to kick " + who.ColoredName + " %Shas been called!");
|
||||
Player.GlobalMessage("&9Type &aY %Sor &cN %Sto vote.");
|
||||
|
||||
@ -70,7 +70,7 @@ namespace MCGalaxy.Commands {
|
||||
|
||||
int netVotesYes = votesYes - votesNo;
|
||||
// Should we also send this to players?
|
||||
Chat.GlobalMessageOps("Vote Ended. Results: &aY: " + votesYes + " &cN: " + votesNo);
|
||||
Chat.MessageOps("Vote Ended. Results: &aY: " + votesYes + " &cN: " + votesNo);
|
||||
Server.s.Log("VoteKick results for " + who.DisplayName + ": " + votesYes + " yes and " + votesNo + " no votes.");
|
||||
|
||||
if (votesYes + votesNo < Server.voteKickVotesNeeded) {
|
||||
|
@ -53,7 +53,7 @@ namespace MCGalaxy.Commands {
|
||||
|
||||
Server.whiteList.Add(player);
|
||||
string src = p == null ? "(console)" : p.ColoredName;
|
||||
Chat.GlobalMessageOps(src + " %Sadded &f" + player + " %Sto the whitelist.");
|
||||
Chat.MessageOps(src + " %Sadded &f" + player + " %Sto the whitelist.");
|
||||
Server.whiteList.Save();
|
||||
Server.s.Log("WHITELIST: Added " + player);
|
||||
}
|
||||
@ -65,7 +65,7 @@ namespace MCGalaxy.Commands {
|
||||
|
||||
Server.whiteList.Remove(player);
|
||||
string src = p == null ? "(console)" : p.ColoredName;
|
||||
Chat.GlobalMessageOps(src + " %Sremoved &f" + player + " %Sfrom the whitelist.");
|
||||
Chat.MessageOps(src + " %Sremoved &f" + player + " %Sfrom the whitelist.");
|
||||
Server.whiteList.Save();
|
||||
Server.s.Log("WHITELIST: Removed " + player);
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ namespace MCGalaxy.Commands {
|
||||
p.MakeSelection(1, null, DeleteZone);
|
||||
} else { //if they cant, it warns them, the ops and logs it on the server!
|
||||
Player.Message(p, "You can't delete a zone which is above your rank!");
|
||||
Chat.GlobalMessageOps(p.name + " tried to delete a zone that is above their rank!");
|
||||
Chat.MessageOps(p.name + " tried to delete a zone that is above their rank!");
|
||||
Server.s.Log(p.name + " tried to delete a zone that is above their rank!");
|
||||
}
|
||||
} else {
|
||||
|
@ -45,11 +45,11 @@ namespace MCGalaxy.Commands {
|
||||
if (!File.Exists(path)) {
|
||||
File.Create(path).Dispose();
|
||||
Player.GlobalMessage("The map " + args[1] + " has been locked");
|
||||
Chat.GlobalMessageOps("Locked by: " + ((p == null) ? "Console" : p.name));
|
||||
Chat.MessageOps("Locked by: " + ((p == null) ? "Console" : p.name));
|
||||
} else {
|
||||
File.Delete(path);
|
||||
Player.GlobalMessage("The map " + args[1] + " has been unlocked");
|
||||
Chat.GlobalMessageOps("Unlocked by: " + ((p == null) ? "Console" : p.name));
|
||||
Chat.MessageOps("Unlocked by: " + ((p == null) ? "Console" : p.name));
|
||||
}
|
||||
} else {
|
||||
Player who = PlayerInfo.FindMatches(p, args[1]);
|
||||
@ -65,10 +65,10 @@ namespace MCGalaxy.Commands {
|
||||
who.BlockUntilLoad(500);
|
||||
}
|
||||
Player.GlobalMessage(who.ColoredName + " %Shas been locked down!");
|
||||
Chat.GlobalMessageOps("Locked by: " + ((p == null) ? "Console" : p.name));
|
||||
Chat.MessageOps("Locked by: " + ((p == null) ? "Console" : p.name));
|
||||
} else {
|
||||
Player.GlobalMessage(who.ColoredName + " %Shas been unlocked.");
|
||||
Chat.GlobalMessageOps("Unlocked by: " + ((p == null) ? "Console" : p.name));
|
||||
Chat.MessageOps("Unlocked by: " + ((p == null) ? "Console" : p.name));
|
||||
}
|
||||
who.jailed = !who.jailed;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ namespace MCGalaxy.Commands.World {
|
||||
setter(level, grp.Permission);
|
||||
Level.SaveSettings(level);
|
||||
Server.s.Log(level.name + " " + target + " permission changed to " + grp.Permission + ".");
|
||||
Chat.GlobalMessageLevel(level, target + " permission changed to " + grp.ColoredName + "%S.");
|
||||
Chat.MessageLevel(level, target + " permission changed to " + grp.ColoredName + "%S.");
|
||||
if (p == null || p.level != level)
|
||||
Player.Message(p, "{0} permission changed to {1}%S on {2}.", target, grp.ColoredName, level.name);
|
||||
}
|
||||
@ -98,7 +98,7 @@ namespace MCGalaxy.Commands.World {
|
||||
Level.SaveSettings(level);
|
||||
string msg = name + " was " + target + " " + mode + "ed";
|
||||
Server.s.Log(msg + " on " + level.name);
|
||||
Chat.GlobalMessageLevel(level, msg);
|
||||
Chat.MessageLevel(level, msg);
|
||||
if (p == null || p.level != level)
|
||||
Player.Message(p, msg + " on {0}.", level.name);
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ namespace MCGalaxy.Commands {
|
||||
|
||||
File.Move("extra/reported/" + args[1] + ".txt", "extra/reportedbackups/" + args[1] + ".txt");
|
||||
Player.Message(p, "&a" + args[1] + "'s report has been deleted.");
|
||||
Chat.GlobalMessageOps(p.ColoredName + " %Sdeleted " + args[1] + "'s report.");
|
||||
Chat.MessageOps(p.ColoredName + " %Sdeleted " + args[1] + "'s report.");
|
||||
Server.s.Log(args[1] + "'s report has been deleted by " + p.name);
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ namespace MCGalaxy.Commands {
|
||||
File.Move(path, "extra/reportedbackups/" + name);
|
||||
}
|
||||
Player.Message(p, "%aYou have cleared all reports!");
|
||||
Chat.GlobalMessageOps(p.ColoredName + "%c cleared ALL reports!");
|
||||
Chat.MessageOps(p.ColoredName + "%c cleared ALL reports!");
|
||||
Server.s.Log(p.name + " cleared ALL reports!");
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ namespace MCGalaxy.Commands {
|
||||
}
|
||||
File.WriteAllText("extra/reported/" + target + ".txt", reason + " - Reported by " + p.name + " on " + DateTime.Now);
|
||||
Player.Message(p, "%aYour report has been sent, it should be viewed when an operator is online!");
|
||||
Chat.GlobalMessageOps(p.ColoredName + " %Shas made a report, view it with %T/report check " + target);
|
||||
Chat.MessageOps(p.ColoredName + " %Shas made a report, view it with %T/report check " + target);
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
|
@ -38,6 +38,7 @@ namespace MCGalaxy.SQL {
|
||||
public override void Fill(string query, DataTable results) {
|
||||
using (var conn = new SQLiteConnection(SQLite.connString)) {
|
||||
conn.Open();
|
||||
|
||||
using (SQLiteDataAdapter da = new SQLiteDataAdapter(query, conn)) {
|
||||
foreach (var param in parameters)
|
||||
da.SelectCommand.Parameters.AddWithValue(param.Key, param.Value);
|
||||
|
@ -33,6 +33,8 @@ namespace MCGalaxy.Drawing.Brushes {
|
||||
public override byte NextBlock(DrawOp op) { return block; }
|
||||
|
||||
public override byte NextExtBlock(DrawOp op) { return extBlock; }
|
||||
|
||||
// TODO: OVerride validate
|
||||
}
|
||||
|
||||
public sealed class StripedBrush : Brush {
|
||||
|
@ -24,7 +24,7 @@ namespace MCGalaxy.Gui {
|
||||
public static void HandleChat(string text, Action<string> output) {
|
||||
if (text != null) text = text.Trim();
|
||||
if (String.IsNullOrEmpty(text)) return;
|
||||
if (Chat.HandleModes(null, text)) return;
|
||||
if (ChatModes.Handle(null, text)) return;
|
||||
|
||||
Player.GlobalMessage("Console [&a" + Server.ZallState + Server.DefaultColor + "]:&f " + text);
|
||||
Server.IRC.Say("Console [&a" + Server.ZallState + "%S]: " + text);
|
||||
|
@ -278,7 +278,7 @@ namespace MCGalaxy.Games
|
||||
Thread.Sleep(300);
|
||||
if (GetPlayer(p1).hasflag)
|
||||
{
|
||||
Chat.GlobalMessageLevel(mainlevel, redteam.color + p.name + " DROPPED THE FLAG!");
|
||||
Chat.MessageLevel(mainlevel, redteam.color + p.name + " DROPPED THE FLAG!");
|
||||
GetPlayer(p1).points -= caplose;
|
||||
mainlevel.Blockchange(b.x, b.y, b.z, b.block);
|
||||
GetPlayer(p1).hasflag = false;
|
||||
@ -303,13 +303,13 @@ namespace MCGalaxy.Games
|
||||
{
|
||||
//cache.Remove(GetPlayer(p));
|
||||
blueteam.members.Remove(p);
|
||||
Chat.GlobalMessageLevel(mainlevel, p.color + p.name + " " + blueteam.color + "left the ctf game");
|
||||
Chat.MessageLevel(mainlevel, p.color + p.name + " " + blueteam.color + "left the ctf game");
|
||||
}
|
||||
else if (redteam.members.Contains(p))
|
||||
{
|
||||
//cache.Remove(GetPlayer(p));
|
||||
redteam.members.Remove(p);
|
||||
Chat.GlobalMessageLevel(mainlevel, p.color + p.name + " " + redteam.color + "left the ctf game");
|
||||
Chat.MessageLevel(mainlevel, p.color + p.name + " " + redteam.color + "left the ctf game");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -386,34 +386,34 @@ tags MEDIUMINT UNSIGNED{1});";
|
||||
map2 = maps1[rand.Next(maps1.Count)];
|
||||
maps1.Remove(map2);
|
||||
map3 = maps1[rand.Next(maps1.Count)];
|
||||
Chat.GlobalMessageLevel(mainlevel, "%2VOTE:");
|
||||
Chat.GlobalMessageLevel(mainlevel, "1. " + map1 + " 2. " + map2 + " 3. " + map3);
|
||||
Chat.MessageLevel(mainlevel, "%2VOTE:");
|
||||
Chat.MessageLevel(mainlevel, "1. " + map1 + " 2. " + map2 + " 3. " + map3);
|
||||
voting = true;
|
||||
int seconds = rand.Next(15, 61);
|
||||
Chat.GlobalMessageLevel(mainlevel, "You have " + seconds + " seconds to vote!");
|
||||
Chat.MessageLevel(mainlevel, "You have " + seconds + " seconds to vote!");
|
||||
Thread.Sleep(seconds * 1000);
|
||||
voting = false;
|
||||
Chat.GlobalMessageLevel(mainlevel, "VOTING ENDED!");
|
||||
Chat.MessageLevel(mainlevel, "VOTING ENDED!");
|
||||
Thread.Sleep(rand.Next(1, 10) * 1000);
|
||||
if (vote1 > vote2 && vote1 > vote3)
|
||||
{
|
||||
Chat.GlobalMessageLevel(mainlevel, map1 + " WON!");
|
||||
Chat.MessageLevel(mainlevel, map1 + " WON!");
|
||||
return map1;
|
||||
}
|
||||
if (vote2 > vote1 && vote2 > vote3)
|
||||
{
|
||||
Chat.GlobalMessageLevel(mainlevel, map2 + " WON!");
|
||||
Chat.MessageLevel(mainlevel, map2 + " WON!");
|
||||
return map2;
|
||||
}
|
||||
if (vote3 > vote2 && vote3 > vote1)
|
||||
{
|
||||
Chat.GlobalMessageLevel(mainlevel, map3 + " WON!");
|
||||
Chat.MessageLevel(mainlevel, map3 + " WON!");
|
||||
return map3;
|
||||
}
|
||||
else
|
||||
{
|
||||
Chat.GlobalMessageLevel(mainlevel, "There was a tie!");
|
||||
Chat.GlobalMessageLevel(mainlevel, "I'll choose!");
|
||||
Chat.MessageLevel(mainlevel, "There was a tie!");
|
||||
Chat.MessageLevel(mainlevel, "I'll choose!");
|
||||
return maps[rand.Next(maps.Count)];
|
||||
}
|
||||
}
|
||||
@ -435,9 +435,9 @@ tags MEDIUMINT UNSIGNED{1});";
|
||||
}
|
||||
else
|
||||
{
|
||||
Chat.GlobalMessageLevel(mainlevel, "The game ended in a tie!");
|
||||
Chat.MessageLevel(mainlevel, "The game ended in a tie!");
|
||||
}
|
||||
Chat.GlobalMessageLevel(mainlevel, "The winner was " + winnerteam.color + winner + "!!");
|
||||
Chat.MessageLevel(mainlevel, "The winner was " + winnerteam.color + winner + "!!");
|
||||
Thread.Sleep(4000);
|
||||
//MYSQL!
|
||||
cache.ForEach(delegate(Data d) {
|
||||
@ -446,7 +446,7 @@ tags MEDIUMINT UNSIGNED{1});";
|
||||
d.p.name, d.points, d.cap, d.tag);
|
||||
});
|
||||
nextmap = Vote();
|
||||
Chat.GlobalMessageLevel(mainlevel, "Starting a new game!");
|
||||
Chat.MessageLevel(mainlevel, "Starting a new game!");
|
||||
redbase = null;
|
||||
redteam = null;
|
||||
bluebase = null;
|
||||
@ -468,19 +468,19 @@ tags MEDIUMINT UNSIGNED{1});";
|
||||
}
|
||||
if (p.level == mainlevel && blueteam.members.Contains(p) && x == redbase.x && y == redbase.y && z == redbase.z && mainlevel.GetTile(redbase.x, redbase.y, redbase.z) != Block.air)
|
||||
{
|
||||
Chat.GlobalMessageLevel(mainlevel, blueteam.color + p.name + " took the " + redteam.color + " red team's FLAG!");
|
||||
Chat.MessageLevel(mainlevel, blueteam.color + p.name + " took the " + redteam.color + " red team's FLAG!");
|
||||
GetPlayer(p).hasflag = true;
|
||||
}
|
||||
if (p.level == mainlevel && redteam.members.Contains(p) && x == bluebase.x && y == bluebase.y && z == bluebase.z && mainlevel.GetTile(bluebase.x, bluebase.y, bluebase.z) != Block.air)
|
||||
{
|
||||
Chat.GlobalMessageLevel(mainlevel, redteam.color + p.name + " took the " + blueteam.color + " blue team's FLAG");
|
||||
Chat.MessageLevel(mainlevel, redteam.color + p.name + " took the " + blueteam.color + " blue team's FLAG");
|
||||
GetPlayer(p).hasflag = true;
|
||||
}
|
||||
if (p.level == mainlevel && blueteam.members.Contains(p) && x == bluebase.x && y == bluebase.y && z == bluebase.z && mainlevel.GetTile(bluebase.x, bluebase.y, bluebase.z) != Block.air)
|
||||
{
|
||||
if (GetPlayer(p).hasflag)
|
||||
{
|
||||
Chat.GlobalMessageLevel(mainlevel, blueteam.color + p.name + " RETURNED THE FLAG!");
|
||||
Chat.MessageLevel(mainlevel, blueteam.color + p.name + " RETURNED THE FLAG!");
|
||||
GetPlayer(p).hasflag = false;
|
||||
GetPlayer(p).cap++;
|
||||
GetPlayer(p).points += cappoint;
|
||||
@ -505,7 +505,7 @@ tags MEDIUMINT UNSIGNED{1});";
|
||||
{
|
||||
if (GetPlayer(p).hasflag)
|
||||
{
|
||||
Chat.GlobalMessageLevel(mainlevel, redteam.color + p.name + " RETURNED THE FLAG!");
|
||||
Chat.MessageLevel(mainlevel, redteam.color + p.name + " RETURNED THE FLAG!");
|
||||
GetPlayer(p).hasflag = false;
|
||||
GetPlayer(p).points += cappoint;
|
||||
GetPlayer(p).cap++;
|
||||
@ -573,7 +573,7 @@ tags MEDIUMINT UNSIGNED{1});";
|
||||
GetPlayer(p).blue = false;
|
||||
}
|
||||
redteam.Add(p);
|
||||
Chat.GlobalMessageLevel(mainlevel, p.color + p.name + " " + Colors.red + "joined the RED Team");
|
||||
Chat.MessageLevel(mainlevel, p.color + p.name + " " + Colors.red + "joined the RED Team");
|
||||
Player.Message(p, Colors.red + "You are now on the red team!");
|
||||
}
|
||||
else if (redteam.members.Count > blueteam.members.Count)
|
||||
@ -586,7 +586,7 @@ tags MEDIUMINT UNSIGNED{1});";
|
||||
GetPlayer(p).blue = true;
|
||||
}
|
||||
blueteam.Add(p);
|
||||
Chat.GlobalMessageLevel(mainlevel, p.color + p.name + " " + Colors.blue + "joined the BLUE Team");
|
||||
Chat.MessageLevel(mainlevel, p.color + p.name + " " + Colors.blue + "joined the BLUE Team");
|
||||
Player.Message(p, Colors.blue + "You are now on the blue team!");
|
||||
}
|
||||
else if (new Random().Next(2) == 0)
|
||||
@ -599,7 +599,7 @@ tags MEDIUMINT UNSIGNED{1});";
|
||||
GetPlayer(p).blue = false;
|
||||
}
|
||||
redteam.Add(p);
|
||||
Chat.GlobalMessageLevel(mainlevel, p.color + p.name + " " + Colors.red + "joined the RED Team");
|
||||
Chat.MessageLevel(mainlevel, p.color + p.name + " " + Colors.red + "joined the RED Team");
|
||||
Player.Message(p, Colors.red + "You are now on the red team!");
|
||||
}
|
||||
else
|
||||
@ -612,7 +612,7 @@ tags MEDIUMINT UNSIGNED{1});";
|
||||
GetPlayer(p).blue = true;
|
||||
}
|
||||
blueteam.Add(p);
|
||||
Chat.GlobalMessageLevel(mainlevel, p.color + p.name + " " + Colors.blue + "joined the BLUE Team");
|
||||
Chat.MessageLevel(mainlevel, p.color + p.name + " " + Colors.blue + "joined the BLUE Team");
|
||||
Player.Message(p, Colors.blue + "You are now on the blue team!");
|
||||
}
|
||||
}
|
||||
@ -622,13 +622,13 @@ tags MEDIUMINT UNSIGNED{1});";
|
||||
{
|
||||
//cache.Remove(GetPlayer(p));
|
||||
blueteam.members.Remove(p);
|
||||
Chat.GlobalMessageLevel(mainlevel, p.color + p.name + " " + blueteam.color + "left the ctf game");
|
||||
Chat.MessageLevel(mainlevel, p.color + p.name + " " + blueteam.color + "left the ctf game");
|
||||
}
|
||||
else if (redteam.members.Contains(p))
|
||||
{
|
||||
//cache.Remove(GetPlayer(p));
|
||||
redteam.members.Remove(p);
|
||||
Chat.GlobalMessageLevel(mainlevel, p.color + p.name + " " + redteam.color + "left the ctf game");
|
||||
Chat.MessageLevel(mainlevel, p.color + p.name + " " + redteam.color + "left the ctf game");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -701,13 +701,13 @@ tags MEDIUMINT UNSIGNED{1});";
|
||||
{
|
||||
if (redteam.members.Contains(p))
|
||||
{
|
||||
Chat.GlobalMessageLevel(mainlevel, redteam.color + p.name + " DROPPED THE FLAG!");
|
||||
Chat.MessageLevel(mainlevel, redteam.color + p.name + " DROPPED THE FLAG!");
|
||||
GetPlayer(p).points -= caplose;
|
||||
mainlevel.Blockchange(redbase.x, redbase.y, redbase.z, Block.red);
|
||||
}
|
||||
else if (blueteam.members.Contains(p))
|
||||
{
|
||||
Chat.GlobalMessageLevel(mainlevel, blueteam.color + p.name + " DROPPED THE FLAG!");
|
||||
Chat.MessageLevel(mainlevel, blueteam.color + p.name + " DROPPED THE FLAG!");
|
||||
GetPlayer(p).points -= caplose;
|
||||
mainlevel.Blockchange(bluebase.x, bluebase.y, bluebase.z, Block.blue);
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ namespace MCGalaxy.Games
|
||||
if (BackupNumber <= 0)
|
||||
{
|
||||
SendAllPlayersMessage(Colors.red + "Backing up Level for TNT Wars failed, Stopping game");
|
||||
Chat.GlobalMessageOps(Colors.red + "Backing up Level for TNT Wars failed, Stopping game");
|
||||
Chat.MessageOps(Colors.red + "Backing up Level for TNT Wars failed, Stopping game");
|
||||
GameStatus = TntWarsGameStatus.Finished;
|
||||
return;
|
||||
}
|
||||
|
@ -314,8 +314,8 @@ namespace MCGalaxy {
|
||||
goto retry;
|
||||
} catch (Exception e) {
|
||||
Server.ErrorLog(e);
|
||||
Chat.GlobalMessageOps(p.name + " triggered a non-fatal error on " + name);
|
||||
Chat.GlobalMessageOps("Error location: " + errorLocation);
|
||||
Chat.MessageOps(p.name + " triggered a non-fatal error on " + name);
|
||||
Chat.MessageOps("Error location: " + errorLocation);
|
||||
Server.s.Log(p.name + " triggered a non-fatal error on " + name);
|
||||
Server.s.Log("Error location: " + errorLocation);
|
||||
return false;
|
||||
|
@ -194,7 +194,7 @@ namespace MCGalaxy {
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
|
||||
if (!silent) Chat.GlobalMessageOps("&3" + name + " %Swas unloaded.");
|
||||
if (!silent) Chat.MessageOps("&3" + name + " %Swas unloaded.");
|
||||
Server.s.Log(name + " was unloaded.");
|
||||
}
|
||||
return true;
|
||||
|
@ -115,9 +115,11 @@
|
||||
<Compile Include="Bots\PlayerBot.cs" />
|
||||
<Compile Include="Bots\ScriptFile.cs" />
|
||||
<Compile Include="Chat\Chat.cs" />
|
||||
<Compile Include="Chat\ChatModes.cs" />
|
||||
<Compile Include="Chat\Colors.cs" />
|
||||
<Compile Include="Chat\EmotesHandler.cs" />
|
||||
<Compile Include="Chat\FullCP437Handler.cs" />
|
||||
<Compile Include="Chat\ChatTokens.cs" />
|
||||
<Compile Include="Commands\Bots\CmdBotAdd.cs" />
|
||||
<Compile Include="Commands\Bots\CmdBotAI.cs" />
|
||||
<Compile Include="Commands\Bots\CmdBotRemove.cs" />
|
||||
|
@ -300,7 +300,7 @@ namespace MCGalaxy {
|
||||
|
||||
if (channel.CaselessEq(opchannel)) {
|
||||
Server.s.Log(String.Format("(OPs): [IRC] {0}: {1}", user.Nick, message));
|
||||
Chat.GlobalMessageOps(String.Format("To Ops &f-%I[IRC] {0}&f- {1}", user.Nick,
|
||||
Chat.MessageOps(String.Format("To Ops &f-%I[IRC] {0}&f- {1}", user.Nick,
|
||||
Server.profanityFilter ? ProfanityFilter.Parse(message) : message));
|
||||
} else {
|
||||
Server.s.Log(String.Format("[IRC] {0}: {1}", user.Nick, message));
|
||||
|
@ -263,8 +263,8 @@ namespace MCGalaxy {
|
||||
StringBuilder sb = new StringBuilder(message);
|
||||
if (colorParse) ParseColors(sb);
|
||||
|
||||
Chat.ApplyTokens(sb, this);
|
||||
if ( Server.parseSmiley && parseEmotes ) {
|
||||
ChatTokens.Apply(sb, this);
|
||||
if (Server.parseSmiley && parseEmotes) {
|
||||
sb.Replace(":)", "(darksmile)");
|
||||
sb.Replace(":D", "(smile)");
|
||||
sb.Replace("<3", "(heart)");
|
||||
|
@ -136,10 +136,10 @@ namespace MCGalaxy {
|
||||
}
|
||||
|
||||
internal static void Spawn(Player dst, PlayerBot b) {
|
||||
string name = Chat.ApplyTokens(b.DisplayName, dst);
|
||||
string name = ChatTokens.Apply(b.DisplayName, dst);
|
||||
if (name.CaselessEq("empty")) name = "";
|
||||
else name = b.color + name;
|
||||
string skin = Chat.ApplyTokens(b.SkinName, dst);
|
||||
string skin = ChatTokens.Apply(b.SkinName, dst);
|
||||
|
||||
if (dst.hasExtList) {
|
||||
dst.SendExtAddEntity2(b.id, skin, name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]);
|
||||
|
@ -269,8 +269,8 @@ namespace MCGalaxy {
|
||||
ManualChange(x, y, z, action, block, extBlock);
|
||||
} catch ( Exception e ) {
|
||||
// Don't ya just love it when the server tattles?
|
||||
Chat.GlobalMessageOps(DisplayName + " has triggered a block change error");
|
||||
Chat.GlobalMessageOps(e.GetType().ToString() + ": " + e.Message);
|
||||
Chat.MessageOps(DisplayName + " has triggered a block change error");
|
||||
Chat.MessageOps(e.GetType().ToString() + ": " + e.Message);
|
||||
Server.ErrorLog(e);
|
||||
}
|
||||
}
|
||||
@ -576,7 +576,7 @@ try { SendBlockchange(pos1.x, pos1.y, pos1.z, Block.waterstill); } catch { }
|
||||
if (Server.chatmod && !voice) { SendMessage("Chat moderation is on, you cannot speak."); return; }
|
||||
CheckForMessageSpam();
|
||||
|
||||
if (Chat.HandleModes(this, text)) return;
|
||||
if (ChatModes.Handle(this, text)) return;
|
||||
|
||||
if ( text[0] == ':' ) {
|
||||
if ( PlayingTntWars ) {
|
||||
@ -661,7 +661,7 @@ return;
|
||||
File.Create("text/joker.txt").Dispose(); return text;
|
||||
}
|
||||
Server.s.Log("<JOKER>: " + name + ": " + text);
|
||||
Chat.GlobalMessageOps("%S<&aJ&bO&cK&5E&9R%S>: " + ColoredName + ":&f " + text);
|
||||
Chat.MessageOps("%S<&aJ&bO&cK&5E&9R%S>: " + ColoredName + ":&f " + text);
|
||||
|
||||
List<string> lines = new List<string>();
|
||||
using (StreamReader r = new StreamReader("text/joker.txt")) {
|
||||
|
@ -151,7 +151,7 @@ namespace MCGalaxy {
|
||||
}
|
||||
if (guests < Server.maxGuests) return true;
|
||||
|
||||
if (Server.guestLimitNotify) Chat.GlobalMessageOps("Guest " + DisplayName + " couldn't log in - too many guests.");
|
||||
if (Server.guestLimitNotify) Chat.MessageOps("Guest " + DisplayName + " couldn't log in - too many guests.");
|
||||
Server.s.Log("Guest " + name + " couldn't log in - too many guests.");
|
||||
Leave("Server has reached max number of guests", true);
|
||||
return false;
|
||||
@ -222,7 +222,7 @@ namespace MCGalaxy {
|
||||
}
|
||||
if (found) {
|
||||
if (group.Permission < Server.adminchatperm || !Server.adminsjoinsilent) {
|
||||
Chat.GlobalMessageOps(alts);
|
||||
Chat.MessageOps(alts);
|
||||
//IRCBot.Say(temp, true); //Tells people in op channel on IRC
|
||||
}
|
||||
Server.s.Log(alts);
|
||||
|
@ -215,7 +215,7 @@ namespace MCGalaxy {
|
||||
CommandOtherPerms.Load();
|
||||
ProfanityFilter.Init();
|
||||
Team.LoadList();
|
||||
Chat.LoadCustomTokens();
|
||||
ChatTokens.LoadCustom();
|
||||
FixupOldReviewPerms();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user