From fd7c23e1a3da0854dc2d8bdfb84bd4c7821f220d Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Fri, 20 Jul 2018 05:16:33 +1000 Subject: [PATCH] log when moving sqlite dll fails --- MCGalaxy/Commands/World/CmdReload.cs | 80 +++++++++++++-------------- MCGalaxy/Player/Player.Handlers.cs | 4 +- MCGalaxy/Server/Server.cs | 11 ++-- MCGalaxy/Server/Tasks/UpgradeTasks.cs | 2 +- 4 files changed, 48 insertions(+), 49 deletions(-) diff --git a/MCGalaxy/Commands/World/CmdReload.cs b/MCGalaxy/Commands/World/CmdReload.cs index cd6aa319a..cab90e681 100644 --- a/MCGalaxy/Commands/World/CmdReload.cs +++ b/MCGalaxy/Commands/World/CmdReload.cs @@ -17,45 +17,45 @@ */ using System; namespace MCGalaxy.Commands.World { - public sealed class CmdReload : Command2 { - public override string name { get { return "Reload"; } } - public override string shortcut { get { return "Reveal"; } } - public override string type { get { return CommandTypes.World; } } - public override bool museumUsable { get { return false; } } - public override CommandAlias[] Aliases { - get { return new [] { new CommandAlias("ReJoin"), new CommandAlias("rd"), - new CommandAlias("WFlush"), new CommandAlias("WorldFlush") }; } - } - public override CommandPerm[] ExtraPerms { - get { return new[] { new CommandPerm(LevelPermission.Operator, "can reload for all players") }; } - } + public sealed class CmdReload : Command2 { + public override string name { get { return "Reload"; } } + public override string shortcut { get { return "Reveal"; } } + public override string type { get { return CommandTypes.World; } } + public override bool museumUsable { get { return false; } } + public override CommandAlias[] Aliases { + get { return new [] { new CommandAlias("ReJoin"), new CommandAlias("rd"), + new CommandAlias("WFlush"), new CommandAlias("WorldFlush") }; } + } + public override CommandPerm[] ExtraPerms { + get { return new[] { new CommandPerm(LevelPermission.Operator, "can reload for all players") }; } + } - public override void Use(Player p, string message, CommandData data) { - if (CheckSuper(p, message, "player or level name")) return; - if (message.Length == 0) message = p.name; - string[] parts = message.SplitSpaces(); - - if (!parts[0].CaselessEq("all")) { - LevelActions.ReloadFor(p, p, true); - } else { - Level lvl = p.level; - if (parts.Length == 2) { - lvl = Matcher.FindLevels(p, parts[1]); - if (lvl == null) return; - } else if (p.IsSuper) { - SuperRequiresArgs(name + " all", p, "level name"); return; - } - - if (!CheckExtraPerm(p, data, 1)) return; - LevelActions.ReloadAll(lvl, p, true); - } - Server.DoGC(); - } - - public override void Help(Player p) { - p.Message("%T/Reload %H- Reloads the map you are in, just for you."); - p.Message("%T/Reload all %H- Reloads for all players in map you are in."); - p.Message("%T/Reload all [map] %H- Reloads for all players in [map]"); - } - } + public override void Use(Player p, string message, CommandData data) { + if (CheckSuper(p, message, "player or level name")) return; + if (message.Length == 0) message = p.name; + string[] parts = message.SplitSpaces(); + + if (!parts[0].CaselessEq("all")) { + LevelActions.ReloadFor(p, p, true); + } else { + Level lvl = p.level; + if (parts.Length == 2) { + lvl = Matcher.FindLevels(p, parts[1]); + if (lvl == null) return; + } else if (p.IsSuper) { + SuperRequiresArgs(name + " all", p, "level name"); return; + } + + if (!CheckExtraPerm(p, data, 1)) return; + LevelActions.ReloadAll(lvl, p, true); + } + Server.DoGC(); + } + + public override void Help(Player p) { + p.Message("%T/Reload %H- Reloads the map you are in, just for you."); + p.Message("%T/Reload all %H- Reloads for all players in map you are in."); + p.Message("%T/Reload all [map] %H- Reloads for all players in [map]"); + } + } } diff --git a/MCGalaxy/Player/Player.Handlers.cs b/MCGalaxy/Player/Player.Handlers.cs index 124586bcf..b061c40eb 100644 --- a/MCGalaxy/Player/Player.Handlers.cs +++ b/MCGalaxy/Player/Player.Handlers.cs @@ -651,9 +651,9 @@ namespace MCGalaxy { Message("%WInfinite message block loop detected, aborting"); return false; } - } else if (data.Context == CommandContext.Normal) { + } else if (data.Context == CommandContext.Normal) { mbRecursion = 0; - } + } return true; } diff --git a/MCGalaxy/Server/Server.cs b/MCGalaxy/Server/Server.cs index fe1f5533e..f3ff14c1e 100644 --- a/MCGalaxy/Server/Server.cs +++ b/MCGalaxy/Server/Server.cs @@ -129,12 +129,11 @@ namespace MCGalaxy { static void MoveSqliteDll() { try { - if (File.Exists("sqlite3_x32.dll") && IntPtr.Size == 4) - File.Copy("sqlite3_x32.dll", "sqlite3.dll", true); - - if (File.Exists("sqlite3_x64.dll") && IntPtr.Size == 8) - File.Copy("sqlite3_x64.dll", "sqlite3.dll", true); - } catch { } + string dll = IntPtr.Size == 8 ? "sqlite3_x64.dll" : "sqlite3_x32.dll"; + if (File.Exists(dll)) File.Copy(dll, "sqlite3.dll", true); + } catch (Exception ex) { + Logger.LogError("Error moving SQLite dll", ex); + } } static void EnsureFilesExist() { diff --git a/MCGalaxy/Server/Tasks/UpgradeTasks.cs b/MCGalaxy/Server/Tasks/UpgradeTasks.cs index 351cf94b9..4380323fe 100644 --- a/MCGalaxy/Server/Tasks/UpgradeTasks.cs +++ b/MCGalaxy/Server/Tasks/UpgradeTasks.cs @@ -152,7 +152,7 @@ namespace MCGalaxy.Tasks { foreach (var kvp in botsByLevel) { string path = BotsFile.BotsPath(kvp.Key); using (StreamWriter w = new StreamWriter(path)) { - BotsFile.WriteAll(w, kvp.Value); + BotsFile.WriteAll(w, kvp.Value); } }