From a6d21a57973a1a56fbd03946db6551ae60cd33e1 Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Tue, 2 Apr 2019 16:20:57 -0400 Subject: [PATCH] [-] Set Stats and Skills features to maintenance mode --- src/main/java/cc/moecraft/icq/plugins/osubot/Main.java | 4 ++++ .../icq/plugins/osubot/browser/browsers/RecentBrowser.java | 2 +- .../icq/plugins/osubot/commands/osu/CommandSkills.java | 2 ++ .../icq/plugins/osubot/commands/osu/CommandStats.java | 7 +++---- src/main/resources/config.yml | 3 +++ 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/cc/moecraft/icq/plugins/osubot/Main.java b/src/main/java/cc/moecraft/icq/plugins/osubot/Main.java index dca384c..da3d7bf 100644 --- a/src/main/java/cc/moecraft/icq/plugins/osubot/Main.java +++ b/src/main/java/cc/moecraft/icq/plugins/osubot/Main.java @@ -31,6 +31,9 @@ public class Main extends IcqPlugin { public static final String CONTACT_INFO = "qq:565656"; + // Stats和Skills维护 + public static boolean disableStatsSkills; + @Getter private static OsuBrowserManager browserManager; @@ -53,6 +56,7 @@ public void onEnable() getConfig().getString("IRC.Username"), getConfig().getString("IRC.Password")); + disableStatsSkills = getConfig().getBoolean("Misc.DisableStatSkills"); init(getLogger()); } diff --git a/src/main/java/cc/moecraft/icq/plugins/osubot/browser/browsers/RecentBrowser.java b/src/main/java/cc/moecraft/icq/plugins/osubot/browser/browsers/RecentBrowser.java index 3545793..7892163 100644 --- a/src/main/java/cc/moecraft/icq/plugins/osubot/browser/browsers/RecentBrowser.java +++ b/src/main/java/cc/moecraft/icq/plugins/osubot/browser/browsers/RecentBrowser.java @@ -90,7 +90,7 @@ public File render(OPABeatmapData beatmapData, OWAUserData userData, OPAUserRece loadHtml(html); sleep(1000); setRunning(false); - return render(0, 0, 1142, 142); //TODO: change dis + return render(0, 0, 1142, 142); //TODO: change this } @Override diff --git a/src/main/java/cc/moecraft/icq/plugins/osubot/commands/osu/CommandSkills.java b/src/main/java/cc/moecraft/icq/plugins/osubot/commands/osu/CommandSkills.java index 674c0cd..535ee73 100644 --- a/src/main/java/cc/moecraft/icq/plugins/osubot/commands/osu/CommandSkills.java +++ b/src/main/java/cc/moecraft/icq/plugins/osubot/commands/osu/CommandSkills.java @@ -31,6 +31,8 @@ public CommandSkills() @Override public String runOsu(EventMessage event, User user, String command, ArrayList args) throws Exception { + if (Main.disableStatsSkills) return ""; + long startTime = System.currentTimeMillis(); String username = getDatabasedUsername(args, 0, user); diff --git a/src/main/java/cc/moecraft/icq/plugins/osubot/commands/osu/CommandStats.java b/src/main/java/cc/moecraft/icq/plugins/osubot/commands/osu/CommandStats.java index ff3382e..4c7853f 100644 --- a/src/main/java/cc/moecraft/icq/plugins/osubot/commands/osu/CommandStats.java +++ b/src/main/java/cc/moecraft/icq/plugins/osubot/commands/osu/CommandStats.java @@ -5,14 +5,11 @@ import cc.moecraft.icq.plugins.osubot.Main; import cc.moecraft.icq.plugins.osubot.browser.browsers.StatsBrowser; import cc.moecraft.icq.plugins.osubot.commands.OsuCommandBase; -import cc.moecraft.icq.plugins.osubot.osu.exceptions.UserNotFoundException; import cc.moecraft.icq.plugins.osubot.osu.webapi.OWAUserData; import cc.moecraft.icq.plugins.osubot.osu.webapi.OWAUtils; import cc.moecraft.icq.user.User; -import cc.moecraft.utils.ArrayUtils; import java.io.File; -import java.io.IOException; import java.util.ArrayList; /** @@ -33,6 +30,8 @@ public CommandStats() @Override public String runOsu(EventMessage event, User user, String command, ArrayList args) throws Exception { + if (Main.disableStatsSkills) return ""; + long startTime = System.currentTimeMillis(); String username = getDatabasedUsername(args, 0, user); @@ -56,6 +55,6 @@ public String help(String command) @Override public CommandProperties properties() { - return new CommandProperties("stats", "me", "home", "stat"); + return new CommandProperties("stats", "home", "stat"); } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 1fd8e21..c19b32b 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -14,6 +14,9 @@ Encoding: Force: true Encoding: utf-8 +Misc: + DisableWebAPI: false + #-----------------------------------------------# # Database section is deprecated. # # You'll have to configure your database in #