mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -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.
|
permissions and limitations under the Licenses.
|
||||||
*/
|
*/
|
||||||
using System;
|
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 {
|
namespace MCGalaxy {
|
||||||
|
|
||||||
public static class Chat {
|
public static class Chat {
|
||||||
|
|
||||||
public static void GlobalChatLevel(Player from, string message, bool showname) {
|
public static void GlobalChatLevel(Player from, string message, bool showname) {
|
||||||
@ -67,30 +61,6 @@ namespace MCGalaxy {
|
|||||||
Server.s.Log("<ChatRoom " + chatroom + ">" + from.name + ": " + rawMessage);
|
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) {
|
static void SendMessage(Player p, Player from, string message) {
|
||||||
if (from != null && p.listignored.Contains(from.name)) return;
|
if (from != null && p.listignored.Contains(from.name)) return;
|
||||||
|
|
||||||
@ -98,174 +68,60 @@ namespace MCGalaxy {
|
|||||||
Player.Message(p, Server.DefaultColor + message);
|
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) {
|
/// <summary> Sends a message to all players who are on the given level. </summary>
|
||||||
// only apply standard $tokens when necessary
|
public static void MessageLevel(Level lvl, string message) {
|
||||||
for (int i = 0; i < sb.Length; i++) {
|
Player[] players = PlayerInfo.Online.Items;
|
||||||
if (sb[i] != '$') continue;
|
foreach (Player p in players) {
|
||||||
|
if (p.level == lvl && p.Chatroom == null)
|
||||||
foreach (var token in standardTokens) {
|
Player.Message(p, message);
|
||||||
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 (:)");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool HandleModes(Player p, string text) {
|
/// <summary> Sends a message to all players who are ranked minPerm or above. </summary>
|
||||||
if (text.Length >= 2 && text[0] == '@' && text[1] == '@') {
|
public static void MessageAllMinPerm(string message, LevelPermission minPerm) {
|
||||||
text = text.Remove(0, 2);
|
Player[] players = PlayerInfo.Online.Items;
|
||||||
if (text.Length < 1) { Player.Message(p, "No message entered"); return true; }
|
foreach (Player p in players) {
|
||||||
|
if (p.Rank >= minPerm)
|
||||||
Player.Message(p, "[<] Console: &f" + text);
|
Player.Message(p, message);
|
||||||
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) {
|
/// <summary> Sends a message to all players who are have the permission to read opchat. </summary>
|
||||||
string displayName = p == null ? "(console)" : p.ColoredName;
|
public static void MessageOps(string message) {
|
||||||
string name = p == null ? "(console)" : p.name;
|
MessageAllMinPerm(message, Server.opchatperm);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HandleWhisper(Player p, string target, string message) {
|
/// <summary> Sends a message to all players who are have the permission to read adminchat. </summary>
|
||||||
Player who = PlayerInfo.FindMatches(p, target);
|
public static void MessageAdmins(string message) {
|
||||||
if (who == null) return;
|
MessageAllMinPerm(message, Server.adminchatperm);
|
||||||
if (who == p) { Player.Message(p, "Trying to talk to yourself, huh?"); return; }
|
}
|
||||||
|
|
||||||
if (who.ignoreAll) {
|
/// <summary> Sends a message to all players, who do not have
|
||||||
DoFakePM(p, who, message); return;
|
/// isolated level/level only chat and are not in a chatroom. </summary>
|
||||||
}
|
public static void MessageAll(string message) {
|
||||||
if (p != null && who.listignored.Contains(p.name)) {
|
message = Colors.EscapeColors(message);
|
||||||
DoFakePM(p, who, message); return;
|
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) {
|
public static void MessageAll(string message, object a0) {
|
||||||
string name = p == null ? "(console)" : p.name;
|
MessageAll(String.Format(message, a0));
|
||||||
Server.s.Log(name + " @" + who.name + ": " + message);
|
|
||||||
Player.Message(p, "[<] " + who.ColoredName + ": &f" + message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DoPM(Player p, Player who, string message) {
|
public static void MessageAll(string message, object a0, object a1) {
|
||||||
string name = p == null ? "(console)" : p.name;
|
MessageAll(String.Format(message, a0, a1));
|
||||||
string fullName = p == null ? "%S(console)" : p.ColoredName;
|
}
|
||||||
|
|
||||||
Server.s.Log(name + " @" + who.name + ": " + message);
|
public static void MessageAll(string message, object a0, object a1, object a2) {
|
||||||
Player.Message(p, "[<] " + who.ColoredName + ": &f" + message);
|
MessageAll(String.Format(message, a0, a1, a2));
|
||||||
Player.Message(who, "&9[>] " + fullName + ": &f" + message);
|
}
|
||||||
|
|
||||||
|
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 CmdAdminChat() { }
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
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;
|
p.adminchat = !p.adminchat;
|
||||||
if (p.adminchat) Player.Message(p, "All messages will now be sent to Admins only");
|
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 CmdOpChat() { }
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
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;
|
p.opchat = !p.opchat;
|
||||||
if (p.opchat) Player.Message(p, "All messages will now be sent to OPs only");
|
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");
|
Player.Message(p, "Countdown rules sent to everyone");
|
||||||
return;
|
return;
|
||||||
} else if (target == "map") {
|
} else if (target == "map") {
|
||||||
Chat.GlobalMessageLevel(p.level, "Countdown Rules being sent to " + p.level.name + " by " + p.ColoredName + ":");
|
Chat.MessageLevel(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.MessageLevel(p.level, "The aim of the game is to stay alive the longest.");
|
||||||
Chat.GlobalMessageLevel(p.level, "Don't fall in the lava!!");
|
Chat.MessageLevel(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.MessageLevel(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, "The last person alive will win!!");
|
||||||
Player.Message(p, "Countdown rules sent to: " + p.level.name);
|
Player.Message(p, "Countdown rules sent to: " + p.level.name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ namespace MCGalaxy.Commands.Moderation {
|
|||||||
} else {
|
} else {
|
||||||
if (stealth) {
|
if (stealth) {
|
||||||
banMsg = who.ColoredName + " %Swas STEALTH &8banned %Sby " + banner + "%S." + banReason;
|
banMsg = who.ColoredName + " %Swas STEALTH &8banned %Sby " + banner + "%S." + banReason;
|
||||||
Chat.GlobalMessageOps(banMsg);
|
Chat.MessageOps(banMsg);
|
||||||
} else {
|
} else {
|
||||||
banMsg = who.ColoredName + " %Swas &8banned %Sby " + banner + "%S." + banReason;
|
banMsg = who.ColoredName + " %Swas &8banned %Sby " + banner + "%S." + banReason;
|
||||||
Player.GlobalMessage(banMsg);
|
Player.GlobalMessage(banMsg);
|
||||||
|
@ -62,7 +62,7 @@ namespace MCGalaxy.Commands
|
|||||||
Entities.GlobalDespawn(p, false);
|
Entities.GlobalDespawn(p, false);
|
||||||
TabList.Add(p, p, 0xFF);
|
TabList.Add(p, p, 0xFF);
|
||||||
if (messageOps && !p.otherRankHidden)
|
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);
|
string discMsg = PlayerDB.GetLogoutMessage(p);
|
||||||
Player.SendChatFrom(p, "&c- " + p.FullName + " %S" + discMsg, false);
|
Player.SendChatFrom(p, "&c- " + p.FullName + " %S" + discMsg, false);
|
||||||
Server.IRC.Say(p.DisplayName + " left the game (" + discMsg + ")");
|
Server.IRC.Say(p.DisplayName + " left the game (" + discMsg + ")");
|
||||||
@ -74,7 +74,7 @@ namespace MCGalaxy.Commands
|
|||||||
p.otherRankHidden = false;
|
p.otherRankHidden = false;
|
||||||
p.oHideRank = LevelPermission.Null;
|
p.oHideRank = LevelPermission.Null;
|
||||||
if (messageOps)
|
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);
|
Player.SendChatFrom(p, "&a+ " + p.FullName + " %S" + PlayerDB.GetLoginMessage(p), false);
|
||||||
Server.IRC.Say(p.DisplayName + " joined the game");
|
Server.IRC.Say(p.DisplayName + " joined the game");
|
||||||
|
@ -41,14 +41,14 @@ namespace MCGalaxy.Commands {
|
|||||||
|
|
||||||
if (!who.joker) {
|
if (!who.joker) {
|
||||||
if (stealth) {
|
if (stealth) {
|
||||||
Chat.GlobalMessageOps(who.ColoredName + " %Sis now STEALTH jokered.");
|
Chat.MessageOps(who.ColoredName + " %Sis now STEALTH jokered.");
|
||||||
} else {
|
} else {
|
||||||
Player.SendChatFrom(who, who.ColoredName + " %Sis now a &aJ&bo&ck&5e&9r%S.", false);
|
Player.SendChatFrom(who, who.ColoredName + " %Sis now a &aJ&bo&ck&5e&9r%S.", false);
|
||||||
}
|
}
|
||||||
Player.RaisePlayerAction(p, PlayerAction.Joker, null, stealth);
|
Player.RaisePlayerAction(p, PlayerAction.Joker, null, stealth);
|
||||||
} else {
|
} else {
|
||||||
if (stealth) {
|
if (stealth) {
|
||||||
Chat.GlobalMessageOps(who.ColoredName + " %Sis now STEALTH unjokered.");
|
Chat.MessageOps(who.ColoredName + " %Sis now STEALTH unjokered.");
|
||||||
} else {
|
} else {
|
||||||
Player.SendChatFrom(who, who.ColoredName + " %Sis no longer a &aJ&bo&ck&5e&9r%S.", false);
|
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);
|
Player.Message(p, msg);
|
||||||
|
|
||||||
string start = pos > 0 ? "There are now &c" + (pos + 1) + " %Speople" : "There is now &c1 %Sperson";
|
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.MessageAllMinPerm(p.ColoredName + " %Sentered the review queue", nextPerm);
|
||||||
Chat.GlobalMessageMinPerms(start + " waiting for a &creview!", nextPerm);
|
Chat.MessageAllMinPerm(start + " waiting for a &creview!", nextPerm);
|
||||||
p.NextReviewTime = DateTime.UtcNow.AddSeconds(Server.reviewcooldown);
|
p.NextReviewTime = DateTime.UtcNow.AddSeconds(Server.reviewcooldown);
|
||||||
Player.RaisePlayerAction(p, PlayerAction.Review, null, true);
|
Player.RaisePlayerAction(p, PlayerAction.Review, null, true);
|
||||||
}
|
}
|
||||||
@ -157,8 +157,8 @@ namespace MCGalaxy.Commands {
|
|||||||
|
|
||||||
static void MessageNoPerm(Player p, LevelPermission perm) {
|
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");
|
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.MessageAdmins(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("The group permission that is messed up is: " + perm + " (" + (int)perm+ ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MessageReviewPosChanged() {
|
static void MessageReviewPosChanged() {
|
||||||
|
@ -41,7 +41,7 @@ namespace MCGalaxy.Commands {
|
|||||||
return;
|
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("&9A vote to kick " + who.ColoredName + " %Shas been called!");
|
||||||
Player.GlobalMessage("&9Type &aY %Sor &cN %Sto vote.");
|
Player.GlobalMessage("&9Type &aY %Sor &cN %Sto vote.");
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ namespace MCGalaxy.Commands {
|
|||||||
|
|
||||||
int netVotesYes = votesYes - votesNo;
|
int netVotesYes = votesYes - votesNo;
|
||||||
// Should we also send this to players?
|
// 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.");
|
Server.s.Log("VoteKick results for " + who.DisplayName + ": " + votesYes + " yes and " + votesNo + " no votes.");
|
||||||
|
|
||||||
if (votesYes + votesNo < Server.voteKickVotesNeeded) {
|
if (votesYes + votesNo < Server.voteKickVotesNeeded) {
|
||||||
|
@ -53,7 +53,7 @@ namespace MCGalaxy.Commands {
|
|||||||
|
|
||||||
Server.whiteList.Add(player);
|
Server.whiteList.Add(player);
|
||||||
string src = p == null ? "(console)" : p.ColoredName;
|
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.whiteList.Save();
|
||||||
Server.s.Log("WHITELIST: Added " + player);
|
Server.s.Log("WHITELIST: Added " + player);
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ namespace MCGalaxy.Commands {
|
|||||||
|
|
||||||
Server.whiteList.Remove(player);
|
Server.whiteList.Remove(player);
|
||||||
string src = p == null ? "(console)" : p.ColoredName;
|
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.whiteList.Save();
|
||||||
Server.s.Log("WHITELIST: Removed " + player);
|
Server.s.Log("WHITELIST: Removed " + player);
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ namespace MCGalaxy.Commands {
|
|||||||
p.MakeSelection(1, null, DeleteZone);
|
p.MakeSelection(1, null, DeleteZone);
|
||||||
} else { //if they cant, it warns them, the ops and logs it on the server!
|
} 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!");
|
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!");
|
Server.s.Log(p.name + " tried to delete a zone that is above their rank!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -45,11 +45,11 @@ namespace MCGalaxy.Commands {
|
|||||||
if (!File.Exists(path)) {
|
if (!File.Exists(path)) {
|
||||||
File.Create(path).Dispose();
|
File.Create(path).Dispose();
|
||||||
Player.GlobalMessage("The map " + args[1] + " has been locked");
|
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 {
|
} else {
|
||||||
File.Delete(path);
|
File.Delete(path);
|
||||||
Player.GlobalMessage("The map " + args[1] + " has been unlocked");
|
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 {
|
} else {
|
||||||
Player who = PlayerInfo.FindMatches(p, args[1]);
|
Player who = PlayerInfo.FindMatches(p, args[1]);
|
||||||
@ -65,10 +65,10 @@ namespace MCGalaxy.Commands {
|
|||||||
who.BlockUntilLoad(500);
|
who.BlockUntilLoad(500);
|
||||||
}
|
}
|
||||||
Player.GlobalMessage(who.ColoredName + " %Shas been locked down!");
|
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 {
|
} else {
|
||||||
Player.GlobalMessage(who.ColoredName + " %Shas been unlocked.");
|
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;
|
who.jailed = !who.jailed;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ namespace MCGalaxy.Commands.World {
|
|||||||
setter(level, grp.Permission);
|
setter(level, grp.Permission);
|
||||||
Level.SaveSettings(level);
|
Level.SaveSettings(level);
|
||||||
Server.s.Log(level.name + " " + target + " permission changed to " + grp.Permission + ".");
|
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)
|
if (p == null || p.level != level)
|
||||||
Player.Message(p, "{0} permission changed to {1}%S on {2}.", target, grp.ColoredName, level.name);
|
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);
|
Level.SaveSettings(level);
|
||||||
string msg = name + " was " + target + " " + mode + "ed";
|
string msg = name + " was " + target + " " + mode + "ed";
|
||||||
Server.s.Log(msg + " on " + level.name);
|
Server.s.Log(msg + " on " + level.name);
|
||||||
Chat.GlobalMessageLevel(level, msg);
|
Chat.MessageLevel(level, msg);
|
||||||
if (p == null || p.level != level)
|
if (p == null || p.level != level)
|
||||||
Player.Message(p, msg + " on {0}.", level.name);
|
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");
|
File.Move("extra/reported/" + args[1] + ".txt", "extra/reportedbackups/" + args[1] + ".txt");
|
||||||
Player.Message(p, "&a" + args[1] + "'s report has been deleted.");
|
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);
|
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);
|
File.Move(path, "extra/reportedbackups/" + name);
|
||||||
}
|
}
|
||||||
Player.Message(p, "%aYou have cleared all reports!");
|
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!");
|
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);
|
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!");
|
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) {
|
public override void Help(Player p) {
|
||||||
|
@ -38,6 +38,7 @@ namespace MCGalaxy.SQL {
|
|||||||
public override void Fill(string query, DataTable results) {
|
public override void Fill(string query, DataTable results) {
|
||||||
using (var conn = new SQLiteConnection(SQLite.connString)) {
|
using (var conn = new SQLiteConnection(SQLite.connString)) {
|
||||||
conn.Open();
|
conn.Open();
|
||||||
|
|
||||||
using (SQLiteDataAdapter da = new SQLiteDataAdapter(query, conn)) {
|
using (SQLiteDataAdapter da = new SQLiteDataAdapter(query, conn)) {
|
||||||
foreach (var param in parameters)
|
foreach (var param in parameters)
|
||||||
da.SelectCommand.Parameters.AddWithValue(param.Key, param.Value);
|
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 NextBlock(DrawOp op) { return block; }
|
||||||
|
|
||||||
public override byte NextExtBlock(DrawOp op) { return extBlock; }
|
public override byte NextExtBlock(DrawOp op) { return extBlock; }
|
||||||
|
|
||||||
|
// TODO: OVerride validate
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class StripedBrush : Brush {
|
public sealed class StripedBrush : Brush {
|
||||||
|
@ -24,7 +24,7 @@ namespace MCGalaxy.Gui {
|
|||||||
public static void HandleChat(string text, Action<string> output) {
|
public static void HandleChat(string text, Action<string> output) {
|
||||||
if (text != null) text = text.Trim();
|
if (text != null) text = text.Trim();
|
||||||
if (String.IsNullOrEmpty(text)) return;
|
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);
|
Player.GlobalMessage("Console [&a" + Server.ZallState + Server.DefaultColor + "]:&f " + text);
|
||||||
Server.IRC.Say("Console [&a" + Server.ZallState + "%S]: " + text);
|
Server.IRC.Say("Console [&a" + Server.ZallState + "%S]: " + text);
|
||||||
|
@ -278,7 +278,7 @@ namespace MCGalaxy.Games
|
|||||||
Thread.Sleep(300);
|
Thread.Sleep(300);
|
||||||
if (GetPlayer(p1).hasflag)
|
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;
|
GetPlayer(p1).points -= caplose;
|
||||||
mainlevel.Blockchange(b.x, b.y, b.z, b.block);
|
mainlevel.Blockchange(b.x, b.y, b.z, b.block);
|
||||||
GetPlayer(p1).hasflag = false;
|
GetPlayer(p1).hasflag = false;
|
||||||
@ -303,13 +303,13 @@ namespace MCGalaxy.Games
|
|||||||
{
|
{
|
||||||
//cache.Remove(GetPlayer(p));
|
//cache.Remove(GetPlayer(p));
|
||||||
blueteam.members.Remove(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))
|
else if (redteam.members.Contains(p))
|
||||||
{
|
{
|
||||||
//cache.Remove(GetPlayer(p));
|
//cache.Remove(GetPlayer(p));
|
||||||
redteam.members.Remove(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)];
|
map2 = maps1[rand.Next(maps1.Count)];
|
||||||
maps1.Remove(map2);
|
maps1.Remove(map2);
|
||||||
map3 = maps1[rand.Next(maps1.Count)];
|
map3 = maps1[rand.Next(maps1.Count)];
|
||||||
Chat.GlobalMessageLevel(mainlevel, "%2VOTE:");
|
Chat.MessageLevel(mainlevel, "%2VOTE:");
|
||||||
Chat.GlobalMessageLevel(mainlevel, "1. " + map1 + " 2. " + map2 + " 3. " + map3);
|
Chat.MessageLevel(mainlevel, "1. " + map1 + " 2. " + map2 + " 3. " + map3);
|
||||||
voting = true;
|
voting = true;
|
||||||
int seconds = rand.Next(15, 61);
|
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);
|
Thread.Sleep(seconds * 1000);
|
||||||
voting = false;
|
voting = false;
|
||||||
Chat.GlobalMessageLevel(mainlevel, "VOTING ENDED!");
|
Chat.MessageLevel(mainlevel, "VOTING ENDED!");
|
||||||
Thread.Sleep(rand.Next(1, 10) * 1000);
|
Thread.Sleep(rand.Next(1, 10) * 1000);
|
||||||
if (vote1 > vote2 && vote1 > vote3)
|
if (vote1 > vote2 && vote1 > vote3)
|
||||||
{
|
{
|
||||||
Chat.GlobalMessageLevel(mainlevel, map1 + " WON!");
|
Chat.MessageLevel(mainlevel, map1 + " WON!");
|
||||||
return map1;
|
return map1;
|
||||||
}
|
}
|
||||||
if (vote2 > vote1 && vote2 > vote3)
|
if (vote2 > vote1 && vote2 > vote3)
|
||||||
{
|
{
|
||||||
Chat.GlobalMessageLevel(mainlevel, map2 + " WON!");
|
Chat.MessageLevel(mainlevel, map2 + " WON!");
|
||||||
return map2;
|
return map2;
|
||||||
}
|
}
|
||||||
if (vote3 > vote2 && vote3 > vote1)
|
if (vote3 > vote2 && vote3 > vote1)
|
||||||
{
|
{
|
||||||
Chat.GlobalMessageLevel(mainlevel, map3 + " WON!");
|
Chat.MessageLevel(mainlevel, map3 + " WON!");
|
||||||
return map3;
|
return map3;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Chat.GlobalMessageLevel(mainlevel, "There was a tie!");
|
Chat.MessageLevel(mainlevel, "There was a tie!");
|
||||||
Chat.GlobalMessageLevel(mainlevel, "I'll choose!");
|
Chat.MessageLevel(mainlevel, "I'll choose!");
|
||||||
return maps[rand.Next(maps.Count)];
|
return maps[rand.Next(maps.Count)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -435,9 +435,9 @@ tags MEDIUMINT UNSIGNED{1});";
|
|||||||
}
|
}
|
||||||
else
|
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);
|
Thread.Sleep(4000);
|
||||||
//MYSQL!
|
//MYSQL!
|
||||||
cache.ForEach(delegate(Data d) {
|
cache.ForEach(delegate(Data d) {
|
||||||
@ -446,7 +446,7 @@ tags MEDIUMINT UNSIGNED{1});";
|
|||||||
d.p.name, d.points, d.cap, d.tag);
|
d.p.name, d.points, d.cap, d.tag);
|
||||||
});
|
});
|
||||||
nextmap = Vote();
|
nextmap = Vote();
|
||||||
Chat.GlobalMessageLevel(mainlevel, "Starting a new game!");
|
Chat.MessageLevel(mainlevel, "Starting a new game!");
|
||||||
redbase = null;
|
redbase = null;
|
||||||
redteam = null;
|
redteam = null;
|
||||||
bluebase = 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)
|
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;
|
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)
|
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;
|
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 (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)
|
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).hasflag = false;
|
||||||
GetPlayer(p).cap++;
|
GetPlayer(p).cap++;
|
||||||
GetPlayer(p).points += cappoint;
|
GetPlayer(p).points += cappoint;
|
||||||
@ -505,7 +505,7 @@ tags MEDIUMINT UNSIGNED{1});";
|
|||||||
{
|
{
|
||||||
if (GetPlayer(p).hasflag)
|
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).hasflag = false;
|
||||||
GetPlayer(p).points += cappoint;
|
GetPlayer(p).points += cappoint;
|
||||||
GetPlayer(p).cap++;
|
GetPlayer(p).cap++;
|
||||||
@ -573,7 +573,7 @@ tags MEDIUMINT UNSIGNED{1});";
|
|||||||
GetPlayer(p).blue = false;
|
GetPlayer(p).blue = false;
|
||||||
}
|
}
|
||||||
redteam.Add(p);
|
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!");
|
Player.Message(p, Colors.red + "You are now on the red team!");
|
||||||
}
|
}
|
||||||
else if (redteam.members.Count > blueteam.members.Count)
|
else if (redteam.members.Count > blueteam.members.Count)
|
||||||
@ -586,7 +586,7 @@ tags MEDIUMINT UNSIGNED{1});";
|
|||||||
GetPlayer(p).blue = true;
|
GetPlayer(p).blue = true;
|
||||||
}
|
}
|
||||||
blueteam.Add(p);
|
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!");
|
Player.Message(p, Colors.blue + "You are now on the blue team!");
|
||||||
}
|
}
|
||||||
else if (new Random().Next(2) == 0)
|
else if (new Random().Next(2) == 0)
|
||||||
@ -599,7 +599,7 @@ tags MEDIUMINT UNSIGNED{1});";
|
|||||||
GetPlayer(p).blue = false;
|
GetPlayer(p).blue = false;
|
||||||
}
|
}
|
||||||
redteam.Add(p);
|
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!");
|
Player.Message(p, Colors.red + "You are now on the red team!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -612,7 +612,7 @@ tags MEDIUMINT UNSIGNED{1});";
|
|||||||
GetPlayer(p).blue = true;
|
GetPlayer(p).blue = true;
|
||||||
}
|
}
|
||||||
blueteam.Add(p);
|
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!");
|
Player.Message(p, Colors.blue + "You are now on the blue team!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -622,13 +622,13 @@ tags MEDIUMINT UNSIGNED{1});";
|
|||||||
{
|
{
|
||||||
//cache.Remove(GetPlayer(p));
|
//cache.Remove(GetPlayer(p));
|
||||||
blueteam.members.Remove(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))
|
else if (redteam.members.Contains(p))
|
||||||
{
|
{
|
||||||
//cache.Remove(GetPlayer(p));
|
//cache.Remove(GetPlayer(p));
|
||||||
redteam.members.Remove(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))
|
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;
|
GetPlayer(p).points -= caplose;
|
||||||
mainlevel.Blockchange(redbase.x, redbase.y, redbase.z, Block.red);
|
mainlevel.Blockchange(redbase.x, redbase.y, redbase.z, Block.red);
|
||||||
}
|
}
|
||||||
else if (blueteam.members.Contains(p))
|
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;
|
GetPlayer(p).points -= caplose;
|
||||||
mainlevel.Blockchange(bluebase.x, bluebase.y, bluebase.z, Block.blue);
|
mainlevel.Blockchange(bluebase.x, bluebase.y, bluebase.z, Block.blue);
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ namespace MCGalaxy.Games
|
|||||||
if (BackupNumber <= 0)
|
if (BackupNumber <= 0)
|
||||||
{
|
{
|
||||||
SendAllPlayersMessage(Colors.red + "Backing up Level for TNT Wars failed, Stopping game");
|
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;
|
GameStatus = TntWarsGameStatus.Finished;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -314,8 +314,8 @@ namespace MCGalaxy {
|
|||||||
goto retry;
|
goto retry;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Server.ErrorLog(e);
|
Server.ErrorLog(e);
|
||||||
Chat.GlobalMessageOps(p.name + " triggered a non-fatal error on " + name);
|
Chat.MessageOps(p.name + " triggered a non-fatal error on " + name);
|
||||||
Chat.GlobalMessageOps("Error location: " + errorLocation);
|
Chat.MessageOps("Error location: " + errorLocation);
|
||||||
Server.s.Log(p.name + " triggered a non-fatal error on " + name);
|
Server.s.Log(p.name + " triggered a non-fatal error on " + name);
|
||||||
Server.s.Log("Error location: " + errorLocation);
|
Server.s.Log("Error location: " + errorLocation);
|
||||||
return false;
|
return false;
|
||||||
|
@ -194,7 +194,7 @@ namespace MCGalaxy {
|
|||||||
GC.Collect();
|
GC.Collect();
|
||||||
GC.WaitForPendingFinalizers();
|
GC.WaitForPendingFinalizers();
|
||||||
|
|
||||||
if (!silent) Chat.GlobalMessageOps("&3" + name + " %Swas unloaded.");
|
if (!silent) Chat.MessageOps("&3" + name + " %Swas unloaded.");
|
||||||
Server.s.Log(name + " was unloaded.");
|
Server.s.Log(name + " was unloaded.");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -115,9 +115,11 @@
|
|||||||
<Compile Include="Bots\PlayerBot.cs" />
|
<Compile Include="Bots\PlayerBot.cs" />
|
||||||
<Compile Include="Bots\ScriptFile.cs" />
|
<Compile Include="Bots\ScriptFile.cs" />
|
||||||
<Compile Include="Chat\Chat.cs" />
|
<Compile Include="Chat\Chat.cs" />
|
||||||
|
<Compile Include="Chat\ChatModes.cs" />
|
||||||
<Compile Include="Chat\Colors.cs" />
|
<Compile Include="Chat\Colors.cs" />
|
||||||
<Compile Include="Chat\EmotesHandler.cs" />
|
<Compile Include="Chat\EmotesHandler.cs" />
|
||||||
<Compile Include="Chat\FullCP437Handler.cs" />
|
<Compile Include="Chat\FullCP437Handler.cs" />
|
||||||
|
<Compile Include="Chat\ChatTokens.cs" />
|
||||||
<Compile Include="Commands\Bots\CmdBotAdd.cs" />
|
<Compile Include="Commands\Bots\CmdBotAdd.cs" />
|
||||||
<Compile Include="Commands\Bots\CmdBotAI.cs" />
|
<Compile Include="Commands\Bots\CmdBotAI.cs" />
|
||||||
<Compile Include="Commands\Bots\CmdBotRemove.cs" />
|
<Compile Include="Commands\Bots\CmdBotRemove.cs" />
|
||||||
|
@ -300,7 +300,7 @@ namespace MCGalaxy {
|
|||||||
|
|
||||||
if (channel.CaselessEq(opchannel)) {
|
if (channel.CaselessEq(opchannel)) {
|
||||||
Server.s.Log(String.Format("(OPs): [IRC] {0}: {1}", user.Nick, message));
|
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));
|
Server.profanityFilter ? ProfanityFilter.Parse(message) : message));
|
||||||
} else {
|
} else {
|
||||||
Server.s.Log(String.Format("[IRC] {0}: {1}", user.Nick, message));
|
Server.s.Log(String.Format("[IRC] {0}: {1}", user.Nick, message));
|
||||||
|
@ -263,8 +263,8 @@ namespace MCGalaxy {
|
|||||||
StringBuilder sb = new StringBuilder(message);
|
StringBuilder sb = new StringBuilder(message);
|
||||||
if (colorParse) ParseColors(sb);
|
if (colorParse) ParseColors(sb);
|
||||||
|
|
||||||
Chat.ApplyTokens(sb, this);
|
ChatTokens.Apply(sb, this);
|
||||||
if ( Server.parseSmiley && parseEmotes ) {
|
if (Server.parseSmiley && parseEmotes) {
|
||||||
sb.Replace(":)", "(darksmile)");
|
sb.Replace(":)", "(darksmile)");
|
||||||
sb.Replace(":D", "(smile)");
|
sb.Replace(":D", "(smile)");
|
||||||
sb.Replace("<3", "(heart)");
|
sb.Replace("<3", "(heart)");
|
||||||
|
@ -136,10 +136,10 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal static void Spawn(Player dst, PlayerBot b) {
|
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 = "";
|
if (name.CaselessEq("empty")) name = "";
|
||||||
else name = b.color + name;
|
else name = b.color + name;
|
||||||
string skin = Chat.ApplyTokens(b.SkinName, dst);
|
string skin = ChatTokens.Apply(b.SkinName, dst);
|
||||||
|
|
||||||
if (dst.hasExtList) {
|
if (dst.hasExtList) {
|
||||||
dst.SendExtAddEntity2(b.id, skin, name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]);
|
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);
|
ManualChange(x, y, z, action, block, extBlock);
|
||||||
} catch ( Exception e ) {
|
} catch ( Exception e ) {
|
||||||
// Don't ya just love it when the server tattles?
|
// Don't ya just love it when the server tattles?
|
||||||
Chat.GlobalMessageOps(DisplayName + " has triggered a block change error");
|
Chat.MessageOps(DisplayName + " has triggered a block change error");
|
||||||
Chat.GlobalMessageOps(e.GetType().ToString() + ": " + e.Message);
|
Chat.MessageOps(e.GetType().ToString() + ": " + e.Message);
|
||||||
Server.ErrorLog(e);
|
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; }
|
if (Server.chatmod && !voice) { SendMessage("Chat moderation is on, you cannot speak."); return; }
|
||||||
CheckForMessageSpam();
|
CheckForMessageSpam();
|
||||||
|
|
||||||
if (Chat.HandleModes(this, text)) return;
|
if (ChatModes.Handle(this, text)) return;
|
||||||
|
|
||||||
if ( text[0] == ':' ) {
|
if ( text[0] == ':' ) {
|
||||||
if ( PlayingTntWars ) {
|
if ( PlayingTntWars ) {
|
||||||
@ -661,7 +661,7 @@ return;
|
|||||||
File.Create("text/joker.txt").Dispose(); return text;
|
File.Create("text/joker.txt").Dispose(); return text;
|
||||||
}
|
}
|
||||||
Server.s.Log("<JOKER>: " + name + ": " + 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>();
|
List<string> lines = new List<string>();
|
||||||
using (StreamReader r = new StreamReader("text/joker.txt")) {
|
using (StreamReader r = new StreamReader("text/joker.txt")) {
|
||||||
|
@ -151,7 +151,7 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
if (guests < Server.maxGuests) return true;
|
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.");
|
Server.s.Log("Guest " + name + " couldn't log in - too many guests.");
|
||||||
Leave("Server has reached max number of guests", true);
|
Leave("Server has reached max number of guests", true);
|
||||||
return false;
|
return false;
|
||||||
@ -222,7 +222,7 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
if (found) {
|
if (found) {
|
||||||
if (group.Permission < Server.adminchatperm || !Server.adminsjoinsilent) {
|
if (group.Permission < Server.adminchatperm || !Server.adminsjoinsilent) {
|
||||||
Chat.GlobalMessageOps(alts);
|
Chat.MessageOps(alts);
|
||||||
//IRCBot.Say(temp, true); //Tells people in op channel on IRC
|
//IRCBot.Say(temp, true); //Tells people in op channel on IRC
|
||||||
}
|
}
|
||||||
Server.s.Log(alts);
|
Server.s.Log(alts);
|
||||||
|
@ -215,7 +215,7 @@ namespace MCGalaxy {
|
|||||||
CommandOtherPerms.Load();
|
CommandOtherPerms.Load();
|
||||||
ProfanityFilter.Init();
|
ProfanityFilter.Init();
|
||||||
Team.LoadList();
|
Team.LoadList();
|
||||||
Chat.LoadCustomTokens();
|
ChatTokens.LoadCustom();
|
||||||
FixupOldReviewPerms();
|
FixupOldReviewPerms();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user