diff --git a/MCGalaxy/Blocks/BlockDefinitions.cs b/MCGalaxy/Blocks/BlockDefinitions.cs index 5fae83e1a..eca02dd29 100644 --- a/MCGalaxy/Blocks/BlockDefinitions.cs +++ b/MCGalaxy/Blocks/BlockDefinitions.cs @@ -144,7 +144,6 @@ namespace MCGalaxy { Logger.LogError(ex); } - Save(true, null); // As the BlockDefinition instances in levels will now be different // to the instances in GlobalDefs, we need to update them. if (oldDefs != null) UpdateLoadedLevels(oldDefs); diff --git a/MCGalaxy/Chat/ChatModes.cs b/MCGalaxy/Chat/ChatModes.cs index 13c5ba245..d8bda1ba0 100644 --- a/MCGalaxy/Chat/ChatModes.cs +++ b/MCGalaxy/Chat/ChatModes.cs @@ -91,14 +91,13 @@ namespace MCGalaxy { if (who == null) return; if (who == p) { Player.Message(p, "Trying to talk to yourself, huh?"); return; } - if (who.Ignores.All) { - DoFakePM(p, who, message); - } else if (who.Ignores.Names.CaselessContains(p.name)) { - DoFakePM(p, who, message); - } else { - DoPM(p, who, message); - } + Logger.Log(LogType.PrivateChat, "{0} @{1}: {2}", p.name, who.name, message); + Player.Message(p, "[<] {0}: &f{1}", who.ColoredName, message); + if (!Chat.Ignoring(who, p)) { + Player.Message(who, "&9[>] {0}: &f{1}", p.ColoredName, message); + } + p.CheckForMessageSpam(); } @@ -109,16 +108,5 @@ namespace MCGalaxy { p.CheckForMessageSpam(); } - - static void DoFakePM(Player p, Player who, string message) { - Logger.Log(LogType.PrivateChat, "{0} @{1}: {2}", p.name, who.name, message); - Player.Message(p, "[<] {0}: &f{1}", who.ColoredName, message); - } - - static void DoPM(Player p, Player who, string message) { - Logger.Log(LogType.PrivateChat, "{0} @{1}: {2}", p.name, who.name, message); - Player.Message(p, "[<] {0}: &f{1}", who.ColoredName, message); - Player.Message(who, "&9[>] {0}: &f{1}", p.ColoredName, message); - } } } diff --git a/MCGalaxy/Commands/CPE/CustomBlockCommand.cs b/MCGalaxy/Commands/CPE/CustomBlockCommand.cs index 388f4dd14..85bd5f7a6 100644 --- a/MCGalaxy/Commands/CPE/CustomBlockCommand.cs +++ b/MCGalaxy/Commands/CPE/CustomBlockCommand.cs @@ -732,7 +732,7 @@ namespace MCGalaxy.Commands.CPE { "Minimum coordinates for a normal block are &40 &20 &10." } }, { "max", new string[] { "Enter the three maximum coordinates of the cube in units (separated by spaces). 1 block = 16 units.", "Maximum coordinates for a normal block are &416 &216 &116." } }, - { "collide", new string[] { "Type a number between '0' and '6' for collision type.", + { "collide", new string[] { "Type a number between '0' and '7' for collision type.", "0 - block is walk-through (e.g. air).", "1 - block is swim-through/climbable (e.g. rope).", "2 - block is solid (e.g. dirt).", "3 - block is solid, but slippery like ice", "4 - block is solid, but even slipperier than ice", "5 - block is swim-through like water", diff --git a/MCGalaxy/Config/ServerProperties.cs b/MCGalaxy/Config/ServerProperties.cs index 146ed335f..1478fe26a 100644 --- a/MCGalaxy/Config/ServerProperties.cs +++ b/MCGalaxy/Config/ServerProperties.cs @@ -44,8 +44,6 @@ namespace MCGalaxy { old = new OldPerms(); if (PropertiesFile.Read(Paths.ServerPropsFile, ref old, LineProcessor)) Server.SettingsUpdate(); - if (old.saveZS) - ZSConfig.SaveSettings(); ZSConfig.LoadSettings(); Database.Backend = ServerConfig.UseMySQL ? MySQLBackend.Instance : SQLiteBackend.Instance; @@ -88,12 +86,7 @@ namespace MCGalaxy { } if (!ConfigElement.Parse(Server.serverConfig, key, value, null)) { - // Backwards compatibility: ZS used to be part of server.properties - if (ConfigElement.Parse(Server.zombieConfig, key, value, null)) { - perms.saveZS = true; - } else { - Logger.Log(LogType.Warning, "\"{0}\" was not a recognised server property key.", key); - } + Logger.Log(LogType.Warning, "\"{0}\" was not a recognised server property key.", key); } } @@ -103,7 +96,6 @@ namespace MCGalaxy { public int viewPerm = -1, nextPerm = -1, clearPerm = -1, opchatPerm = -1, adminchatPerm = -1; public int mapGenLimit = -1, mapGenLimitAdmin = -1; public int afkKickMins = -1; public LevelPermission afkKickMax = LevelPermission.Banned; - public bool saveZS; } internal static void FixupOldPerms() { diff --git a/MCGalaxy/Games/LavaSurvival/LSConfig.cs b/MCGalaxy/Games/LavaSurvival/LSConfig.cs index e3f508350..124ce318e 100644 --- a/MCGalaxy/Games/LavaSurvival/LSConfig.cs +++ b/MCGalaxy/Games/LavaSurvival/LSConfig.cs @@ -41,13 +41,11 @@ namespace MCGalaxy.Games { return data; } - bool needsSaveSettings; public void LoadSettings() { if (!File.Exists("properties/lavasurvival.properties")) { SaveSettings(); return; } try { PropertiesFile.Read("properties/lavasurvival.properties", ProcessSettingsLine); - if (needsSaveSettings) SaveSettings(); } catch (Exception e) { Logger.LogError(e); } @@ -57,15 +55,6 @@ namespace MCGalaxy.Games { switch (key.ToLower()) { case "start-on-startup": StartOnStartup = bool.Parse(value); break; case "lives": MaxLives = int.Parse(value); break; - - case "setup-rank": - LevelPermission setupRank = Group.ParsePermOrName(value, LevelPermission.Admin); - UpdateExtraPerms(setupRank, 1); - break; - case "control-rank": - LevelPermission controlRank = Group.ParsePermOrName(value, LevelPermission.Operator); - UpdateExtraPerms(controlRank, 2); - break; case "maps": foreach (string name in value.Split(',')) { string map = name.Trim(); @@ -77,13 +66,6 @@ namespace MCGalaxy.Games { } } - void UpdateExtraPerms(LevelPermission perm, int num) { - CommandExtraPerms.Load(); - CommandExtraPerms.Set("lavasurvival", perm, "temp desc", num); - CommandExtraPerms.Save(); - needsSaveSettings = true; - } - public void SaveSettings() { using (StreamWriter w = new StreamWriter("properties/lavasurvival.properties")) { w.WriteLine("#Lava Survival main properties"); diff --git a/MCGalaxy/Network/IRCPlugin/IRCBot.cs b/MCGalaxy/Network/IRCPlugin/IRCBot.cs index b24db3a76..4af04104f 100644 --- a/MCGalaxy/Network/IRCPlugin/IRCBot.cs +++ b/MCGalaxy/Network/IRCPlugin/IRCBot.cs @@ -32,8 +32,8 @@ namespace MCGalaxy { internal Connection connection; internal string[] channels, opchannels; internal string nick, server; - internal bool reset = false; - internal byte retries = 0; + internal bool resetting; + internal byte retries; IRCHandlers handlers; ConnectionArgs args; @@ -78,7 +78,7 @@ namespace MCGalaxy { /// Disconnects this bot from IRC, then reconnects to IRC if IRC is enabled. public void Reset() { - reset = true; + resetting = true; retries = 0; Disconnect("IRC Bot resetting..."); if (!ServerConfig.UseIRC) return; diff --git a/MCGalaxy/Network/IRCPlugin/IRCHandlers.cs b/MCGalaxy/Network/IRCPlugin/IRCHandlers.cs index 3cf8920dc..79ad6a1c8 100644 --- a/MCGalaxy/Network/IRCPlugin/IRCHandlers.cs +++ b/MCGalaxy/Network/IRCPlugin/IRCHandlers.cs @@ -125,27 +125,30 @@ namespace MCGalaxy.Network { bot.Say("*" + p.DisplayName + " " + message, stealth); } - bool ToPublicChannel(ChatScope scope, object arg, ChatMessageFilter filter) { - return Chat.scopeFilters[(int)scope](ircGuest, arg) - && (filter == null || filter(ircGuest, arg)); + void MessageToIRC(ChatScope scope, string msg, object arg, ChatMessageFilter filter) { + ChatMessageFilter scopeFilter = Chat.scopeFilters[(int)scope]; + + if (scopeFilter(ircGuest, arg) && (filter == null || filter(ircGuest, arg))) { + bot.Say(msg, false); + } else { + // TODO: Check filters!!!!! + bot.Say(msg, true); + } } void HandleChatSys(ChatScope scope, string msg, object arg, ref ChatMessageFilter filter, bool irc) { - if (!irc) return; - bot.Say(msg, !ToPublicChannel(scope, arg, filter)); + if (irc) MessageToIRC(scope, msg, arg, filter); } void HandleChatFrom(ChatScope scope, Player source, string msg, object arg, ref ChatMessageFilter filter, bool irc) { - if (!irc) return; - bot.Say(Unescape(source, msg), !ToPublicChannel(scope, arg, filter)); + if (irc) MessageToIRC(scope, Unescape(source, msg), arg, filter); } void HandleChat(ChatScope scope, Player source, string msg, object arg, ref ChatMessageFilter filter, bool irc) { - if (!irc) return; - bot.Say(Unescape(source, msg), !ToPublicChannel(scope, arg, filter)); + if (irc) MessageToIRC(scope, Unescape(source, msg), arg, filter); } void HandleShutdown(bool restarting, string message) { @@ -344,7 +347,7 @@ namespace MCGalaxy.Network { void Listener_OnRegistered() { Logger.Log(LogType.IRCCActivity, "Connected to IRC!"); - bot.reset = false; + bot.resetting = false; bot.retries = 0; Authenticate(); @@ -378,7 +381,7 @@ namespace MCGalaxy.Network { } void Listener_OnDisconnected() { - if (!bot.reset && bot.retries < 3) { bot.retries++; bot.Connect(); } + if (!bot.resetting && bot.retries < 3) { bot.retries++; bot.Connect(); } } void Listener_OnNick(UserInfo user, string newNick) { diff --git a/MCGalaxy/Server/Logger.cs b/MCGalaxy/Server/Logger.cs index b3f1b4cea..c623e9e13 100644 --- a/MCGalaxy/Server/Logger.cs +++ b/MCGalaxy/Server/Logger.cs @@ -55,7 +55,7 @@ namespace MCGalaxy { PlayerChat, /// Chat from IRC. - IRCChat, + IRCChat, /// Chat to all players in a particular chatroom, or across all chatrooms. ChatroomChat, diff --git a/MCGalaxy/Server/Server.Fields.cs b/MCGalaxy/Server/Server.Fields.cs index 9f85d2117..1cf0c4744 100644 --- a/MCGalaxy/Server/Server.Fields.cs +++ b/MCGalaxy/Server/Server.Fields.cs @@ -54,7 +54,7 @@ namespace MCGalaxy { public static INetworkListen Listener; //Other - public static bool ServerSetupFinished = false; + public static bool SetupFinished = false; public static CTFGame ctf = new CTFGame(); public static PlayerList bannedIP, whiteList, ircControllers, invalidIds; diff --git a/MCGalaxy/Server/Server.Init.cs b/MCGalaxy/Server/Server.Init.cs index 96133685b..665c7dd3a 100644 --- a/MCGalaxy/Server/Server.Init.cs +++ b/MCGalaxy/Server/Server.Init.cs @@ -62,7 +62,7 @@ namespace MCGalaxy { hidden = PlayerList.Load("ranks/hidden.txt"); vip = PlayerList.Load("text/vip.txt"); noEmotes = PlayerList.Load("text/emotelist.txt"); - lockdown = PlayerList.Load("text/lockdown.txt"); + lockdown = PlayerList.Load("text/lockdown.txt"); models = PlayerExtList.Load("extra/models.txt"); skins = PlayerExtList.Load("extra/skins.txt"); reach = PlayerExtList.Load("extra/reach.txt"); @@ -71,9 +71,9 @@ namespace MCGalaxy { modelScales = PlayerExtList.Load("extra/modelscales.txt"); muted = PlayerExtList.Load("ranks/muted.txt"); - frozen = PlayerExtList.Load("ranks/frozen.txt"); + frozen = PlayerExtList.Load("ranks/frozen.txt"); tempRanks = PlayerExtList.Load(Paths.TempRanksFile); - tempBans = PlayerExtList.Load(Paths.TempBansFile); + tempBans = PlayerExtList.Load(Paths.TempBansFile); ModerationTasks.QueueTasks(); if (ServerConfig.WhitelistedOnly) @@ -129,7 +129,7 @@ namespace MCGalaxy { TimeSpan.FromMilliseconds(20)); Logger.Log(LogType.SystemActivity, "Finished setting up server, finding classicube.net url.."); - ServerSetupFinished = true; + SetupFinished = true; } static void InitZombieSurvival() { diff --git a/MCGalaxy/Server/Server.cs b/MCGalaxy/Server/Server.cs index 4e564723e..4272ef04c 100644 --- a/MCGalaxy/Server/Server.cs +++ b/MCGalaxy/Server/Server.cs @@ -268,7 +268,7 @@ namespace MCGalaxy { lvl.SaveBlockDBChanges(); } - if (Server.ServerSetupFinished && !ServerConfig.AutoLoadMaps) { + if (Server.SetupFinished && !ServerConfig.AutoLoadMaps) { File.WriteAllText("text/autoload.txt", autoload); } } catch (Exception ex) { Logger.LogError(ex); }