mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
Cleanup CmdTntWars a bit.
This commit is contained in:
parent
83a8998777
commit
53bdd1e22a
@ -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
@ -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") {
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user