Cleanup CmdTntWars a bit.

This commit is contained in:
UnknownShadow200 2016-06-08 11:28:27 +10:00
parent 83a8998777
commit 53bdd1e22a
4 changed files with 257 additions and 695 deletions

View File

@ -134,7 +134,7 @@ namespace MCGalaxy.Commands {
p.SetPrefix();
Team.TeamsList[team.Name] = team;
Team.SaveList();
Player.GlobalMessage(p.ColoredName + " %Sjust created the &a" + args[1] + " %Steam.");
Player.SendChatFrom(p, p.ColoredName + " %Sjust created the &a" + args[1] + " %Steam.", false);
}
void HandleJoin(Player p, string[] args) {

File diff suppressed because it is too large Load Diff

View File

@ -1115,32 +1115,7 @@ Player.Message(p, "(" + team.teamstring + ") " + this.color + this.name + ":&f "
}
return;
}*/
if ( this.joker ) {
if ( File.Exists("text/joker.txt") ) {
Server.s.Log("<JOKER>: " + this.name + ": " + text);
Chat.GlobalMessageOps("%S<&aJ&bO&cK&5E&9R%S>: " + ColoredName + ":&f " + text);
FileInfo jokertxt = new FileInfo("text/joker.txt");
StreamReader stRead = jokertxt.OpenText();
List<string> lines = new List<string>();
Random rnd = new Random();
int i = 0;
while ( !( stRead.Peek() == -1 ) )
lines.Add(stRead.ReadLine());
stRead.Close();
stRead.Dispose();
if ( lines.Count > 0 ) {
i = rnd.Next(lines.Count);
text = lines[i];
}
}
else { File.Create("text/joker.txt").Dispose(); }
}
text = HandleJoker(text);
//chatroom stuff
if ( this.Chatroom != null ) {
Chat.ChatRoom(this, text, true, this.Chatroom);
@ -1187,6 +1162,24 @@ return;
catch ( Exception e ) { Server.ErrorLog(e); Player.GlobalMessage("An error occurred: " + e.Message); }
}
string HandleJoker(string text) {
if (!joker) return text;
if (!File.Exists("text/joker.txt")) {
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);
List<string> lines = new List<string>();
using (StreamReader r = new StreamReader("text/joker.txt")) {
string line = null;
while ((line = r.ReadLine()) != null)
lines.Add(line);
}
Random rnd = new Random();
return lines.Count > 0 ? lines[rnd.Next(lines.Count)] : text;
}
bool IsHandledMessage(string text) {
if (Server.voteKickInProgress && text.Length == 1) {
if (text.ToLower() == "y") {

View File

@ -442,7 +442,6 @@ namespace MCGalaxy {
chatmessage.username = from.color + from.name;
chatmessage.time = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss");
Last50Chat.Add(chatmessage);
if (showname)
message = from.voicestring + from.color + from.prefix + from.DisplayName + ": &f" + message;