diff --git a/.gitignore b/.gitignore index 8c1f47591..57b5b05ec 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ Plan.iml PlanPluginBridge.iml .sonar/ +*.db + # Shell files *.sh diff --git a/Plan/dependency-reduced-pom.xml b/Plan/dependency-reduced-pom.xml index def2b3e0a..67d6f5663 100644 --- a/Plan/dependency-reduced-pom.xml +++ b/Plan/dependency-reduced-pom.xml @@ -27,7 +27,7 @@ maven-compiler-plugin - 3.3 + 3.7.0 1.8 1.8 @@ -71,15 +71,20 @@ com.maxmind plan.com.maxmind - - org.apache.logging.** - com.fasterxml plan.com.fasterxml + + + com.zaxxer + plan.com.zaxxer + + + org.slf4j + plan.org.slf4j - org.apache.logging.** + org.slf4j.Logger @@ -91,7 +96,7 @@ maven-jar-plugin - 2.6 + 3.0.2 **/test/* @@ -104,7 +109,7 @@ org.jacoco jacoco-maven-plugin - 0.7.9 + 0.8.0 maven-checkstyle-plugin @@ -180,10 +185,6 @@ bungeecord-chat net.md-5 - - slf4j-api - org.slf4j - asm org.ow2.asm @@ -197,7 +198,7 @@ org.spigotmc spigot-api - 1.12-R0.1-SNAPSHOT + 1.12.2-R0.1-SNAPSHOT provided @@ -285,7 +286,7 @@ org.spongepowered spongeapi - LATEST + 7.0.0 provided @@ -328,10 +329,6 @@ flow-noise com.flowpowered - - slf4j-api - org.slf4j - jsr305 com.google.code.findbugs @@ -373,7 +370,7 @@ org.xerial sqlite-jdbc - 3.21.0 + 3.21.0.1 test diff --git a/Plan/pom.xml b/Plan/pom.xml index 84c5f811f..ef6bcd10b 100644 --- a/Plan/pom.xml +++ b/Plan/pom.xml @@ -6,6 +6,7 @@ Plan 4.3.0-SNAPSHOT jar + bungeecord-repo @@ -24,6 +25,7 @@ https://repo.spongepowered.org/maven + @@ -37,6 +39,7 @@ PlanPluginBridge 4.3.0-SNAPSHOT + com.destroystokyo.paper @@ -48,7 +51,7 @@ org.spigotmc spigot-api - 1.12-R0.1-SNAPSHOT + 1.12.2-R0.1-SNAPSHOT jar provided @@ -70,37 +73,36 @@ org.spongepowered spongeapi - LATEST + 7.0.0 jar provided + + org.apache.commons commons-text 1.3 + + + org.apache.httpcomponents + httpclient + 4.5.6 + + + + com.zaxxer + HikariCP + 3.1.0 + + com.maxmind.geoip2 geoip2 2.9.0 - - - org.apache.commons - commons-dbcp2 - 2.1.1 - - - org.apache.commons - commons-pool2 - 2.4.2 - - - commons-logging - commons-logging - 1.2 - @@ -111,11 +113,10 @@ test - org.xerial sqlite-jdbc - 3.21.0 + 3.21.0.1 test @@ -155,7 +156,7 @@ maven-compiler-plugin - 3.3 + 3.7.0 1.8 1.8 @@ -200,15 +201,20 @@ com.maxmind plan.com.maxmind - - org.apache.logging.** - com.fasterxml plan.com.fasterxml + + + com.zaxxer + plan.com.zaxxer + + + org.slf4j + plan.org.slf4j - org.apache.logging.** + org.slf4j.Logger @@ -222,7 +228,7 @@ org.apache.maven.plugins maven-jar-plugin - 2.6 + 3.0.2 **/test/* @@ -235,7 +241,7 @@ org.jacoco jacoco-maven-plugin - 0.7.9 + 0.8.0 org.apache.maven.plugins diff --git a/Plan/src/main/java/com/djrapitops/plan/Plan.java b/Plan/src/main/java/com/djrapitops/plan/Plan.java index 9569f4369..f1619c650 100644 --- a/Plan/src/main/java/com/djrapitops/plan/Plan.java +++ b/Plan/src/main/java/com/djrapitops/plan/Plan.java @@ -22,10 +22,10 @@ package com.djrapitops.plan; import com.djrapitops.plan.api.exceptions.EnableException; import com.djrapitops.plan.command.PlanCommand; import com.djrapitops.plan.system.BukkitSystem; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.PluginLang; import com.djrapitops.plan.system.processing.importing.ImporterManager; import com.djrapitops.plan.system.processing.importing.importers.OfflinePlayerImporter; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plan.system.settings.theme.PlanColorScheme; import com.djrapitops.plan.utilities.metrics.BStats; import com.djrapitops.plugin.BukkitPlugin; @@ -48,6 +48,7 @@ import java.util.logging.Logger; public class Plan extends BukkitPlugin implements PlanPlugin { private BukkitSystem system; + private Locale locale; /** * Used to get the plugin-instance singleton. @@ -58,11 +59,6 @@ public class Plan extends BukkitPlugin implements PlanPlugin { return (Plan) StaticHolder.getInstance(Plan.class); } - /** - * OnEnable method. - *

- * - Enables the plugin's subsystems. - */ @Override public void onEnable() { super.onEnable(); @@ -70,6 +66,7 @@ public class Plan extends BukkitPlugin implements PlanPlugin { Benchmark.start("Enable"); system = new BukkitSystem(this); system.enable(); + locale = system.getLocaleSystem().getLocale(); ImporterManager.registerImporter(new OfflinePlayerImporter()); @@ -79,7 +76,7 @@ public class Plan extends BukkitPlugin implements PlanPlugin { Log.debug("Verbose debug messages are enabled."); Benchmark.stop("Enable", "Enable"); Log.logDebug("Enable"); - Log.info(Locale.get(Msg.ENABLED).toString()); + Log.info(locale.getString(PluginLang.ENABLED)); } catch (AbstractMethodError e) { Log.error("Plugin ran into AbstractMethodError - Server restart is required. Likely cause is updating the jar without a restart."); } catch (EnableException e) { @@ -109,7 +106,7 @@ public class Plan extends BukkitPlugin implements PlanPlugin { public void onDisable() { system.disable(); - Log.info(Locale.get(Msg.DISABLED).toString()); + Log.info(locale.getString(PluginLang.DISABLED)); Benchmark.pluginDisabled(Plan.class); DebugLog.pluginDisabled(Plan.class); } diff --git a/Plan/src/main/java/com/djrapitops/plan/PlanBungee.java b/Plan/src/main/java/com/djrapitops/plan/PlanBungee.java index e49a207ad..1c5704843 100644 --- a/Plan/src/main/java/com/djrapitops/plan/PlanBungee.java +++ b/Plan/src/main/java/com/djrapitops/plan/PlanBungee.java @@ -7,8 +7,8 @@ package com.djrapitops.plan; import com.djrapitops.plan.api.exceptions.EnableException; import com.djrapitops.plan.command.PlanBungeeCommand; import com.djrapitops.plan.system.BungeeSystem; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.PluginLang; import com.djrapitops.plan.system.settings.theme.PlanColorScheme; import com.djrapitops.plugin.BungeePlugin; import com.djrapitops.plugin.StaticHolder; @@ -29,6 +29,7 @@ import java.util.logging.Logger; public class PlanBungee extends BungeePlugin implements PlanPlugin { private BungeeSystem system; + private Locale locale; public static PlanBungee getInstance() { return (PlanBungee) StaticHolder.getInstance(PlanBungee.class); @@ -40,8 +41,9 @@ public class PlanBungee extends BungeePlugin implements PlanPlugin { try { system = new BungeeSystem(this); system.enable(); + locale = system.getLocaleSystem().getLocale(); - Log.info(Locale.get(Msg.ENABLED).toString()); + Log.info(locale.getString(PluginLang.ENABLED)); } catch (AbstractMethodError e) { Log.error("Plugin ran into AbstractMethodError - Server restart is required. Likely cause is updating the jar without a restart."); } catch (EnableException e) { @@ -63,7 +65,7 @@ public class PlanBungee extends BungeePlugin implements PlanPlugin { public void onDisable() { system.disable(); - Log.info(Locale.get(Msg.DISABLED).toString()); + Log.info(locale.getString(PluginLang.DISABLED)); Benchmark.pluginDisabled(PlanBungee.class); DebugLog.pluginDisabled(PlanBungee.class); } diff --git a/Plan/src/main/java/com/djrapitops/plan/PlanPlugin.java b/Plan/src/main/java/com/djrapitops/plan/PlanPlugin.java index 6edcf0649..c4d263d3e 100644 --- a/Plan/src/main/java/com/djrapitops/plan/PlanPlugin.java +++ b/Plan/src/main/java/com/djrapitops/plan/PlanPlugin.java @@ -4,6 +4,7 @@ */ package com.djrapitops.plan; +import com.djrapitops.plan.system.PlanSystem; import com.djrapitops.plugin.IPlugin; import com.djrapitops.plugin.api.Check; import com.djrapitops.plugin.settings.ColorScheme; @@ -60,4 +61,6 @@ public interface PlanPlugin extends IPlugin { @Override boolean isReloading(); + + PlanSystem getSystem(); } diff --git a/Plan/src/main/java/com/djrapitops/plan/PlanSponge.java b/Plan/src/main/java/com/djrapitops/plan/PlanSponge.java index db4a06ad5..7e8841f9b 100644 --- a/Plan/src/main/java/com/djrapitops/plan/PlanSponge.java +++ b/Plan/src/main/java/com/djrapitops/plan/PlanSponge.java @@ -3,8 +3,8 @@ package com.djrapitops.plan; import com.djrapitops.plan.api.exceptions.EnableException; import com.djrapitops.plan.command.PlanCommand; import com.djrapitops.plan.system.SpongeSystem; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.PluginLang; import com.djrapitops.plan.system.settings.theme.PlanColorScheme; import com.djrapitops.plugin.SpongePlugin; import com.djrapitops.plugin.StaticHolder; @@ -23,7 +23,7 @@ import org.spongepowered.api.plugin.Plugin; import java.io.File; import java.io.InputStream; -@Plugin(id = "plan", name = "Plan", version = "4.4.1", description = "Player Analytics Plugin by Rsl1122", authors = {"Rsl1122"}) +@Plugin(id = "plan", name = "Plan", version = "4.4.2", description = "Player Analytics Plugin by Rsl1122", authors = {"Rsl1122"}) public class PlanSponge extends SpongePlugin implements PlanPlugin { @Inject @@ -33,6 +33,7 @@ public class PlanSponge extends SpongePlugin implements PlanPlugin { @ConfigDir(sharedRoot = false) private File dataFolder; private SpongeSystem system; + private Locale locale; @Listener public void onServerStart(GameStartedServerEvent event) { @@ -54,6 +55,9 @@ public class PlanSponge extends SpongePlugin implements PlanPlugin { system = new SpongeSystem(this); try { system.enable(); + locale = system.getLocaleSystem().getLocale(); + + Log.info(locale.getString(PluginLang.ENABLED)); } catch (AbstractMethodError e) { Log.error("Plugin ran into AbstractMethodError - Server restart is required. Likely cause is updating the jar without a restart."); } catch (EnableException e) { @@ -77,7 +81,7 @@ public class PlanSponge extends SpongePlugin implements PlanPlugin { system.disable(); } - Log.info(Locale.get(Msg.DISABLED).toString()); + Log.info(locale.getString(PluginLang.DISABLED)); Benchmark.pluginDisabled(PlanSponge.class); DebugLog.pluginDisabled(PlanSponge.class); } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/PlanBungeeCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/PlanBungeeCommand.java index 3baa3d3b6..8af457fd7 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/PlanBungeeCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/PlanBungeeCommand.java @@ -1,11 +1,11 @@ package com.djrapitops.plan.command; -import com.djrapitops.plan.PlanBungee; +import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.command.commands.*; import com.djrapitops.plan.command.commands.manage.ManageConDebugCommand; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.TreeCmdNode; @@ -21,37 +21,36 @@ import com.djrapitops.plugin.command.defaultcmds.StatusCommand; */ public class PlanBungeeCommand extends TreeCmdNode { - /** - * CommandExecutor class Constructor. - *

- * Initializes Subcommands - * - * @param plugin Current instance of Plan - */ - public PlanBungeeCommand(PlanBungee plugin) { + public PlanBungeeCommand(PlanPlugin plugin) { super("planbungee", Permissions.MANAGE.getPermission(), CommandType.CONSOLE, null); super.setColorScheme(plugin.getColorScheme()); - setInDepthHelp(Locale.get(Msg.CMD_HELP_PLAN).toArray()); - RegisterCommand registerCommand = new RegisterCommand(); - setNodeGroups( - new CommandNode[]{ - new NetworkCommand(), - new ListServersCommand(plugin), - new ListCommand(), - }, - new CommandNode[]{ - registerCommand, - new WebUserCommand(plugin, registerCommand, this), - }, - new CommandNode[]{ - new ManageConDebugCommand(), - new BungeeSetupToggleCommand(), - new ReloadCommand(plugin), - new DisableCommand(), - new StatusCommand<>(plugin, Permissions.MANAGE.getPermission(), plugin.getColorScheme()), + Locale locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setInDepthHelp(locale.getArray(DeepHelpLang.PLAN)); + + RegisterCommand registerCommand = new RegisterCommand(plugin); + CommandNode[] analyticsGroup = { + new NetworkCommand(plugin), + new ListServersCommand(plugin), + new ListPlayersCommand(plugin), + }; + CommandNode[] webGroup = { + registerCommand, + new WebUserCommand(plugin, registerCommand, this), + }; + CommandNode[] manageGroup = { + new ManageConDebugCommand(plugin), + new BungeeSetupToggleCommand(plugin), + new ReloadCommand(plugin), + new DisableCommand(plugin), + new StatusCommand<>(plugin, Permissions.MANAGE.getPermission(), plugin.getColorScheme()), // (Settings.ALLOW_UPDATE.isTrue() ? new UpdateCommand() : null) - } + }; + setNodeGroups( + analyticsGroup, + webGroup, + manageGroup ); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/PlanCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/PlanCommand.java index ed0787e36..e740df78a 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/PlanCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/PlanCommand.java @@ -2,10 +2,10 @@ package com.djrapitops.plan.command; import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.command.commands.*; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; import com.djrapitops.plan.system.settings.Permissions; import com.djrapitops.plan.system.settings.Settings; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.TreeCmdNode; @@ -25,31 +25,33 @@ public class PlanCommand extends TreeCmdNode { super("plan", "", CommandType.CONSOLE, null); super.setDefaultCommand("inspect"); super.setColorScheme(plugin.getColorScheme()); - setInDepthHelp(Locale.get(Msg.CMD_HELP_PLAN).toArray()); - RegisterCommand registerCommand = new RegisterCommand(); - setNodeGroups( - new CommandNode[]{ - new InspectCommand(), - new QInspectCommand(plugin), - new SearchCommand(), - new ListCommand(), - new AnalyzeCommand(), - new NetworkCommand(), - new ListServersCommand(plugin) - }, - new CommandNode[]{ - new WebUserCommand(plugin, registerCommand, this), - registerCommand - }, - new CommandNode[]{ - new InfoCommand(plugin), - new ReloadCommand(plugin), - new ManageCommand(plugin, this), - new StatusCommand<>(plugin, Permissions.MANAGE.getPermission(), plugin.getColorScheme()), - (Settings.DEV_MODE.isTrue() ? new DevCommand() : null), + Locale locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setInDepthHelp(locale.getArray(DeepHelpLang.PLAN)); + + RegisterCommand registerCommand = new RegisterCommand(plugin); + CommandNode[] analyticsGroup = { + new InspectCommand(plugin), + new QInspectCommand(plugin), + new SearchCommand(plugin), + new ListPlayersCommand(plugin), + new AnalyzeCommand(plugin), + new NetworkCommand(plugin), + new ListServersCommand(plugin) + }; + CommandNode[] webGroup = { + new WebUserCommand(plugin, registerCommand, this), + registerCommand + }; + CommandNode[] manageGroup = { + new InfoCommand(plugin), + new ReloadCommand(plugin), + new ManageCommand(plugin, this), + new StatusCommand<>(plugin, Permissions.MANAGE.getPermission(), plugin.getColorScheme()), + (Settings.DEV_MODE.isTrue() ? new DevCommand(plugin) : null), // (Settings.ALLOW_UPDATE.isTrue() ? new UpdateCommand() : null) - } - ); + }; + setNodeGroups(analyticsGroup, webGroup, manageGroup); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/AnalyzeCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/AnalyzeCommand.java index 6fd95436c..47ef1639a 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/AnalyzeCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/AnalyzeCommand.java @@ -1,5 +1,6 @@ package com.djrapitops.plan.command.commands; +import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.api.exceptions.connection.WebException; import com.djrapitops.plan.api.exceptions.database.DBOpException; import com.djrapitops.plan.system.database.databases.Database; @@ -7,10 +8,13 @@ import com.djrapitops.plan.system.info.InfoSystem; import com.djrapitops.plan.system.info.connection.ConnectionSystem; import com.djrapitops.plan.system.info.server.Server; import com.djrapitops.plan.system.info.server.ServerInfo; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; +import com.djrapitops.plan.system.locale.lang.ManageLang; import com.djrapitops.plan.system.processing.Processing; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plan.system.webserver.WebServerSystem; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.command.CommandNode; @@ -30,23 +34,27 @@ import java.util.UUID; */ public class AnalyzeCommand extends CommandNode { - public AnalyzeCommand() { + private final Locale locale; + + public AnalyzeCommand(PlanPlugin plugin) { super("analyze|analyse|analysis|a", Permissions.ANALYZE.getPermission(), CommandType.CONSOLE); - setShortHelp(Locale.get(Msg.CMD_USG_ANALYZE).parse()); - setInDepthHelp(Locale.get(Msg.CMD_HELP_ANALYZE).toArray()); + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setShortHelp(locale.getString(CmdHelpLang.ANALYZE)); + setInDepthHelp(locale.getArray(DeepHelpLang.ANALYZE)); setArguments("[server/id]"); } @Override public void onCommand(ISender sender, String commandLabel, String[] args) { - sender.sendMessage(Locale.get(Msg.CMD_INFO_FETCH_DATA).toString()); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_START)); Processing.submitNonCritical(() -> { try { Server server = getServer(args).orElseGet(ServerInfo::getServer); UUID serverUUID = server.getUuid(); - InfoSystem.getInstance().generateAnalysisPage(serverUUID); sendWebUserNotificationIfNecessary(sender); sendLink(server, sender); @@ -60,17 +68,17 @@ public class AnalyzeCommand extends CommandNode { private void sendLink(Server server, ISender sender) { String target = "/server/" + server.getName(); String url = ConnectionSystem.getAddress() + target; - String message = Locale.get(Msg.CMD_INFO_LINK).toString(); - sender.sendMessage(Locale.get(Msg.CMD_HEADER_ANALYZE).toString()); + String linkPrefix = locale.getString(CommandLang.LINK_PREFIX); + sender.sendMessage(locale.getString(CommandLang.HEADER_ANALYSIS)); // Link boolean console = !CommandUtils.isPlayer(sender); if (console) { - sender.sendMessage(message + url); + sender.sendMessage(linkPrefix + url); } else { - sender.sendMessage(message); - sender.sendLink(" ", Locale.get(Msg.CMD_INFO_CLICK_ME).toString(), url); + sender.sendMessage(linkPrefix); + sender.sendLink(" ", locale.getString(CommandLang.LINK_CLICK_ME), url); } - sender.sendMessage(Locale.get(Msg.CMD_CONSTANT_FOOTER).toString()); + sender.sendMessage(">"); } private void sendWebUserNotificationIfNecessary(ISender sender) { @@ -78,7 +86,7 @@ public class AnalyzeCommand extends CommandNode { boolean senderHasWebUser = Database.getActive().check().doesWebUserExists(sender.getName()); if (!senderHasWebUser) { - sender.sendMessage("§e[Plan] You might not have a web user, use /plan register "); + sender.sendMessage("§e" + locale.getString(CommandLang.NO_WEB_USER_NOTIFY)); } } } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/BungeeSetupToggleCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/BungeeSetupToggleCommand.java index 8deb54b2c..e4c23e393 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/BungeeSetupToggleCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/BungeeSetupToggleCommand.java @@ -4,7 +4,12 @@ */ package com.djrapitops.plan.command.commands; +import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.system.info.connection.ConnectionSystem; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; import com.djrapitops.plan.system.settings.Permissions; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; @@ -19,9 +24,15 @@ import com.djrapitops.plugin.command.ISender; */ public class BungeeSetupToggleCommand extends CommandNode { - public BungeeSetupToggleCommand() { + private final Locale locale; + + public BungeeSetupToggleCommand(PlanPlugin plugin) { super("setup", Permissions.MANAGE.getPermission(), CommandType.ALL); - setShortHelp("Toggle Setup mode for Bungee"); + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setShortHelp(locale.getString(CmdHelpLang.SETUP)); + setInDepthHelp(locale.getArray(DeepHelpLang.SETUP)); } @Override @@ -34,7 +45,7 @@ public class BungeeSetupToggleCommand extends CommandNode { } else { connectionSystem.setSetupAllowed(true); } - String msg = !setupAllowed ? "§aSet-up is now Allowed" : "§cSet-up is now Forbidden"; + String msg = locale.getString(!setupAllowed ? CommandLang.SETUP_ALLOWED : CommandLang.CONNECT_FORBIDDEN); sender.sendMessage(msg); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/DevCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/DevCommand.java index 4ca5dc43c..8ca20e7f6 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/DevCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/DevCommand.java @@ -4,13 +4,17 @@ */ package com.djrapitops.plan.command.commands; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; +import com.djrapitops.plan.PlanPlugin; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.ISender; import com.djrapitops.plugin.utilities.Verify; +import java.util.Arrays; + /** * Command used for testing functions that are too difficult to unit test. * @@ -18,15 +22,21 @@ import com.djrapitops.plugin.utilities.Verify; */ public class DevCommand extends CommandNode { - public DevCommand() { + private final Locale locale; + + public DevCommand(PlanPlugin plugin) { super("dev", "plan.*", CommandType.PLAYER_OR_ARGS); - setShortHelp("Test Plugin functions not testable with unit tests."); + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setShortHelp(locale.get(CmdHelpLang.DEV).toString()); setArguments(""); } @Override public void onCommand(ISender sender, String cmd, String[] args) { - Verify.isTrue(args.length >= 1, () -> new IllegalArgumentException(Locale.get(Msg.CMD_FAIL_REQ_ONE_ARG).toString())); + Verify.isTrue(args.length >= 1, + () -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_REQ_ONE_ARG, Arrays.toString(this.getArguments())))); sender.sendMessage("No features currently implemented in the command."); } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/DisableCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/DisableCommand.java index 1911c2825..b54e40b34 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/DisableCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/DisableCommand.java @@ -1,22 +1,30 @@ package com.djrapitops.plan.command.commands; import com.djrapitops.plan.PlanPlugin; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.ISender; public class DisableCommand extends CommandNode { - public DisableCommand() { + private final Locale locale; + + public DisableCommand(PlanPlugin plugin) { super("disable", "plan.reload", CommandType.ALL); + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setShortHelp(locale.getString(CmdHelpLang.DISABLE)); + setInDepthHelp(locale.getArray(DeepHelpLang.DISABLE)); } @Override public void onCommand(ISender sender, String commandLabel, String[] args) { PlanPlugin.getInstance().onDisable(); - sender.sendMessage( - "§aPlan systems are now disabled. " + - "You can still use /planbungee reload to restart the plugin." - ); + sender.sendMessage(locale.getString(CommandLang.DISABLE_DISABLED)); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/InfoCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/InfoCommand.java index 0b2ee49d5..12210e0de 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/InfoCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/InfoCommand.java @@ -3,14 +3,15 @@ package com.djrapitops.plan.command.commands; import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.system.database.databases.Database; import com.djrapitops.plan.system.info.connection.ConnectionSystem; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.GenericLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plan.system.update.VersionCheckSystem; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.ISender; -import com.djrapitops.plugin.settings.ColorScheme; /** * This SubCommand is used to view the version and the database type in use. @@ -21,29 +22,33 @@ import com.djrapitops.plugin.settings.ColorScheme; public class InfoCommand extends CommandNode { private final PlanPlugin plugin; + private final Locale locale; public InfoCommand(PlanPlugin plugin) { super("info", Permissions.INFO.getPermission(), CommandType.CONSOLE); - setShortHelp(Locale.get(Msg.CMD_USG_INFO).toString()); + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setShortHelp(locale.get(CmdHelpLang.INFO).toString()); this.plugin = plugin; } @Override public void onCommand(ISender sender, String commandLabel, String[] args) { - ColorScheme cs = plugin.getColorScheme(); - String mColor = cs.getMainColor(); - String sColor = cs.getSecondaryColor(); - String tColor = cs.getTertiaryColor(); - String ball = Locale.get(Msg.CMD_CONSTANT_LIST_BALL).toString(); + String yes = locale.getString(GenericLang.YES); + String no = locale.getString(GenericLang.NO); - String upToDate = VersionCheckSystem.isNewVersionAvailable() ? "Update Available" : "Up to date"; + String updateAvailable = VersionCheckSystem.isNewVersionAvailable() ? yes : no; + String connectedToBungee = ConnectionSystem.getInstance().isServerAvailable() ? yes : no; String[] messages = { - Locale.get(Msg.CMD_HEADER_INFO).toString(), - ball + mColor + " Version: " + sColor + plugin.getVersion(), - ball + mColor + " Up to date: " + sColor + upToDate, - ball + mColor + " Active Database: " + tColor + Database.getActive().getConfigName(), - ball + mColor + " Connected to Bungee: " + tColor + (ConnectionSystem.getInstance().isServerAvailable() ? "Yes" : "No"), - Locale.get(Msg.CMD_CONSTANT_FOOTER).toString() + locale.getString(CommandLang.HEADER_INFO), + "", + locale.getString(CommandLang.INFO_VERSION, plugin.getVersion()), + locale.getString(CommandLang.INFO_UPDATE, updateAvailable), + locale.getString(CommandLang.INFO_DATABASE, Database.getActive().getName()), + locale.getString(CommandLang.INFO_BUNGEE_CONNECTION, connectedToBungee), + "", + ">" }; sender.sendMessage(messages); } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/InspectCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/InspectCommand.java index 9708b4df8..09ea35f35 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/InspectCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/InspectCommand.java @@ -1,12 +1,15 @@ package com.djrapitops.plan.command.commands; +import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.api.exceptions.database.DBOpException; import com.djrapitops.plan.system.database.databases.Database; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; import com.djrapitops.plan.system.processing.Processing; import com.djrapitops.plan.system.processing.processors.info.InspectCacheRequestProcessor; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plan.system.webserver.WebServer; import com.djrapitops.plan.utilities.MiscUtils; import com.djrapitops.plan.utilities.uuid.UUIDUtility; @@ -28,17 +31,26 @@ import java.util.UUID; */ public class InspectCommand extends CommandNode { - public InspectCommand() { + private final Locale locale; + + public InspectCommand(PlanPlugin plugin) { super("inspect", Permissions.INSPECT.getPermission(), CommandType.PLAYER_OR_ARGS); setArguments(""); - setShortHelp(Locale.get(Msg.CMD_USG_INSPECT).toString()); - setInDepthHelp(Locale.get(Msg.CMD_HELP_INSPECT).toArray()); + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setShortHelp(locale.getString(CmdHelpLang.INSPECT)); + setInDepthHelp(locale.getArray(DeepHelpLang.INSPECT)); } @Override public void onCommand(ISender sender, String commandLabel, String[] args) { String playerName = MiscUtils.getPlayerName(args, sender); + if (playerName == null) { + sender.sendMessage(locale.getString(CommandLang.FAIL_NO_PERMISSION)); + } + runInspectTask(playerName, sender); } @@ -49,18 +61,18 @@ public class InspectCommand extends CommandNode { try { UUID uuid = UUIDUtility.getUUIDOf(playerName); if (uuid == null) { - sender.sendMessage(Locale.get(Msg.CMD_FAIL_USERNAME_NOT_VALID).toString()); + sender.sendMessage(locale.getString(CommandLang.FAIL_USERNAME_NOT_VALID)); return; } Database activeDB = Database.getActive(); if (!activeDB.check().isPlayerRegistered(uuid)) { - sender.sendMessage(Locale.get(Msg.CMD_FAIL_USERNAME_NOT_KNOWN).toString()); + sender.sendMessage(locale.getString(CommandLang.FAIL_USERNAME_NOT_KNOWN)); return; } checkWebUserAndNotify(activeDB, sender); - Processing.submit(new InspectCacheRequestProcessor(uuid, sender, playerName)); + Processing.submit(new InspectCacheRequestProcessor(uuid, sender, playerName, locale)); } catch (DBOpException e) { if (e.isFatal()) { sender.sendMessage("§cFatal database exception occurred: " + e.getMessage()); @@ -80,7 +92,7 @@ public class InspectCommand extends CommandNode { boolean senderHasWebUser = activeDB.check().doesWebUserExists(sender.getName()); if (!senderHasWebUser) { - sender.sendMessage("§e[Plan] You might not have a web user, use /plan register "); + sender.sendMessage("§e" + locale.getString(CommandLang.NO_WEB_USER_NOTIFY)); } } } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/ListCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/ListPlayersCommand.java similarity index 50% rename from Plan/src/main/java/com/djrapitops/plan/command/commands/ListCommand.java rename to Plan/src/main/java/com/djrapitops/plan/command/commands/ListPlayersCommand.java index d8b12f741..e5d903293 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/ListCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/ListPlayersCommand.java @@ -1,9 +1,12 @@ package com.djrapitops.plan.command.commands; +import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.system.info.connection.ConnectionSystem; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandUtils; @@ -15,12 +18,17 @@ import com.djrapitops.plugin.command.ISender; * @author Rsl1122 * @since 3.5.2 */ -public class ListCommand extends CommandNode { +public class ListPlayersCommand extends CommandNode { - public ListCommand() { + private final Locale locale; + + public ListPlayersCommand(PlanPlugin plugin) { super("players|pl|playerlist|list", Permissions.INSPECT_OTHER.getPermission(), CommandType.CONSOLE); - setShortHelp(Locale.get(Msg.CMD_USG_LIST).toString()); - setInDepthHelp(Locale.get(Msg.CMD_HELP_LIST).toArray()); + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setShortHelp(locale.getString(CmdHelpLang.PLAYERS)); + setInDepthHelp(locale.getArray(DeepHelpLang.PLAYERS)); } @Override @@ -29,18 +37,18 @@ public class ListCommand extends CommandNode { } private void sendListMsg(ISender sender) { - sender.sendMessage(Locale.get(Msg.CMD_CONSTANT_FOOTER).parse()); + sender.sendMessage(locale.getString(CommandLang.HEADER_PLAYERS)); // Link String url = ConnectionSystem.getAddress() + "/players/"; - String message = Locale.get(Msg.CMD_INFO_LINK).toString(); + String linkPrefix = locale.getString(CommandLang.LINK_PREFIX); boolean console = !CommandUtils.isPlayer(sender); if (console) { - sender.sendMessage(message + url); + sender.sendMessage(linkPrefix + url); } else { - sender.sendMessage(message); - sender.sendLink(" ", Locale.get(Msg.CMD_INFO_CLICK_ME).toString(), url); + sender.sendMessage(linkPrefix); + sender.sendLink(" ", locale.getString(CommandLang.LINK_CLICK_ME), url); } - sender.sendMessage(Locale.get(Msg.CMD_CONSTANT_FOOTER).toString()); + sender.sendMessage(">"); } } \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/ListServersCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/ListServersCommand.java index af56e3564..65c4bf3a1 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/ListServersCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/ListServersCommand.java @@ -4,9 +4,11 @@ import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.api.exceptions.database.DBOpException; import com.djrapitops.plan.system.database.databases.Database; import com.djrapitops.plan.system.info.server.Server; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; @@ -23,27 +25,30 @@ import java.util.List; public class ListServersCommand extends CommandNode { private final PlanPlugin plugin; + private final Locale locale; public ListServersCommand(PlanPlugin plugin) { super("servers|serverlist|listservers|sl|ls", Permissions.MANAGE.getPermission(), CommandType.CONSOLE); - setShortHelp("List servers in the network"); - this.plugin = plugin; + + this.locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setShortHelp(locale.getString(CmdHelpLang.SERVERS)); + setInDepthHelp(locale.getArray(DeepHelpLang.SERVERS)); } @Override public void onCommand(ISender sender, String commandLabel, String[] args) { ColorScheme colorScheme = plugin.getColorScheme(); - String mCol = colorScheme.getMainColor(); String sCol = colorScheme.getSecondaryColor(); String tCol = colorScheme.getTertiaryColor(); try { - sender.sendMessage(Locale.get(Msg.CMD_CONSTANT_FOOTER).toString() + mCol + " Servers"); + sender.sendMessage(locale.getString(CommandLang.HEADER_SERVERS)); List servers = Database.getActive().fetch().getServers(); for (Server server : servers) { sender.sendMessage(" " + tCol + server.getId() + sCol + " : " + server.getName() + " : " + server.getWebAddress()); } - sender.sendMessage(Locale.get(Msg.CMD_CONSTANT_FOOTER).toString()); + sender.sendMessage(">"); } catch (DBOpException e) { sender.sendMessage("§cDatabase Exception occurred."); Log.toLog(this.getClass(), e); diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/ManageCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/ManageCommand.java index 8db09c39c..689771cc4 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/ManageCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/ManageCommand.java @@ -2,9 +2,10 @@ package com.djrapitops.plan.command.commands; import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.command.commands.manage.*; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.TreeCmdNode; @@ -19,23 +20,26 @@ public class ManageCommand extends TreeCmdNode { public ManageCommand(PlanPlugin plugin, CommandNode parent) { super("manage|m", Permissions.MANAGE.getPermission(), CommandType.CONSOLE, parent); - setShortHelp(Locale.get(Msg.CMD_USG_MANAGE).toString()); - setInDepthHelp(Locale.get(Msg.CMD_HELP_MANAGE).toArray()); + + Locale locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setShortHelp(locale.getString(CmdHelpLang.MANAGE)); + setInDepthHelp(locale.getArray(DeepHelpLang.MANAGE)); super.setColorScheme(plugin.getColorScheme()); setNodeGroups( new CommandNode[]{ - new ManageMoveCommand(), - new ManageBackupCommand(), + new ManageMoveCommand(plugin), + new ManageBackupCommand(plugin), new ManageRestoreCommand(plugin), - new ManageRemoveCommand(), + new ManageRemoveCommand(plugin), new ManageHotSwapCommand(plugin), - new ManageClearCommand(), + new ManageClearCommand(plugin), }, new CommandNode[]{ - new ManageSetupCommand(), - new ManageConDebugCommand(), - new ManageImportCommand(), - new ManageDisableCommand() + new ManageSetupCommand(plugin), + new ManageConDebugCommand(plugin), + new ManageImportCommand(plugin), + new ManageDisableCommand(plugin) } ); } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/NetworkCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/NetworkCommand.java index 3b4b89725..85f165364 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/NetworkCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/NetworkCommand.java @@ -1,9 +1,12 @@ package com.djrapitops.plan.command.commands; +import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.system.info.connection.ConnectionSystem; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandUtils; @@ -16,9 +19,15 @@ import com.djrapitops.plugin.command.ISender; */ public class NetworkCommand extends CommandNode { - public NetworkCommand() { + private final Locale locale; + + public NetworkCommand(PlanPlugin plugin) { super("network|n|netw", Permissions.ANALYZE.getPermission(), CommandType.CONSOLE); - setShortHelp("View the network page"); + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setShortHelp(locale.getString(CmdHelpLang.NETWORK)); + setInDepthHelp(locale.getArray(DeepHelpLang.NETWORK)); } @Override @@ -27,18 +36,18 @@ public class NetworkCommand extends CommandNode { } private void sendNetworkMsg(ISender sender) { - sender.sendMessage(Locale.get(Msg.CMD_CONSTANT_FOOTER).parse()); + sender.sendMessage(locale.getString(CommandLang.HEADER_NETWORK)); // Link String url = ConnectionSystem.getAddress() + "/network/"; - String message = Locale.get(Msg.CMD_INFO_LINK).toString(); + String linkPrefix = locale.getString(CommandLang.LINK_PREFIX); boolean console = !CommandUtils.isPlayer(sender); if (console) { - sender.sendMessage(message + url); + sender.sendMessage(linkPrefix + url); } else { - sender.sendMessage(message); - sender.sendLink(" ", Locale.get(Msg.CMD_INFO_CLICK_ME).toString(), url); + sender.sendMessage(linkPrefix); + sender.sendLink(" ", locale.getString(CommandLang.LINK_CLICK_ME), url); } - sender.sendMessage(Locale.get(Msg.CMD_CONSTANT_FOOTER).toString()); + sender.sendMessage(">"); } } \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/QInspectCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/QInspectCommand.java index a0bc82e40..fbf65b522 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/QInspectCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/QInspectCommand.java @@ -12,16 +12,18 @@ import com.djrapitops.plan.data.store.mutators.formatting.Formatter; import com.djrapitops.plan.data.store.mutators.formatting.Formatters; import com.djrapitops.plan.data.store.objects.DateHolder; import com.djrapitops.plan.system.database.databases.Database; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; +import com.djrapitops.plan.system.locale.lang.GenericLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plan.utilities.MiscUtils; import com.djrapitops.plan.utilities.uuid.UUIDUtility; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.ISender; -import com.djrapitops.plugin.settings.ColorScheme; import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.task.RunnableFactory; @@ -38,7 +40,7 @@ import java.util.UUID; */ public class QInspectCommand extends CommandNode { - private final PlanPlugin plugin; + private final Locale locale; /** * Class Constructor. @@ -48,16 +50,22 @@ public class QInspectCommand extends CommandNode { public QInspectCommand(PlanPlugin plugin) { super("qinspect", Permissions.QUICK_INSPECT.getPermission(), CommandType.PLAYER_OR_ARGS); setArguments(""); - setShortHelp(Locale.get(Msg.CMD_USG_QINSPECT).toString()); - setInDepthHelp(Locale.get(Msg.CMD_HELP_QINSPECT).toArray()); - this.plugin = plugin; + locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setShortHelp(locale.getString(CmdHelpLang.QINSPECT)); + setInDepthHelp(locale.getArray(DeepHelpLang.QINSPECT)); } @Override public void onCommand(ISender sender, String commandLabel, String[] args) { String playerName = MiscUtils.getPlayerName(args, sender, Permissions.QUICK_INSPECT_OTHER); + if (playerName == null) { + sender.sendMessage(locale.getString(CommandLang.FAIL_NO_PERMISSION)); + return; + } + runInspectTask(playerName, sender); } @@ -68,13 +76,13 @@ public class QInspectCommand extends CommandNode { try { UUID uuid = UUIDUtility.getUUIDOf(playerName); if (uuid == null) { - sender.sendMessage(Locale.get(Msg.CMD_FAIL_USERNAME_NOT_VALID).toString()); + sender.sendMessage(locale.getString(CommandLang.FAIL_USERNAME_NOT_VALID)); return; } PlayerContainer container = Database.getActive().fetch().getPlayerContainer(uuid); if (!container.getValue(PlayerKeys.REGISTERED).isPresent()) { - sender.sendMessage(Locale.get(Msg.CMD_FAIL_USERNAME_NOT_KNOWN).toString()); + sender.sendMessage(locale.getString(CommandLang.FAIL_USERNAME_NOT_KNOWN)); return; } @@ -96,36 +104,34 @@ public class QInspectCommand extends CommandNode { private void sendMessages(ISender sender, PlayerContainer player) { long now = System.currentTimeMillis(); - ColorScheme colorScheme = plugin.getColorScheme(); - - String colM = colorScheme.getMainColor(); - String colS = colorScheme.getSecondaryColor(); - String colT = colorScheme.getTertiaryColor(); Formatter timestamp = Formatters.year(); Formatter length = Formatters.timeAmount(); - sender.sendMessage(Locale.get(Msg.CMD_HEADER_INSPECT).toString() + ": " + colT + player.getValue(PlayerKeys.NAME).orElse("Unknown")); + String playerName = player.getValue(PlayerKeys.NAME).orElse(locale.getString(GenericLang.UNKNOWN)); ActivityIndex activityIndex = player.getActivityIndex(now); Long registered = player.getValue(PlayerKeys.REGISTERED).orElse(0L); Long lastSeen = player.getValue(PlayerKeys.LAST_SEEN).orElse(0L); List geoInfo = player.getValue(PlayerKeys.GEO_INFO).orElse(new ArrayList<>()); Optional mostRecentGeoInfo = new GeoInfoMutator(geoInfo).mostRecent(); - String loginLocation = mostRecentGeoInfo.isPresent() ? mostRecentGeoInfo.get().getGeolocation() : "-"; + String geolocation = mostRecentGeoInfo.isPresent() ? mostRecentGeoInfo.get().getGeolocation() : "-"; SessionsMutator sessionsMutator = SessionsMutator.forContainer(player); - sender.sendMessage(colM + " Activity Index: " + colS + activityIndex.getFormattedValue() + " | " + activityIndex.getGroup()); - sender.sendMessage(colM + " Registered: " + colS + timestamp.apply(() -> registered)); - sender.sendMessage(colM + " Last Seen: " + colS + timestamp.apply(() -> lastSeen)); - sender.sendMessage(colM + " Logged in from: " + colS + loginLocation); - sender.sendMessage(colM + " Playtime: " + colS + length.apply(sessionsMutator.toPlaytime())); - sender.sendMessage(colM + " Longest Session: " + colS + length.apply(sessionsMutator.toLongestSessionLength())); - sender.sendMessage(colM + " Times Kicked: " + colS + player.getValue(PlayerKeys.KICK_COUNT).orElse(0)); - sender.sendMessage(""); - sender.sendMessage(colM + " Player Kills : " + colS + sessionsMutator.toPlayerKillCount()); - sender.sendMessage(colM + " Mob Kills : " + colS + sessionsMutator.toMobKillCount()); - sender.sendMessage(colM + " Deaths : " + colS + sessionsMutator.toDeathCount()); - - sender.sendMessage(Locale.get(Msg.CMD_CONSTANT_FOOTER).toString()); + String[] messages = new String[]{ + locale.getString(CommandLang.HEADER_INSPECT, playerName), + locale.getString(CommandLang.QINSPECT_ACTIVITY_INDEX, activityIndex.getFormattedValue(), activityIndex.getGroup()), + locale.getString(CommandLang.QINSPECT_REGISTERED, timestamp.apply(() -> registered)), + locale.getString(CommandLang.QINSPECT_LAST_SEEN, timestamp.apply(() -> lastSeen)), + locale.getString(CommandLang.QINSPECT_GEOLOCATION, geolocation), + locale.getString(CommandLang.QINSPECT_PLAYTIME, length.apply(sessionsMutator.toPlaytime())), + locale.getString(CommandLang.QINSPECT_LONGEST_SESSION, length.apply(sessionsMutator.toLongestSessionLength())), + locale.getString(CommandLang.QINSPECT_TIMES_KICKED, player.getValue(PlayerKeys.KICK_COUNT).orElse(0)), + "", + locale.getString(CommandLang.QINSPECT_PLAYER_KILLS, sessionsMutator.toPlayerKillCount()), + locale.getString(CommandLang.QINSPECT_MOB_KILLS, sessionsMutator.toMobKillCount()), + locale.getString(CommandLang.QINSPECT_DEATHS, sessionsMutator.toDeathCount()), + ">" + }; + sender.sendMessage(messages); } } \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/RegisterCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/RegisterCommand.java index 52d597fd0..133c5d583 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/RegisterCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/RegisterCommand.java @@ -1,10 +1,13 @@ package com.djrapitops.plan.command.commands; +import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.data.WebUser; import com.djrapitops.plan.system.database.databases.Database; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plan.utilities.PassEncryptUtil; import com.djrapitops.plugin.api.Check; import com.djrapitops.plugin.api.utility.log.Log; @@ -33,18 +36,22 @@ public class RegisterCommand extends CommandNode { private final String notEnoughArgsMsg; private final String hashErrorMsg; + private final Locale locale; - public RegisterCommand() { + public RegisterCommand(PlanPlugin plugin) { // No Permission Requirement super("register", "", CommandType.PLAYER_OR_ARGS); - setShortHelp(Locale.get(Msg.CMD_USG_WEB_REGISTER).toString()); + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + setArguments("", "[name]", "[lvl]"); - setInDepthHelp(Locale.get(Msg.CMD_HELP_WEB_REGISTER).toArray()); + setShortHelp(locale.getString(CmdHelpLang.WEB_REGISTER)); + setInDepthHelp(locale.getArray(DeepHelpLang.WEB_REGISTER)); if (Check.isBukkitAvailable()) { setupFilter(); } - notEnoughArgsMsg = Locale.get(Msg.CMD_FAIL_REQ_ARGS).parse("(3) " + Arrays.toString(getArguments())); + notEnoughArgsMsg = locale.getString(CommandLang.FAIL_REQ_ARGS, 3, Arrays.toString(getArguments())); hashErrorMsg = "§cPassword hash error."; } @@ -52,7 +59,6 @@ public class RegisterCommand extends CommandNode { public void onCommand(ISender sender, String commandLabel, String[] args) { try { if (CommandUtils.isPlayer(sender)) { - Log.info(sender.getName() + " issued WebUser register command."); playerRegister(args, sender); } else { consoleRegister(args, sender, notEnoughArgsMsg); @@ -86,7 +92,7 @@ public class RegisterCommand extends CommandNode { } else if (sender.hasPermission(Permissions.MANAGE_WEB.getPermission())) { consoleRegister(args, sender, notEnoughArgsMsg); } else { - sender.sendMessage(Locale.get(Msg.CMD_FAIL_NO_PERMISSION).parse()); + sender.sendMessage(locale.getString(CommandLang.FAIL_NO_PERMISSION)); } } @@ -110,9 +116,9 @@ public class RegisterCommand extends CommandNode { RunnableFactory.createNew(new AbsRunnable("Register WebUser Task") { @Override public void run() { - final String existsMsg = "§cUser Already Exists!"; + final String existsMsg = locale.getString(CommandLang.FAIL_WEB_USER_EXISTS); final String userName = webUser.getName(); - final String successMsg = "§aAdded a new user (" + userName + ") successfully!"; + final String successMsg = locale.getString(CommandLang.WEB_USER_REGISTER_SUCCESS); try { Database database = Database.getActive(); boolean userExists = database.check().doesWebUserExists(userName); @@ -122,7 +128,7 @@ public class RegisterCommand extends CommandNode { } database.save().webUser(webUser); sender.sendMessage(successMsg); - Log.info("Registered new user: " + userName + " Perm level: " + webUser.getPermLevel()); + Log.info(locale.getString(CommandLang.WEB_USER_REGISTER_NOTIFY, userName, webUser.getPermLevel())); } catch (Exception e) { Log.toLog(this.getClass(), e); } finally { diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/ReloadCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/ReloadCommand.java index 17bacbdd4..d44233459 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/ReloadCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/ReloadCommand.java @@ -1,9 +1,11 @@ package com.djrapitops.plan.command.commands; import com.djrapitops.plan.PlanPlugin; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; @@ -18,11 +20,16 @@ import com.djrapitops.plugin.command.ISender; public class ReloadCommand extends CommandNode { private final PlanPlugin plugin; + private final Locale locale; public ReloadCommand(PlanPlugin plugin) { - super("reload", Permissions.MANAGE.getPermission(), CommandType.CONSOLE); - setShortHelp(Locale.get(Msg.CMD_USG_RELOAD).toString()); + super("reload", Permissions.RELOAD.getPermission(), CommandType.CONSOLE); this.plugin = plugin; + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setShortHelp(locale.getString(CmdHelpLang.RELOAD)); + setInDepthHelp(locale.getArray(DeepHelpLang.RELOAD)); } @Override @@ -31,8 +38,8 @@ public class ReloadCommand extends CommandNode { plugin.reloadPlugin(true); } catch (Exception e) { Log.toLog(this.getClass(), e); - sender.sendMessage("§cSomething went wrong during reload of the plugin, a restart is recommended."); + sender.sendMessage(locale.getString(CommandLang.RELOAD_FAILED)); } - sender.sendMessage(Locale.get(Msg.CMD_INFO_RELOAD_COMPLETE).toString()); + sender.sendMessage(locale.getString(CommandLang.RELOAD_COMPLETE)); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/SearchCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/SearchCommand.java index f8ee36c69..5a0e33173 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/SearchCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/SearchCommand.java @@ -1,9 +1,13 @@ package com.djrapitops.plan.command.commands; +import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.api.exceptions.database.DBOpException; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; +import com.djrapitops.plan.system.locale.lang.ManageLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plan.utilities.MiscUtils; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.command.CommandNode; @@ -25,18 +29,24 @@ import java.util.List; */ public class SearchCommand extends CommandNode { - public SearchCommand() { + private final Locale locale; + + public SearchCommand(PlanPlugin plugin) { super("search", Permissions.SEARCH.getPermission(), CommandType.PLAYER_OR_ARGS); - setShortHelp(Locale.get(Msg.CMD_USG_SEARCH).toString()); + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + setArguments(""); - setInDepthHelp(Locale.get(Msg.CMD_HELP_SEARCH).toArray()); + setShortHelp(locale.getString(CmdHelpLang.SEARCH)); + setInDepthHelp(locale.getArray(DeepHelpLang.SEARCH)); } @Override public void onCommand(ISender sender, String commandLabel, String[] args) { - Verify.isTrue(args.length >= 1, () -> new IllegalArgumentException(Locale.get(Msg.CMD_FAIL_REQ_ONE_ARG).toString())); + Verify.isTrue(args.length >= 1, + () -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_REQ_ONE_ARG, Arrays.toString(this.getArguments())))); - sender.sendMessage(Locale.get(Msg.CMD_INFO_SEARCHING).toString()); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_START)); runSearchTask(args, sender); } @@ -46,19 +56,18 @@ public class SearchCommand extends CommandNode { @Override public void run() { try { - List names = MiscUtils.getMatchingPlayerNames(args[0]); + String searchTerm = args[0]; + List names = MiscUtils.getMatchingPlayerNames(searchTerm); boolean empty = Verify.isEmpty(names); - sender.sendMessage(Locale.get(Msg.CMD_HEADER_SEARCH) + args[0] + " (" + (empty ? 0 : names.size()) + ")"); + sender.sendMessage(locale.getString(CommandLang.HEADER_SEARCH, empty ? 0 : names.size(), searchTerm)); // Results - if (empty) { - sender.sendMessage(Locale.get(Msg.CMD_INFO_NO_RESULTS).parse(Arrays.toString(args))); - } else { - sender.sendMessage(Locale.get(Msg.CMD_INFO_RESULTS).toString() + FormatUtils.collectionToStringNoBrackets(names)); + if (!empty) { + sender.sendMessage(FormatUtils.collectionToStringNoBrackets(names)); } - sender.sendMessage(Locale.get(Msg.CMD_CONSTANT_FOOTER).toString()); + sender.sendMessage(">"); } catch (DBOpException e) { sender.sendMessage("§cDatabase error occurred: " + e.getMessage()); Log.toLog(this.getClass(), e); diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/UpdateCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/UpdateCommand.java index c8a499f0a..7e34f18aa 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/UpdateCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/UpdateCommand.java @@ -1,5 +1,6 @@ package com.djrapitops.plan.command.commands; +import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.api.exceptions.connection.*; import com.djrapitops.plan.api.exceptions.database.DBOpException; import com.djrapitops.plan.command.commands.manage.ManageConDebugCommand; @@ -9,9 +10,12 @@ import com.djrapitops.plan.system.info.InfoSystem; import com.djrapitops.plan.system.info.request.UpdateCancelRequest; import com.djrapitops.plan.system.info.request.UpdateRequest; import com.djrapitops.plan.system.info.server.Server; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; +import com.djrapitops.plan.system.locale.lang.PluginLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plan.system.update.VersionCheckSystem; import com.djrapitops.plan.system.update.VersionInfo; import com.djrapitops.plan.system.webserver.WebServerSystem; @@ -35,23 +39,22 @@ import java.util.UUID; */ public class UpdateCommand extends CommandNode { - public UpdateCommand() { + private final Locale locale; + + public UpdateCommand(PlanPlugin plugin) { super("update", Permissions.MANAGE.getPermission(), CommandType.ALL); + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + setArguments("[-u]/[cancel]"); - setShortHelp("Get change log link or update plugin."); - setInDepthHelp( - "/plan update", - " Used to update the plugin on the next shutdown\n", - " /plan update - get change log link", - " /plan update -u - Schedule update to happen on all network servers that are online next time they reboot.", - " /plan update cancel - Cancel scheduled update on servers that haven't rebooted yet." - ); + setShortHelp(locale.getString(CmdHelpLang.UPDATE)); + setInDepthHelp(locale.getArray(DeepHelpLang.UPDATE)); } @Override public void onCommand(ISender sender, String commandLabel, String[] args) { if (!VersionCheckSystem.isNewVersionAvailable()) { - sender.sendMessage("§aYou're running the latest version of Plan."); + sender.sendMessage("§a" + locale.getString(PluginLang.VERSION_NEWEST)); return; } @@ -59,21 +62,19 @@ public class UpdateCommand extends CommandNode { String downloadUrl = available.getDownloadUrl(); if (!available.isTrusted()) { - sender.sendMessage("§cVersion download url did not start with " + - "https://github.com/Rsl1122/Plan-PlayerAnalytics/releases/ " + - "and might not be trusted. You can download this version manually here (Direct download):"); + sender.sendMessage(locale.getString(CommandLang.UPDATE_WRONG_URL, "https://github.com/Rsl1122/Plan-PlayerAnalytics/releases/")); sender.sendLink(downloadUrl, downloadUrl); return; } if (args.length == 0) { - String message = "Change Log v" + available.getVersion().toString() + ": "; + String message = locale.getString(CommandLang.UPDATE_CHANGE_LOG, available.getVersion().toString()); String url = available.getChangeLogUrl(); if (CommandUtils.isConsole(sender)) { sender.sendMessage(message + url); } else { sender.sendMessage(message); - sender.sendLink(" ", Locale.get(Msg.CMD_INFO_CLICK_ME).toString(), url); + sender.sendLink(" ", locale.getString(CommandLang.LINK_CLICK_ME), url); } return; } @@ -100,7 +101,7 @@ public class UpdateCommand extends CommandNode { private void handleCancel(ISender sender) { try { cancel(sender, Database.getActive().fetch().getServers()); - sender.sendMessage("§aCancel operation performed."); + sender.sendMessage(locale.getString(CommandLang.UPDATE_CANCEL_SUCCESS)); } catch (DBOpException e) { sender.sendMessage("§cDatabase error occurred, cancel could not be performed."); Log.toLog(this.getClass().getName(), e); @@ -108,10 +109,10 @@ public class UpdateCommand extends CommandNode { } private void handleUpdate(ISender sender, String[] args) { - sender.sendMessage("§aYou can cancel the update on servers that haven't rebooted yet with /plan update cancel."); - sender.sendMessage("Checking that all servers are online.."); + sender.sendMessage(locale.getString(CommandLang.UPDATE_NOTIFY_CANCEL)); + sender.sendMessage(locale.getString(CommandLang.UPDATE_ONLINE_CHECK)); if (!checkNetworkStatus(sender)) { - sender.sendMessage("§cNot all servers were online or accessible, you can still update available servers using /plan -update -force"); + sender.sendMessage(locale.getString(CommandLang.UPDATE_FAIL_NOT_ONLINE)); // If -force, continue, otherwise return. if (args.length < 2 || !"-force".equals(args[1])) { return; @@ -128,15 +129,15 @@ public class UpdateCommand extends CommandNode { private void update(ISender sender, List servers, String[] args) { for (Server server : servers) { if (update(sender, server)) { - sender.sendMessage("§a" + server.getName() + " scheduled for update."); + sender.sendMessage(locale.getString(CommandLang.UPDATE_SCHEDULED, server.getName())); } else { if (args.length > 1 && "-force".equals(args[1])) { - sender.sendMessage("§e" + server.getName() + " failed to update, -force specified, continuing update."); + sender.sendMessage(locale.getString(CommandLang.UPDATE_FAIL_FORCED)); continue; } - sender.sendMessage("§cUpdate failed on a server, cancelling update on all servers.."); + sender.sendMessage(locale.getString(CommandLang.UPDATE_FAIL_CANCEL)); cancel(sender, servers); - sender.sendMessage("§cUpdate cancelled."); + sender.sendMessage(locale.getString(CommandLang.UPDATE_CANCELLED)); break; } } @@ -146,7 +147,6 @@ public class UpdateCommand extends CommandNode { for (Server server : servers) { cancel(sender, server); } - } private void cancel(ISender sender, Server server) { @@ -219,12 +219,12 @@ public class UpdateCommand extends CommandNode { String accessAddress = WebServerSystem.getInstance().getWebServer().getAccessAddress(); boolean success = true; for (Server server : bukkitServers.values()) { - if (!ManageConDebugCommand.testServer(sender, accessAddress, server)) { + if (!ManageConDebugCommand.testServer(sender, accessAddress, server, locale)) { success = false; } } Server bungee = bungeeInformation.get(); - if (!ManageConDebugCommand.testServer(sender, accessAddress, bungee)) { + if (!ManageConDebugCommand.testServer(sender, accessAddress, bungee, locale)) { success = false; } return success; diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/WebUserCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/WebUserCommand.java index 7a18cfcdc..dda251209 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/WebUserCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/WebUserCommand.java @@ -5,9 +5,10 @@ import com.djrapitops.plan.command.commands.webuser.WebCheckCommand; import com.djrapitops.plan.command.commands.webuser.WebDeleteCommand; import com.djrapitops.plan.command.commands.webuser.WebLevelCommand; import com.djrapitops.plan.command.commands.webuser.WebListUsersCommand; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.TreeCmdNode; @@ -22,16 +23,19 @@ public class WebUserCommand extends TreeCmdNode { public WebUserCommand(PlanPlugin plugin, RegisterCommand register, CommandNode parent) { super("webuser|web", Permissions.MANAGE_WEB.getPerm(), CommandType.CONSOLE, parent); - setShortHelp(Locale.get(Msg.CMD_USG_WEB).toString()); super.setColorScheme(plugin.getColorScheme()); - setInDepthHelp(Locale.get(Msg.CMD_HELP_WEB).toArray()); + + Locale locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setShortHelp(locale.getString(CmdHelpLang.WEB)); + setInDepthHelp(locale.getArray(DeepHelpLang.WEB)); setNodeGroups( new CommandNode[]{ register, new WebLevelCommand(plugin), new WebListUsersCommand(plugin), - new WebCheckCommand(), - new WebDeleteCommand() + new WebCheckCommand(plugin), + new WebDeleteCommand(plugin) } ); } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageBackupCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageBackupCommand.java index 93530dbf0..61c7cb34c 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageBackupCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageBackupCommand.java @@ -1,14 +1,18 @@ package com.djrapitops.plan.command.commands.manage; +import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.api.exceptions.database.DBException; import com.djrapitops.plan.api.exceptions.database.DBInitException; import com.djrapitops.plan.data.store.mutators.formatting.Formatters; import com.djrapitops.plan.system.database.DBSystem; import com.djrapitops.plan.system.database.databases.Database; import com.djrapitops.plan.system.database.databases.sql.SQLiteDB; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; +import com.djrapitops.plan.system.locale.lang.ManageLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; @@ -29,9 +33,15 @@ import java.util.UUID; */ public class ManageBackupCommand extends CommandNode { - public ManageBackupCommand() { + private final Locale locale; + + public ManageBackupCommand(PlanPlugin plugin) { super("backup", Permissions.MANAGE.getPermission(), CommandType.CONSOLE); - setShortHelp(Locale.get(Msg.CMD_USG_MANAGE_BACKUP).toString()); + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setShortHelp(locale.getString(CmdHelpLang.MANAGE_BACKUP)); + setInDepthHelp(locale.getArray(DeepHelpLang.MANAGE_BACKUP)); setArguments(""); } @@ -40,21 +50,19 @@ public class ManageBackupCommand extends CommandNode { public void onCommand(ISender sender, String commandLabel, String[] args) { try { Verify.isTrue(args.length >= 1, - () -> new IllegalArgumentException(Locale.get(Msg.CMD_FAIL_REQ_ARGS).parse(Arrays.toString(this.getArguments())))); + () -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_REQ_ONE_ARG, Arrays.toString(this.getArguments())))); String dbName = args[0].toLowerCase(); boolean isCorrectDB = Verify.equalsOne(dbName, "sqlite", "mysql"); Verify.isTrue(isCorrectDB, - () -> new IllegalArgumentException(Locale.get(Msg.MANAGE_FAIL_INCORRECT_DB) + dbName)); + () -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_INCORRECT_DB, dbName))); Database database = DBSystem.getActiveDatabaseByName(dbName); - Verify.nullCheck(database, NullPointerException::new); - runBackupTask(sender, args, database); - } catch (DBInitException | NullPointerException e) { - sender.sendMessage(Locale.get(Msg.MANAGE_FAIL_FAULTY_DB).toString()); + } catch (DBInitException e) { + sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); } } @@ -64,12 +72,12 @@ public class ManageBackupCommand extends CommandNode { public void run() { try { Log.debug("Backup", "Start"); - sender.sendMessage(Locale.get(Msg.MANAGE_INFO_START).parse()); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_START)); createNewBackup(args[0], database); - sender.sendMessage(Locale.get(Msg.MANAGE_INFO_COPY_SUCCESS).toString()); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS)); } catch (Exception e) { Log.toLog(ManageBackupCommand.class, e); - sender.sendMessage(Locale.get(Msg.MANAGE_INFO_FAIL).toString()); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); } finally { Log.logDebug("Backup"); this.cancel(); @@ -89,7 +97,7 @@ public class ManageBackupCommand extends CommandNode { try { String timeStamp = Formatters.iso8601NoClock().apply(System::currentTimeMillis); String fileName = dbName + "-backup-" + timeStamp; - backupDB = new SQLiteDB(fileName); + backupDB = new SQLiteDB(fileName, () -> locale); Collection uuids = copyFromDB.fetch().getSavedUUIDs(); if (uuids.isEmpty()) { return; diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageClearCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageClearCommand.java index 197064c6f..3da5ee20b 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageClearCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageClearCommand.java @@ -1,12 +1,16 @@ package com.djrapitops.plan.command.commands.manage; +import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.api.exceptions.database.DBInitException; import com.djrapitops.plan.api.exceptions.database.DBOpException; import com.djrapitops.plan.system.database.DBSystem; import com.djrapitops.plan.system.database.databases.Database; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; +import com.djrapitops.plan.system.locale.lang.ManageLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; @@ -15,6 +19,8 @@ import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.task.RunnableFactory; import com.djrapitops.plugin.utilities.Verify; +import java.util.Arrays; + /** * This manage SubCommand is used to clear a database of all data. * @@ -23,27 +29,31 @@ import com.djrapitops.plugin.utilities.Verify; */ public class ManageClearCommand extends CommandNode { - public ManageClearCommand() { - super("clear", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS); - setShortHelp(Locale.get(Msg.CMD_USG_MANAGE_CLEAR).toString()); - setArguments("", "[-a]"); - setInDepthHelp(Locale.get(Msg.CMD_HELP_MANAGE_CLEAR).toArray()); + private final Locale locale; + public ManageClearCommand(PlanPlugin plugin) { + super("clear", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS); + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setArguments("", "[-a]"); + setShortHelp(locale.getString(CmdHelpLang.MANAGE_CLEAR)); + setInDepthHelp(locale.getArray(DeepHelpLang.MANAGE_CLEAR)); } @Override public void onCommand(ISender sender, String commandLabel, String[] args) { Verify.isTrue(args.length >= 1, - () -> new IllegalArgumentException(Locale.get(Msg.CMD_FAIL_REQ_ONE_ARG).toString())); + () -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_REQ_ONE_ARG, Arrays.toString(this.getArguments())))); String dbName = args[0].toLowerCase(); boolean isCorrectDB = "sqlite".equals(dbName) || "mysql".equals(dbName); Verify.isTrue(isCorrectDB, - () -> new IllegalArgumentException(Locale.get(Msg.MANAGE_FAIL_INCORRECT_DB) + dbName)); + () -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_INCORRECT_DB, dbName))); if (!Verify.contains("-a", args)) { - sender.sendMessage(Locale.get(Msg.MANAGE_FAIL_CONFIRM).parse(Locale.get(Msg.MANAGE_NOTIFY_REMOVE).parse(args[0]))); + sender.sendMessage(locale.getString(ManageLang.CONFIRMATION, locale.getString(ManageLang.CONFIRM_REMOVAL, dbName))); return; } @@ -51,7 +61,7 @@ public class ManageClearCommand extends CommandNode { Database database = DBSystem.getActiveDatabaseByName(dbName); runClearTask(sender, database); } catch (DBInitException e) { - sender.sendMessage(Locale.get(Msg.MANAGE_FAIL_FAULTY_DB).toString()); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); } } @@ -60,18 +70,13 @@ public class ManageClearCommand extends CommandNode { @Override public void run() { try { - sender.sendMessage(Locale.get(Msg.MANAGE_INFO_START).parse()); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_START)); database.remove().everything(); - sender.sendMessage(Locale.get(Msg.MANAGE_INFO_CLEAR_SUCCESS).toString()); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS)); } catch (DBOpException e) { - if (e.isFatal()) { - sender.sendMessage(Locale.get(Msg.MANAGE_INFO_FAIL).toString() - + " Error was fatal, so all information may not have been removed."); - } else { - sender.sendMessage(Locale.get(Msg.MANAGE_INFO_FAIL).toString()); - } + sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); Log.toLog(this.getClass(), e); } finally { this.cancel(); diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageConDebugCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageConDebugCommand.java index 2c95c27e2..8c1f163cd 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageConDebugCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageConDebugCommand.java @@ -7,9 +7,15 @@ import com.djrapitops.plan.system.info.InfoSystem; import com.djrapitops.plan.system.info.request.CheckConnectionRequest; import com.djrapitops.plan.system.info.server.Server; import com.djrapitops.plan.system.info.server.ServerInfo; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; +import com.djrapitops.plan.system.locale.lang.ManageLang; import com.djrapitops.plan.system.processing.Processing; import com.djrapitops.plan.system.settings.Permissions; import com.djrapitops.plan.system.webserver.WebServerSystem; +import com.djrapitops.plugin.api.Check; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.ISender; @@ -26,39 +32,18 @@ import java.util.UUID; */ public class ManageConDebugCommand extends CommandNode { - public ManageConDebugCommand() { + private final Locale locale; + + public ManageConDebugCommand(PlanPlugin plugin) { super("con", Permissions.MANAGE.getPermission(), CommandType.ALL); - setShortHelp("Debug Bukkit-Bungee Connections"); + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setShortHelp(locale.getString(Check.isBungeeAvailable() ? CmdHelpLang.CON : CmdHelpLang.MANAGE_CON)); + setInDepthHelp(locale.getArray(DeepHelpLang.MANAGE_CON)); } - @Override - public void onCommand(ISender sender, String commandLabel, String[] args) { - if (!WebServerSystem.isWebServerEnabled()) { - sender.sendMessage("§cWebServer is not enabled on this server."); - return; - } - - Processing.submitNonCritical(() -> testServers(sender)); - } - - private void testServers(ISender sender) { - List servers = Database.getActive().fetch().getServers(); - - if (servers.isEmpty()) { - sender.sendMessage("§cNo Servers found in the database."); - } - - String accessAddress = WebServerSystem.getInstance().getWebServer().getAccessAddress(); - UUID thisServer = ServerInfo.getServerUUID(); - for (Server server : servers) { - if (thisServer.equals(server.getUuid())) { - continue; - } - testServer(sender, accessAddress, server); - } - } - - public static boolean testServer(ISender sender, String accessAddress, Server server) { + public static boolean testServer(ISender sender, String accessAddress, Server server, Locale locale) { String address = server.getWebAddress().toLowerCase(); boolean usingHttps = address.startsWith("https"); boolean local = address.contains("localhost") @@ -74,28 +59,55 @@ public class ManageConDebugCommand extends CommandNode { } catch (ForbiddenException | BadRequestException | InternalErrorException e) { sender.sendMessage(getMsgFor(address, usingHttps, local, false, false)); - sender.sendMessage("§eOdd Exception: " + e.getClass().getSimpleName()); + sender.sendMessage(locale.getString(ManageLang.CON_EXCEPTION, e.getClass().getSimpleName())); } catch (UnauthorizedServerException e) { sender.sendMessage(getMsgFor(address, usingHttps, local, true, false)); - sender.sendMessage("§eFail reason: Unauthorized. Server might be using different database."); + sender.sendMessage(locale.getString(ManageLang.CON_UNAUTHORIZED)); } catch (ConnectionFailException e) { sender.sendMessage(getMsgFor(address, usingHttps, local, false, false)); - sender.sendMessage("§eFail reason: " + e.getCause().getClass().getSimpleName() + " " + e.getCause().getMessage()); + sender.sendMessage(locale.getString(ManageLang.CON_GENERIC_FAIL) + e.getCause().getClass().getSimpleName() + " " + e.getCause().getMessage()); if (!local) { - sender.sendMessage("§eNon-local address, check that port is open"); + sender.sendMessage(locale.getString(ManageLang.CON_EXTERNAL_URL)); } } catch (GatewayException e) { sender.sendMessage(getMsgFor(address, usingHttps, local, true, false)); } catch (NotFoundException e) { sender.sendMessage(getMsgFor(address, usingHttps, local, false, false)); - sender.sendMessage("§eFail reason: Older Plan version on receiving server"); + sender.sendMessage(locale.getString(ManageLang.CON_OLD_VERSION)); } catch (WebException e) { sender.sendMessage(getMsgFor(address, usingHttps, local, false, false)); - sender.sendMessage("§eOdd Exception: " + e.getClass().getSimpleName()); + sender.sendMessage(locale.getString(ManageLang.CON_EXCEPTION, e.getClass().getSimpleName())); } return false; } + @Override + public void onCommand(ISender sender, String commandLabel, String[] args) { + if (!WebServerSystem.isWebServerEnabled()) { + sender.sendMessage(locale.getString(CommandLang.CONNECT_WEBSERVER_NOT_ENABLED)); + return; + } + + Processing.submitNonCritical(() -> testServers(sender)); + } + + private void testServers(ISender sender) { + List servers = Database.getActive().fetch().getServers(); + + if (servers.isEmpty()) { + sender.sendMessage(locale.getString(ManageLang.CON_NO_SERVERS)); + } + + String accessAddress = WebServerSystem.getInstance().getWebServer().getAccessAddress(); + UUID thisServer = ServerInfo.getServerUUID(); + for (Server server : servers) { + if (thisServer.equals(server.getUuid())) { + continue; + } + testServer(sender, accessAddress, server, locale); + } + } + private static String getMsgFor(String address, boolean usingHttps, boolean local, boolean successTo, boolean successFrom) { ColorScheme cs = PlanPlugin.getInstance().getColorScheme(); String tCol = cs.getTertiaryColor(); diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageDisableCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageDisableCommand.java index 0435514de..30725c900 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageDisableCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageDisableCommand.java @@ -1,9 +1,12 @@ package com.djrapitops.plan.command.commands.manage; +import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.system.listeners.bukkit.PlayerOnlineListener; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.ISender; @@ -18,27 +21,31 @@ import java.util.Arrays; * @since 4.0.4 */ public class ManageDisableCommand extends CommandNode { - /** - * Class Constructor. - */ - public ManageDisableCommand() { + + private final Locale locale; + + public ManageDisableCommand(PlanPlugin plugin) { super("disable", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS); - setShortHelp("Disable a feature temporarily"); + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + setArguments(""); + setShortHelp(locale.getString(CmdHelpLang.MANAGE_DISABLE)); + setInDepthHelp(locale.getArray(DeepHelpLang.MANAGE_DISABLE)); } @Override public void onCommand(ISender sender, String commandLabel, String[] args) { Verify.isTrue(args.length >= 1, - () -> new IllegalArgumentException(Locale.get(Msg.CMD_FAIL_REQ_ARGS).parse(Arrays.toString(this.getArguments())))); + () -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_REQ_ONE_ARG, Arrays.toString(this.getArguments())))); switch (args[0].toLowerCase()) { case "kickcount": PlayerOnlineListener.setCountKicks(false); - sender.sendMessage("§aDisabled Kick Counting temporarily until next plugin reload."); + sender.sendMessage(locale.getString(CommandLang.FEATURE_DISABLED, "Kick Counting")); break; default: - sender.sendMessage("§eDefine a feature to disable! (currently supports only kickCount)"); + sender.sendMessage(locale.getString(CommandLang.FAIL_NO_SUCH_FEATURE, "'kickcount'")); } } } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageHotSwapCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageHotSwapCommand.java index 5f071aa3d..d8194edce 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageHotSwapCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageHotSwapCommand.java @@ -3,16 +3,20 @@ package com.djrapitops.plan.command.commands.manage; import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.system.database.DBSystem; import com.djrapitops.plan.system.database.databases.Database; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.ManageLang; import com.djrapitops.plan.system.settings.Permissions; import com.djrapitops.plan.system.settings.Settings; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.ISender; import com.djrapitops.plugin.utilities.Verify; +import java.util.Arrays; + /** * This manage SubCommand is used to swap to a different database and reload the * plugin if the connection to the new database can be established. @@ -23,44 +27,41 @@ import com.djrapitops.plugin.utilities.Verify; public class ManageHotSwapCommand extends CommandNode { private final PlanPlugin plugin; + private final Locale locale; public ManageHotSwapCommand(PlanPlugin plugin) { super("hotswap", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS); - setShortHelp(Locale.get(Msg.CMD_USG_MANAGE_HOTSWAP).toString()); - setArguments(""); - setInDepthHelp(Locale.get(Msg.CMD_HELP_MANAGE_HOTSWAP).toArray()); this.plugin = plugin; + locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setArguments(""); + setShortHelp(locale.getString(CmdHelpLang.MANAGE_HOTSWAP)); } @Override public void onCommand(ISender sender, String commandLabel, String[] args) { Verify.isTrue(args.length >= 1, - () -> new IllegalArgumentException(Locale.get(Msg.CMD_FAIL_REQ_ONE_ARG).toString())); + () -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_REQ_ONE_ARG, Arrays.toString(this.getArguments())))); String dbName = args[0].toLowerCase(); boolean isCorrectDB = Verify.equalsOne(dbName, "sqlite", "mysql"); Verify.isTrue(isCorrectDB, - () -> new IllegalArgumentException(Locale.get(Msg.MANAGE_FAIL_INCORRECT_DB) + dbName)); + () -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_INCORRECT_DB, dbName))); Verify.isFalse(dbName.equals(Database.getActive().getConfigName()), - () -> new IllegalArgumentException(Locale.get(Msg.MANAGE_FAIL_SAME_DB).toString())); + () -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_SAME_DB))); try { - final Database database = DBSystem.getActiveDatabaseByName(dbName); - - Verify.nullCheck(database, NullPointerException::new); + Database database = DBSystem.getActiveDatabaseByName(dbName); if (!database.isOpen()) { return; } - } catch (NullPointerException e) { - sender.sendMessage(Locale.get(Msg.MANAGE_FAIL_FAULTY_DB).toString()); - return; } catch (Exception e) { Log.toLog(this.getClass(), e); - sender.sendMessage(Locale.get(Msg.MANAGE_FAIL_FAULTY_DB).toString()); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); return; } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageImportCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageImportCommand.java index d4aa79a3c..86dcfd8e8 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageImportCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageImportCommand.java @@ -1,10 +1,14 @@ package com.djrapitops.plan.command.commands.manage; +import com.djrapitops.plan.PlanPlugin; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; +import com.djrapitops.plan.system.locale.lang.ManageLang; import com.djrapitops.plan.system.processing.importing.ImporterManager; import com.djrapitops.plan.system.processing.importing.importers.Importer; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.ISender; @@ -22,22 +26,27 @@ import java.util.Arrays; */ public class ManageImportCommand extends CommandNode { - public ManageImportCommand() { + private final Locale locale; + + public ManageImportCommand(PlanPlugin plugin) { super("import", Permissions.MANAGE.getPermission(), CommandType.CONSOLE); - setShortHelp(Locale.get(Msg.CMD_USG_MANAGE_IMPORT).toString()); + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + setArguments("/list", "[import args]"); - setInDepthHelp(Locale.get(Msg.CMD_HELP_MANAGE_IMPORT).toArray()); + setShortHelp(locale.getString(CmdHelpLang.MANAGE_IMPORT)); + setInDepthHelp(locale.getArray(DeepHelpLang.MANAGE_IMPORT)); } @Override public void onCommand(ISender sender, String commandLabel, String[] args) { Verify.isTrue(args.length >= 1, - () -> new IllegalArgumentException(Locale.get(Msg.CMD_FAIL_REQ_ARGS).parse(Arrays.toString(this.getArguments())))); + () -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_REQ_ARGS, "1+", Arrays.toString(this.getArguments())))); String importArg = args[0]; if (importArg.equals("list")) { - sender.sendMessage("Importers: "); + sender.sendMessage(locale.getString(ManageLang.IMPORTERS)); ImporterManager.getImporters().stream() .map(Importer::getNames) .map(list -> list.get(0)) @@ -47,7 +56,7 @@ public class ManageImportCommand extends CommandNode { Importer importer = ImporterManager.getImporter(importArg); if (importer == null) { - sender.sendMessage("§eImporter '" + importArg + "' doesn't exist"); + sender.sendMessage(locale.getString(ManageLang.FAIL_IMPORTER_NOT_FOUND, importArg)); return; } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageMoveCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageMoveCommand.java index 0e0391196..4f8d59075 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageMoveCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageMoveCommand.java @@ -1,10 +1,14 @@ package com.djrapitops.plan.command.commands.manage; +import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.system.database.DBSystem; import com.djrapitops.plan.system.database.databases.Database; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; +import com.djrapitops.plan.system.locale.lang.ManageLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; @@ -25,32 +29,38 @@ import java.util.Arrays; */ public class ManageMoveCommand extends CommandNode { - public ManageMoveCommand() { + private final Locale locale; + + public ManageMoveCommand(PlanPlugin plugin) { super("move", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS); - setShortHelp(Locale.get(Msg.CMD_USG_MANAGE_MOVE).toString()); + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + setArguments("", "", "[-a]"); + setShortHelp(locale.getString(CmdHelpLang.MANAGE_MOVE)); + setInDepthHelp(locale.getArray(DeepHelpLang.MANAGE_MOVE)); } @Override public void onCommand(ISender sender, String commandLabel, String[] args) { Verify.isTrue(args.length >= 2, - () -> new IllegalArgumentException(Locale.get(Msg.CMD_FAIL_REQ_ARGS).parse(Arrays.toString(this.getArguments())))); + () -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_REQ_ARGS, 2, Arrays.toString(this.getArguments())))); String fromDB = args[0].toLowerCase(); boolean isCorrectDB = Verify.equalsOne(fromDB, "sqlite", "mysql"); Verify.isTrue(isCorrectDB, - () -> new IllegalArgumentException(Locale.get(Msg.MANAGE_FAIL_INCORRECT_DB) + fromDB)); + () -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_INCORRECT_DB, fromDB))); String toDB = args[1].toLowerCase(); isCorrectDB = Verify.equalsOne(toDB, "sqlite", "mysql"); Verify.isTrue(isCorrectDB, - () -> new IllegalArgumentException(Locale.get(Msg.MANAGE_FAIL_INCORRECT_DB) + fromDB)); + () -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_INCORRECT_DB, toDB))); Verify.isFalse(fromDB.equalsIgnoreCase(toDB), - () -> new IllegalArgumentException(Locale.get(Msg.MANAGE_FAIL_SAME_DB).toString())); + () -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_SAME_DB))); if (!Verify.contains("-a", args)) { - sender.sendMessage(Locale.get(Msg.MANAGE_FAIL_CONFIRM).parse(Locale.get(Msg.MANAGE_NOTIFY_OVERWRITE).parse(args[0]))); + sender.sendMessage(locale.getString(ManageLang.CONFIRMATION, locale.getString(ManageLang.CONFIRM_OVERWRITE, toDB))); return; } @@ -60,7 +70,7 @@ public class ManageMoveCommand extends CommandNode { runMoveTask(fromDatabase, toDatabase, sender); } catch (Exception e) { - sender.sendMessage(Locale.get(Msg.MANAGE_FAIL_FAULTY_DB).toString()); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); } } @@ -69,19 +79,19 @@ public class ManageMoveCommand extends CommandNode { @Override public void run() { try { - sender.sendMessage(Locale.get(Msg.MANAGE_INFO_START).parse()); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_START)); fromDatabase.backup().backup(toDatabase); - sender.sendMessage(Locale.get(Msg.MANAGE_INFO_MOVE_SUCCESS).toString()); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS)); boolean movingToCurrentDB = toDatabase.getConfigName().equalsIgnoreCase(Database.getActive().getConfigName()); if (movingToCurrentDB) { - sender.sendMessage(Locale.get(Msg.MANAGE_INFO_CONFIG_REMINDER).toString()); + sender.sendMessage(locale.getString(ManageLang.HOTSWAP_REMINDER, toDatabase.getConfigName())); } } catch (Exception e) { Log.toLog(this.getClass(), e); - sender.sendMessage(Locale.get(Msg.MANAGE_INFO_FAIL).toString()); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); } finally { this.cancel(); } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRemoveCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRemoveCommand.java index f7ed4ba4d..25cba8866 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRemoveCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRemoveCommand.java @@ -1,10 +1,14 @@ package com.djrapitops.plan.command.commands.manage; +import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.api.exceptions.database.DBOpException; import com.djrapitops.plan.system.database.databases.Database; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; +import com.djrapitops.plan.system.locale.lang.ManageLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plan.utilities.MiscUtils; import com.djrapitops.plan.utilities.uuid.UUIDUtility; import com.djrapitops.plugin.api.utility.log.Log; @@ -15,6 +19,7 @@ import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.task.RunnableFactory; import com.djrapitops.plugin.utilities.Verify; +import java.util.Arrays; import java.util.UUID; /** @@ -25,20 +30,30 @@ import java.util.UUID; */ public class ManageRemoveCommand extends CommandNode { - public ManageRemoveCommand() { + private final Locale locale; + + public ManageRemoveCommand(PlanPlugin plugin) { super("remove|delete", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS); - setShortHelp(Locale.get(Msg.CMD_USG_MANAGE_REMOVE).toString()); + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + setArguments("", "[-a]"); - setInDepthHelp(Locale.get(Msg.CMD_HELP_MANAGE_REMOVE).toArray()); + setShortHelp(locale.getString(CmdHelpLang.MANAGE_REMOVE)); + setInDepthHelp(locale.getArray(DeepHelpLang.MANAGE_REMOVE)); } @Override public void onCommand(ISender sender, String commandLabel, String[] args) { Verify.isTrue(args.length >= 1, - () -> new IllegalArgumentException(Locale.get(Msg.CMD_FAIL_REQ_ONE_ARG).toString())); + () -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_REQ_ONE_ARG, Arrays.toString(this.getArguments())))); String playerName = MiscUtils.getPlayerName(args, sender, Permissions.MANAGE); + if (playerName == null) { + sender.sendMessage(locale.getString(CommandLang.FAIL_NO_PERMISSION)); + return; + } + runRemoveTask(playerName, sender, args); } @@ -50,29 +65,29 @@ public class ManageRemoveCommand extends CommandNode { UUID uuid = UUIDUtility.getUUIDOf(playerName); if (uuid == null) { - sender.sendMessage(Locale.get(Msg.CMD_FAIL_USERNAME_NOT_VALID).toString()); + sender.sendMessage(locale.getString(CommandLang.FAIL_USERNAME_NOT_VALID)); return; } Database database = Database.getActive(); if (!database.check().isPlayerRegistered(uuid)) { - sender.sendMessage(Locale.get(Msg.CMD_FAIL_USERNAME_NOT_KNOWN).toString()); + sender.sendMessage(locale.getString(CommandLang.FAIL_USERNAME_NOT_KNOWN)); return; } if (!Verify.contains("-a", args)) { - sender.sendMessage(Locale.get(Msg.MANAGE_FAIL_CONFIRM).parse(Locale.get(Msg.MANAGE_NOTIFY_REMOVE).parse(database.getName()))); + sender.sendMessage(locale.getString(ManageLang.CONFIRMATION, locale.getString(ManageLang.CONFIRM_REMOVAL, database.getName()))); return; } - sender.sendMessage(Locale.get(Msg.MANAGE_INFO_START).parse()); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_START)); database.remove().player(uuid); - sender.sendMessage(Locale.get(Msg.MANAGE_INFO_REMOVE_SUCCESS).parse(playerName, Database.getActive().getConfigName())); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS)); } catch (DBOpException e) { Log.toLog(this.getClass(), e); - sender.sendMessage(Locale.get(Msg.MANAGE_INFO_FAIL).toString()); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); } finally { this.cancel(); } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRestoreCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRestoreCommand.java index b29fdb10b..db56b97d1 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRestoreCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRestoreCommand.java @@ -4,9 +4,12 @@ import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.system.database.DBSystem; import com.djrapitops.plan.system.database.databases.Database; import com.djrapitops.plan.system.database.databases.sql.SQLiteDB; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; +import com.djrapitops.plan.system.locale.lang.ManageLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; @@ -27,51 +30,59 @@ import java.util.Arrays; public class ManageRestoreCommand extends CommandNode { private final PlanPlugin plugin; + private final Locale locale; public ManageRestoreCommand(PlanPlugin plugin) { super("restore", Permissions.MANAGE.getPermission(), CommandType.CONSOLE); - setShortHelp(Locale.get(Msg.CMD_USG_MANAGE_RESTORE).toString()); - setArguments("", "", "[-a]"); - this.plugin = plugin; + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setArguments("", "", "[-a]"); + setShortHelp(locale.getString(CmdHelpLang.MANAGE_RESTORE)); + setInDepthHelp(locale.getArray(DeepHelpLang.MANAGE_RESTORE)); } @Override public void onCommand(ISender sender, String commandLabel, String[] args) { Verify.isTrue(args.length >= 2, - () -> new IllegalArgumentException(Locale.get(Msg.CMD_FAIL_REQ_ARGS).parse(Arrays.toString(this.getArguments())))); + () -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_REQ_ARGS, 2, Arrays.toString(this.getArguments())))); - String db = args[1].toLowerCase(); - boolean isCorrectDB = Verify.equalsOne(db, "sqlite", "mysql"); + String backupDbName = args[0]; + + String dbName = args[1].toLowerCase(); + boolean isCorrectDB = Verify.equalsOne(dbName, "sqlite", "mysql"); Verify.isTrue(isCorrectDB, - () -> new IllegalArgumentException(Locale.get(Msg.MANAGE_FAIL_INCORRECT_DB).toString())); - - if (!Verify.contains("-a", args)) { - sender.sendMessage(Locale.get(Msg.MANAGE_FAIL_CONFIRM).parse(Locale.get(Msg.MANAGE_NOTIFY_REWRITE).parse(args[1]))); - return; - } + () -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_INCORRECT_DB, dbName))); try { - final Database database = DBSystem.getActiveDatabaseByName(db); + Database database = DBSystem.getActiveDatabaseByName(dbName); + Verify.isFalse(backupDbName.contains("database") && database instanceof SQLiteDB, + () -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_SAME_DB))); - runRestoreTask(args, sender, database); + if (!Verify.contains("-a", args)) { + sender.sendMessage(locale.getString(ManageLang.CONFIRMATION, locale.getString(ManageLang.CONFIRM_OVERWRITE, database.getName()))); + return; + } + + runRestoreTask(backupDbName, sender, database); } catch (Exception e) { - sender.sendMessage(Locale.get(Msg.MANAGE_FAIL_FAULTY_DB).toString()); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); } } - private void runRestoreTask(String[] args, ISender sender, final Database database) { + private void runRestoreTask(String backupDbName, ISender sender, final Database database) { RunnableFactory.createNew(new AbsRunnable("RestoreTask") { @Override public void run() { try { - String backupDBName = args[0]; + String backupDBName = backupDbName; boolean containsDBFileExtension = backupDBName.endsWith(".db"); File backupDBFile = new File(plugin.getDataFolder(), backupDBName + (containsDBFileExtension ? "" : ".db")); if (!backupDBFile.exists()) { - sender.sendMessage(Locale.get(Msg.MANAGE_FAIL_FILE_NOT_FOUND) + " " + args[0]); + sender.sendMessage(locale.getString(ManageLang.FAIL_FILE_NOT_FOUND, backupDBFile.getAbsolutePath())); return; } @@ -79,17 +90,17 @@ public class ManageRestoreCommand extends CommandNode { backupDBName = backupDBName.substring(0, backupDBName.length() - 3); } - SQLiteDB backupDB = new SQLiteDB(backupDBName); + SQLiteDB backupDB = new SQLiteDB(backupDBName, () -> locale); backupDB.init(); - sender.sendMessage(Locale.get(Msg.MANAGE_INFO_START).parse()); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_START)); database.backup().restore(backupDB); - sender.sendMessage(Locale.get(Msg.MANAGE_INFO_COPY_SUCCESS).toString()); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS)); } catch (Exception e) { Log.toLog(this.getClass(), e); - sender.sendMessage(Locale.get(Msg.MANAGE_INFO_FAIL).toString()); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); } finally { this.cancel(); } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageSetupCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageSetupCommand.java index 413fbedd9..cbd00231a 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageSetupCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageSetupCommand.java @@ -1,12 +1,15 @@ package com.djrapitops.plan.command.commands.manage; +import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.api.exceptions.connection.*; import com.djrapitops.plan.system.info.InfoSystem; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.DeepHelpLang; import com.djrapitops.plan.system.processing.Processing; import com.djrapitops.plan.system.settings.Permissions; import com.djrapitops.plan.system.settings.Settings; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plan.system.webserver.WebServerSystem; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.command.CommandNode; @@ -14,6 +17,8 @@ import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.ISender; import com.djrapitops.plugin.utilities.Verify; +import java.util.Arrays; + /** * This manage SubCommand is used to request settings from Bungee so that connection can be established. * @@ -22,25 +27,30 @@ import com.djrapitops.plugin.utilities.Verify; */ public class ManageSetupCommand extends CommandNode { - public ManageSetupCommand() { + private final Locale locale; + + public ManageSetupCommand(PlanPlugin plugin) { super("setup", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS); - setShortHelp("Set-Up Bungee connection"); + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + setArguments(""); - setInDepthHelp(Locale.get(Msg.CMD_HELP_MANAGE_HOTSWAP).toArray()); + setShortHelp(locale.getString(CmdHelpLang.MANAGE_SETUP)); + setInDepthHelp(locale.getArray(DeepHelpLang.MANAGE_SETUP)); } @Override public void onCommand(ISender sender, String commandLabel, String[] args) { Verify.isTrue(args.length >= 1, - () -> new IllegalArgumentException(Locale.get(Msg.CMD_FAIL_REQ_ONE_ARG).toString())); + () -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_REQ_ONE_ARG, Arrays.toString(this.getArguments())))); if (!WebServerSystem.isWebServerEnabled()) { - sender.sendMessage("§cWebServer is not enabled on this server! Make sure it enables on boot!"); + sender.sendMessage(locale.getString(CommandLang.CONNECT_WEBSERVER_NOT_ENABLED)); return; } String address = args[0].toLowerCase(); if (!address.startsWith("http") || address.endsWith("://")) { - sender.sendMessage("§cMake sure you're using the full address (Starts with http:// or https://) - Check Bungee enable log for the full address."); + sender.sendMessage(locale.getString(CommandLang.CONNECT_URL_MISTAKE)); return; } if (address.endsWith("/")) { @@ -58,22 +68,22 @@ public class ManageSetupCommand extends CommandNode { InfoSystem.getInstance().requestSetUp(address); - sender.sendMessage("§aConnection successful, Plan may restart in a few seconds.."); + sender.sendMessage(locale.getString(CommandLang.CONNECT_SUCCESS)); } catch (ForbiddenException e) { - sender.sendMessage("§eConnection succeeded, but Bungee has set-up mode disabled - use '/planbungee setup' to enable it."); + sender.sendMessage(locale.getString(CommandLang.CONNECT_FORBIDDEN)); } catch (BadRequestException e) { - sender.sendMessage("§eConnection succeeded, but Receiving server was a Bukkit server. Use Bungee address instead."); + sender.sendMessage(locale.getString(CommandLang.CONNECT_BAD_REQUEST)); } catch (UnauthorizedServerException e) { - sender.sendMessage("§eConnection succeeded, but Receiving server didn't authorize this server. Contact Discord for support"); + sender.sendMessage(locale.getString(CommandLang.CONNECT_UNAUTHORIZED)); } catch (ConnectionFailException e) { - sender.sendMessage("§eConnection failed: " + e.getMessage()); + sender.sendMessage(locale.getString(CommandLang.CONNECT_FAIL, e.getMessage())); } catch (InternalErrorException e) { - sender.sendMessage("§eConnection succeeded. " + e.getMessage() + ", check possible ErrorLog on receiving server's debug page."); + sender.sendMessage(locale.getString(CommandLang.CONNECT_INTERNAL_ERROR, e.getMessage())); } catch (GatewayException e) { - sender.sendMessage("§eConnection succeeded, but Bungee failed to connect to this server. Use Connection debug commands for more."); + sender.sendMessage(locale.getString(CommandLang.CONNECT_GATEWAY)); } catch (WebException e) { Log.toLog(this.getClass(), e); - sender.sendMessage("§cConnection to Bungee WebServer failed: More info in the error log."); + sender.sendMessage(locale.getString(CommandLang.CONNECT_FAIL, e.toString())); } }); } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebCheckCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebCheckCommand.java index 95fb484f4..85b327061 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebCheckCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebCheckCommand.java @@ -1,10 +1,13 @@ package com.djrapitops.plan.command.commands.webuser; +import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.data.WebUser; import com.djrapitops.plan.system.database.databases.Database; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.ManageLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; @@ -23,16 +26,21 @@ import java.util.Arrays; */ public class WebCheckCommand extends CommandNode { - public WebCheckCommand() { + private final Locale locale; + + public WebCheckCommand(PlanPlugin plugin) { super("check", Permissions.MANAGE_WEB.getPerm(), CommandType.PLAYER_OR_ARGS); - setShortHelp(Locale.get(Msg.CMD_USG_WEB_CHECK).toString()); + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setShortHelp(locale.getString(CmdHelpLang.WEB_CHECK)); setArguments(""); } @Override public void onCommand(ISender sender, String commandLabel, String[] args) { Verify.isTrue(args.length >= 1, - () -> new IllegalArgumentException(Locale.get(Msg.CMD_FAIL_REQ_ARGS).parse(Arrays.toString(this.getArguments())))); + () -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_REQ_ONE_ARG, Arrays.toString(this.getArguments())))); Database database = Database.getActive(); String user = args[0]; @@ -42,14 +50,14 @@ public class WebCheckCommand extends CommandNode { public void run() { try { if (!database.check().doesWebUserExists(user)) { - sender.sendMessage("§c[Plan] User Doesn't exist."); + sender.sendMessage(locale.getString(CommandLang.FAIL_WEB_USER_NOT_EXISTS)); return; } WebUser info = database.fetch().getWebUser(user); - sender.sendMessage(info.getName() + ": Permission level: " + info.getPermLevel()); - } catch (Exception ex) { - Log.toLog(this.getClass(), ex); - sender.sendMessage(Locale.get(Msg.MANAGE_INFO_FAIL).parse()); + sender.sendMessage(locale.getString(CommandLang.WEB_USER_LIST, info.getName(), info.getPermLevel())); + } catch (Exception e) { + Log.toLog(this.getClass(), e); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); } finally { this.cancel(); } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebDeleteCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebDeleteCommand.java index c89c77cfc..bd9df7675 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebDeleteCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebDeleteCommand.java @@ -1,9 +1,12 @@ package com.djrapitops.plan.command.commands.webuser; +import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.system.database.databases.Database; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.ManageLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; @@ -22,21 +25,26 @@ import java.util.Arrays; */ public class WebDeleteCommand extends CommandNode { - public WebDeleteCommand() { + private final Locale locale; + + public WebDeleteCommand(PlanPlugin plugin) { super("delete|remove", Permissions.MANAGE_WEB.getPerm(), CommandType.PLAYER_OR_ARGS); - setShortHelp(Locale.get(Msg.CMD_USG_WEB_DELETE).toString()); + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setShortHelp(locale.getString(CmdHelpLang.WEB_DELETE)); setArguments(""); } @Override public void onCommand(ISender sender, String commandLabel, String[] args) { Verify.isTrue(args.length >= 1, - () -> new IllegalArgumentException(Locale.get(Msg.CMD_FAIL_REQ_ARGS).parse(Arrays.toString(this.getArguments())))); + () -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_REQ_ONE_ARG, Arrays.toString(this.getArguments())))); Database database = Database.getActive(); String user = args[0]; - RunnableFactory.createNew(new AbsRunnable("Webuser Delete Task: " + user) { + RunnableFactory.createNew("Webuser Delete Task: " + user, new AbsRunnable() { @Override public void run() { try { @@ -45,10 +53,10 @@ public class WebDeleteCommand extends CommandNode { return; } database.remove().webUser(user); - sender.sendMessage(Locale.get(Msg.MANAGE_INFO_SUCCESS).parse()); - } catch (Exception ex) { - Log.toLog(this.getClass(), ex); - sender.sendMessage(Locale.get(Msg.MANAGE_INFO_FAIL).parse()); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS)); + } catch (Exception e) { + Log.toLog(this.getClass(), e); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); } finally { this.cancel(); } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebLevelCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebLevelCommand.java index 1a054105f..105fdbb6a 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebLevelCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebLevelCommand.java @@ -1,13 +1,13 @@ package com.djrapitops.plan.command.commands.webuser; import com.djrapitops.plan.PlanPlugin; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.ISender; -import com.djrapitops.plugin.settings.ColorScheme; /** * Subcommand for info about permission levels. @@ -17,31 +17,19 @@ import com.djrapitops.plugin.settings.ColorScheme; */ public class WebLevelCommand extends CommandNode { - private final PlanPlugin plugin; + private final Locale locale; public WebLevelCommand(PlanPlugin plugin) { super("level", Permissions.MANAGE_WEB.getPerm(), CommandType.CONSOLE); - setShortHelp(Locale.get(Msg.CMD_USG_WEB_LEVEL).toString()); - this.plugin = plugin; + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setShortHelp(locale.getString(CmdHelpLang.WEB_LEVEL)); } @Override public void onCommand(ISender sender, String commandLabel, String[] args) { - ColorScheme cs = plugin.getColorScheme(); - String sCol = cs.getSecondaryColor(); - String cmdBall = Locale.get(Msg.CMD_CONSTANT_LIST_BALL).parse(); - String cmdFooter = Locale.get(Msg.CMD_CONSTANT_FOOTER).parse(); - - String[] messages = new String[]{ - cmdFooter, - cmdBall + sCol + "0: Access all pages", - cmdBall + sCol + "1: Access '/players' and all inspect pages", - cmdBall + sCol + "2: Access inspect page with the same username as the webuser", - cmdBall + sCol + "3+: No permissions", - cmdFooter - }; - - sender.sendMessage(messages); + sender.sendMessage(locale.getArray(CommandLang.WEB_PERMISSION_LEVELS)); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebListUsersCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebListUsersCommand.java index 55f775ae3..87780fc78 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebListUsersCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebListUsersCommand.java @@ -3,15 +3,16 @@ package com.djrapitops.plan.command.commands.webuser; import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.data.WebUser; import com.djrapitops.plan.system.database.databases.Database; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.CommandLang; +import com.djrapitops.plan.system.locale.lang.ManageLang; import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plan.utilities.comparators.WebUserComparator; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.ISender; -import com.djrapitops.plugin.settings.ColorScheme; import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.task.RunnableFactory; @@ -25,32 +26,32 @@ import java.util.List; */ public class WebListUsersCommand extends CommandNode { - private final PlanPlugin plugin; + private final Locale locale; public WebListUsersCommand(PlanPlugin plugin) { super("list", Permissions.MANAGE_WEB.getPerm(), CommandType.CONSOLE); - setShortHelp("List registered web users & permission levels."); - this.plugin = plugin; + + locale = plugin.getSystem().getLocaleSystem().getLocale(); + + setShortHelp(locale.getString(CmdHelpLang.WEB_LIST)); } @Override public void onCommand(ISender sender, String commandLabel, String[] args) { - RunnableFactory.createNew(new AbsRunnable("Webuser List Task") { + RunnableFactory.createNew(new AbsRunnable("Web user List Task") { @Override public void run() { try { - ColorScheme cs = plugin.getColorScheme(); - String mCol = cs.getMainColor(); List users = Database.getActive().fetch().getWebUsers(); users.sort(new WebUserComparator()); - sender.sendMessage(Locale.get(Msg.CMD_CONSTANT_FOOTER).parse() + mCol + " WebUsers (" + users.size() + ")"); + sender.sendMessage(locale.getString(CommandLang.HEADER_WEB_USERS, users.size())); for (WebUser user : users) { - sender.sendMessage(" " + user.getPermLevel() + " : " + user.getName()); + sender.sendMessage(locale.getString(CommandLang.WEB_USER_LIST, user.getName(), user.getPermLevel())); } - sender.sendMessage(Locale.get(Msg.CMD_CONSTANT_FOOTER).parse()); - } catch (Exception ex) { - Log.toLog(this.getClass(), ex); - sender.sendMessage(Locale.get(Msg.MANAGE_INFO_FAIL).parse()); + sender.sendMessage(">"); + } catch (Exception e) { + Log.toLog(this.getClass(), e); + sender.sendMessage(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage())); } finally { this.cancel(); } diff --git a/Plan/src/main/java/com/djrapitops/plan/data/container/GeoInfo.java b/Plan/src/main/java/com/djrapitops/plan/data/container/GeoInfo.java index bff37d252..2ed38a28d 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/container/GeoInfo.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/container/GeoInfo.java @@ -10,7 +10,7 @@ import com.djrapitops.plan.utilities.FormatUtils; import com.djrapitops.plan.utilities.SHA256Hash; import com.google.common.base.Objects; -import java.io.UnsupportedEncodingException; +import java.io.Serializable; import java.net.InetAddress; import java.security.NoSuchAlgorithmException; @@ -19,7 +19,7 @@ import java.security.NoSuchAlgorithmException; * * @author Rsl1122 */ -public class GeoInfo implements DateHolder { +public class GeoInfo implements DateHolder, Serializable { private final String ip; private final String geolocation; @@ -27,7 +27,7 @@ public class GeoInfo implements DateHolder { private final long date; public GeoInfo(InetAddress address, String geolocation, long lastUsed) - throws UnsupportedEncodingException, NoSuchAlgorithmException { + throws NoSuchAlgorithmException { this(FormatUtils.formatIP(address), geolocation, lastUsed, new SHA256Hash(address.getHostAddress()).create()); } diff --git a/Plan/src/main/java/com/djrapitops/plan/data/container/PlayerKill.java b/Plan/src/main/java/com/djrapitops/plan/data/container/PlayerKill.java index f7e3067ff..7eece6d25 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/container/PlayerKill.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/container/PlayerKill.java @@ -2,6 +2,7 @@ package com.djrapitops.plan.data.container; import com.djrapitops.plan.data.store.objects.DateHolder; +import java.io.Serializable; import java.util.Objects; import java.util.UUID; @@ -11,7 +12,7 @@ import java.util.UUID; * * @author Rsl1122 */ -public class PlayerKill implements DateHolder { +public class PlayerKill implements DateHolder, Serializable { private final UUID victim; private final long date; diff --git a/Plan/src/main/java/com/djrapitops/plan/data/container/Session.java b/Plan/src/main/java/com/djrapitops/plan/data/container/Session.java index 1b662f30d..77822cbc8 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/container/Session.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/container/Session.java @@ -16,6 +16,10 @@ import java.util.*; */ public class Session extends DataContainer implements DateHolder { + private long sessionStart; + private WorldTimes worldTimes; + private List playerKills; + private int mobKills; private int deaths; private long afkTime; @@ -29,18 +33,22 @@ public class Session extends DataContainer implements DateHolder { * @param gm Starting GameMode. */ public Session(UUID uuid, long sessionStart, String world, String gm) { + this.sessionStart = sessionStart; + worldTimes = new WorldTimes(world, gm, sessionStart); + playerKills = new ArrayList<>(); + mobKills = 0; deaths = 0; afkTime = 0; putRawData(SessionKeys.UUID, uuid); - putRawData(SessionKeys.START, sessionStart); - putRawData(SessionKeys.WORLD_TIMES, new WorldTimes(world, gm)); - putRawData(SessionKeys.PLAYER_KILLS, new ArrayList<>()); + putSupplier(SessionKeys.START, this::getSessionStart); + putSupplier(SessionKeys.WORLD_TIMES, this::getWorldTimes); + putSupplier(SessionKeys.PLAYER_KILLS, this::getPlayerKills); putRawData(SessionKeys.PLAYER_DEATHS, new ArrayList<>()); - putSupplier(SessionKeys.MOB_KILL_COUNT, () -> mobKills); - putSupplier(SessionKeys.DEATH_COUNT, () -> deaths); - putSupplier(SessionKeys.AFK_TIME, () -> afkTime); + putSupplier(SessionKeys.MOB_KILL_COUNT, this::getMobKills); + putSupplier(SessionKeys.DEATH_COUNT, this::getDeaths); + putSupplier(SessionKeys.AFK_TIME, this::getAfkTime); putSupplier(SessionKeys.PLAYER_KILL_COUNT, getUnsafe(SessionKeys.PLAYER_KILLS)::size); putSupplier(SessionKeys.LENGTH, () -> @@ -64,22 +72,26 @@ public class Session extends DataContainer implements DateHolder { * @param afkTime Time spent AFK during the session. */ public Session(int id, UUID uuid, UUID serverUUID, long sessionStart, long sessionEnd, int mobKills, int deaths, long afkTime) { - putRawData(SessionKeys.DB_ID, id); - putRawData(SessionKeys.UUID, uuid); - putRawData(SessionKeys.SERVER_UUID, serverUUID); - putRawData(SessionKeys.START, sessionStart); - putRawData(SessionKeys.END, sessionEnd); - putRawData(SessionKeys.WORLD_TIMES, new WorldTimes(new HashMap<>())); - putRawData(SessionKeys.PLAYER_KILLS, new ArrayList<>()); - putRawData(SessionKeys.PLAYER_DEATHS, new ArrayList<>()); - putSupplier(SessionKeys.MOB_KILL_COUNT, () -> mobKills); - putSupplier(SessionKeys.DEATH_COUNT, () -> deaths); - putSupplier(SessionKeys.AFK_TIME, () -> afkTime); + this.sessionStart = sessionStart; + worldTimes = new WorldTimes(new HashMap<>()); + playerKills = new ArrayList<>(); this.mobKills = mobKills; this.deaths = deaths; this.afkTime = afkTime; + putRawData(SessionKeys.DB_ID, id); + putRawData(SessionKeys.UUID, uuid); + putRawData(SessionKeys.SERVER_UUID, serverUUID); + putSupplier(SessionKeys.START, this::getSessionStart); + putRawData(SessionKeys.END, sessionEnd); + putSupplier(SessionKeys.WORLD_TIMES, this::getWorldTimes); + putSupplier(SessionKeys.PLAYER_KILLS, this::getPlayerKills); + putRawData(SessionKeys.PLAYER_DEATHS, new ArrayList<>()); + putSupplier(SessionKeys.MOB_KILL_COUNT, this::getMobKills); + putSupplier(SessionKeys.DEATH_COUNT, this::getDeaths); + putSupplier(SessionKeys.AFK_TIME, this::getAfkTime); + putSupplier(SessionKeys.PLAYER_KILL_COUNT, () -> getUnsafe(SessionKeys.PLAYER_KILLS).size()); putSupplier(SessionKeys.LENGTH, () -> getValue(SessionKeys.END).orElse(System.currentTimeMillis()) - getUnsafe(SessionKeys.START)); @@ -95,8 +107,6 @@ public class Session extends DataContainer implements DateHolder { */ public void endSession(long endOfSession) { putRawData(SessionKeys.END, endOfSession); - WorldTimes worldTimes = getValue(SessionKeys.WORLD_TIMES) - .orElseThrow(() -> new IllegalStateException("World times have not been defined")); worldTimes.updateState(endOfSession); } @@ -108,14 +118,10 @@ public class Session extends DataContainer implements DateHolder { * @param time Epoch ms of the event. */ public void changeState(String world, String gm, long time) { - WorldTimes worldTimes = getValue(SessionKeys.WORLD_TIMES) - .orElseThrow(() -> new IllegalStateException("World times is not defined")); worldTimes.updateState(world, gm, time); } public void playerKilled(PlayerKill kill) { - List playerKills = getValue(SessionKeys.PLAYER_KILLS) - .orElseThrow(() -> new IllegalStateException("Player kills is not defined.")); playerKills.add(kill); } @@ -179,4 +185,33 @@ public class Session extends DataContainer implements DateHolder { session.getValue(SessionKeys.PLAYER_KILLS).orElse(new ArrayList<>()) ); } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), mobKills, deaths, afkTime); + } + + private long getSessionStart() { + return sessionStart; + } + + private WorldTimes getWorldTimes() { + return worldTimes; + } + + private List getPlayerKills() { + return playerKills; + } + + private int getMobKills() { + return mobKills; + } + + private int getDeaths() { + return deaths; + } + + private long getAfkTime() { + return afkTime; + } } diff --git a/Plan/src/main/java/com/djrapitops/plan/data/container/UserInfo.java b/Plan/src/main/java/com/djrapitops/plan/data/container/UserInfo.java index 2bced5402..310968d6f 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/container/UserInfo.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/container/UserInfo.java @@ -17,10 +17,6 @@ public class UserInfo { private boolean banned; private boolean opped; - public UserInfo(UUID uuid) { - this.uuid = uuid; - } - public UserInfo(UUID uuid, String name, long registered, boolean opped, boolean banned) { this.uuid = uuid; this.name = name; diff --git a/Plan/src/main/java/com/djrapitops/plan/data/plugin/HookHandler.java b/Plan/src/main/java/com/djrapitops/plan/data/plugin/HookHandler.java index bedc5718f..5c9698869 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/plugin/HookHandler.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/plugin/HookHandler.java @@ -1,6 +1,6 @@ package com.djrapitops.plan.data.plugin; -import com.djrapitops.plan.Plan; +import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.data.element.InspectContainer; import com.djrapitops.plan.system.PlanSystem; import com.djrapitops.plan.system.SubSystem; @@ -65,7 +65,7 @@ public class HookHandler implements SubSystem { return; } try { - StaticHolder.saveInstance(dataSource.getClass(), Plan.class); + StaticHolder.saveInstance(dataSource.getClass(), PlanPlugin.getInstance().getClass()); if (!configHandler.hasSection(dataSource)) { configHandler.createSection(dataSource); } diff --git a/Plan/src/main/java/com/djrapitops/plan/data/store/CachingSupplier.java b/Plan/src/main/java/com/djrapitops/plan/data/store/CachingSupplier.java index 62fe2e386..81726eb8b 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/store/CachingSupplier.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/store/CachingSupplier.java @@ -16,15 +16,22 @@ public class CachingSupplier implements Supplier { private final Supplier original; private T cachedValue; private long cacheTime; + private long timeToLive; public CachingSupplier(Supplier original) { + this(original, TimeAmount.SECOND.ms() * 30L); + } + + public CachingSupplier(Supplier original, long timeToLive) { this.original = original; + this.timeToLive = timeToLive; + cacheTime = 0L; } @Override public T get() { - if (cachedValue == null || System.currentTimeMillis() - cacheTime > TimeAmount.SECOND.ms() * 30L) { + if (cachedValue == null || System.currentTimeMillis() - cacheTime > timeToLive) { cachedValue = original.get(); cacheTime = System.currentTimeMillis(); } diff --git a/Plan/src/main/java/com/djrapitops/plan/data/store/containers/DataContainer.java b/Plan/src/main/java/com/djrapitops/plan/data/store/containers/DataContainer.java index fbef41097..c2cefb496 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/store/containers/DataContainer.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/store/containers/DataContainer.java @@ -3,8 +3,10 @@ package com.djrapitops.plan.data.store.containers; import com.djrapitops.plan.data.store.CachingSupplier; import com.djrapitops.plan.data.store.Key; import com.djrapitops.plan.data.store.mutators.formatting.Formatter; +import com.djrapitops.plugin.api.TimeAmount; import java.util.HashMap; +import java.util.Map; import java.util.Optional; import java.util.function.Supplier; @@ -16,7 +18,19 @@ import java.util.function.Supplier; * * @author Rsl1122 */ -public class DataContainer extends HashMap { +public class DataContainer { + + private final Map map; + private long timeToLive; + + public DataContainer() { + this(TimeAmount.SECOND.ms() * 30L); + } + + public DataContainer(long timeToLive) { + this.timeToLive = timeToLive; + map = new HashMap<>(); + } /** * Place your data inside the container. @@ -30,11 +44,14 @@ public class DataContainer extends HashMap { } public void putSupplier(Key key, Supplier supplier) { - super.put(key, new CachingSupplier<>(supplier)); + if (supplier == null) { + return; + } + map.put(key, new CachingSupplier<>(supplier, timeToLive)); } public Supplier getSupplier(Key key) { - return (Supplier) super.get(key); + return (Supplier) map.get(key); } /** @@ -45,7 +62,7 @@ public class DataContainer extends HashMap { * @return true if found, false if not. */ public boolean supports(Key key) { - return containsKey(key); + return map.containsKey(key); } /** @@ -73,7 +90,7 @@ public class DataContainer extends HashMap { } public T getUnsafe(Key key) { - Supplier supplier = get(key); + Supplier supplier = map.get(key); if (supplier == null) { throw new IllegalArgumentException("Unsupported Key: " + key.getKeyName()); } @@ -90,30 +107,15 @@ public class DataContainer extends HashMap { return formatter.apply(value); } - /** - * Normal put method. - * - * @param key Key. - * @param value Supplier - * @return the previous value. - * @deprecated Use putSupplier instead for type safety. - */ - @Override - @Deprecated - public Supplier put(Key key, Supplier value) { - return super.put(key, value); + public void putAll(Map toPut) { + map.putAll(toPut); } - /** - * Normal get method. - * - * @param key Key. - * @return Supplier - * @deprecated Use getSupplier instead for types. - */ - @Override - @Deprecated - public Supplier get(Object key) { - return super.get(key); + public void putAll(DataContainer dataContainer) { + putAll(dataContainer.map); + } + + public void clear() { + map.clear(); } } \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/DateHoldersMutator.java b/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/DateHoldersMutator.java index 632688bda..692e1bd1e 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/DateHoldersMutator.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/DateHoldersMutator.java @@ -47,7 +47,7 @@ public class DateHoldersMutator { long start = map.firstKey(); long now = System.currentTimeMillis(); long end = now - (now % twentyFourHours); - for (long date = map.firstKey(); date < end; date += twentyFourHours) { + for (long date = start; date < end; date += twentyFourHours) { map.putIfAbsent(date, new ArrayList<>()); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/GeoInfoMutator.java b/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/GeoInfoMutator.java index 7be669b7a..03f982bce 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/GeoInfoMutator.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/GeoInfoMutator.java @@ -36,7 +36,6 @@ public class GeoInfoMutator { if (geoInfo.isEmpty()) { return Optional.empty(); } - geoInfo.sort(new GeoInfoComparator()); - return Optional.of(geoInfo.get(0)); + return geoInfo.stream().min(new GeoInfoComparator()); } } \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/TPSMutator.java b/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/TPSMutator.java index 5ca6176cb..8af6fa550 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/TPSMutator.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/TPSMutator.java @@ -4,12 +4,14 @@ import com.djrapitops.plan.data.container.TPS; import com.djrapitops.plan.data.store.containers.DataContainer; import com.djrapitops.plan.data.store.keys.ServerKeys; import com.djrapitops.plan.system.settings.Settings; +import com.djrapitops.plan.utilities.comparators.TPSComparator; import com.djrapitops.plan.utilities.html.graphs.line.Point; import com.djrapitops.plugin.api.TimeAmount; import java.util.ArrayList; import java.util.List; import java.util.OptionalDouble; +import java.util.function.Predicate; import java.util.stream.Collectors; /** @@ -35,12 +37,16 @@ public class TPSMutator { return new TPSMutator(new ArrayList<>(mutator.tpsData)); } - public TPSMutator filterDataBetween(long after, long before) { + public TPSMutator filterBy(Predicate filter) { return new TPSMutator(tpsData.stream() - .filter(tps -> tps.getDate() >= after && tps.getDate() <= before) + .filter(filter) .collect(Collectors.toList())); } + public TPSMutator filterDataBetween(long after, long before) { + return filterBy(tps -> tps.getDate() >= after && tps.getDate() <= before); + } + public List all() { return tpsData; } @@ -84,6 +90,7 @@ public class TPSMutator { public long serverDownTime() { long lastDate = -1; long downTime = 0; + tpsData.sort(new TPSComparator()); for (TPS tps : tpsData) { long date = tps.getDate(); if (lastDate == -1) { @@ -105,6 +112,7 @@ public class TPSMutator { long lastDate = -1; int lastPlayers = 0; long idleTime = 0; + tpsData.sort(new TPSComparator()); for (TPS tps : tpsData) { long date = tps.getDate(); int players = tps.getPlayers(); diff --git a/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/formatting/Formatters.java b/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/formatting/Formatters.java index 69e5e0140..b12e10668 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/formatting/Formatters.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/formatting/Formatters.java @@ -3,7 +3,10 @@ package com.djrapitops.plan.data.store.mutators.formatting; import com.djrapitops.plan.data.store.objects.DateHolder; import com.djrapitops.plan.utilities.FormatUtils; import com.djrapitops.plugin.api.TimeAmount; +import com.djrapitops.plugin.utilities.Format; +import org.apache.commons.text.TextStringBuilder; +import java.util.Arrays; import java.util.Calendar; import java.util.function.Function; @@ -79,4 +82,13 @@ public class Formatters { } }; } + + public static Formatter itemName() { + return name -> { + String[] parts = name.split("_"); + TextStringBuilder builder = new TextStringBuilder(); + builder.appendWithSeparators(Arrays.stream(parts).map(part -> new Format(part).capitalize()).iterator(), " "); + return builder.toString(); + }; + } } \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/health/HealthInformation.java b/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/health/HealthInformation.java index 3e17c0a33..fb7c22306 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/health/HealthInformation.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/health/HealthInformation.java @@ -77,13 +77,13 @@ public class HealthInformation extends AbstractHealthInfo { long playersRetainedMonth = analysisContainer.getValue(AnalysisKeys.PLAYERS_RETAINED_MONTH).orElse(0); if (playersNewMonth != 0) { - double retainPercentage = playersRetainedMonth / playersNewMonth; + double retainPercentage = playersRetainedMonth * 1.0 / playersNewMonth; if (retainPercentage >= 0.25) { addNote(Icons.GREEN_THUMB + " " + Formatters.percentage().apply(retainPercentage) + " of new players have stuck around (" + playersRetainedMonth + "/" + playersNewMonth + ")"); } else { addNote(Icons.YELLOW_FLAG + " " + Formatters.percentage().apply(retainPercentage) - + "% of new players have stuck around (" + playersRetainedMonth + "/" + playersNewMonth + ")"); + + " of new players have stuck around (" + playersRetainedMonth + "/" + playersNewMonth + ")"); } } } diff --git a/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/health/NetworkHealthInformation.java b/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/health/NetworkHealthInformation.java index b5a333f0e..64bbffc91 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/health/NetworkHealthInformation.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/store/mutators/health/NetworkHealthInformation.java @@ -55,7 +55,7 @@ public class NetworkHealthInformation extends AbstractHealthInfo { uniquePlayersNote(serverCount, serverKey, perServerContainers); newPlayersNote(serverCount, serverKey, perServerContainers); - playersNote(serverCount, serverKey, perServerContainers); + playersNote(serverKey, perServerContainers); } private void uniquePlayersNote(int serverCount, Key serverKey, List perServerContainers) { @@ -137,7 +137,7 @@ public class NetworkHealthInformation extends AbstractHealthInfo { return perServerContainers; } - private void playersNote(int serverCount, Key serverKey, List perServerContainers) { + private void playersNote(Key serverKey, List perServerContainers) { Icon icon = Icons.HELP_RING; String uniquePlayersNote = "${playersMonth} players played on the network:"; StringBuilder subNotes = new StringBuilder(); diff --git a/Plan/src/main/java/com/djrapitops/plan/data/time/TimeKeeper.java b/Plan/src/main/java/com/djrapitops/plan/data/time/TimeKeeper.java index 8fdd617e7..f2d608c72 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/time/TimeKeeper.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/time/TimeKeeper.java @@ -2,25 +2,20 @@ package com.djrapitops.plan.data.time; import com.djrapitops.plugin.utilities.Verify; +import java.io.Serializable; import java.util.HashMap; import java.util.Map; import java.util.Objects; /** * Abstract class for keeping track of time spent in each state. + * + * @author Rsl1122 */ -public abstract class TimeKeeper { - /** - * Keeps time of states. - */ +public abstract class TimeKeeper implements Serializable { + protected Map times; - /** - * Last State seen in - */ protected String state; - /** - * Relates to Playtime Milliseconds. - */ protected long lastStateChange; public TimeKeeper(Map times, String lastState, long lastStateChange) { @@ -72,19 +67,19 @@ public abstract class TimeKeeper { * Adds time to the last state while updating the status of other parameters. * * @param newState New State seen in. - * @param playTime Current Playtime. + * @param ms Epoch ms the change occurred. * @throws IllegalArgumentException If newState is null. */ - public void changeState(String newState, long playTime) { + public void changeState(String newState, long ms) { Verify.nullCheck(newState); if (state == null) { state = newState; } Long currentTime = times.getOrDefault(state, 0L); - long diff = playTime - lastStateChange; + long diff = ms - lastStateChange; times.put(state, currentTime + Math.abs(diff)); state = newState; - lastStateChange = playTime; + lastStateChange = ms; } protected void resetState(String state) { diff --git a/Plan/src/main/java/com/djrapitops/plan/data/time/WorldTimes.java b/Plan/src/main/java/com/djrapitops/plan/data/time/WorldTimes.java index 5edbb07c0..1fed088ed 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/time/WorldTimes.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/time/WorldTimes.java @@ -1,5 +1,6 @@ package com.djrapitops.plan.data.time; +import java.io.Serializable; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -10,7 +11,7 @@ import java.util.Objects; * @author Rsl1122 * @since 4.0.0 */ -public class WorldTimes { +public class WorldTimes implements Serializable { private final Map worldTimes; private String currentWorld; @@ -21,12 +22,13 @@ public class WorldTimes { * * @param startingWorld World to start the calculations at. * @param startingGM GameMode to start the calculations at. + * @param time Epoch ms the time calculation should start */ - public WorldTimes(String startingWorld, String startingGM) { + public WorldTimes(String startingWorld, String startingGM, long time) { worldTimes = new HashMap<>(); currentWorld = startingWorld; currentGamemode = startingGM; - addWorld(startingWorld, startingGM, System.currentTimeMillis()); + addWorld(startingWorld, startingGM, time); } /** diff --git a/Plan/src/main/java/com/djrapitops/plan/system/BukkitSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/BukkitSystem.java index ed0ff357e..fa49b9eee 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/BukkitSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/BukkitSystem.java @@ -14,6 +14,7 @@ import com.djrapitops.plan.system.file.FileSystem; import com.djrapitops.plan.system.info.ServerInfoSystem; import com.djrapitops.plan.system.info.server.BukkitServerInfo; import com.djrapitops.plan.system.listeners.BukkitListenerSystem; +import com.djrapitops.plan.system.locale.Locale; import com.djrapitops.plan.system.settings.PlanErrorManager; import com.djrapitops.plan.system.settings.config.ServerConfigSystem; import com.djrapitops.plan.system.settings.network.NetworkSettings; @@ -22,6 +23,8 @@ import com.djrapitops.plan.system.update.VersionCheckSystem; import com.djrapitops.plugin.StaticHolder; import com.djrapitops.plugin.api.utility.log.Log; +import java.util.function.Supplier; + /** * Represents PlanSystem for Plan. * @@ -34,14 +37,16 @@ public class BukkitSystem extends PlanSystem implements ServerSystem { Log.setErrorManager(new PlanErrorManager()); - versionCheckSystem = new VersionCheckSystem(plugin.getVersion()); + Supplier localeSupplier = () -> getLocaleSystem().getLocale(); + + versionCheckSystem = new VersionCheckSystem(plugin.getVersion(), localeSupplier); fileSystem = new FileSystem(plugin); configSystem = new ServerConfigSystem(); - databaseSystem = new ServerDBSystem(); + databaseSystem = new ServerDBSystem(localeSupplier); listenerSystem = new BukkitListenerSystem(plugin); taskSystem = new BukkitTaskSystem(plugin); - infoSystem = new ServerInfoSystem(); + infoSystem = new ServerInfoSystem(localeSupplier); serverInfo = new BukkitServerInfo(plugin); hookHandler = new HookHandler(); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/BungeeSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/BungeeSystem.java index 3e087a7f6..0de142b74 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/BungeeSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/BungeeSystem.java @@ -15,6 +15,7 @@ import com.djrapitops.plan.system.file.FileSystem; import com.djrapitops.plan.system.info.BungeeInfoSystem; import com.djrapitops.plan.system.info.server.BungeeServerInfo; import com.djrapitops.plan.system.listeners.BungeeListenerSystem; +import com.djrapitops.plan.system.locale.Locale; import com.djrapitops.plan.system.settings.PlanErrorManager; import com.djrapitops.plan.system.settings.config.BungeeConfigSystem; import com.djrapitops.plan.system.settings.network.NetworkSettings; @@ -22,6 +23,8 @@ import com.djrapitops.plan.system.tasks.BungeeTaskSystem; import com.djrapitops.plan.system.update.VersionCheckSystem; import com.djrapitops.plugin.api.utility.log.Log; +import java.util.function.Supplier; + /** * Represents PlanSystem for PlanBungee. * @@ -34,10 +37,12 @@ public class BungeeSystem extends PlanSystem { Log.setErrorManager(new PlanErrorManager()); - versionCheckSystem = new VersionCheckSystem(plugin.getVersion()); + Supplier localeSupplier = () -> getLocaleSystem().getLocale(); + + versionCheckSystem = new VersionCheckSystem(plugin.getVersion(), localeSupplier); fileSystem = new FileSystem(plugin); configSystem = new BungeeConfigSystem(); - databaseSystem = new BungeeDBSystem(); + databaseSystem = new BungeeDBSystem(localeSupplier); cacheSystem = new BungeeCacheSystem(this); listenerSystem = new BungeeListenerSystem(plugin); taskSystem = new BungeeTaskSystem(plugin); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/PlanSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/PlanSystem.java index 536f084e5..a62975d40 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/PlanSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/PlanSystem.java @@ -13,6 +13,8 @@ import com.djrapitops.plan.system.file.FileSystem; import com.djrapitops.plan.system.info.InfoSystem; import com.djrapitops.plan.system.info.server.ServerInfo; import com.djrapitops.plan.system.listeners.ListenerSystem; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.LocaleSystem; import com.djrapitops.plan.system.processing.Processing; import com.djrapitops.plan.system.settings.config.ConfigSystem; import com.djrapitops.plan.system.tasks.TaskSystem; @@ -22,6 +24,8 @@ import com.djrapitops.plugin.api.Check; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.utilities.Verify; +import java.util.function.Supplier; + /** * PlanSystem contains everything Plan needs to run. *

@@ -36,6 +40,7 @@ public abstract class PlanSystem implements SubSystem { // Initialized in this class private Processing processing; protected final WebServerSystem webServerSystem; + protected final LocaleSystem localeSystem; protected CacheSystem cacheSystem; // These need to be initialized in the sub class. @@ -55,8 +60,11 @@ public abstract class PlanSystem implements SubSystem { protected PlanAPI planAPI; public PlanSystem() { - processing = new Processing(); - webServerSystem = new WebServerSystem(); + Supplier localeSupplier = () -> getLocaleSystem().getLocale(); + + processing = new Processing(localeSupplier); + webServerSystem = new WebServerSystem(localeSupplier); + localeSystem = new LocaleSystem(); cacheSystem = new CacheSystem(this); } @@ -80,9 +88,10 @@ public abstract class PlanSystem implements SubSystem { public void enable() throws EnableException { checkSubSystemInitialization(); - SubSystem[] systems = new SubSystem[]{ + enableSystems( fileSystem, configSystem, + localeSystem, versionCheckSystem, databaseSystem, webServerSystem, @@ -93,7 +102,10 @@ public abstract class PlanSystem implements SubSystem { listenerSystem, taskSystem, hookHandler - }; + ); + } + + private void enableSystems(SubSystem... systems) throws EnableException { for (SubSystem system : systems) { system.enable(); } @@ -101,7 +113,7 @@ public abstract class PlanSystem implements SubSystem { @Override public void disable() { - SubSystem[] systems = new SubSystem[]{ + disableSystems( taskSystem, hookHandler, cacheSystem, @@ -111,10 +123,14 @@ public abstract class PlanSystem implements SubSystem { webServerSystem, infoSystem, serverInfo, + localeSystem, configSystem, fileSystem, versionCheckSystem - }; + ); + } + + private void disableSystems(SubSystem... systems) { for (SubSystem system : systems) { try { if (system != null) { @@ -131,6 +147,7 @@ public abstract class PlanSystem implements SubSystem { Verify.nullCheck(versionCheckSystem, () -> new IllegalStateException("Version Check system was not initialized.")); Verify.nullCheck(fileSystem, () -> new IllegalStateException("File system was not initialized.")); Verify.nullCheck(configSystem, () -> new IllegalStateException("Config system was not initialized.")); + Verify.nullCheck(localeSystem, () -> new IllegalStateException("Locale system was not initialized.")); Verify.nullCheck(databaseSystem, () -> new IllegalStateException("Database system was not initialized.")); Verify.nullCheck(infoSystem, () -> new IllegalStateException("Info system was not initialized.")); Verify.nullCheck(serverInfo, () -> new IllegalStateException("ServerInfo was not initialized.")); @@ -200,4 +217,8 @@ public abstract class PlanSystem implements SubSystem { static void setTestSystem(PlanSystem testSystem) { PlanSystem.testSystem = testSystem; } + + public LocaleSystem getLocaleSystem() { + return localeSystem; + } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/SpongeSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/SpongeSystem.java index 74d7dd87d..2dd82a5a7 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/SpongeSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/SpongeSystem.java @@ -14,6 +14,7 @@ import com.djrapitops.plan.system.file.FileSystem; import com.djrapitops.plan.system.info.ServerInfoSystem; import com.djrapitops.plan.system.info.server.SpongeServerInfo; import com.djrapitops.plan.system.listeners.SpongeListenerSystem; +import com.djrapitops.plan.system.locale.Locale; import com.djrapitops.plan.system.settings.PlanErrorManager; import com.djrapitops.plan.system.settings.config.SpongeConfigSystem; import com.djrapitops.plan.system.settings.network.NetworkSettings; @@ -22,6 +23,8 @@ import com.djrapitops.plan.system.update.VersionCheckSystem; import com.djrapitops.plugin.StaticHolder; import com.djrapitops.plugin.api.utility.log.Log; +import java.util.function.Supplier; + /** * Represents PlanSystem for PlanSponge. * @@ -32,16 +35,18 @@ public class SpongeSystem extends PlanSystem implements ServerSystem { public SpongeSystem(PlanSponge plugin) { setTestSystem(this); + Supplier localeSupplier = () -> getLocaleSystem().getLocale(); + Log.setErrorManager(new PlanErrorManager()); - versionCheckSystem = new VersionCheckSystem(plugin.getVersion()); + versionCheckSystem = new VersionCheckSystem(plugin.getVersion(), localeSupplier); fileSystem = new FileSystem(plugin); configSystem = new SpongeConfigSystem(); - databaseSystem = new ServerDBSystem(); + databaseSystem = new ServerDBSystem(localeSupplier); listenerSystem = new SpongeListenerSystem(plugin); taskSystem = new SpongeTaskSystem(plugin); - infoSystem = new ServerInfoSystem(); + infoSystem = new ServerInfoSystem(localeSupplier); serverInfo = new SpongeServerInfo(); hookHandler = new HookHandler(); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/cache/BungeeCacheSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/cache/BungeeCacheSystem.java index 3babf2a10..cdb559730 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/cache/BungeeCacheSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/cache/BungeeCacheSystem.java @@ -12,7 +12,7 @@ import com.djrapitops.plan.system.PlanSystem; public class BungeeCacheSystem extends CacheSystem { public BungeeCacheSystem(PlanSystem system) { - super(new BungeeDataCache(system)); + super(new BungeeDataCache(system), system); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/cache/CacheSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/cache/CacheSystem.java index 41b57d069..7c8467631 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/cache/CacheSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/cache/CacheSystem.java @@ -7,6 +7,9 @@ package com.djrapitops.plan.system.cache; import com.djrapitops.plan.api.exceptions.EnableException; import com.djrapitops.plan.system.PlanSystem; import com.djrapitops.plan.system.SubSystem; +import com.djrapitops.plugin.api.TimeAmount; +import com.djrapitops.plugin.task.AbsRunnable; +import com.djrapitops.plugin.task.RunnableFactory; import com.djrapitops.plugin.utilities.Verify; /** @@ -18,14 +21,16 @@ public class CacheSystem implements SubSystem { private final DataCache dataCache; private final GeolocationCache geolocationCache; + private final DataContainerCache dataContainerCache; public CacheSystem(PlanSystem system) { - this(new DataCache(system)); + this(new DataCache(system), system); } - protected CacheSystem(DataCache dataCache) { + protected CacheSystem(DataCache dataCache, PlanSystem system) { this.dataCache = dataCache; - geolocationCache = new GeolocationCache(); + geolocationCache = new GeolocationCache(() -> system.getLocaleSystem().getLocale()); + dataContainerCache = new DataContainerCache(); } public static CacheSystem getInstance() { @@ -39,11 +44,18 @@ public class CacheSystem implements SubSystem { dataCache.enable(); geolocationCache.enable(); + RunnableFactory.createNew("DataContainer cache clean task", new AbsRunnable() { + @Override + public void run() { + dataContainerCache.clear(); + } + }).runTaskTimerAsynchronously(TimeAmount.MINUTE.ticks(), TimeAmount.MINUTE.ms()); } @Override public void disable() { geolocationCache.clearCache(); + dataContainerCache.clear(); } public DataCache getDataCache() { @@ -53,4 +65,8 @@ public class CacheSystem implements SubSystem { public GeolocationCache getGeolocationCache() { return geolocationCache; } + + public DataContainerCache getDataContainerCache() { + return dataContainerCache; + } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/cache/DataContainerCache.java b/Plan/src/main/java/com/djrapitops/plan/system/cache/DataContainerCache.java new file mode 100644 index 000000000..fba38e52e --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/cache/DataContainerCache.java @@ -0,0 +1,71 @@ +package com.djrapitops.plan.system.cache; + +import com.djrapitops.plan.data.store.Key; +import com.djrapitops.plan.data.store.containers.AnalysisContainer; +import com.djrapitops.plan.data.store.containers.DataContainer; +import com.djrapitops.plan.data.store.containers.NetworkContainer; +import com.djrapitops.plan.data.store.containers.PlayerContainer; +import com.djrapitops.plan.system.database.databases.Database; +import com.djrapitops.plugin.api.TimeAmount; + +import java.util.UUID; +import java.util.function.Supplier; + +/** + * Cache to aid Bungee in case SQL is causing cpu thread starvation, leading to mysql connection drops. + * + * @author Rsl1122 + */ +public class DataContainerCache extends DataContainer { + + public DataContainerCache() { + super(TimeAmount.SECOND.ms() * 10L); + + putSupplier(Keys.NETWORK_CONTAINER, Suppliers.NETWORK_CONTAINER); + } + + public PlayerContainer getPlayerContainer(UUID uuid) { + return getAndCacheSupplier(Keys.playerContainer(uuid), Suppliers.playerContainer(uuid)); + } + + public AnalysisContainer getAnalysisContainer(UUID serverUUID) { + return getAndCacheSupplier(Keys.analysisContainer(serverUUID), Suppliers.analysisContainer(serverUUID)); + } + + public T getAndCacheSupplier(Key key, Supplier ifNotPresent) { + if (!supports(key)) { + putSupplier(key, ifNotPresent); + } + return getUnsafe(key); + } + + public NetworkContainer getNetworkContainer() { + return getAndCacheSupplier(Keys.NETWORK_CONTAINER, Suppliers.NETWORK_CONTAINER); + } + + public static class Keys { + static final Key NETWORK_CONTAINER = new Key<>(NetworkContainer.class, "NETWORK_CONTAINER"); + + static Key analysisContainer(UUID serverUUID) { + return new Key<>(AnalysisContainer.class, "ANALYSIS_CONTAINER:" + serverUUID); + } + + static Key playerContainer(UUID uuid) { + return new Key<>(PlayerContainer.class, "PLAYER_CONTAINER:" + uuid); + } + + } + + public static class Suppliers { + static final Supplier NETWORK_CONTAINER = () -> Database.getActive().fetch().getNetworkContainer(); + + static Supplier analysisContainer(UUID serverUUID) { + return () -> new AnalysisContainer(Database.getActive().fetch().getServerContainer(serverUUID)); + } + + static Supplier playerContainer(UUID uuid) { + return () -> Database.getActive().fetch().getPlayerContainer(uuid); + } + } + +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/cache/GeolocationCache.java b/Plan/src/main/java/com/djrapitops/plan/system/cache/GeolocationCache.java index 8207fcc44..270d4510b 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/cache/GeolocationCache.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/cache/GeolocationCache.java @@ -3,6 +3,8 @@ package com.djrapitops.plan.system.cache; import com.djrapitops.plan.api.exceptions.EnableException; import com.djrapitops.plan.system.SubSystem; import com.djrapitops.plan.system.file.FileSystem; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.PluginLang; import com.djrapitops.plan.system.settings.Settings; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.utilities.Verify; @@ -21,6 +23,7 @@ import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; import java.util.HashMap; import java.util.Map; +import java.util.function.Supplier; import java.util.zip.GZIPInputStream; /** @@ -33,10 +36,12 @@ import java.util.zip.GZIPInputStream; */ public class GeolocationCache implements SubSystem { + private final Supplier locale; private final Map geolocationCache; private File geolocationDB; - public GeolocationCache() { + public GeolocationCache(Supplier locale) { + this.locale = locale; geolocationCache = new HashMap<>(); } @@ -47,10 +52,12 @@ public class GeolocationCache implements SubSystem { try { GeolocationCache.checkDB(); } catch (UnknownHostException e) { - Log.error("Plan Requires internet access on first run to download GeoLite2 Geolocation database."); + Log.error(locale.get().getString(PluginLang.ENABLE_NOTIFY_GEOLOCATIONS_INTERNET_REQUIRED)); } catch (IOException e) { - throw new EnableException("Something went wrong saving the downloaded GeoLite2 Geolocation database", e); + throw new EnableException(locale.get().getString(PluginLang.ENABLE_FAIL_GEODB_WRITE), e); } + } else { + Log.infoColor("§e" + locale.get().getString(PluginLang.ENABLE_NOTIFY_GEOLOCATIONS_DISABLED)); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/cache/SessionCache.java b/Plan/src/main/java/com/djrapitops/plan/system/cache/SessionCache.java index dbd86adee..e195c7bdc 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/cache/SessionCache.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/cache/SessionCache.java @@ -58,10 +58,6 @@ public class SessionCache { return Optional.ofNullable(activeSessions.get(uuid)); } - public static boolean isOnline(UUID uuid) { - return getCachedSession(uuid).isPresent(); - } - public void cacheSession(UUID uuid, Session session) { if (getCachedSession(uuid).isPresent()) { endSession(uuid, System.currentTimeMillis()); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/BungeeDBSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/database/BungeeDBSystem.java index 0493412a9..2cc2534b3 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/BungeeDBSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/BungeeDBSystem.java @@ -6,6 +6,9 @@ package com.djrapitops.plan.system.database; import com.djrapitops.plan.api.exceptions.database.DBInitException; import com.djrapitops.plan.system.database.databases.sql.MySQLDB; +import com.djrapitops.plan.system.locale.Locale; + +import java.util.function.Supplier; /** * Bungee Database system that initializes MySQL object. @@ -14,9 +17,13 @@ import com.djrapitops.plan.system.database.databases.sql.MySQLDB; */ public class BungeeDBSystem extends DBSystem { + public BungeeDBSystem(Supplier locale) { + super(locale); + } + @Override protected void initDatabase() throws DBInitException { - db = new MySQLDB(); + db = new MySQLDB(locale); databases.add(db); db.init(); } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/DBSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/database/DBSystem.java index ebd257400..21eb8bfca 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/DBSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/DBSystem.java @@ -10,14 +10,15 @@ import com.djrapitops.plan.api.exceptions.database.DBInitException; import com.djrapitops.plan.system.PlanSystem; import com.djrapitops.plan.system.SubSystem; import com.djrapitops.plan.system.database.databases.Database; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.PluginLang; import com.djrapitops.plugin.api.Benchmark; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.utilities.Verify; import java.util.HashSet; import java.util.Set; +import java.util.function.Supplier; /** * System that holds the active databases. @@ -26,10 +27,13 @@ import java.util.Set; */ public abstract class DBSystem implements SubSystem { + protected final Supplier locale; + protected Database db; protected Set databases; - public DBSystem() { + public DBSystem(Supplier locale) { + this.locale = locale; databases = new HashSet<>(); } @@ -39,20 +43,16 @@ public abstract class DBSystem implements SubSystem { return dbSystem; } - @Override - public void enable() throws EnableException { - try { - Benchmark.start("Init Database"); - Log.info(Locale.get(Msg.ENABLE_DB_INIT).toString()); - initDatabase(); - db.scheduleClean(1L); - Log.info(Locale.get(Msg.ENABLE_DB_INFO).parse(db.getConfigName())); - Benchmark.stop("Enable", "Init Database"); - } catch (DBInitException e) { - Throwable cause = e.getCause(); - String message = cause == null ? e.getMessage() : cause.getMessage(); - throw new EnableException((db != null ? db.getName() : "Database") + " init failure: " + message, cause); + public static Database getActiveDatabaseByName(String dbName) throws DBInitException { + DBSystem system = getInstance(); + for (Database database : system.getDatabases()) { + String dbConfigName = database.getConfigName(); + if (Verify.equalsIgnoreCase(dbName, dbConfigName)) { + database.init(); + return database; + } } + throw new DBInitException(system.locale.get().getString(PluginLang.ENABLE_FAIL_WRONG_DB, dbName)); } protected abstract void initDatabase() throws DBInitException; @@ -76,15 +76,19 @@ public abstract class DBSystem implements SubSystem { return db; } - public static Database getActiveDatabaseByName(String dbName) throws DBInitException { - for (Database database : getInstance().getDatabases()) { - String dbConfigName = database.getConfigName(); - if (Verify.equalsIgnoreCase(dbName, dbConfigName)) { - database.init(); - return database; - } + @Override + public void enable() throws EnableException { + try { + Benchmark.start("Init Database"); + initDatabase(); + db.scheduleClean(1L); + Log.info(locale.get().getString(PluginLang.ENABLED_DATABASE, db.getName())); + Benchmark.stop("Enable", "Init Database"); + } catch (DBInitException e) { + Throwable cause = e.getCause(); + String message = cause == null ? e.getMessage() : cause.getMessage(); + throw new EnableException((db != null ? db.getName() : "Database") + " init failure: " + message, cause); } - throw new DBInitException(Locale.get(Msg.ENABLE_FAIL_WRONG_DB) + " " + dbName); } public void setActiveDatabase(Database db) throws DBException { diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/ServerDBSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/database/ServerDBSystem.java index 3c2ff2b51..f04ac673b 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/ServerDBSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/ServerDBSystem.java @@ -8,9 +8,12 @@ import com.djrapitops.plan.api.exceptions.database.DBInitException; import com.djrapitops.plan.system.database.databases.sql.MySQLDB; import com.djrapitops.plan.system.database.databases.sql.SQLiteDB; import com.djrapitops.plan.system.database.databases.sql.SpongeMySQLDB; +import com.djrapitops.plan.system.locale.Locale; import com.djrapitops.plan.system.settings.Settings; import com.djrapitops.plugin.api.Check; +import java.util.function.Supplier; + /** * Bukkit Database system that initializes SQLite and MySQL database objects. * @@ -18,10 +21,14 @@ import com.djrapitops.plugin.api.Check; */ public class ServerDBSystem extends DBSystem { + public ServerDBSystem(Supplier locale) { + super(locale); + } + @Override protected void initDatabase() throws DBInitException { - databases.add(Check.isSpongeAvailable() ? new SpongeMySQLDB() : new MySQLDB()); - databases.add(new SQLiteDB()); + databases.add(Check.isSpongeAvailable() ? new SpongeMySQLDB(locale) : new MySQLDB(locale)); + databases.add(new SQLiteDB(locale)); String dbType = Settings.DB_TYPE.toString().toLowerCase().trim(); db = getActiveDatabaseByName(dbType); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/operation/CountOperations.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/operation/CountOperations.java index 49d7a5994..cc8703276 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/operation/CountOperations.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/operation/CountOperations.java @@ -6,5 +6,4 @@ public interface CountOperations { int getServerPlayerCount(UUID server); - int getNetworkPlayerCount(); } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/MySQLDB.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/MySQLDB.java index 4a84d0da4..248a4684c 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/MySQLDB.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/MySQLDB.java @@ -1,53 +1,36 @@ package com.djrapitops.plan.system.database.databases.sql; import com.djrapitops.plan.api.exceptions.database.DBInitException; +import com.djrapitops.plan.api.exceptions.database.DBOpException; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.PluginLang; import com.djrapitops.plan.system.settings.Settings; +import com.djrapitops.plugin.api.TimeAmount; import com.djrapitops.plugin.api.utility.log.Log; -import org.apache.commons.dbcp2.BasicDataSource; +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; import javax.sql.DataSource; import java.sql.Connection; import java.sql.SQLException; import java.util.Objects; +import java.util.function.Supplier; /** * @author Rsl1122 */ public class MySQLDB extends SQLDB { - protected DataSource dataSource; + private static int increment = 1; - public MySQLDB() { + protected volatile DataSource dataSource; + + public MySQLDB(Supplier locale) { + super(locale); } - /** - * Setups the {@link BasicDataSource} - */ - @Override - public void setupDataSource() throws DBInitException { - BasicDataSource dataSource = new BasicDataSource(); - this.dataSource = dataSource; - dataSource.setDriverClassName("com.mysql.jdbc.Driver"); - - String host = Settings.DB_HOST.toString(); - String port = Integer.toString(Settings.DB_PORT.getNumber()); - String database = Settings.DB_DATABASE.toString(); - String launchOptions = Settings.DB_LAUNCH_OPTIONS.toString(); - if (launchOptions.isEmpty() || !launchOptions.startsWith("?") || launchOptions.endsWith("&")) { - Log.error("Launch Options were faulty, using default (?rewriteBatchedStatements=true&useSSL=false)"); - launchOptions = "?rewriteBatchedStatements=true&useSSL=false"; - } - - dataSource.setUrl("jdbc:mysql://" + host + ":" + port + "/" + database + launchOptions); - - String username = Settings.DB_USER.toString(); - String password = Settings.DB_PASS.toString(); - - dataSource.setUsername(username); - dataSource.setPassword(password); - - dataSource.setInitialSize(1); - dataSource.setMaxTotal(8); + private static synchronized void increment() { + increment++; } /** @@ -58,21 +41,87 @@ public class MySQLDB extends SQLDB { return "MySQL"; } + /** + * Setups the {@link HikariDataSource} + */ + @Override + public void setupDataSource() throws DBInitException { + try { + HikariConfig config = new HikariConfig(); + + String host = Settings.DB_HOST.toString(); + String port = Integer.toString(Settings.DB_PORT.getNumber()); + String database = Settings.DB_DATABASE.toString(); + String launchOptions = Settings.DB_LAUNCH_OPTIONS.toString(); + if (launchOptions.isEmpty() || !launchOptions.startsWith("?") || launchOptions.endsWith("&")) { + launchOptions = "?rewriteBatchedStatements=true&useSSL=false"; + Log.error(locale.get().getString(PluginLang.DB_MYSQL_LAUNCH_OPTIONS_FAIL, launchOptions)); + } + config.setJdbcUrl("jdbc:mysql://" + host + ":" + port + "/" + database + launchOptions); + + String username = Settings.DB_USER.toString(); + String password = Settings.DB_PASS.toString(); + + config.setUsername(username); + config.setPassword(password); + + config.setPoolName("Plan Connection Pool-" + increment); + increment(); + + config.setAutoCommit(true); + config.setMaximumPoolSize(8); + config.setMaxLifetime(25L * TimeAmount.MINUTE.ms()); + config.setLeakDetectionThreshold(10L * TimeAmount.MINUTE.ms()); + + this.dataSource = new HikariDataSource(config); + + getConnection(); + } catch (SQLException e) { + throw new DBInitException("Failed to set-up HikariCP Datasource: " + e.getMessage(), e); + } + } + @Override public Connection getConnection() throws SQLException { - return dataSource.getConnection(); + Connection connection = dataSource.getConnection(); + if (!connection.isValid(5)) { + connection.close(); + if (dataSource instanceof HikariDataSource) { + ((HikariDataSource) dataSource).close(); + } + try { + setupDataSource(); + // get new connection after restarting pool + return dataSource.getConnection(); + } catch (DBInitException e) { + throw new DBOpException("Failed to restart DataSource after a connection was invalid: " + e.getMessage(), e); + } + } + return connection; } @Override public void close() { + if (dataSource instanceof HikariDataSource) { + ((HikariDataSource) dataSource).close(); + } + super.close(); + } + + @Override + public void returnToPool(Connection connection) { try { - if (dataSource instanceof BasicDataSource) { - ((BasicDataSource) dataSource).close(); + if (connection != null) { + connection.close(); } } catch (SQLException e) { Log.toLog(this.getClass(), e); } - super.close(); + } + + @Override + public void commit(Connection connection) { + returnToPool(connection); } @Override @@ -86,7 +135,6 @@ public class MySQLDB extends SQLDB { @Override public int hashCode() { - return Objects.hash(super.hashCode(), dataSource); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/SQLDB.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/SQLDB.java index 2b8be5e1a..2e1656591 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/SQLDB.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/SQLDB.java @@ -1,21 +1,24 @@ package com.djrapitops.plan.system.database.databases.sql; +import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.api.exceptions.database.DBInitException; import com.djrapitops.plan.api.exceptions.database.DBOpException; import com.djrapitops.plan.system.database.databases.Database; import com.djrapitops.plan.system.database.databases.operation.*; import com.djrapitops.plan.system.database.databases.sql.operation.*; +import com.djrapitops.plan.system.database.databases.sql.patches.*; import com.djrapitops.plan.system.database.databases.sql.processing.ExecStatement; import com.djrapitops.plan.system.database.databases.sql.processing.QueryStatement; import com.djrapitops.plan.system.database.databases.sql.tables.*; -import com.djrapitops.plan.system.database.databases.sql.tables.move.Version8TransferTable; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.PluginLang; import com.djrapitops.plan.system.settings.Settings; import com.djrapitops.plugin.api.TimeAmount; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.task.ITask; import com.djrapitops.plugin.task.RunnableFactory; -import org.apache.commons.dbcp2.BasicDataSource; +import com.djrapitops.plugin.utilities.Verify; import java.sql.Connection; import java.sql.PreparedStatement; @@ -24,6 +27,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; import java.util.UUID; +import java.util.function.Supplier; import java.util.stream.Collectors; /** @@ -34,6 +38,8 @@ import java.util.stream.Collectors; */ public abstract class SQLDB extends Database { + protected final Supplier locale; + private final UsersTable usersTable; private final UserInfoTable userInfoTable; private final KillsTable killsTable; @@ -42,7 +48,6 @@ public abstract class SQLDB extends Database { private final GeoInfoTable geoInfoTable; private final CommandUseTable commandUseTable; private final TPSTable tpsTable; - private final VersionTable versionTable; private final SecurityTable securityTable; private final WorldTable worldTable; private final WorldTimesTable worldTimesTable; @@ -62,10 +67,10 @@ public abstract class SQLDB extends Database { private final boolean usingMySQL; private ITask dbCleanTask; - public SQLDB() { - usingMySQL = getName().equals("MySQL"); + public SQLDB(Supplier locale) { + this.locale = locale; + usingMySQL = this instanceof MySQLDB; - versionTable = new VersionTable(this); serverTable = new ServerTable(this); securityTable = new SecurityTable(this); @@ -136,67 +141,47 @@ public abstract class SQLDB extends Database { */ public void setupDatabase() throws DBInitException { try { - boolean newDatabase = versionTable.isNewDatabase(); - - versionTable.createTable(); createTables(); - if (newDatabase) { - Log.info("New Database created."); - versionTable.setVersion(19); - } + Patch[] patches = new Patch[]{ + new Version10Patch(this), + new GeoInfoLastUsedPatch(this), + new TransferPartitionPatch(this), + new SessionAFKTimePatch(this), + new KillsServerIDPatch(this), + new WorldTimesSeverIDPatch(this), + new WorldsServerIDPatch(this), + new IPHashPatch(this), + new IPAnonPatch(this), + new NicknameLastSeenPatch(this), + new VersionTableRemovalPatch(this) + }; - int version = versionTable.getVersion(); - - final SQLDB db = this; - if (version < 10) { - RunnableFactory.createNew("DB v8 -> v10 Task", new AbsRunnable() { - @Override - public void run() { - try { - new Version8TransferTable(db).alterTablesToV10(); - } catch (DBInitException | DBOpException e) { - Log.toLog(this.getClass(), e); + RunnableFactory.createNew("Database Patch", new AbsRunnable() { + @Override + public void run() { + try { + boolean applied = false; + for (Patch patch : patches) { + if (!patch.hasBeenApplied()) { + String patchName = patch.getClass().getSimpleName(); + Log.info(locale.get().getString(PluginLang.DB_APPLY_PATCH, patchName)); + patch.apply(); + applied = true; + } } + Log.info(locale.get().getString( + applied ? PluginLang.DB_APPLIED_PATCHES : PluginLang.DB_APPLIED_PATCHES_ALREADY + )); + } catch (Exception e) { + Log.error("----------------------------------------------------"); + Log.error(locale.get().getString(PluginLang.ENABLE_FAIL_DB_PATCH)); + Log.error("----------------------------------------------------"); + Log.toLog(this.getClass(), e); + PlanPlugin.getInstance().onDisable(); } - }).runTaskLaterAsynchronously(TimeAmount.SECOND.ticks() * 5L); - } - if (version < 11) { - serverTable.alterTableV11(); - versionTable.setVersion(11); - } - if (version < 12) { - geoInfoTable.alterTableV12(); - versionTable.setVersion(12); - } - if (version < 13) { - geoInfoTable.alterTableV13(); - versionTable.setVersion(13); - } - if (version < 14) { - transferTable.alterTableV14(); - versionTable.setVersion(14); - } - if (version < 15) { - sessionsTable.alterTableV15(); - versionTable.setVersion(15); - } - if (version < 16) { - killsTable.alterTableV16(); - worldTimesTable.alterTableV16(); - versionTable.setVersion(16); - } - if (version < 17) { - geoInfoTable.alterTableV17(); - versionTable.setVersion(17); - } - if (version < 18) { - geoInfoTable.alterTableV18(); - // version set in the runnable in above method - } - if (version < 19) { - nicknamesTable.alterTableV19(); - } + } + }).runTaskLaterAsynchronously(TimeAmount.SECOND.ticks() * 5L); } catch (DBOpException e) { throw new DBInitException("Failed to set-up Database", e); } @@ -241,9 +226,6 @@ public abstract class SQLDB extends Database { }; } - /** - * Setups the {@link BasicDataSource} - */ public abstract void setupDataSource() throws DBInitException; @Override @@ -254,18 +236,9 @@ public abstract class SQLDB extends Database { } } - public int getVersion() { - return versionTable.getVersion(); - } - - public void setVersion(int version) { - versionTable.setVersion(version); - } - private void clean() { tpsTable.clean(); transferTable.clean(); - geoInfoTable.clean(); pingTable.clean(); long now = System.currentTimeMillis(); @@ -280,40 +253,15 @@ public abstract class SQLDB extends Database { } int removed = inactivePlayers.size(); if (removed > 0) { - Log.info("Removed data of " + removed + " players."); + Log.info(locale.get().getString(PluginLang.DB_NOTIFY_CLEAN, removed)); } } public abstract Connection getConnection() throws SQLException; - /** - * Commits changes to the .db file when using SQLite Database. - *

- * MySQL has Auto Commit enabled. - */ - public void commit(Connection connection) { - try { - if (!usingMySQL) { - connection.commit(); - } - } catch (SQLException e) { - if (!e.getMessage().contains("cannot commit")) { - Log.toLog(this.getClass(), e); - } - } finally { - returnToPool(connection); - } - } + public abstract void commit(Connection connection); - public void returnToPool(Connection connection) { - try { - if (usingMySQL && connection != null) { - connection.close(); - } - } catch (SQLException e) { - Log.toLog(this.getClass(), e); - } - } + public abstract void returnToPool(Connection connection); /** * Reverts transaction when using SQLite Database. @@ -344,6 +292,28 @@ public abstract class SQLDB extends Database { } } + public boolean execute(String sql) { + return execute(new ExecStatement(sql) { + @Override + public void prepare(PreparedStatement statement) { + // Statement is ready for execution. + } + }); + } + + public void executeUnsafe(String... statements) { + Verify.nullCheck(statements); + for (String statement : statements) { + try { + execute(statement); + } catch (DBOpException e) { + if (Settings.DEV_MODE.isTrue()) { + Log.toLog(this.getClass(), e); + } + } + } + } + public void executeBatch(ExecStatement statement) { Connection connection = null; try { diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/SQLiteDB.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/SQLiteDB.java index a035f4304..3890c0e93 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/SQLiteDB.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/SQLiteDB.java @@ -2,16 +2,18 @@ package com.djrapitops.plan.system.database.databases.sql; import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.api.exceptions.database.DBInitException; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.PluginLang; import com.djrapitops.plan.utilities.MiscUtils; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.task.ITask; import com.djrapitops.plugin.task.RunnableFactory; -import org.apache.commons.dbcp2.BasicDataSource; import java.io.File; import java.sql.*; import java.util.Objects; +import java.util.function.Supplier; /** * @author Rsl1122 @@ -23,25 +25,20 @@ public class SQLiteDB extends SQLDB { private Connection connection; private ITask connectionPingTask; - /** - * Class Constructor. - */ - public SQLiteDB() { - this("database"); + public SQLiteDB(Supplier locale) { + this("database", locale); } - public SQLiteDB(String dbName) { - this(new File(PlanPlugin.getInstance().getDataFolder(), dbName + ".db")); + public SQLiteDB(String dbName, Supplier locale) { + this(new File(PlanPlugin.getInstance().getDataFolder(), dbName + ".db"), locale); } - public SQLiteDB(File databaseFile) { + public SQLiteDB(File databaseFile, Supplier locale) { + super(locale); dbName = databaseFile.getName(); this.databaseFile = databaseFile; } - /** - * Setups the {@link BasicDataSource} - */ @Override public void setupDataSource() throws DBInitException { try { @@ -72,7 +69,7 @@ public class SQLiteDB extends SQLDB { try { return DriverManager.getConnection("jdbc:sqlite:" + dbFilePath + "?journal_mode=WAL"); } catch (SQLException ignored) { - Log.info("SQLite WAL mode not supported on this server version, using default. This may or may not affect performance."); + Log.info(locale.get().getString(PluginLang.DB_NOTIFY_SQLITE_WAL)); return DriverManager.getConnection("jdbc:sqlite:" + dbFilePath); } } @@ -92,7 +89,7 @@ public class SQLiteDB extends SQLDB { resultSet = statement.executeQuery("/* ping */ SELECT 1"); } } catch (SQLException e) { - Log.debug("Something went wrong during Ping task."); + Log.debug("Something went wrong during SQLite Connection upkeep task."); try { connection = getNewConnection(databaseFile); } catch (SQLException e1) { @@ -144,6 +141,22 @@ public class SQLiteDB extends SQLDB { super.close(); } + @Override + public void commit(Connection connection) { + try { + connection.commit(); + } catch (SQLException e) { + if (!e.getMessage().contains("cannot commit")) { + Log.toLog(this.getClass(), e); + } + } + } + + @Override + public void returnToPool(Connection connection) { + // Connection pool not in use, no action required. + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -155,7 +168,6 @@ public class SQLiteDB extends SQLDB { @Override public int hashCode() { - return Objects.hash(super.hashCode(), dbName); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/SpongeMySQLDB.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/SpongeMySQLDB.java index f1fcb6b4d..7a9409d6b 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/SpongeMySQLDB.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/SpongeMySQLDB.java @@ -1,6 +1,7 @@ package com.djrapitops.plan.system.database.databases.sql; import com.djrapitops.plan.api.exceptions.database.DBInitException; +import com.djrapitops.plan.system.locale.Locale; import com.djrapitops.plan.system.settings.Settings; import com.djrapitops.plugin.api.utility.log.Log; import org.spongepowered.api.Sponge; @@ -9,6 +10,7 @@ import org.spongepowered.api.service.sql.SqlService; import java.sql.Connection; import java.sql.SQLException; import java.util.Optional; +import java.util.function.Supplier; /** * MySQLDB implementation for Sponge since default driver is not available. @@ -17,6 +19,10 @@ import java.util.Optional; */ public class SpongeMySQLDB extends MySQLDB { + public SpongeMySQLDB(Supplier locale) { + super(locale); + } + @Override public void setupDataSource() throws DBInitException { Optional sqlServiceProvider = Sponge.getServiceManager().provide(SqlService.class); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/operation/SQLCountOps.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/operation/SQLCountOps.java index 6faad1a66..874f65d12 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/operation/SQLCountOps.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/operation/SQLCountOps.java @@ -16,8 +16,4 @@ public class SQLCountOps extends SQLOps implements CountOperations { return userInfoTable.getServerUserCount(server); } - @Override - public int getNetworkPlayerCount() { - return usersTable.getPlayerCount(); - } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/GeoInfoLastUsedPatch.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/GeoInfoLastUsedPatch.java new file mode 100644 index 000000000..80b0d2ef5 --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/GeoInfoLastUsedPatch.java @@ -0,0 +1,23 @@ +package com.djrapitops.plan.system.database.databases.sql.patches; + +import com.djrapitops.plan.system.database.databases.sql.SQLDB; +import com.djrapitops.plan.system.database.databases.sql.tables.GeoInfoTable; + +public class GeoInfoLastUsedPatch extends Patch { + + public GeoInfoLastUsedPatch(SQLDB db) { + super(db); + } + + @Override + public boolean hasBeenApplied() { + return hasColumn(GeoInfoTable.TABLE_NAME, GeoInfoTable.Col.LAST_USED.get()); + } + + @Override + public void apply() { + addColumns(GeoInfoTable.TABLE_NAME, + GeoInfoTable.Col.LAST_USED + " bigint NOT NULL DEFAULT 0" + ); + } +} diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/IPAnonPatch.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/IPAnonPatch.java new file mode 100644 index 000000000..353c2153a --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/IPAnonPatch.java @@ -0,0 +1,102 @@ +package com.djrapitops.plan.system.database.databases.sql.patches; + +import com.djrapitops.plan.api.exceptions.database.DBInitException; +import com.djrapitops.plan.api.exceptions.database.DBOpException; +import com.djrapitops.plan.data.container.GeoInfo; +import com.djrapitops.plan.system.database.databases.sql.SQLDB; +import com.djrapitops.plan.system.database.databases.sql.processing.ExecStatement; +import com.djrapitops.plan.system.database.databases.sql.processing.QueryStatement; +import com.djrapitops.plan.system.database.databases.sql.tables.GeoInfoTable; +import com.djrapitops.plan.system.database.databases.sql.tables.move.Version18TransferTable; +import com.djrapitops.plan.system.settings.Settings; +import com.djrapitops.plugin.api.utility.log.Log; + +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.security.NoSuchAlgorithmException; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public class IPAnonPatch extends Patch { + + public IPAnonPatch(SQLDB db) { + super(db); + } + + @Override + public boolean hasBeenApplied() { + String sql = "SELECT * FROM " + GeoInfoTable.TABLE_NAME + + " WHERE " + GeoInfoTable.Col.IP + " NOT LIKE ? LIMIT 1"; + + return query(new QueryStatement(sql) { + @Override + public void prepare(PreparedStatement statement) throws SQLException { + statement.setString(1, "%x%"); + } + + @Override + public Boolean processResults(ResultSet set) throws SQLException { + return !set.next(); + } + }); + } + + @Override + public void apply() { + Map> allGeoInfo = db.getGeoInfoTable().getAllGeoInfo(); + anonymizeIPs(allGeoInfo); + groupHashedIPs(); + } + + private void anonymizeIPs(Map> allGeoInfo) { + String sql = "UPDATE " + GeoInfoTable.TABLE_NAME + " SET " + + GeoInfoTable.Col.IP + "=?, " + + GeoInfoTable.Col.IP_HASH + "=? " + + "WHERE " + GeoInfoTable.Col.IP + "=?"; + + db.executeBatch(new ExecStatement(sql) { + @Override + public void prepare(PreparedStatement statement) throws SQLException { + for (List geoInfos : allGeoInfo.values()) { + for (GeoInfo geoInfo : geoInfos) { + addToBatch(statement, geoInfo); + } + } + } + + private void addToBatch(PreparedStatement statement, GeoInfo geoInfo) throws SQLException { + try { + String oldIP = geoInfo.getIp(); + if (oldIP.endsWith(".xx.xx") || oldIP.endsWith("xx..")) { + return; + } + GeoInfo updatedInfo = new GeoInfo( + InetAddress.getByName(oldIP), + geoInfo.getGeolocation(), + geoInfo.getDate() + ); + statement.setString(1, updatedInfo.getIp()); + statement.setString(2, updatedInfo.getIpHash()); + statement.setString(3, geoInfo.getIp()); + statement.addBatch(); + } catch (UnknownHostException | NoSuchAlgorithmException e) { + if (Settings.DEV_MODE.isTrue()) { + Log.toLog(this.getClass(), e); + } + } + } + }); + } + + private void groupHashedIPs() { + try { + new Version18TransferTable(db).alterTableV18(); + } catch (DBInitException e) { + throw new DBOpException(e.getMessage(), e); + } + } +} diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/IPHashPatch.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/IPHashPatch.java new file mode 100644 index 000000000..a83134639 --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/IPHashPatch.java @@ -0,0 +1,21 @@ +package com.djrapitops.plan.system.database.databases.sql.patches; + +import com.djrapitops.plan.system.database.databases.sql.SQLDB; +import com.djrapitops.plan.system.database.databases.sql.tables.GeoInfoTable; + +public class IPHashPatch extends Patch { + + public IPHashPatch(SQLDB db) { + super(db); + } + + @Override + public boolean hasBeenApplied() { + return hasColumn(GeoInfoTable.TABLE_NAME, GeoInfoTable.Col.IP_HASH.get()); + } + + @Override + public void apply() { + addColumns(GeoInfoTable.Col.IP_HASH.get() + " varchar(200) DEFAULT ''"); + } +} diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/KillsServerIDPatch.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/KillsServerIDPatch.java new file mode 100644 index 000000000..e6832a7fd --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/KillsServerIDPatch.java @@ -0,0 +1,64 @@ +package com.djrapitops.plan.system.database.databases.sql.patches; + +import com.djrapitops.plan.system.database.databases.sql.SQLDB; +import com.djrapitops.plan.system.database.databases.sql.processing.ExecStatement; +import com.djrapitops.plan.system.database.databases.sql.processing.QueryStatement; +import com.djrapitops.plan.system.database.databases.sql.tables.KillsTable; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +public class KillsServerIDPatch extends Patch { + + public KillsServerIDPatch(SQLDB db) { + super(db); + } + + @Override + public boolean hasBeenApplied() { + String tableName = KillsTable.TABLE_NAME; + String columnName = KillsTable.Col.SERVER_ID.get(); + return hasColumn(tableName, columnName) && allValuesHaveServerID(tableName, columnName); + } + + private Boolean allValuesHaveServerID(String tableName, String columnName) { + String sql = "SELECT * FROM " + tableName + " WHERE " + columnName + "=? LIMIT 1"; + return query(new QueryStatement(sql) { + @Override + public void prepare(PreparedStatement statement) throws SQLException { + statement.setInt(1, 0); + } + + @Override + public Boolean processResults(ResultSet set) throws SQLException { + return !set.next(); + } + }); + } + + @Override + public void apply() { + addColumns(KillsTable.Col.SERVER_ID + " integer NOT NULL DEFAULT 0"); + + Map sessionIDServerIDRelation = db.getSessionsTable().getIDServerIDRelation(); + + String sql = "UPDATE " + KillsTable.TABLE_NAME + " SET " + + KillsTable.Col.SERVER_ID + "=?" + + " WHERE " + KillsTable.Col.SESSION_ID + "=?"; + + db.executeBatch(new ExecStatement(sql) { + @Override + public void prepare(PreparedStatement statement) throws SQLException { + for (Map.Entry entry : sessionIDServerIDRelation.entrySet()) { + Integer sessionID = entry.getKey(); + Integer serverID = entry.getValue(); + statement.setInt(1, serverID); + statement.setInt(2, sessionID); + statement.addBatch(); + } + } + }); + } +} diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/NicknameLastSeenPatch.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/NicknameLastSeenPatch.java new file mode 100644 index 000000000..51c6a480e --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/NicknameLastSeenPatch.java @@ -0,0 +1,99 @@ +package com.djrapitops.plan.system.database.databases.sql.patches; + +import com.djrapitops.plan.data.store.objects.Nickname; +import com.djrapitops.plan.system.database.databases.sql.SQLDB; +import com.djrapitops.plan.system.database.databases.sql.processing.ExecStatement; +import com.djrapitops.plan.system.database.databases.sql.processing.QueryAllStatement; +import com.djrapitops.plan.system.database.databases.sql.tables.GeoInfoTable; +import com.djrapitops.plan.system.database.databases.sql.tables.NicknamesTable; +import com.djrapitops.plan.system.database.databases.sql.tables.UserIDTable; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.*; + +public class NicknameLastSeenPatch extends Patch { + + public NicknameLastSeenPatch(SQLDB db) { + super(db); + } + + @Override + public boolean hasBeenApplied() { + return hasColumn(GeoInfoTable.TABLE_NAME, GeoInfoTable.Col.LAST_USED.get()); + } + + @Override + public void apply() { + addColumns(NicknamesTable.TABLE_NAME, + NicknamesTable.Col.LAST_USED + " bigint NOT NULL DEFAULT '0'" + ); + + // Create table if has failed already + db.executeUnsafe("CREATE TABLE IF NOT EXISTS plan_actions " + + "(action_id integer, date bigint, server_id integer, user_id integer, additional_info varchar(1))"); + + Map serverUUIDsByID = db.getServerTable().getServerUUIDsByID(); + Map serverIDsByUUID = new HashMap<>(); + for (Map.Entry entry : serverUUIDsByID.entrySet()) { + serverIDsByUUID.put(entry.getValue(), entry.getKey()); + } + + Map> nicknames = getNicknamesByUserID(serverUUIDsByID); + updateLastUsed(serverIDsByUUID, nicknames); + + db.executeUnsafe("DROP TABLE plan_actions"); + } + + private Map> getNicknamesByUserID(Map serverUUIDsByID) { + String fetchSQL = "SELECT * FROM plan_actions WHERE action_id=3 ORDER BY date DESC"; + return query(new QueryAllStatement>>(fetchSQL, 10000) { + @Override + public Map> processResults(ResultSet set) throws SQLException { + Map> map = new HashMap<>(); + + while (set.next()) { + long date = set.getLong("date"); + int userID = set.getInt(UserIDTable.Col.USER_ID.get()); + int serverID = set.getInt("server_id"); + UUID serverUUID = serverUUIDsByID.get(serverID); + Nickname nick = new Nickname(set.getString("additional_info"), date, serverUUID); + Set nicknames1 = map.getOrDefault(userID, new HashSet<>()); + if (serverUUID == null || nicknames1.contains(nick)) { + continue; + } + nicknames1.add(nick); + map.put(userID, nicknames1); + } + + return map; + } + }); + } + + private void updateLastUsed(Map serverIDsByUUID, Map> nicknames) { + String updateSQL = "UPDATE " + NicknamesTable.TABLE_NAME + " SET " + NicknamesTable.Col.LAST_USED + "=?" + + " WHERE " + NicknamesTable.Col.NICKNAME + "=?" + + " AND " + NicknamesTable.Col.USER_ID + "=?" + + " AND " + NicknamesTable.Col.SERVER_ID + "=?"; + + db.executeBatch(new ExecStatement(updateSQL) { + @Override + public void prepare(PreparedStatement statement) throws SQLException { + for (Map.Entry> entry : nicknames.entrySet()) { + Integer userId = entry.getKey(); + Set nicks = entry.getValue(); + for (Nickname nick : nicks) { + Integer serverID = serverIDsByUUID.get(nick.getServerUUID()); + statement.setLong(1, nick.getDate()); + statement.setString(2, nick.getName()); + statement.setInt(3, userId); + statement.setInt(4, serverID); + statement.addBatch(); + } + } + } + }); + } +} diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/Patch.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/Patch.java new file mode 100644 index 000000000..e832d00f3 --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/Patch.java @@ -0,0 +1,94 @@ +package com.djrapitops.plan.system.database.databases.sql.patches; + +import com.djrapitops.plan.system.database.databases.sql.SQLDB; +import com.djrapitops.plan.system.database.databases.sql.processing.QueryAllStatement; +import com.djrapitops.plan.system.database.databases.sql.processing.QueryStatement; +import com.djrapitops.plan.system.database.databases.sql.statements.TableSqlParser; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +public abstract class Patch { + + protected final SQLDB db; + protected final boolean usingMySQL; + + public Patch(SQLDB db) { + this.db = db; + usingMySQL = db.isUsingMySQL(); + } + + public abstract boolean hasBeenApplied(); + + public abstract void apply(); + + public T query(QueryStatement query) { + return db.query(query); + } + + public boolean hasTable(String tableName) { + String sql = usingMySQL ? + "SELECT * FROM information_schema.TABLES WHERE table_name=? LIMIT 1" : + "SELECT tbl_name FROM sqlite_master WHERE tbl_name=?"; + + return query(new QueryStatement(sql) { + @Override + public void prepare(PreparedStatement statement) throws SQLException { + statement.setString(1, tableName); + } + + @Override + public Boolean processResults(ResultSet set) throws SQLException { + return set.next(); + } + }); + } + + protected boolean hasColumn(String tableName, String columnName) { + return usingMySQL ? + query(new QueryStatement("SELECT * FROM information_schema.COLUMNS" + + " WHERE TABLE_NAME=? AND COLUMN_NAME=?") { + @Override + public void prepare(PreparedStatement statement) throws SQLException { + statement.setString(1, tableName); + statement.setString(2, columnName); + } + + @Override + public Boolean processResults(ResultSet set) throws SQLException { + return set.next(); + } + }) : + query(new QueryAllStatement("PRAGMA table_info(" + tableName + ")") { + @Override + public Boolean processResults(ResultSet set) throws SQLException { + while (set.next()) { + if (columnName.equals(set.getString("name"))) { + return true; + } + } + return false; + } + }); + } + + protected void addColumns(String tableName, String... columnInfo) { + for (int i = 0; i < columnInfo.length; i++) { + columnInfo[i] = "ALTER TABLE " + tableName + " ADD " + (usingMySQL ? "" : "COLUMN ") + columnInfo[i]; + } + db.executeUnsafe(columnInfo); + } + + protected void dropTable(String name) { + db.executeUnsafe(TableSqlParser.dropTable(name)); + } + + protected void renameTable(String from, String to) { + String sql = usingMySQL ? + "RENAME TABLE " + from + " TO " + to : + "ALTER TABLE " + from + " RENAME TO " + to; + db.execute(sql); + } + +} diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/SessionAFKTimePatch.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/SessionAFKTimePatch.java new file mode 100644 index 000000000..672780d3c --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/SessionAFKTimePatch.java @@ -0,0 +1,23 @@ +package com.djrapitops.plan.system.database.databases.sql.patches; + +import com.djrapitops.plan.system.database.databases.sql.SQLDB; +import com.djrapitops.plan.system.database.databases.sql.tables.SessionsTable; + +public class SessionAFKTimePatch extends Patch { + + public SessionAFKTimePatch(SQLDB db) { + super(db); + } + + @Override + public boolean hasBeenApplied() { + return hasColumn(SessionsTable.TABLE_NAME, SessionsTable.Col.AFK_TIME.get()); + } + + @Override + public void apply() { + addColumns(SessionsTable.TABLE_NAME, + SessionsTable.Col.AFK_TIME + " bigint NOT NULL DEFAULT 0" + ); + } +} diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/TransferPartitionPatch.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/TransferPartitionPatch.java new file mode 100644 index 000000000..147d8e47a --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/TransferPartitionPatch.java @@ -0,0 +1,21 @@ +package com.djrapitops.plan.system.database.databases.sql.patches; + +import com.djrapitops.plan.system.database.databases.sql.SQLDB; +import com.djrapitops.plan.system.database.databases.sql.tables.TransferTable; + +public class TransferPartitionPatch extends Patch { + + public TransferPartitionPatch(SQLDB db) { + super(db); + } + + @Override + public boolean hasBeenApplied() { + return hasColumn(TransferTable.TABLE_NAME, TransferTable.Col.PART.get()); + } + + @Override + public void apply() { + addColumns(TransferTable.TABLE_NAME, TransferTable.Col.PART + " bigint NOT NULL DEFAULT 0"); + } +} diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/move/Version8TransferTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/Version10Patch.java similarity index 59% rename from Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/move/Version8TransferTable.java rename to Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/Version10Patch.java index 4ad5ea12f..e55f65eb7 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/move/Version8TransferTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/Version10Patch.java @@ -1,10 +1,7 @@ -/* - * License is provided in the jar as LICENSE also here: - * https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/LICENSE - */ -package com.djrapitops.plan.system.database.databases.sql.tables.move; +package com.djrapitops.plan.system.database.databases.sql.patches; import com.djrapitops.plan.api.exceptions.database.DBInitException; +import com.djrapitops.plan.api.exceptions.database.DBOpException; import com.djrapitops.plan.system.database.databases.sql.SQLDB; import com.djrapitops.plan.system.database.databases.sql.tables.*; import com.djrapitops.plan.system.info.server.ServerInfo; @@ -12,24 +9,31 @@ import com.djrapitops.plugin.api.Benchmark; import java.util.Optional; -/** - * Class used for executing transfer queries when the database has version 8. - *

- * Changes the DB Schema to 10. - * - * @author Rsl1122 - */ -public class Version8TransferTable extends TransferTable { +public class Version10Patch extends Patch { - private final int serverID; + private Integer serverID; - public Version8TransferTable(SQLDB db) { + public Version10Patch(SQLDB db) { super(db); - Optional serverID = db.getServerTable().getServerID(ServerInfo.getServerUUID()); - if (!serverID.isPresent()) { - throw new IllegalStateException("Server UUID was not registered, try rebooting the plugin."); + } + + @Override + public boolean hasBeenApplied() { + return !hasTable("plan_gamemodetimes"); + } + + @Override + public void apply() { + try { + Optional fetchedServerID = db.getServerTable().getServerID(ServerInfo.getServerUUID()); + if (!fetchedServerID.isPresent()) { + throw new IllegalStateException("Server UUID was not registered, try rebooting the plugin."); + } + serverID = fetchedServerID.get(); + alterTablesToV10(); + } catch (DBInitException e) { + throw new DBOpException(e.getMessage(), e); } - this.serverID = serverID.get(); } public void alterTablesToV10() throws DBInitException { @@ -52,8 +56,6 @@ public class Version8TransferTable extends TransferTable { dropTable("temp_nicks"); dropTable("temp_kills"); dropTable("temp_users"); - - db.setVersion(10); Benchmark.stop("Schema copy from 8 to 10"); } @@ -80,40 +82,32 @@ public class Version8TransferTable extends TransferTable { userInfoTable.createTable(); String statement = "INSERT INTO plan_users " + - "(" + - "id, uuid, registered, name" + - ") SELECT " + - "id, uuid, registered, name" + + "(id, uuid, registered, name)" + + " SELECT id, uuid, registered, name" + " FROM " + tempTableName; - execute(statement); + db.execute(statement); statement = "INSERT INTO plan_user_info " + - "(" + - "user_id, registered, opped, banned, server_id" + - ") SELECT " + - "id, registered, opped, banned, '" + serverID + "'" + + "(user_id, registered, opped, banned, server_id)" + + " SELECT id, registered, opped, banned, '" + serverID + "'" + " FROM " + tempTableName; - execute(statement); + db.execute(statement); statement = "INSERT INTO plan_nicknames " + - "(" + - "user_id, nickname, server_id" + - ") SELECT " + - "user_id, nickname, '" + serverID + "'" + + "(user_id, nickname, server_id)" + + " SELECT user_id, nickname, '" + serverID + "'" + " FROM " + tempNickTableName; - execute(statement); + db.execute(statement); try { if (usingMySQL) { - execute("SET foreign_key_checks = 0"); + db.execute("SET foreign_key_checks = 0"); } statement = "INSERT INTO plan_kills " + - "(" + - "killer_id, victim_id, weapon, date, session_id" + - ") SELECT " + - "killer_id, victim_id, weapon, date, '0'" + + "(killer_id, victim_id, weapon, date, session_id)" + + " SELECT killer_id, victim_id, weapon, date, '0'" + " FROM " + tempKillsTableName; - execute(statement); + db.execute(statement); } finally { if (usingMySQL) { - execute("SET foreign_key_checks = 1"); + db.execute("SET foreign_key_checks = 1"); } } } @@ -127,12 +121,10 @@ public class Version8TransferTable extends TransferTable { commandUseTable.createTable(); String statement = "INSERT INTO plan_commandusages " + - "(" + - "command, times_used, server_id" + - ") SELECT " + - "command, times_used, '" + serverID + "'" + + "(command, times_used, server_id)" + + " SELECT command, times_used, '" + serverID + "'" + " FROM " + tempTableName; - execute(statement); + db.execute(statement); dropTable(tempTableName); } @@ -146,12 +138,10 @@ public class Version8TransferTable extends TransferTable { tpsTable.createTable(); String statement = "INSERT INTO plan_tps " + - "(" + - "date, tps, players_online, cpu_usage, ram_usage, entities, chunks_loaded, server_id" + - ") SELECT " + - "date, tps, players_online, cpu_usage, ram_usage, entities, chunks_loaded, '" + serverID + "'" + + "(date, tps, players_online, cpu_usage, ram_usage, entities, chunks_loaded, server_id)" + + " SELECT date, tps, players_online, cpu_usage, ram_usage, entities, chunks_loaded, '" + serverID + "'" + " FROM " + tempTableName; - execute(statement); + db.execute(statement); dropTable(tempTableName); } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/VersionTableRemovalPatch.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/VersionTableRemovalPatch.java new file mode 100644 index 000000000..c205cbded --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/VersionTableRemovalPatch.java @@ -0,0 +1,20 @@ +package com.djrapitops.plan.system.database.databases.sql.patches; + +import com.djrapitops.plan.system.database.databases.sql.SQLDB; + +public class VersionTableRemovalPatch extends Patch { + + public VersionTableRemovalPatch(SQLDB db) { + super(db); + } + + @Override + public boolean hasBeenApplied() { + return hasTable("plan_version"); + } + + @Override + public void apply() { + dropTable("plan_version"); + } +} diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/WorldTimesSeverIDPatch.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/WorldTimesSeverIDPatch.java new file mode 100644 index 000000000..ef086bd69 --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/WorldTimesSeverIDPatch.java @@ -0,0 +1,63 @@ +package com.djrapitops.plan.system.database.databases.sql.patches; + +import com.djrapitops.plan.system.database.databases.sql.SQLDB; +import com.djrapitops.plan.system.database.databases.sql.processing.ExecStatement; +import com.djrapitops.plan.system.database.databases.sql.processing.QueryStatement; +import com.djrapitops.plan.system.database.databases.sql.tables.WorldTimesTable; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +public class WorldTimesSeverIDPatch extends Patch { + + public WorldTimesSeverIDPatch(SQLDB db) { + super(db); + } + + @Override + public boolean hasBeenApplied() { + String tableName = WorldTimesTable.TABLE_NAME; + String columnName = WorldTimesTable.Col.SERVER_ID.get(); + return hasColumn(tableName, columnName) + && allValuesHaveServerID(tableName, columnName); + } + + private Boolean allValuesHaveServerID(String tableName, String columnName) { + String sql = "SELECT * FROM " + tableName + " WHERE " + columnName + "=? LIMIT 1"; + return query(new QueryStatement(sql) { + @Override + public void prepare(PreparedStatement statement) throws SQLException { + statement.setInt(1, 0); + } + + @Override + public Boolean processResults(ResultSet set) throws SQLException { + return !set.next(); + } + }); + } + + @Override + public void apply() { + Map sessionIDServerIDRelation = db.getSessionsTable().getIDServerIDRelation(); + + String sql = "UPDATE " + WorldTimesTable.TABLE_NAME + " SET " + + WorldTimesTable.Col.SERVER_ID + "=?" + + " WHERE " + WorldTimesTable.Col.SESSION_ID + "=?"; + + db.executeBatch(new ExecStatement(sql) { + @Override + public void prepare(PreparedStatement statement) throws SQLException { + for (Map.Entry entry : sessionIDServerIDRelation.entrySet()) { + Integer sessionID = entry.getKey(); + Integer serverID = entry.getValue(); + statement.setInt(1, serverID); + statement.setInt(2, sessionID); + statement.addBatch(); + } + } + }); + } +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/WorldsServerIDPatch.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/WorldsServerIDPatch.java new file mode 100644 index 000000000..f67d3177a --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/WorldsServerIDPatch.java @@ -0,0 +1,188 @@ +package com.djrapitops.plan.system.database.databases.sql.patches; + +import com.djrapitops.plan.system.database.databases.sql.SQLDB; +import com.djrapitops.plan.system.database.databases.sql.processing.ExecStatement; +import com.djrapitops.plan.system.database.databases.sql.processing.QueryAllStatement; +import com.djrapitops.plan.system.database.databases.sql.processing.QueryStatement; +import com.djrapitops.plan.system.database.databases.sql.tables.SessionsTable; +import com.djrapitops.plan.system.database.databases.sql.tables.WorldTable; +import com.djrapitops.plan.system.database.databases.sql.tables.WorldTimesTable; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; + +public class WorldsServerIDPatch extends Patch { + + public WorldsServerIDPatch(SQLDB db) { + super(db); + } + + @Override + public boolean hasBeenApplied() { + String tableName = WorldTable.TABLE_NAME; + String columnName = WorldTable.Col.SERVER_ID.get(); + return hasColumn(tableName, columnName) + && allValuesHaveServerID(tableName, columnName); + } + + private Boolean allValuesHaveServerID(String tableName, String columnName) { + String sql = "SELECT * FROM " + tableName + " WHERE " + columnName + "=? LIMIT 1"; + return query(new QueryStatement(sql) { + @Override + public void prepare(PreparedStatement statement) throws SQLException { + statement.setInt(1, 0); + } + + @Override + public Boolean processResults(ResultSet set) throws SQLException { + return !set.next(); + } + }); + } + + @Override + public void apply() { + WorldTable worldTable = db.getWorldTable(); + + List serverUUIDs = db.getServerTable().getServerUUIDs(); + + Map> worldsPerServer = new HashMap<>(); + for (UUID serverUUID : serverUUIDs) { + worldsPerServer.put(serverUUID, getWorldNamesOld(serverUUID)); + } + + for (Map.Entry> entry : worldsPerServer.entrySet()) { + UUID serverUUID = entry.getKey(); + Set worlds = entry.getValue(); + + worldTable.saveWorlds(worlds, serverUUID); + } + + updateWorldTimesTableWorldIDs(); + db.executeUnsafe("DELETE FROM " + WorldTable.TABLE_NAME + " WHERE " + WorldTable.Col.SERVER_ID + "=0"); + } + + private Set getWorldNamesOld(UUID serverUUID) { + WorldTimesTable worldTimesTable = db.getWorldTimesTable(); + SessionsTable sessionsTable = db.getSessionsTable(); + + String statementSelectServerID = db.getServerTable().statementSelectServerID; + + String worldIDColumn = worldTimesTable + "." + WorldTimesTable.Col.WORLD_ID; + String worldSessionIDColumn = worldTimesTable + "." + WorldTimesTable.Col.SESSION_ID; + String sessionIDColumn = sessionsTable + "." + SessionsTable.Col.ID; + String sessionServerIDColumn = sessionsTable + "." + SessionsTable.Col.SERVER_ID; + + String sql = "SELECT DISTINCT " + + WorldTable.Col.NAME + " FROM " + + WorldTable.TABLE_NAME + + " INNER JOIN " + worldTimesTable + " on " + worldIDColumn + "=" + WorldTable.TABLE_NAME + "." + WorldTable.Col.ID + + " INNER JOIN " + sessionsTable + " on " + worldSessionIDColumn + "=" + sessionIDColumn + + " WHERE " + statementSelectServerID + "=" + sessionServerIDColumn; + + return query(new QueryStatement>(sql, 1000) { + @Override + public void prepare(PreparedStatement statement) throws SQLException { + statement.setString(1, serverUUID.toString()); + } + + @Override + public Set processResults(ResultSet set) throws SQLException { + Set worldNames = new HashSet<>(); + while (set.next()) { + worldNames.add(set.getString(WorldTable.Col.NAME.get())); + } + return worldNames; + } + }); + } + + private void updateWorldTimesTableWorldIDs() { + List worldObjects = getWorldObjects(); + Map> oldToNewMap = + worldObjects.stream() + .filter(worldObj -> worldObj.serverId == 0) + .collect(Collectors.toMap( + Function.identity(), + oldWorld -> worldObjects.stream() + .filter(worldObj -> worldObj.serverId != 0) + .filter(worldObj -> worldObj.equals(oldWorld)) + .collect(Collectors.toList() + ))); + + WorldTimesTable worldTimesTable = db.getWorldTimesTable(); + String sql = "UPDATE " + worldTimesTable + " SET " + + WorldTimesTable.Col.WORLD_ID + "=?" + + " WHERE " + WorldTimesTable.Col.WORLD_ID + "=?" + + " AND " + WorldTimesTable.Col.SERVER_ID + "=?"; + db.executeBatch(new ExecStatement(sql) { + @Override + public void prepare(PreparedStatement statement) throws SQLException { + for (Map.Entry> entry : oldToNewMap.entrySet()) { + WorldObj old = entry.getKey(); + for (WorldObj newWorld : entry.getValue()) { + statement.setInt(1, newWorld.id); + statement.setInt(2, old.id); + statement.setInt(3, newWorld.serverId); + statement.addBatch(); + } + } + } + }); + } + + public List getWorldObjects() { + String sql = "SELECT * FROM " + WorldTable.TABLE_NAME; + return query(new QueryAllStatement>(sql, 100) { + @Override + public List processResults(ResultSet set) throws SQLException { + List objects = new ArrayList<>(); + while (set.next()) { + int worldID = set.getInt(WorldTable.Col.ID.get()); + int serverID = set.getInt(WorldTable.Col.SERVER_ID.get()); + String worldName = set.getString(WorldTable.Col.NAME.get()); + objects.add(new WorldObj(worldID, serverID, worldName)); + } + return objects; + } + }); + } +} + +class WorldObj { + final int id; + final int serverId; + final String name; + + public WorldObj(int id, int serverId, String name) { + this.id = id; + this.serverId = serverId; + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + WorldObj worldObj = (WorldObj) o; + return Objects.equals(name, worldObj.name); + } + + @Override + public int hashCode() { + return Objects.hashCode(name); + } + + @Override + public String toString() { + return "{" + + "id=" + id + + ", serverId=" + serverId + + ", name='" + name + '\'' + + '}'; + } +} diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/GeoInfoTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/GeoInfoTable.java index c7ce1f7c1..5d4ac9df7 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/GeoInfoTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/GeoInfoTable.java @@ -1,7 +1,6 @@ package com.djrapitops.plan.system.database.databases.sql.tables; import com.djrapitops.plan.api.exceptions.database.DBInitException; -import com.djrapitops.plan.api.exceptions.database.DBOpException; import com.djrapitops.plan.data.container.GeoInfo; import com.djrapitops.plan.system.database.databases.sql.SQLDB; import com.djrapitops.plan.system.database.databases.sql.processing.ExecStatement; @@ -11,18 +10,9 @@ import com.djrapitops.plan.system.database.databases.sql.statements.Column; import com.djrapitops.plan.system.database.databases.sql.statements.Select; import com.djrapitops.plan.system.database.databases.sql.statements.Sql; import com.djrapitops.plan.system.database.databases.sql.statements.TableSqlParser; -import com.djrapitops.plan.system.database.databases.sql.tables.move.Version18TransferTable; -import com.djrapitops.plan.system.settings.Settings; import com.djrapitops.plan.utilities.comparators.GeoInfoComparator; -import com.djrapitops.plugin.api.utility.log.Log; -import com.djrapitops.plugin.task.AbsRunnable; -import com.djrapitops.plugin.task.RunnableFactory; import com.djrapitops.plugin.utilities.Verify; -import java.io.UnsupportedEncodingException; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.security.NoSuchAlgorithmException; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -39,8 +29,10 @@ import java.util.*; */ public class GeoInfoTable extends UserIDTable { + public static final String TABLE_NAME = "plan_ips"; + public GeoInfoTable(SQLDB db) { - super("plan_ips", db); + super(TABLE_NAME, db); insertStatement = "INSERT INTO " + tableName + " (" + Col.USER_ID + ", " + Col.IP + ", " @@ -67,71 +59,6 @@ public class GeoInfoTable extends UserIDTable { ); } - public void alterTableV12() { - if (usingMySQL) { - executeUnsafe("ALTER TABLE " + tableName + " MODIFY " + Col.IP + " VARCHAR(39) NOT NULL"); - } - } - - public void alterTableV13() { - addColumns(Col.LAST_USED + " bigint NOT NULL DEFAULT 0"); - } - - public void alterTableV17() { - addColumns(Col.IP_HASH.get() + " varchar(200) DEFAULT ''"); - } - - public void alterTableV18() { - RunnableFactory.createNew("DB Version 17->18", new AbsRunnable() { - @Override - public void run() { - try { - Map> allGeoInfo = getAllGeoInfo(); - - String sql = "UPDATE " + tableName + " SET " + - Col.IP + "=?, " + - Col.IP_HASH + "=? " + - "WHERE " + Col.IP + "=?"; - executeBatch(new ExecStatement(sql) { - @Override - public void prepare(PreparedStatement statement) throws SQLException { - for (List geoInfos : allGeoInfo.values()) { - for (GeoInfo geoInfo : geoInfos) { - try { - if (geoInfo.getIp().endsWith(".xx.xx")) { - continue; - } - GeoInfo updatedInfo = new GeoInfo( - InetAddress.getByName(geoInfo.getIp()), - geoInfo.getGeolocation(), - geoInfo.getDate() - ); - statement.setString(1, updatedInfo.getIp()); - statement.setString(2, updatedInfo.getIpHash()); - statement.setString(3, geoInfo.getIp()); - statement.addBatch(); - } catch (UnknownHostException | UnsupportedEncodingException | NoSuchAlgorithmException e) { - if (Settings.DEV_MODE.isTrue()) { - Log.toLog(this.getClass(), e); - } - } - } - } - } - }); - new Version18TransferTable(db).alterTableV18(); - db.setVersion(18); - } catch (DBOpException | DBInitException e) { - Log.toLog(this.getClass(), e); - } - } - }).runTaskAsynchronously(); - } - - public void clean() { - - } - public List getGeoInfo(UUID uuid) { String sql = "SELECT DISTINCT * FROM " + tableName + " WHERE " + Col.USER_ID + "=" + usersTable.statementSelectID; diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/KillsTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/KillsTable.java index 42073b097..f7ee98ee6 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/KillsTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/KillsTable.java @@ -31,10 +31,11 @@ import java.util.*; */ public class KillsTable extends UserIDTable { + public static final String TABLE_NAME = "plan_kills"; private final ServerTable serverTable; public KillsTable(SQLDB db) { - super("plan_kills", db); + super(TABLE_NAME, db); sessionsTable = db.getSessionsTable(); serverTable = db.getServerTable(); insertStatement = "INSERT INTO " + tableName + " (" @@ -304,29 +305,6 @@ public class KillsTable extends UserIDTable { }); } - public void alterTableV16() { - addColumns(Col.SERVER_ID + " integer NOT NULL DEFAULT 0"); - - Map sessionIDServerIDRelation = sessionsTable.getIDServerIDRelation(); - - String sql = "UPDATE " + tableName + " SET " + - Col.SERVER_ID + "=?" + - " WHERE " + Col.SESSION_ID + "=?"; - - executeBatch(new ExecStatement(sql) { - @Override - public void prepare(PreparedStatement statement) throws SQLException { - for (Map.Entry entry : sessionIDServerIDRelation.entrySet()) { - Integer sessionID = entry.getKey(); - Integer serverID = entry.getValue(); - statement.setInt(1, serverID); - statement.setInt(2, sessionID); - statement.addBatch(); - } - } - }); - } - public enum Col implements Column { KILLER_ID("killer_id"), VICTIM_ID("victim_id"), diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/NicknamesTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/NicknamesTable.java index 5b1f5e5d9..bf9559483 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/NicknamesTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/NicknamesTable.java @@ -10,8 +10,6 @@ import com.djrapitops.plan.system.database.databases.sql.statements.Column; import com.djrapitops.plan.system.database.databases.sql.statements.Sql; import com.djrapitops.plan.system.database.databases.sql.statements.TableSqlParser; import com.djrapitops.plan.system.info.server.ServerInfo; -import com.djrapitops.plugin.task.AbsRunnable; -import com.djrapitops.plugin.task.RunnableFactory; import com.djrapitops.plugin.utilities.Verify; import java.sql.PreparedStatement; @@ -30,12 +28,13 @@ import java.util.*; */ public class NicknamesTable extends UserIDTable { + public static final String TABLE_NAME = "plan_nicknames"; private final ServerTable serverTable; private String insertStatement; private final String updateStatement; public NicknamesTable(SQLDB db) { - super("plan_nicknames", db); + super(TABLE_NAME, db); serverTable = db.getServerTable(); insertStatement = "INSERT INTO " + tableName + " (" + Col.USER_ID + ", " + @@ -65,117 +64,6 @@ public class NicknamesTable extends UserIDTable { ); } - public void alterTableV19() { - addColumns(Col.LAST_USED + " bigint NOT NULL DEFAULT '0'"); - - RunnableFactory.createNew(new AbsRunnable("DB version 18->19") { - @Override - public void run() { - // Create actions table if version 18 transfer is run concurrently. - execute("CREATE TABLE IF NOT EXISTS plan_actions " + - "(action_id integer, date bigint, server_id integer, user_id integer, additional_info varchar(1))"); - - Map serverUUIDsByID = serverTable.getServerUUIDsByID(); - Map serverIDsByUUID = new HashMap<>(); - for (Map.Entry entry : serverUUIDsByID.entrySet()) { - serverIDsByUUID.put(entry.getValue(), entry.getKey()); - } - - String fetchSQL = "SELECT * FROM plan_actions WHERE action_id=3 ORDER BY date DESC"; - Map> nicknames = query(new QueryAllStatement>>(fetchSQL, 10000) { - @Override - public Map> processResults(ResultSet set) throws SQLException { - Map> map = new HashMap<>(); - - while (set.next()) { - long date = set.getLong("date"); - int userID = set.getInt(UserIDTable.Col.USER_ID.get()); - int serverID = set.getInt("server_id"); - UUID serverUUID = serverUUIDsByID.get(serverID); - Nickname nick = new Nickname(set.getString("additional_info"), date, serverUUID); - Set nicknames = map.getOrDefault(userID, new HashSet<>()); - if (serverUUID == null || nicknames.contains(nick)) { - continue; - } - nicknames.add(nick); - map.put(userID, nicknames); - } - - return map; - } - }); - - String updateSQL = "UPDATE " + tableName + " SET " + Col.LAST_USED + "=?" + - " WHERE " + Col.NICKNAME + "=?" + - " AND " + Col.USER_ID + "=?" + - " AND " + Col.SERVER_ID + "=?"; - - executeBatch(new ExecStatement(updateSQL) { - @Override - public void prepare(PreparedStatement statement) throws SQLException { - for (Map.Entry> entry : nicknames.entrySet()) { - Integer userId = entry.getKey(); - Set nicks = entry.getValue(); - for (Nickname nick : nicks) { - Integer serverID = serverIDsByUUID.get(nick.getServerUUID()); - statement.setLong(1, nick.getDate()); - statement.setString(2, nick.getName()); - statement.setInt(3, userId); - statement.setInt(4, serverID); - statement.addBatch(); - } - } - } - }); - - db.setVersion(19); - executeUnsafe("DROP TABLE plan_actions"); - } - }).runTaskAsynchronously(); - } - - /** - * Get ALL nicknames of the user by Server UUID. - *

- * Get's nicknames from other servers as well. - * - * @param uuid UUID of the Player - * @return The nicknames of the User in a map by ServerUUID - */ - public Map> getAllNicknames(UUID uuid) { - String serverIDColumn = serverTable + "." + ServerTable.Col.SERVER_ID; - String serverUUIDColumn = serverTable + "." + ServerTable.Col.SERVER_UUID + " as s_uuid"; - String sql = "SELECT " + - Col.NICKNAME + ", " + - serverUUIDColumn + - " FROM " + tableName + - " INNER JOIN " + serverTable + " on " + serverIDColumn + "=" + Col.SERVER_ID + - " WHERE (" + Col.USER_ID + "=" + usersTable.statementSelectID + ")"; - - return query(new QueryStatement>>(sql, 5000) { - - @Override - public void prepare(PreparedStatement statement) throws SQLException { - statement.setString(1, uuid.toString()); - } - - @Override - public Map> processResults(ResultSet set) throws SQLException { - Map> map = new HashMap<>(); - while (set.next()) { - UUID serverUUID = UUID.fromString(set.getString("s_uuid")); - - List nicknames = map.getOrDefault(serverUUID, new ArrayList<>()); - - nicknames.add(set.getString(Col.NICKNAME.get())); - - map.put(serverUUID, nicknames); - } - return map; - } - }); - } - /** * Get nicknames of the user on a server. *

diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/ServerTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/ServerTable.java index 600b4546f..4523a0ece 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/ServerTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/ServerTable.java @@ -62,12 +62,6 @@ public class ServerTable extends Table { ); } - public void alterTableV11() { - if (usingMySQL) { - executeUnsafe("ALTER TABLE " + tableName + " MODIFY " + Col.MAX_PLAYERS + " INTEGER NOT NULL DEFAULT -1"); - } - } - private void updateServerInfo(Server info) { String sql = Update.values(tableName, Col.SERVER_UUID, @@ -181,24 +175,6 @@ public class ServerTable extends Table { }); } - public Map getServerNamesByID() { - String sql = Select.from(tableName, - Col.SERVER_ID, Col.NAME) - .toString(); - - return query(new QueryAllStatement>(sql) { - @Override - public Map processResults(ResultSet set) throws SQLException { - Map names = new HashMap<>(); - while (set.next()) { - int id = set.getInt(Col.SERVER_ID.get()); - names.put(id, set.getString(Col.NAME.get())); - } - return names; - } - }); - } - public Map getServerNames() { String sql = Select.from(tableName, Col.SERVER_UUID, Col.NAME) @@ -388,20 +364,6 @@ public class ServerTable extends Table { }); } - public int getMaxPlayers() { - String sql = "SELECT SUM(" + Col.MAX_PLAYERS + ") AS max FROM " + tableName; - - return query(new QueryAllStatement(sql) { - @Override - public Integer processResults(ResultSet set) throws SQLException { - if (set.next()) { - return set.getInt("max"); - } - return 0; - } - }); - } - public enum Col implements Column { SERVER_ID("id"), SERVER_UUID("uuid"), diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/SessionsTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/SessionsTable.java index 7f547649e..7aae3de6a 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/SessionsTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/SessionsTable.java @@ -12,7 +12,6 @@ import com.djrapitops.plan.system.database.databases.sql.statements.Select; import com.djrapitops.plan.system.database.databases.sql.statements.Sql; import com.djrapitops.plan.system.database.databases.sql.statements.TableSqlParser; import com.djrapitops.plan.system.info.server.ServerInfo; -import com.djrapitops.plugin.api.TimeAmount; import com.djrapitops.plugin.utilities.Verify; import java.sql.PreparedStatement; @@ -265,52 +264,6 @@ public class SessionsTable extends UserIDTable { return getPlaytime(uuid, serverUUID, 0L); } - /** - * Used to get Playtimes after a date in a Map, sorted by ServerNames. - * - * @param uuid UUID of the Player. - * @param afterDate Epoch ms (Playtime after this date is calculated) - * @return key - ServerName, value ms played - */ - public Map getPlaytimeByServer(UUID uuid, long afterDate) { - Map serverNames = serverTable.getServerNamesByID(); - String sql = "SELECT " + - "(SUM(" + Col.SESSION_END + ") - SUM(" + Col.SESSION_START + ")) as playtime, " + - Col.SERVER_ID + - " FROM " + tableName + - " WHERE " + Col.SESSION_START + ">?" + - " AND " + Col.USER_ID + "=" + usersTable.statementSelectID + - " GROUP BY " + Col.SERVER_ID; - return query(new QueryStatement>(sql, 100) { - @Override - public void prepare(PreparedStatement statement) throws SQLException { - statement.setLong(1, afterDate); - statement.setString(2, uuid.toString()); - } - - @Override - public Map processResults(ResultSet set) throws SQLException { - Map playtimes = new HashMap<>(); - while (set.next()) { - String serverName = serverNames.get(set.getInt(Col.SERVER_ID.get())); - long playtime = set.getLong("playtime"); - playtimes.put(serverName, playtime); - } - return playtimes; - } - }); - } - - /** - * Used to get Totals of Playtime in a Map, sorted by ServerNames. - * - * @param uuid UUID of the Player. - * @return key - ServerName, value ms played - */ - public Map getPlaytimeByServer(UUID uuid) { - return getPlaytimeByServer(uuid, 0L); - } - /** * Used to get Playtime after a date of a Server. * @@ -342,15 +295,6 @@ public class SessionsTable extends UserIDTable { }); } - /** - * Used to get the Total Playtime of THIS Server. - * - * @return Milliseconds played on the server. 0 if server not found. - */ - public long getPlaytimeOfServer() { - return getPlaytimeOfServer(ServerInfo.getServerUUID()); - } - /** * Used to get the Total Playtime of a Server. * @@ -361,16 +305,6 @@ public class SessionsTable extends UserIDTable { return getPlaytimeOfServer(serverUUID, 0L); } - /** - * Used to get Playtime after a date of THIS Server. - * - * @param afterDate Epoch ms (Playtime after this date is calculated) - * @return Milliseconds played after given epoch ms on the server. 0 if server not found. - */ - public long getPlaytimeOfServer(long afterDate) { - return getPlaytimeOfServer(ServerInfo.getServerUUID(), afterDate); - } - /** * Used to get total Session count of a Player on a server after a given epoch ms. * @@ -426,17 +360,6 @@ public class SessionsTable extends UserIDTable { return getSessionCount(uuid, ServerInfo.getServerUUID(), afterDate); } - /** - * Used to get total Session count of a Player on a server. - * - * @param uuid UUID of the player. - * @param serverUUID UUID of the server. - * @return How many sessions player has. 0 if player or server not found. - */ - public int getSessionCount(UUID uuid, UUID serverUUID) { - return getSessionCount(uuid, serverUUID, 0L); - } - public Map> getSessionInfoOfServer(UUID serverUUID) { String usersIDColumn = usersTable + "." + UsersTable.Col.ID; String usersUUIDColumn = usersTable + "." + UsersTable.Col.UUID + " as uuid"; @@ -484,29 +407,6 @@ public class SessionsTable extends UserIDTable { return getSessionInfoOfServer(ServerInfo.getServerUUID()); } - // TODO Write tests for this method - public long getLastSeen(UUID uuid) { - String sql = "SELECT" + - " MAX(" + Col.SESSION_END + ") as last_seen" + - " FROM " + tableName + - " WHERE " + Col.USER_ID + "=" + usersTable.statementSelectID; - - return query(new QueryStatement(sql) { - @Override - public void prepare(PreparedStatement statement) throws SQLException { - statement.setString(1, uuid.toString()); - } - - @Override - public Long processResults(ResultSet set) throws SQLException { - if (set.next()) { - return set.getLong("last_seen"); - } - return 0L; - } - }); - } - public Map getLastSeenForAllPlayers() { String usersIDColumn = usersTable + "." + UsersTable.Col.ID; String usersUUIDColumn = usersTable + "." + UsersTable.Col.UUID + " as uuid"; @@ -581,58 +481,6 @@ public class SessionsTable extends UserIDTable { }); } - public Map>> getSessionInLastMonth() { - Map uuidsByID = usersTable.getUUIDsByID(); - Map serverUUIDsByID = serverTable.getServerUUIDsByID(); - - String sql = "SELECT " + - Col.ID + ", " + - Col.USER_ID + ", " + - Col.SERVER_ID + ", " + - Col.SESSION_START + ", " + - Col.SESSION_END + ", " + - Col.DEATHS + ", " + - Col.MOB_KILLS + ", " + - Col.AFK_TIME + - " FROM " + tableName + - " WHERE " + Col.SESSION_START + ">?"; - - return query(new QueryStatement>>>(sql, 20000) { - @Override - public void prepare(PreparedStatement statement) throws SQLException { - statement.setLong(1, System.currentTimeMillis() - TimeAmount.MONTH.ms()); - } - - @Override - public Map>> processResults(ResultSet set) throws SQLException { - Map>> map = new HashMap<>(); - while (set.next()) { - UUID serverUUID = serverUUIDsByID.get(set.getInt(Col.SERVER_ID.get())); - UUID uuid = uuidsByID.get(set.getInt(Col.USER_ID.get())); - - Map> sessionsByUser = map.getOrDefault(serverUUID, new HashMap<>()); - List sessions = sessionsByUser.getOrDefault(uuid, new ArrayList<>()); - - long start = set.getLong(Col.SESSION_START.get()); - long end = set.getLong(Col.SESSION_END.get()); - - int deaths = set.getInt(Col.DEATHS.get()); - int mobKills = set.getInt(Col.MOB_KILLS.get()); - int id = set.getInt(Col.ID.get()); - - long timeAFK = set.getLong(Col.AFK_TIME.get()); - - Session session = new Session(id, uuid, serverUUID, start, end, mobKills, deaths, timeAFK); - sessions.add(session); - - sessionsByUser.put(uuid, sessions); - map.put(serverUUID, sessionsByUser); - } - return map; - } - }); - } - public void insertSessions(Map>> allSessions, boolean saveKillsAndWorldTimes) { if (Verify.isEmpty(allSessions)) { return; @@ -729,10 +577,6 @@ public class SessionsTable extends UserIDTable { return sessionsByStart; } - public void alterTableV15() { - addColumns(Col.AFK_TIME + " bigint NOT NULL DEFAULT 0"); - } - public Map getIDServerIDRelation() { String sql = "SELECT " + Col.ID + ", " + diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/Table.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/Table.java index 9e440e9da..6fc895155 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/Table.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/Table.java @@ -5,14 +5,10 @@ import com.djrapitops.plan.api.exceptions.database.DBOpException; import com.djrapitops.plan.system.database.databases.sql.SQLDB; import com.djrapitops.plan.system.database.databases.sql.processing.ExecStatement; import com.djrapitops.plan.system.database.databases.sql.processing.QueryStatement; -import com.djrapitops.plan.system.settings.Settings; import com.djrapitops.plan.utilities.MiscUtils; -import com.djrapitops.plugin.api.utility.log.Log; -import com.djrapitops.plugin.utilities.Verify; import com.google.common.base.Objects; import java.sql.Connection; -import java.sql.PreparedStatement; import java.sql.SQLException; /** @@ -67,17 +63,6 @@ public abstract class Table { return db.getConnection(); } - /** - * Get the Database Schema version from VersionTable. - * - * @return Database Schema version. - * @deprecated Use db.getVersion - db is protected variable. - */ - @Deprecated - public int getVersion() { - return db.getVersion(); - } - /** * Executes an SQL Statement * @@ -85,12 +70,7 @@ public abstract class Table { * @return true if rows were updated. */ protected boolean execute(String statementString) { - return execute(new ExecStatement(statementString) { - @Override - public void prepare(PreparedStatement statement) { - /* No preparations necessary */ - } - }); + return db.execute(statementString); } /** @@ -99,16 +79,7 @@ public abstract class Table { * @param statements SQL statements to setUp */ protected void executeUnsafe(String... statements) { - Verify.nullCheck(statements); - for (String statement : statements) { - try { - execute(statement); - } catch (DBOpException e) { - if (Settings.DEV_MODE.isTrue()) { - Log.toLog(this.getClass(), e); - } - } - } + db.executeUnsafe(statements); } /** diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/TransferTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/TransferTable.java index fb0bfa1bc..66fbb1e77 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/TransferTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/TransferTable.java @@ -30,13 +30,14 @@ import java.util.Optional; */ public class TransferTable extends Table { + public static final String TABLE_NAME = "plan_transfer"; private final String insertStatementNoParts; private final ServerTable serverTable; private final String selectStatement; public TransferTable(SQLDB db) { - super("plan_transfer", db); + super(TABLE_NAME, db); serverTable = db.getServerTable(); insertStatementNoParts = "REPLACE INTO " + tableName + " (" + @@ -70,10 +71,6 @@ public class TransferTable extends Table { ); } - public void alterTableV14() { - addColumns(Col.PART + " bigint NOT NULL DEFAULT 0"); - } - public void clean() { String sql = "DELETE FROM " + tableName + " WHERE " + Col.EXPIRY + " < ?" + diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/UserInfoTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/UserInfoTable.java index 2ba530909..dc7bdac3c 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/UserInfoTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/UserInfoTable.java @@ -290,36 +290,6 @@ public class UserInfoTable extends UserIDTable { }); } - public Map> getSavedUUIDs() { - String usersIDColumn = usersTable + "." + UsersTable.Col.ID; - String usersUUIDColumn = usersTable + "." + UsersTable.Col.UUID + " as uuid"; - String serverIDColumn = serverTable + "." + ServerTable.Col.SERVER_ID; - String serverUUIDColumn = serverTable + "." + ServerTable.Col.SERVER_UUID + " as s_uuid"; - String sql = "SELECT " + - usersUUIDColumn + ", " + - serverUUIDColumn + - " FROM " + tableName + - " INNER JOIN " + usersTable + " on " + usersIDColumn + "=" + Col.USER_ID + - " INNER JOIN " + serverTable + " on " + serverIDColumn + "=" + Col.SERVER_ID; - - return query(new QueryAllStatement>>(sql, 50000) { - @Override - public Map> processResults(ResultSet set) throws SQLException { - Map> serverMap = new HashMap<>(); - while (set.next()) { - UUID serverUUID = UUID.fromString(set.getString("s_uuid")); - UUID uuid = UUID.fromString(set.getString("uuid")); - - Set uuids = serverMap.getOrDefault(serverUUID, new HashSet<>()); - uuids.add(uuid); - - serverMap.put(serverUUID, uuids); - } - return serverMap; - } - }); - } - public int getServerUserCount(UUID serverUUID) { String sql = "SELECT " + " COUNT(" + Col.REGISTERED + ") as c" + diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/UsersTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/UsersTable.java index 4b9fb3a25..89dae77a3 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/UsersTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/UsersTable.java @@ -16,7 +16,6 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.*; -import java.util.function.Supplier; /** * Table that is in charge of storing common player data for all servers. @@ -382,39 +381,6 @@ public class UsersTable extends UserIDTable { }); } - public Optional getRegisterDate(UUID uuid) { - String sql = Select.from(tableName, Col.REGISTERED).where(Col.UUID + "=?").toString(); - - return query(new QueryStatement>(sql) { - @Override - public void prepare(PreparedStatement statement) throws SQLException { - statement.setString(1, uuid.toString()); - } - - @Override - public Optional processResults(ResultSet set) throws SQLException { - if (set.next()) { - return Optional.of(set.getLong(Col.REGISTERED.get())); - } - return Optional.empty(); - } - }); - } - - public int getPlayerCount() { - String sql = "SELECT COUNT(*) AS player_count FROM " + tableName; - - return query(new QueryAllStatement(sql) { - @Override - public Integer processResults(ResultSet set) throws SQLException { - if (set.next()) { - return set.getInt("player_count"); - } - return 0; - } - }); - } - public Map getUUIDsByID() { String sql = Select.from(tableName, Col.ID, Col.UUID).toString(); @@ -435,45 +401,45 @@ public class UsersTable extends UserIDTable { } public DataContainer getUserInformation(UUID uuid) { - Key key = new Key<>(DataContainer.class, "plan_users_data"); + Key user_data = new Key<>(DataContainer.class, "plan_users_data"); DataContainer returnValue = new DataContainer(); - Supplier usersTableResults = () -> { - String sql = "SELECT * FROM " + tableName + " WHERE " + Col.UUID + "=?"; - - return query(new QueryStatement(sql) { - @Override - public void prepare(PreparedStatement statement) throws SQLException { - statement.setString(1, uuid.toString()); - } - - @Override - public DataContainer processResults(ResultSet set) throws SQLException { - DataContainer container = new DataContainer(); - - if (set.next()) { - long registered = set.getLong(Col.REGISTERED.get()); - String name = set.getString(Col.USER_NAME.get()); - int timesKicked = set.getInt(Col.TIMES_KICKED.get()); - - container.putRawData(PlayerKeys.REGISTERED, registered); - container.putRawData(PlayerKeys.NAME, name); - container.putRawData(PlayerKeys.KICK_COUNT, timesKicked); - } - - return container; - } - }); - }; - - returnValue.putSupplier(key, usersTableResults); + returnValue.putSupplier(user_data, () -> getUserInformationDataContainer(uuid)); returnValue.putRawData(PlayerKeys.UUID, uuid); - returnValue.putSupplier(PlayerKeys.REGISTERED, () -> returnValue.getUnsafe(key).getUnsafe(PlayerKeys.REGISTERED)); - returnValue.putSupplier(PlayerKeys.NAME, () -> returnValue.getUnsafe(key).getUnsafe(PlayerKeys.NAME)); - returnValue.putSupplier(PlayerKeys.KICK_COUNT, () -> returnValue.getUnsafe(key).getUnsafe(PlayerKeys.KICK_COUNT)); + returnValue.putSupplier(PlayerKeys.REGISTERED, () -> returnValue.getUnsafe(user_data).getValue(PlayerKeys.REGISTERED).orElse(null)); + returnValue.putSupplier(PlayerKeys.NAME, () -> returnValue.getUnsafe(user_data).getValue(PlayerKeys.NAME).orElse(null)); + returnValue.putSupplier(PlayerKeys.KICK_COUNT, () -> returnValue.getUnsafe(user_data).getValue(PlayerKeys.KICK_COUNT).orElse(null)); return returnValue; } + private DataContainer getUserInformationDataContainer(UUID uuid) { + String sql = "SELECT * FROM " + tableName + " WHERE " + Col.UUID + "=?"; + + return query(new QueryStatement(sql) { + @Override + public void prepare(PreparedStatement statement) throws SQLException { + statement.setString(1, uuid.toString()); + } + + @Override + public DataContainer processResults(ResultSet set) throws SQLException { + DataContainer container = new DataContainer(); + + if (set.next()) { + long registered = set.getLong(Col.REGISTERED.get()); + String name = set.getString(Col.USER_NAME.get()); + int timesKicked = set.getInt(Col.TIMES_KICKED.get()); + + container.putRawData(PlayerKeys.REGISTERED, registered); + container.putRawData(PlayerKeys.NAME, name); + container.putRawData(PlayerKeys.KICK_COUNT, timesKicked); + } + + return container; + } + }); + } + public enum Col implements Column { ID("id"), UUID("uuid"), diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/VersionTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/VersionTable.java deleted file mode 100644 index 096275018..000000000 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/VersionTable.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.djrapitops.plan.system.database.databases.sql.tables; - -import com.djrapitops.plan.api.exceptions.database.DBInitException; -import com.djrapitops.plan.system.database.databases.sql.SQLDB; -import com.djrapitops.plan.system.database.databases.sql.processing.ExecStatement; -import com.djrapitops.plan.system.database.databases.sql.processing.QueryAllStatement; -import com.djrapitops.plan.system.database.databases.sql.processing.QueryStatement; -import com.djrapitops.plan.system.database.databases.sql.statements.Sql; -import com.djrapitops.plan.system.database.databases.sql.statements.TableSqlParser; - -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -/** - * @author Rsl1122 - */ -public class VersionTable extends Table { - - public VersionTable(SQLDB db) { - super("plan_version", db); - } - - @Override - public void createTable() throws DBInitException { - createTable(TableSqlParser.createTable(tableName) - .column("version", Sql.INT).notNull() - .toString() - ); - } - - public boolean isNewDatabase() { - String sql = usingMySQL ? - "SHOW TABLES LIKE ?" : - "SELECT tbl_name FROM sqlite_master WHERE tbl_name=?"; - - return query(new QueryStatement(sql) { - @Override - public void prepare(PreparedStatement statement) throws SQLException { - statement.setString(1, tableName); - } - - @Override - public Boolean processResults(ResultSet set) throws SQLException { - return !set.next(); - } - }); - } - - /** - * @return @throws SQLException - */ - @Override - public int getVersion() { - String sql = "SELECT * FROM " + tableName; - - return query(new QueryAllStatement(sql) { - @Override - public Integer processResults(ResultSet set) throws SQLException { - int version = 0; - if (set.next()) { - version = set.getInt("version"); - } - return version; - } - }); - } - - /** - * Set the DB Schema version - * - * @param version DB Schema version - */ - public void setVersion(int version) { - removeAllData(); - - String sql = "INSERT INTO " + tableName + " (version) VALUES (?)"; - - execute(new ExecStatement(sql) { - @Override - public void prepare(PreparedStatement statement) throws SQLException { - statement.setInt(1, version); - } - }); - } -} diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTable.java index bfdf93c89..81d907f24 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTable.java @@ -10,14 +10,11 @@ import com.djrapitops.plan.system.database.databases.sql.statements.Sql; import com.djrapitops.plan.system.database.databases.sql.statements.TableSqlParser; import com.djrapitops.plan.system.info.server.ServerInfo; import com.djrapitops.plugin.utilities.Verify; -import com.google.common.base.Objects; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.*; -import java.util.function.Function; -import java.util.stream.Collectors; /** * Table class representing database table plan_worlds. @@ -75,47 +72,6 @@ public class WorldTable extends Table { }); } - public Map> getWorldsPerServer() { - Map serverUUIDsByID = serverTable.getServerUUIDsByID(); - String sql = "SELECT * FROM " + tableName; - - return query(new QueryAllStatement>>(sql, 1000) { - @Override - public Map> processResults(ResultSet set) throws SQLException { - Map> worldsPerServer = new HashMap<>(); - while (set.next()) { - UUID serverUUID = serverUUIDsByID.get(set.getInt(Col.SERVER_ID.get())); - String worldName = set.getString(Col.NAME.get()); - List worlds = worldsPerServer.getOrDefault(serverUUID, new ArrayList<>()); - worlds.add(worldName); - worldsPerServer.put(serverUUID, worlds); - } - return worldsPerServer; - } - }); - } - - public Map getServerUUIDByWorldID() { - Map serverUUIDsByID = serverTable.getServerUUIDsByID(); - String sql = "SELECT DISTINCT " + - Col.ID + ", " + - Col.SERVER_ID + - " FROM " + tableName; - return query(new QueryAllStatement>(sql, 100) { - @Override - public Map processResults(ResultSet set) throws SQLException { - Map idMap = new HashMap<>(); - while (set.next()) { - int worldId = set.getInt(Col.ID.get()); - int serverId = set.getInt(Col.SERVER_ID.get()); - UUID serverUUID = serverUUIDsByID.getOrDefault(serverId, ServerInfo.getServerUUID()); - idMap.put(worldId, serverUUID); - } - return idMap; - } - }); - } - public List getWorlds() { return getWorlds(ServerInfo.getServerUUID()); } @@ -201,143 +157,6 @@ public class WorldTable extends Table { }); } - /** - * Used to get world names for this server. - * - * @param serverUUID UUID of the Server - * @return World names known for that server - * @deprecated Use getWorldNames instead, this method is slower. - */ - @Deprecated - public Set getWorldNamesOld(UUID serverUUID) { - WorldTimesTable worldTimesTable = db.getWorldTimesTable(); - SessionsTable sessionsTable = db.getSessionsTable(); - - String statementSelectServerID = serverTable.statementSelectServerID; - - String worldIDColumn = worldTimesTable + "." + WorldTimesTable.Col.WORLD_ID; - String worldSessionIDColumn = worldTimesTable + "." + WorldTimesTable.Col.SESSION_ID; - String sessionIDColumn = sessionsTable + "." + SessionsTable.Col.ID; - String sessionServerIDColumn = sessionsTable + "." + SessionsTable.Col.SERVER_ID; - - String sql = "SELECT DISTINCT " + - Col.NAME + " FROM " + - tableName + - " INNER JOIN " + worldTimesTable + " on " + worldIDColumn + "=" + tableName + "." + Col.ID + - " INNER JOIN " + sessionsTable + " on " + worldSessionIDColumn + "=" + sessionIDColumn + - " WHERE " + statementSelectServerID + "=" + sessionServerIDColumn; - - return query(new QueryStatement>(sql, 1000) { - @Override - public void prepare(PreparedStatement statement) throws SQLException { - statement.setString(1, serverUUID.toString()); - } - - @Override - public Set processResults(ResultSet set) throws SQLException { - Set worldNames = new HashSet<>(); - while (set.next()) { - worldNames.add(set.getString(Col.NAME.get())); - } - return worldNames; - } - }); - } - - public void alterTableV16() { - addColumns(Col.SERVER_ID + " integer NOT NULL DEFAULT 0"); - - List serverUUIDs = serverTable.getServerUUIDs(); - - Map> worldsPerServer = new HashMap<>(); - for (UUID serverUUID : serverUUIDs) { - worldsPerServer.put(serverUUID, getWorldNamesOld(serverUUID)); - } - - for (Map.Entry> entry : worldsPerServer.entrySet()) { - UUID serverUUID = entry.getKey(); - Set worlds = entry.getValue(); - - saveWorlds(worlds, serverUUID); - } - - updateWorldTimesTableWorldIDs(); - execute("DELETE FROM " + tableName + " WHERE " + Col.SERVER_ID + "=0"); - } - - private void updateWorldTimesTableWorldIDs() { - List worldObjects = getWorldObjects(); - Map> oldToNewMap = - worldObjects.stream() - .filter(worldObj -> worldObj.serverId == 0) - .collect(Collectors.toMap( - Function.identity(), - oldWorld -> worldObjects.stream() - .filter(worldObj -> worldObj.serverId != 0) - .filter(worldObj -> worldObj.equals(oldWorld)) - .collect(Collectors.toList() - ))); - - WorldTimesTable worldTimesTable = db.getWorldTimesTable(); - String sql = "UPDATE " + worldTimesTable + " SET " + - WorldTimesTable.Col.WORLD_ID + "=?" + - " WHERE " + WorldTimesTable.Col.WORLD_ID + "=?" + - " AND " + WorldTimesTable.Col.SERVER_ID + "=?"; - executeBatch(new ExecStatement(sql) { - @Override - public void prepare(PreparedStatement statement) throws SQLException { - for (Map.Entry> entry : oldToNewMap.entrySet()) { - WorldObj old = entry.getKey(); - for (WorldObj newWorld : entry.getValue()) { - statement.setInt(1, newWorld.id); - statement.setInt(2, old.id); - statement.setInt(3, newWorld.serverId); - statement.addBatch(); - } - } - } - }); - } - - public Map> getWorldIDsByServerIDs() { - String sql = "SELECT " + - Col.ID + ", " + - Col.SERVER_ID + - " FROM " + tableName; - return query(new QueryAllStatement>>(sql, 100) { - @Override - public Map> processResults(ResultSet set) throws SQLException { - Map> map = new HashMap<>(); - while (set.next()) { - - int serverID = set.getInt(Col.SERVER_ID.get()); - int worldID = set.getInt(Col.ID.get()); - List worldIDs = map.getOrDefault(serverID, new ArrayList<>()); - worldIDs.add(worldID); - map.put(serverID, worldIDs); - } - return map; - } - }); - } - - public List getWorldObjects() { - String sql = "SELECT * FROM " + tableName; - return query(new QueryAllStatement>(sql, 100) { - @Override - public List processResults(ResultSet set) throws SQLException { - List objects = new ArrayList<>(); - while (set.next()) { - int worldID = set.getInt(Col.ID.get()); - int serverID = set.getInt(Col.SERVER_ID.get()); - String worldName = set.getString(Col.NAME.get()); - objects.add(new WorldObj(worldID, serverID, worldName)); - } - return objects; - } - }); - } - public enum Col implements Column { ID("id"), SERVER_ID("server_id"), @@ -361,36 +180,3 @@ public class WorldTable extends Table { } } -class WorldObj { - final int id; - final int serverId; - final String name; - - public WorldObj(int id, int serverId, String name) { - this.id = id; - this.serverId = serverId; - this.name = name; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - WorldObj worldObj = (WorldObj) o; - return Objects.equal(name, worldObj.name); - } - - @Override - public int hashCode() { - return Objects.hashCode(name); - } - - @Override - public String toString() { - return "{" + - "id=" + id + - ", serverId=" + serverId + - ", name='" + name + '\'' + - '}'; - } -} diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTimesTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTimesTable.java index 8fe18c378..6ee5e7ff6 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTimesTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTimesTable.java @@ -1,7 +1,6 @@ package com.djrapitops.plan.system.database.databases.sql.tables; import com.djrapitops.plan.api.exceptions.database.DBInitException; -import com.djrapitops.plan.api.exceptions.database.DBOpException; import com.djrapitops.plan.data.container.Session; import com.djrapitops.plan.data.store.keys.SessionKeys; import com.djrapitops.plan.data.time.GMTimes; @@ -14,10 +13,6 @@ import com.djrapitops.plan.system.database.databases.sql.statements.Column; import com.djrapitops.plan.system.database.databases.sql.statements.Sql; import com.djrapitops.plan.system.database.databases.sql.statements.TableSqlParser; import com.djrapitops.plan.system.info.server.ServerInfo; -import com.djrapitops.plugin.api.TimeAmount; -import com.djrapitops.plugin.api.utility.log.Log; -import com.djrapitops.plugin.task.AbsRunnable; -import com.djrapitops.plugin.task.RunnableFactory; import com.djrapitops.plugin.utilities.Verify; import java.sql.PreparedStatement; @@ -356,42 +351,6 @@ public class WorldTimesTable extends UserIDTable { }); } - public void alterTableV16() { - addColumns(Col.SERVER_ID + " integer NOT NULL DEFAULT 0"); - - RunnableFactory.createNew("DB version -> 16", new AbsRunnable() { - @Override - public void run() { - try { - Map sessionIDServerIDRelation = sessionsTable.getIDServerIDRelation(); - - String sql = "UPDATE " + tableName + " SET " + - Col.SERVER_ID + "=?" + - " WHERE " + Col.SESSION_ID + "=?"; - - executeBatch(new ExecStatement(sql) { - @Override - public void prepare(PreparedStatement statement) throws SQLException { - for (Map.Entry entry : sessionIDServerIDRelation.entrySet()) { - Integer sessionID = entry.getKey(); - Integer serverID = entry.getValue(); - statement.setInt(1, serverID); - statement.setInt(2, sessionID); - statement.addBatch(); - } - } - }); - - worldTable.alterTableV16(); - } catch (DBOpException e) { - Log.toLog(this.getClass().getName(), e); - } finally { - cancel(); - } - } - }).runTaskLaterAsynchronously(TimeAmount.SECOND.ticks() * 2); - } - public enum Col implements Column { USER_ID(UserIDTable.Col.USER_ID.get()), SERVER_ID("server_id"), diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/move/TransferTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/move/TransferTable.java index 1ab454a76..5590a85aa 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/move/TransferTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/move/TransferTable.java @@ -1,6 +1,7 @@ package com.djrapitops.plan.system.database.databases.sql.tables.move; import com.djrapitops.plan.system.database.databases.sql.SQLDB; +import com.djrapitops.plan.system.database.databases.sql.statements.TableSqlParser; import com.djrapitops.plan.system.database.databases.sql.tables.Table; /** @@ -27,8 +28,7 @@ public class TransferTable extends Table { } protected void dropTable(String name) { - String sql = "DROP TABLE " + name; - execute(sql); + execute(TableSqlParser.dropTable(name)); } } \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/BungeeInfoSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/info/BungeeInfoSystem.java index acf13549f..4233e8d7d 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/info/BungeeInfoSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/info/BungeeInfoSystem.java @@ -8,6 +8,8 @@ import com.djrapitops.plan.api.exceptions.ParseException; import com.djrapitops.plan.api.exceptions.connection.NoServersException; import com.djrapitops.plan.api.exceptions.connection.WebException; import com.djrapitops.plan.api.exceptions.connection.WebFailException; +import com.djrapitops.plan.data.store.containers.NetworkContainer; +import com.djrapitops.plan.system.cache.CacheSystem; import com.djrapitops.plan.system.info.connection.BungeeConnectionSystem; import com.djrapitops.plan.system.info.request.CacheRequest; import com.djrapitops.plan.system.info.request.GenerateInspectPageRequest; @@ -43,7 +45,8 @@ public class BungeeInfoSystem extends InfoSystem { @Override public void updateNetworkPage() throws WebException { try { - String html = new NetworkPage().toHtml(); + NetworkContainer networkContainer = CacheSystem.getInstance().getDataContainerCache().getNetworkContainer(); + String html = new NetworkPage(networkContainer).toHtml(); ResponseCache.cacheResponse(PageId.SERVER.of(ServerInfo.getServerUUID()), () -> new AnalysisPageResponse(html)); } catch (ParseException e) { throw new WebFailException("Exception during Network Page Parsing", e); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/ServerInfoSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/info/ServerInfoSystem.java index 4027d9133..ed5b4908e 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/info/ServerInfoSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/info/ServerInfoSystem.java @@ -11,9 +11,12 @@ import com.djrapitops.plan.system.info.request.CacheNetworkPageContentRequest; import com.djrapitops.plan.system.info.request.InfoRequest; import com.djrapitops.plan.system.info.request.SetupRequest; import com.djrapitops.plan.system.info.server.ServerInfo; +import com.djrapitops.plan.system.locale.Locale; import com.djrapitops.plan.utilities.html.HtmlStructure; import com.djrapitops.plugin.api.utility.log.Log; +import java.util.function.Supplier; + /** * InfoSystem for Bukkit servers. * @@ -21,8 +24,8 @@ import com.djrapitops.plugin.api.utility.log.Log; */ public class ServerInfoSystem extends InfoSystem { - public ServerInfoSystem() { - super(new ServerConnectionSystem()); + public ServerInfoSystem(Supplier locale) { + super(new ServerConnectionSystem(locale)); } @Override diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/connection/BungeeConnectionSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/info/connection/BungeeConnectionSystem.java index e87255bad..5dab5bd96 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/info/connection/BungeeConnectionSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/info/connection/BungeeConnectionSystem.java @@ -46,14 +46,12 @@ public class BungeeConnectionSystem extends ConnectionSystem { protected Server selectServerForRequest(InfoRequest infoRequest) throws NoServersException { refreshServerMap(); Server server = null; - if (infoRequest instanceof CacheRequest) { - throw new NoServersException("Bungee should not send Cache requests."); + if (infoRequest instanceof CacheRequest || infoRequest instanceof GenerateInspectPageRequest) { + // Run locally + return ServerInfo.getServer(); } else if (infoRequest instanceof GenerateAnalysisPageRequest) { UUID serverUUID = ((GenerateAnalysisPageRequest) infoRequest).getServerUUID(); server = bukkitServers.get(serverUUID); - } else if (infoRequest instanceof GenerateInspectPageRequest) { - // Run locally - server = ServerInfo.getServer(); } if (server == null) { throw new NoServersException("Proper server is not available to process request: " + infoRequest.getClass().getSimpleName()); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/connection/ConnectionOut.java b/Plan/src/main/java/com/djrapitops/plan/system/info/connection/ConnectionOut.java index 771de0e02..36da124b8 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/info/connection/ConnectionOut.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/info/connection/ConnectionOut.java @@ -9,16 +9,24 @@ import com.djrapitops.plan.system.info.request.InfoRequest; import com.djrapitops.plan.system.info.request.InfoRequestWithVariables; import com.djrapitops.plan.system.info.server.Server; import com.djrapitops.plan.system.settings.Settings; +import com.djrapitops.plan.utilities.MiscUtils; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.utilities.Verify; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.conn.ssl.NoopHostnameVerifier; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.conn.ssl.TrustAllStrategy; +import org.apache.http.entity.ByteArrayEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.ssl.SSLContextBuilder; -import javax.net.ssl.*; -import java.io.DataOutputStream; import java.io.IOException; -import java.net.HttpURLConnection; import java.net.SocketTimeoutException; -import java.net.URL; import java.security.KeyManagementException; +import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.util.Map; import java.util.UUID; @@ -30,25 +38,6 @@ import java.util.UUID; */ public class ConnectionOut { - private static final TrustManager[] trustAllCerts = new TrustManager[]{ - new X509TrustManager() { - @Override - public java.security.cert.X509Certificate[] getAcceptedIssuers() { - return null; - } - - @Override - public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) { - //No need to implement. - } - - @Override - public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) { - //No need to implement. - } - } - }; - private final Server toServer; private final UUID serverUUID; private final InfoRequest infoRequest; @@ -68,79 +57,28 @@ public class ConnectionOut { } public void sendRequest() throws WebException { - String address = toServer.getWebAddress(); + String address = getAddress(); - HttpURLConnection connection = null; + CloseableHttpClient client = null; + HttpPost post = null; + CloseableHttpResponse response = null; try { - URL url = new URL(address + "/info/" + infoRequest.getClass().getSimpleName().toLowerCase()); - connection = (HttpURLConnection) url.openConnection(); - if (address.startsWith("https")) { - HttpsURLConnection httpsConn = (HttpsURLConnection) connection; - - // Disables unsigned certificate & hostname check, because we're trusting the user given certificate. - - // This allows https connections internally to local ports. - httpsConn.setHostnameVerifier((hostname, session) -> true); - - // This allows connecting to connections with invalid certificate - // Drawback: MitM attack possible between connections to servers that are not local. - // Scope: InfoRequest transmissions - // Risk: Attacker sets up a server between Bungee and Bukkit WebServers - // - Negotiates SSL Handshake with both servers - // - Receives the SSL encrypted data, but decrypts it in the MitM server. - // -> Access to valid ServerUUID for POST requests - // -> Access to sending Html to the (Bungee) WebServer - // Mitigating factors: - // - If Server owner has access to all routing done on the domain (IP/Address) - // - If Direct IPs are used to transfer between servers - // Alternative solution: InfoRequests run only on HTTP, HTTP can be read during transmission, - // would require running two WebServers when HTTPS is used. - httpsConn.setSSLSocketFactory(getRelaxedSocketFactory()); - } - connection.setConnectTimeout(10000); - connection.setDoOutput(true); - connection.setInstanceFollowRedirects(false); - connection.setRequestMethod("POST"); - connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); - - connection.setRequestProperty("charset", "UTF-8"); + client = getHttpClient(address); + String url = address + "/info/" + infoRequest.getClass().getSimpleName().toLowerCase(); + post = new HttpPost(url); String parameters = parseVariables(); + prepareRequest(post, parameters); - connection.setRequestProperty("Content-Length", Integer.toString(parameters.length())); + // Send request + response = client.execute(post); + int responseCode = response.getStatusLine().getStatusCode(); - byte[] toSend = parameters.getBytes(); - - connection.setUseCaches(false); - try (DataOutputStream out = new DataOutputStream(connection.getOutputStream())) { - out.write(toSend); - } - - int responseCode = connection.getResponseCode(); - - ConnectionLog.logConnectionTo(toServer, infoRequest, responseCode); - switch (responseCode) { - case 200: - return; - case 400: - throw new BadRequestException("Bad Request: " + url.toString() + " | " + parameters); - case 403: - throw new ForbiddenException(url.toString() + " returned 403 | " + parameters); - case 404: - throw new NotFoundException(url.toString() + " returned a 404, ensure that your server is connected to an up to date Plan server."); - case 412: - throw new UnauthorizedServerException(url.toString() + " reported that it does not recognize this server. Make sure '/plan m setup' was successful."); - case 500: - throw new InternalErrorException(); - case 504: - throw new GatewayException(url.toString() + " reported that it failed to connect to this server."); - default: - throw new WebException(url.toString() + "| Wrong response code " + responseCode); - } + handleResult(url, parameters, responseCode); } catch (SocketTimeoutException e) { ConnectionLog.logConnectionTo(toServer, infoRequest, 0); throw new ConnectionFailException("Connection timed out after 10 seconds.", e); - } catch (NoSuchAlgorithmException | KeyManagementException | IOException e) { + } catch (NoSuchAlgorithmException | KeyStoreException | KeyManagementException | IOException e) { if (Settings.DEV_MODE.isTrue()) { Log.warn("THIS ERROR IS ONLY LOGGED IN DEV MODE:"); Log.toLog(this.getClass(), e); @@ -148,12 +86,72 @@ public class ConnectionOut { ConnectionLog.logConnectionTo(toServer, infoRequest, -1); throw new ConnectionFailException("Connection failed to address: " + address + " - Make sure the server is online.", e); } finally { - if (connection != null) { - connection.disconnect(); + if (post != null) { + post.releaseConnection(); } + MiscUtils.close(response); + MiscUtils.close(client); } } + private void handleResult(String url, String parameters, int responseCode) throws WebException { + ConnectionLog.logConnectionTo(toServer, infoRequest, responseCode); + switch (responseCode) { + case 200: + return; + case 400: + throw new BadRequestException("Bad Request: " + url + " | " + parameters); + case 403: + throw new ForbiddenException(url + " returned 403 | " + parameters); + case 404: + throw new NotFoundException(url + " returned a 404, ensure that your server is connected to an up to date Plan server."); + case 412: + throw new UnauthorizedServerException(url + " reported that it does not recognize this server. Make sure '/plan m setup' was successful."); + case 500: + throw new InternalErrorException(); + case 504: + throw new GatewayException(url + " reported that it failed to connect to this server."); + default: + throw new WebException(url + "| Wrong response code " + responseCode); + } + } + + private void prepareRequest(HttpPost post, String parameters) { + RequestConfig requestConfig = RequestConfig.custom() + .setConnectionRequestTimeout(10000) + .setRelativeRedirectsAllowed(true) + .setContentCompressionEnabled(true) + .setMaxRedirects(1) + .build(); + post.setConfig(requestConfig); + + post.setHeader("Content-Type", "application/x-www-form-urlencoded"); + post.setHeader("charset", "UTF-8"); + + byte[] toSend = parameters.getBytes(); + post.setEntity(new ByteArrayEntity(toSend)); + } + + private CloseableHttpClient getHttpClient(String address) throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException { + if (address.startsWith("https")) { + SSLContextBuilder builder = new SSLContextBuilder(); + builder.loadTrustMaterial(null, new TrustAllStrategy()); + SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(builder.build(), NoopHostnameVerifier.INSTANCE); + return HttpClients.custom().setSSLSocketFactory(sslsf).build(); + } else { + return HttpClients.createDefault(); + } + } + + private String getAddress() { + String address = toServer.getWebAddress(); + if (address.contains("://:")) { + String[] parts = address.split("://:", 2); + address = parts[0] + "://localhost:" + parts[1]; + } + return address; + } + private String parseVariables() { StringBuilder parameters = new StringBuilder("sender=" + serverUUID + ";&variable;" + "type=" + infoRequest.getClass().getSimpleName()); @@ -167,10 +165,4 @@ public class ConnectionOut { return parameters.toString(); } - - private SSLSocketFactory getRelaxedSocketFactory() throws NoSuchAlgorithmException, KeyManagementException { - SSLContext sc = SSLContext.getInstance("TLSv1.2"); - sc.init(null, trustAllCerts, new java.security.SecureRandom()); - return sc.getSocketFactory(); - } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/connection/InfoRequestPageHandler.java b/Plan/src/main/java/com/djrapitops/plan/system/info/connection/InfoRequestPageHandler.java index f9f534445..06478d6d5 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/info/connection/InfoRequestPageHandler.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/info/connection/InfoRequestPageHandler.java @@ -7,11 +7,12 @@ package com.djrapitops.plan.system.info.connection; import com.djrapitops.plan.api.exceptions.connection.NotFoundException; import com.djrapitops.plan.api.exceptions.connection.WebException; import com.djrapitops.plan.system.info.request.InfoRequest; +import com.djrapitops.plan.system.locale.lang.ErrorPageLang; import com.djrapitops.plan.system.webserver.Request; import com.djrapitops.plan.system.webserver.pages.PageHandler; -import com.djrapitops.plan.system.webserver.response.DefaultResponses; import com.djrapitops.plan.system.webserver.response.Response; import com.djrapitops.plan.system.webserver.response.api.BadRequestResponse; +import com.djrapitops.plan.system.webserver.response.errors.NotFoundResponse; import com.djrapitops.plugin.utilities.Verify; import java.util.List; @@ -33,7 +34,7 @@ public class InfoRequestPageHandler extends PageHandler { try { if (target.isEmpty()) { - return DefaultResponses.NOT_FOUND.get(); + return new NotFoundResponse(request.getLocale().getString(ErrorPageLang.UNKNOWN_PAGE_404)); } if (!request.getRequestMethod().equals("POST")) { diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/connection/ServerConnectionSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/info/connection/ServerConnectionSystem.java index 04064e4b3..af0aad656 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/info/connection/ServerConnectionSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/info/connection/ServerConnectionSystem.java @@ -10,16 +10,17 @@ import com.djrapitops.plan.system.database.databases.Database; import com.djrapitops.plan.system.info.request.*; import com.djrapitops.plan.system.info.server.Server; import com.djrapitops.plan.system.info.server.ServerInfo; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.PluginLang; import com.djrapitops.plan.system.processing.Processing; import com.djrapitops.plan.system.settings.Settings; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plan.system.webserver.WebServerSystem; import com.djrapitops.plugin.api.TimeAmount; import com.djrapitops.plugin.api.utility.log.Log; import java.util.Optional; import java.util.UUID; +import java.util.function.Supplier; /** * Connection system for Bukkit servers. @@ -28,11 +29,14 @@ import java.util.UUID; */ public class ServerConnectionSystem extends ConnectionSystem { + private final Supplier locale; + private long latestServerMapRefresh; private Server mainServer; - public ServerConnectionSystem() { + public ServerConnectionSystem(Supplier locale) { + this.locale = locale; latestServerMapRefresh = 0; } @@ -105,11 +109,11 @@ public class ServerConnectionSystem extends ConnectionSystem { boolean usingAlternativeIP = Settings.SHOW_ALTERNATIVE_IP.isTrue(); if (!usingAlternativeIP && ServerInfo.getServerProperties().getIp().isEmpty()) { - Log.infoColor(Locale.get(Msg.ENABLE_NOTIFY_EMPTY_IP).toString()); + Log.infoColor("§e" + locale.get().getString(PluginLang.ENABLE_NOTIFY_EMPTY_IP)); } if (usingBungeeWebServer && usingAlternativeIP) { String webServerAddress = WebServerSystem.getInstance().getWebServer().getAccessAddress(); - Log.info("Make sure that this address points to THIS Bukkit Server: " + webServerAddress); + Log.info(locale.get().getString(PluginLang.ENABLE_NOTIFY_ADDRESS_CONFIRMATION, webServerAddress)); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/request/GenerateAnalysisPageRequest.java b/Plan/src/main/java/com/djrapitops/plan/system/info/request/GenerateAnalysisPageRequest.java index 75fff2a44..85ab5970a 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/info/request/GenerateAnalysisPageRequest.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/info/request/GenerateAnalysisPageRequest.java @@ -9,7 +9,7 @@ import com.djrapitops.plan.api.exceptions.connection.InternalErrorException; import com.djrapitops.plan.api.exceptions.connection.WebException; import com.djrapitops.plan.api.exceptions.database.DBOpException; import com.djrapitops.plan.data.store.containers.AnalysisContainer; -import com.djrapitops.plan.system.database.databases.Database; +import com.djrapitops.plan.system.cache.CacheSystem; import com.djrapitops.plan.system.info.InfoSystem; import com.djrapitops.plan.system.info.server.ServerInfo; import com.djrapitops.plan.system.webserver.pages.parsing.AnalysisPage; @@ -79,9 +79,7 @@ public class GenerateAnalysisPageRequest extends InfoRequestWithVariables implem try { runningAnalysis = true; UUID serverUUID = ServerInfo.getServerUUID(); - Database db = Database.getActive(); - - AnalysisContainer analysisContainer = new AnalysisContainer(db.fetch().getServerContainer(serverUUID)); + AnalysisContainer analysisContainer = CacheSystem.getInstance().getDataContainerCache().getAnalysisContainer(serverUUID); return new AnalysisPage(analysisContainer).toHtml(); } catch (DBOpException e) { if (!e.getCause().getMessage().contains("Connection is closed")) { diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/request/GenerateInspectPageRequest.java b/Plan/src/main/java/com/djrapitops/plan/system/info/request/GenerateInspectPageRequest.java index 8c524d2d7..ebc9671bd 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/info/request/GenerateInspectPageRequest.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/info/request/GenerateInspectPageRequest.java @@ -86,8 +86,4 @@ public class GenerateInspectPageRequest extends InfoRequestWithVariables impleme } } } - - public UUID getPlayerUUID() { - return playerUUID; - } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/request/GenerateInspectPluginsTabRequest.java b/Plan/src/main/java/com/djrapitops/plan/system/info/request/GenerateInspectPluginsTabRequest.java index 054618ada..64c18c834 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/info/request/GenerateInspectPluginsTabRequest.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/info/request/GenerateInspectPluginsTabRequest.java @@ -61,8 +61,4 @@ public class GenerateInspectPluginsTabRequest extends InfoRequestWithVariables i public void runLocally() throws WebException { generateAndCache(playerUUID); } - - public UUID getPlayerUUID() { - return playerUUID; - } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/server/Server.java b/Plan/src/main/java/com/djrapitops/plan/system/info/server/Server.java index acaacfa65..783fa0269 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/info/server/Server.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/info/server/Server.java @@ -43,10 +43,6 @@ public class Server implements Comparable { return name; } - public void setName(String name) { - this.name = name; - } - public String getWebAddress() { return webAddress; } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/listeners/bukkit/DeathEventListener.java b/Plan/src/main/java/com/djrapitops/plan/system/listeners/bukkit/DeathEventListener.java index 6576c787a..2c9f22743 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/listeners/bukkit/DeathEventListener.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/listeners/bukkit/DeathEventListener.java @@ -1,6 +1,7 @@ package com.djrapitops.plan.system.listeners.bukkit; import com.djrapitops.plan.data.container.Session; +import com.djrapitops.plan.data.store.mutators.formatting.Formatters; import com.djrapitops.plan.system.cache.SessionCache; import com.djrapitops.plan.system.processing.Processing; import com.djrapitops.plan.system.processing.processors.player.KillProcessor; @@ -80,7 +81,7 @@ public class DeathEventListener implements Listener { } } - return new KillProcessor(killer.getUniqueId(), time, dead, normalizeMaterialName(itemInHand)); + return new KillProcessor(killer.getUniqueId(), time, dead, Formatters.itemName().apply(itemInHand.name())); } private KillProcessor handlePetKill(long time, LivingEntity dead, Tameable tameable) { @@ -93,8 +94,16 @@ public class DeathEventListener implements Listener { return null; } + String name; + try { + name = tameable.getType().name(); + } catch (NoSuchMethodError oldVersionNoTypesError) { + // getType introduced in 1.9 + name = tameable.getClass().getSimpleName(); + } + return new KillProcessor(owner.getUniqueId(), time, dead, - new Format(tameable.getType().name()).capitalize().toString() + new Format(name).removeNumbers().removeSymbols().capitalize().toString() ); } @@ -110,26 +119,5 @@ public class DeathEventListener implements Listener { new Format(projectile.getType().name()).capitalize().toString() ); } - - /** - * Normalizes a material name - * - * @param material The material - * @return The normalized material name - */ - private String normalizeMaterialName(Material material) { - String[] parts = material.name().split("_"); - StringBuilder builder = new StringBuilder(); - - for (int i = 0; i < parts.length; i++) { - String part = new Format(parts[i]).capitalize().toString(); - builder.append(part); - if (i < parts.length - 1) { - builder.append(" "); - } - } - - return builder.toString(); - } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/listeners/bukkit/PlayerOnlineListener.java b/Plan/src/main/java/com/djrapitops/plan/system/listeners/bukkit/PlayerOnlineListener.java index d3a6c850f..23d34756a 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/listeners/bukkit/PlayerOnlineListener.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/listeners/bukkit/PlayerOnlineListener.java @@ -97,7 +97,7 @@ public class PlayerOnlineListener implements Listener { SessionCache.getInstance().cacheSession(uuid, new Session(uuid, time, world, gm)); Processing.submit( - new RegisterProcessor(uuid, player.getFirstPlayed(), playerName, + new RegisterProcessor(uuid, player::getFirstPlayed, playerName, new IPUpdateProcessor(uuid, address, time), new NameProcessor(uuid, playerName, displayName), new PlayerPageUpdateProcessor(uuid) diff --git a/Plan/src/main/java/com/djrapitops/plan/system/listeners/bungee/PlayerOnlineListener.java b/Plan/src/main/java/com/djrapitops/plan/system/listeners/bungee/PlayerOnlineListener.java index e5d88990c..4d1221b63 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/listeners/bungee/PlayerOnlineListener.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/listeners/bungee/PlayerOnlineListener.java @@ -7,6 +7,8 @@ package com.djrapitops.plan.system.listeners.bungee; import com.djrapitops.plan.data.container.Session; import com.djrapitops.plan.system.cache.SessionCache; import com.djrapitops.plan.system.processing.Processing; +import com.djrapitops.plan.system.processing.processors.info.NetworkPageUpdateProcessor; +import com.djrapitops.plan.system.processing.processors.info.PlayerPageUpdateProcessor; import com.djrapitops.plan.system.processing.processors.player.BungeePlayerRegisterProcessor; import com.djrapitops.plan.system.processing.processors.player.IPUpdateProcessor; import com.djrapitops.plugin.api.utility.log.Log; @@ -41,6 +43,8 @@ public class PlayerOnlineListener implements Listener { Processing.submit(new BungeePlayerRegisterProcessor(uuid, name, now, new IPUpdateProcessor(uuid, address, now)) ); + Processing.submit(new PlayerPageUpdateProcessor(uuid)); + Processing.submit(new NetworkPageUpdateProcessor()); } catch (Exception e) { Log.toLog(this.getClass(), e); } @@ -53,6 +57,8 @@ public class PlayerOnlineListener implements Listener { UUID uuid = player.getUniqueId(); SessionCache.getInstance().endSession(uuid, System.currentTimeMillis()); + Processing.submit(new PlayerPageUpdateProcessor(uuid)); + Processing.submit(new NetworkPageUpdateProcessor()); } catch (Exception e) { Log.toLog(this.getClass(), e); } @@ -67,6 +73,7 @@ public class PlayerOnlineListener implements Listener { long now = System.currentTimeMillis(); // Replaces the current session in the cache. SessionCache.getInstance().cacheSession(uuid, new Session(uuid, now, "", "")); + Processing.submit(new PlayerPageUpdateProcessor(uuid)); } catch (Exception e) { Log.toLog(this.getClass(), e); } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/listeners/sponge/SpongeDeathListener.java b/Plan/src/main/java/com/djrapitops/plan/system/listeners/sponge/SpongeDeathListener.java index 9009cd94e..568ca0fff 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/listeners/sponge/SpongeDeathListener.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/listeners/sponge/SpongeDeathListener.java @@ -1,6 +1,7 @@ package com.djrapitops.plan.system.listeners.sponge; import com.djrapitops.plan.data.container.Session; +import com.djrapitops.plan.data.store.mutators.formatting.Formatters; import com.djrapitops.plan.system.cache.SessionCache; import com.djrapitops.plan.system.processing.Processing; import com.djrapitops.plan.system.processing.processors.player.SpongeKillProcessor; @@ -73,7 +74,7 @@ public class SpongeDeathListener { ItemStack inHand = inMainHand.orElse(killer.getItemInHand(HandTypes.OFF_HAND).orElse(ItemStack.empty())); ItemType type = inHand.isEmpty() ? ItemTypes.AIR : inHand.getType(); - return new SpongeKillProcessor(killer.getUniqueId(), time, getUUID(dead), normalizeItemName(type)); + return new SpongeKillProcessor(killer.getUniqueId(), time, getUUID(dead), Formatters.itemName().apply(type.getName())); } private UUID getUUID(Living dead) { @@ -86,13 +87,10 @@ public class SpongeDeathListener { private SpongeKillProcessor handleWolfKill(long time, Living dead, Wolf wolf) { Optional> owner = wolf.get(Keys.TAMED_OWNER); - if (!owner.isPresent()) { - return null; - } - - return owner.get().map( + return owner.map(ownerUUID -> ownerUUID.map( uuid -> new SpongeKillProcessor(uuid, time, getUUID(dead), "Wolf") - ).orElse(null); + ).orElse(null)).orElse(null); + } private SpongeKillProcessor handleProjectileKill(long time, Living dead, Projectile projectile) { @@ -108,25 +106,4 @@ public class SpongeDeathListener { ); } - /** - * Normalizes an item name - * - * @param type The type of the item - * @return The normalized item name - */ - private String normalizeItemName(ItemType type) { - String[] parts = type.getName().split("_"); - StringBuilder builder = new StringBuilder(); - - for (int i = 0; i < parts.length; i++) { - String part = new Format(parts[i]).capitalize().toString(); - builder.append(part); - if (i < parts.length - 1) { - builder.append(" "); - } - } - - return builder.toString(); - } - } \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/listeners/sponge/SpongePlayerListener.java b/Plan/src/main/java/com/djrapitops/plan/system/listeners/sponge/SpongePlayerListener.java index d4805ed6a..a302f2bd2 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/listeners/sponge/SpongePlayerListener.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/listeners/sponge/SpongePlayerListener.java @@ -100,7 +100,7 @@ public class SpongePlayerListener { SessionCache.getInstance().cacheSession(uuid, new Session(uuid, time, world, gm)); Processing.submit( - new RegisterProcessor(uuid, time, playerName, + new RegisterProcessor(uuid, () -> time, playerName, new IPUpdateProcessor(uuid, address, time), new NameProcessor(uuid, playerName, displayName), new PlayerPageUpdateProcessor(uuid) diff --git a/Plan/src/main/java/com/djrapitops/plan/system/locale/LangCode.java b/Plan/src/main/java/com/djrapitops/plan/system/locale/LangCode.java new file mode 100644 index 000000000..d10df7130 --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/locale/LangCode.java @@ -0,0 +1,44 @@ +package com.djrapitops.plan.system.locale; + +/** + * Language enum of supported languages, follows ISO 639-1 for language codes. + * + * @author Rsl1122 + */ +public enum LangCode { + + CUSTOM("Custom"), + EN("English"), + FI("Finnish"), + DE("Deutch"), + FR("French"), + GA("Irish (Gaeilge)"), + CS("Czech"), + PT("Portugese"), + NL("Dutch"), + NO("Norwegian"), + PL("Polish"), + IT("Italian"); + + private final String name; + + LangCode(String name) { + this.name = name; + } + + public static LangCode fromString(String code) { + try { + return LangCode.valueOf(code.toUpperCase()); + } catch (IllegalArgumentException e) { + return LangCode.EN; + } + } + + public String getName() { + return name; + } + + public String getFileName() { + return "locale_" + name() + ".txt"; + } +} diff --git a/Plan/src/main/java/com/djrapitops/plan/system/locale/Locale.java b/Plan/src/main/java/com/djrapitops/plan/system/locale/Locale.java new file mode 100644 index 000000000..3483cd1aa --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/locale/Locale.java @@ -0,0 +1,87 @@ +package com.djrapitops.plan.system.locale; + +import com.djrapitops.plan.PlanPlugin; +import com.djrapitops.plan.system.locale.lang.Lang; +import com.djrapitops.plan.system.settings.Settings; + +import java.io.File; +import java.io.IOException; +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.stream.Collectors; + +/** + * Represents loaded language information. + * + * @author Rsl1122 + */ +public class Locale extends HashMap { + + public static Locale fromSetting() throws IOException { + String locale = Settings.LOCALE.toString(); + if (locale.equalsIgnoreCase("default")) { + return new Locale(); + } + return forLangCodeString(locale); + } + + public static Locale forLangCodeString(String code) throws IOException { + return forLangCode(LangCode.fromString(code)); + } + + public static Locale forLangCode(LangCode code) throws IOException { + return new LocaleFileReader(PlanPlugin.getInstance(), code.getFileName()).load(); + } + + public static Locale fromFile(File file) throws IOException { + return new LocaleFileReader(file).load(); + } + + @Override + public Message get(Object key) { + Message storedValue = super.get(key); + if (key instanceof Lang && storedValue == null) { + return new Message(((Lang) key).getDefault()); + } else { + return storedValue; + } + } + + public String getString(Lang key) { + return get(key).toString(); + } + + public String getString(Lang key, Serializable... values) { + return get(key).parse(values); + } + + public String[] getArray(Lang key) { + return get(key).toArray(); + } + + public String[] getArray(Lang key, Serializable... values) { + return get(key).toArray(values); + } + + public String replaceMatchingLanguage(String from) { + if (isEmpty()) { + return from; + } + + String replaced = from; + + // Longest first so that entries that contain each other don't partially replace. + List> entries = entrySet().stream().sorted( + (one, two) -> Integer.compare(two.getKey().getIdentifier().length(), one.getKey().getIdentifier().length()) + ).collect(Collectors.toList()); + + for (Entry entry : entries) { + String defaultValue = entry.getKey().getDefault(); + String replacement = entry.getValue().toString(); + + replaced = replaced.replace(defaultValue, replacement); + } + return replaced; + } +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/locale/LocaleFileReader.java b/Plan/src/main/java/com/djrapitops/plan/system/locale/LocaleFileReader.java new file mode 100644 index 000000000..061fffb95 --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/locale/LocaleFileReader.java @@ -0,0 +1,47 @@ +package com.djrapitops.plan.system.locale; + +import com.djrapitops.plan.PlanPlugin; +import com.djrapitops.plan.system.locale.lang.Lang; +import com.djrapitops.plan.utilities.file.FileUtil; + +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Utility for reading locale files. + * + * @author Rsl1122 + */ +public class LocaleFileReader { + + private List lines; + + public LocaleFileReader(File from) throws IOException { + lines = FileUtil.lines(from); + } + + public LocaleFileReader(PlanPlugin planPlugin, String fileName) throws IOException { + lines = FileUtil.lines(planPlugin, "locale/" + fileName); + } + + public Locale load() { + Locale locale = new Locale(); + + Map identifiers = LocaleSystem.getIdentifiers(); + lines.forEach(line -> { + String[] split = line.split(" \\|\\| "); + if (split.length == 2) { + String identifier = split[0].trim(); + Lang msg = identifiers.get(identifier); + if (msg != null) { + locale.put(msg, new Message(split[1])); + } + } + }); + + return locale; + } + +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/locale/LocaleFileWriter.java b/Plan/src/main/java/com/djrapitops/plan/system/locale/LocaleFileWriter.java new file mode 100644 index 000000000..8b08ff0a5 --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/locale/LocaleFileWriter.java @@ -0,0 +1,73 @@ +package com.djrapitops.plan.system.locale; + +import com.djrapitops.plan.system.locale.lang.Lang; +import com.djrapitops.plan.utilities.comparators.LocaleEntryComparator; +import com.djrapitops.plan.utilities.comparators.StringLengthComparator; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.List; +import java.util.stream.Collectors; + +/** + * Utility for writing a Locale into a file. + * + * @author Rsl1122 + */ +public class LocaleFileWriter { + + private Locale locale; + + public LocaleFileWriter(Locale locale) { + this.locale = locale; + } + + public void writeToFile(File file) throws IOException { + // Find longest identifier length for spacing + int length = LocaleSystem.getIdentifiers().keySet().stream() + .min(new StringLengthComparator()) + .map(String::length).orElse(0) + 2; + + addMissingLang(); + + List lines = createLines(length); + + write(file, lines); + } + + private void write(File file, List lines) throws IOException { + if (!file.exists()) { + Files.createFile(file.toPath()); + } + Files.write(file.toPath(), lines, StandardCharsets.UTF_8); + } + + private List createLines(int length) { + return locale.entrySet().stream() + .sorted(new LocaleEntryComparator()) + .map(entry -> { + String value = entry.getValue() != null ? entry.getValue().toString() : entry.getKey().getDefault(); + return getSpacedIdentifier(entry.getKey().getIdentifier(), length) + "|| " + value; + }) + .collect(Collectors.toList()); + } + + private void addMissingLang() { + for (Lang lang : LocaleSystem.getIdentifiers().values()) { + if (!locale.containsKey(lang)) { + locale.put(lang, new Message(lang.getDefault())); + } + } + } + + private String getSpacedIdentifier(String identifier, int length) { + StringBuilder b = new StringBuilder(identifier); + while (b.length() < length) { + b.append(" "); + } + return b.toString(); + } + +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/locale/LocaleSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/locale/LocaleSystem.java new file mode 100644 index 000000000..9061a36ed --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/locale/LocaleSystem.java @@ -0,0 +1,102 @@ +package com.djrapitops.plan.system.locale; + +import com.djrapitops.plan.api.exceptions.EnableException; +import com.djrapitops.plan.system.SubSystem; +import com.djrapitops.plan.system.file.FileSystem; +import com.djrapitops.plan.system.locale.lang.*; +import com.djrapitops.plan.system.settings.Settings; +import com.djrapitops.plan.system.webserver.auth.FailReason; +import com.djrapitops.plugin.api.utility.log.Log; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * System in charge of {@link Locale}. + * + * @author Rsl1122 + */ +public class LocaleSystem implements SubSystem { + + private Locale locale; + + public LocaleSystem() { + this.locale = new Locale(); + } + + public static Map getIdentifiers() { + Lang[][] lang = new Lang[][]{ + CommandLang.values(), + CmdHelpLang.values(), + DeepHelpLang.values(), + PluginLang.values(), + ManageLang.values(), + GenericLang.values(), + CommonHtmlLang.values(), + PlayerPageLang.values(), + ServerPageLang.values(), + NetworkPageLang.values(), + ErrorPageLang.values(), + FailReason.values() + }; + + return Arrays.stream(lang) + .flatMap(Arrays::stream) + .collect(Collectors.toMap(Lang::getIdentifier, Function.identity())); + } + + @Override + public void enable() throws EnableException { + File localeFile = FileSystem.getLocaleFile(); + + if (Settings.WRITE_NEW_LOCALE.isTrue()) { + writeNewDefaultLocale(localeFile); + } + + if (localeFile.exists()) { + loadFromFile(localeFile); + } else { + loadSettingLocale(); + } + } + + private void writeNewDefaultLocale(File localeFile) { + try { + new LocaleFileWriter(localeFile.exists() ? Locale.fromFile(localeFile) : locale).writeToFile(localeFile); + } catch (IOException | IllegalStateException e) { + Log.error("Failed to write new Locale file at " + localeFile.getAbsolutePath()); + Log.toLog(this.getClass().getName(), e); + } + Settings.WRITE_NEW_LOCALE.set(false); + Settings.save(); + } + + private void loadSettingLocale() throws EnableException { + try { + locale = Locale.fromSetting(); + } catch (IOException e) { + throw new EnableException("Failed to read locale from jar: " + Settings.LOCALE.toString(), e); + } + } + + private void loadFromFile(File localeFile) throws EnableException { + try { + locale = Locale.fromFile(localeFile); + } catch (IOException e) { + throw new EnableException("Failed to read locale file at " + localeFile.getAbsolutePath(), e); + } + } + + @Override + public void disable() { + // No action necessary on disable. + } + + public Locale getLocale() { + return locale; + } +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/settings/locale/Message.java b/Plan/src/main/java/com/djrapitops/plan/system/locale/Message.java similarity index 85% rename from Plan/src/main/java/com/djrapitops/plan/system/settings/locale/Message.java rename to Plan/src/main/java/com/djrapitops/plan/system/locale/Message.java index 957b19aca..1d053285b 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/settings/locale/Message.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/locale/Message.java @@ -1,4 +1,4 @@ -package com.djrapitops.plan.system.settings.locale; +package com.djrapitops.plan.system.locale; import com.djrapitops.plugin.utilities.Verify; import org.apache.commons.text.StringSubstitutor; @@ -8,7 +8,7 @@ import java.util.HashMap; import java.util.Map; /** - * Represents a Message that can be modified. + * Represents a Message that can be modified by the caller. * * @author Rsl1122 * @since 3.6.2 @@ -43,10 +43,6 @@ public class Message { return parse(p).split("\\\\"); } - public String parse() { - return toString(); - } - @Override public String toString() { return content; diff --git a/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/CmdHelpLang.java b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/CmdHelpLang.java new file mode 100644 index 000000000..8a228462f --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/CmdHelpLang.java @@ -0,0 +1,61 @@ +package com.djrapitops.plan.system.locale.lang; + +/** + * Lang for short help messages in Commands. + * + * @author Rsl1122 + */ +public enum CmdHelpLang implements Lang { + ANALYZE("Command Help - /plan analyze", "View the Server Page"), + HELP("Command Help - /plan help", "Show command list"), + INFO("Command Help - /plan info", "Check the version of Plan"), + INSPECT("Command Help - /plan inspect", "View a Player Page"), + QINSPECT("Command Help - /plan qinspect", "View Player info in game"), + SEARCH("Command Help - /plan search", "Search for a player name"), + PLAYERS("Command Help - /plan players", "View the Players Page"), + SERVERS("Command Help - /plan servers", "List servers in Database"), + NETWORK("Command Help - /plan network", "View the Network Page"), + RELOAD("Command Help - /plan reload", "Restart Plan"), + MANAGE("Command Help - /plan manage", "Manage Plan Database"), + WEB_REGISTER("Command Help - /plan register", "Register a Web User"), + WEB("Command Help - /plan webuser", "Manage Web Users"), + DEV("Command Help - /plan dev", "Development mode command"), + SETUP("Command Help - /planbungee setup", "Toggle set-up mode"), + CON("Command Help - /planbungee con", "Debug Bungee-Server connections"), + DISABLE("Command Help - /planbungee disable", "Disable the plugin temporarily"), + UPDATE("Command Help - /plan update", "Get change log link or update plugin"), + + MANAGE_MOVE("Command Help - /plan manage move", "Move data between Databases"), + MANAGE_BACKUP("Command Help - /plan manage backup", "Backup a Database"), + MANAGE_RESTORE("Command Help - /plan manage restore", "Restore a previous Backup"), + MANAGE_REMOVE("Command Help - /plan manage remove", "Remove Player's data"), + MANAGE_HOTSWAP("Command Help - /plan manage hotswap", "Change Database quickly"), + MANAGE_CLEAR("Command Help - /plan manage clear", "Clear a Database"), + MANAGE_CON("Command Help - /plan manage con", "Debug Server-Bungee connections"), + MANAGE_IMPORT("Command Help - /plan manage import", "Import data from elsewhere"), + MANAGE_DISABLE("Command Help - /plan manage disable", "Disable a feature temporarily"), + MANAGE_SETUP("Command Help - /plan manage setup", "Set-up Server-Bungee connection"), + + WEB_LEVEL("Command Help - /plan web level", "Information about permission levels"), + WEB_LIST("Command Help - /plan web list", "List Web Users"), + WEB_CHECK("Command Help - /plan web check", "Inspect a Web User"), + WEB_DELETE("Command Help - /plan web delete", "Delete a Web User"); + + private final String identifier; + private final String defaultValue; + + CmdHelpLang(String identifier, String defaultValue) { + this.identifier = identifier; + this.defaultValue = defaultValue; + } + + @Override + public String getIdentifier() { + return identifier; + } + + @Override + public String getDefault() { + return defaultValue; + } +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/CommandLang.java b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/CommandLang.java new file mode 100644 index 000000000..ec729794e --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/CommandLang.java @@ -0,0 +1,101 @@ +package com.djrapitops.plan.system.locale.lang; + +/** + * {@link Lang} implementation for general command language. + * + * @author Rsl1122 + */ +public enum CommandLang implements Lang { + FAIL_REQ_ARGS("Cmd FAIL - Requires Arguments", "§cArguments required (${0}) ${1}"), + FAIL_REQ_ONE_ARG("Cmd FAIL - Require only one Argument", "§cSingle Argument required ${1}"), + FAIL_NO_PERMISSION("Cmd FAIL - No Permission", "§cYou do not have the required permission."), + FAIL_USERNAME_NOT_VALID("Cmd FAIL - Invalid Username", "§cUser does not have an UUID."), + FAIL_USERNAME_NOT_KNOWN("Cmd FAIL - Unknown Username", "§cUser has not been seen on this server"), + + FAIL_WEB_USER_EXISTS("Cmd FAIL - WebUser exists", "§cUser already exists!"), + FAIL_WEB_USER_NOT_EXISTS("Cmd FAIL - WebUser does not exists", "§cUser does not exists!"), + FAIL_NO_SUCH_FEATURE("Cmd FAIL - No Feature", "§eDefine a feature to disable! (currently supports ${0})"), + + FEATURE_DISABLED("Cmd SUCCESS - Feature disabled", "§aDisabled '${0}' temporarily until next plugin reload."), + + WEB_USER_REGISTER_SUCCESS("Cmd SUCCESS - WebUser register", "§aAdded a new user (${0}) successfully!"), + WEB_USER_REGISTER_NOTIFY("Cmd Notify - WebUser register", "Registered new user: '${0}' Perm level: ${1}"), + WEB_USER_LIST("Web User Listing", " §2${0} §7: §f${1}"), + NO_WEB_USER_NOTIFY("Cmd Notify - No WebUser", "You might not have a web user, use /plan register "), + WEB_PERMISSION_LEVELS("Cmd Web - Permission Levels", ">\\§70: Access all pages\\§71: Access '/players' and all player pages\\§72: Access player page with the same username as the webuser\\§73+: No permissions"), + + CONNECT_SUCCESS("Cmd Setup - Success", "§aConnection successful, Plan may restart in a few seconds.."), + CONNECT_FORBIDDEN("Cmd Setup - Forbidden", "§eConnection succeeded, but Bungee has set-up mode disabled - use '/planbungee setup' to enable it."), + CONNECT_BAD_REQUEST("Cmd Setup - Bad Request", "§eConnection succeeded, but Receiving server was not a Bungee server. Use Bungee address instead."), + CONNECT_UNAUTHORIZED("Cmd Setup - Unauthorized", "§eConnection succeeded, but Receiving server didn't authorize this server. Contact Discord for support"), + CONNECT_FAIL("Cmd Setup - Generic Fail", "§eConnection failed: ${0}"), + CONNECT_INTERNAL_ERROR("Cmd Setup - Internal Error", "§eConnection succeeded. ${0}, check possible ErrorLog on receiving server's debug page."), + CONNECT_GATEWAY("Cmd Setup - Gateway Error", "§eConnection succeeded, but Bungee failed to connect to this server (Did current web server restart?). Use /plan m con & /planbungee con to debug."), + CONNECT_WEBSERVER_NOT_ENABLED("Cmd Setup - WebServer not Enabled", "§cWebServer is not enabled on this server! Make sure it enables on boot!"), + CONNECT_URL_MISTAKE("Cmd Setup - Url mistake", "§cMake sure you're using the full address (Starts with http:// or https://) - Check Bungee enable log for the full address."), + + SETUP_ALLOWED("Cmd Setup - Allowed", "§aSet-up is now Allowed"), + SETUP_FORBIDDEN("Cmd Setup - Disallowed", "§cSet-up is now Forbidden"), + + LINK_CLICK_ME("Cmd - Click Me", "Click me"), + LINK_PREFIX("Cmd - Link", " §2Link: §f"), + + HEADER_SEARCH("Cmd Header - Search", "> §2${0} Results for §f${1}§2:"), + HEADER_ANALYSIS("Cmd Header - Analysis", "> §2Analysis Results"), + HEADER_INFO("Cmd Header - Info", "> §2Player Analytics"), + HEADER_INSPECT("Cmd Header - Inspect", "> §2Player: §f${0}"), + HEADER_SERVERS("Cmd Header - Servers", "> §2Servers"), + HEADER_PLAYERS("Cmd Header - Players", "> §2Players"), + HEADER_WEB_USERS("Cmd Header - Web Users", "> §2${0} Web Users"), + HEADER_NETWORK("Cmd Header - Network", "> §2Network Page"), + + INFO_VERSION("Cmd Info - Version", " §2Version: §f${0}"), + INFO_UPDATE("Cmd Info - Update", " §2Update Available: §f${0}"), + INFO_DATABASE("Cmd Info - Database", " §2Active Database: §f${0}"), + INFO_BUNGEE_CONNECTION("Cmd Info - Bungee Connection", " §2Connected to Bungee: §f${0}"), + + QINSPECT_ACTIVITY_INDEX("Cmd Qinspect - Activity Index", " §2Activity Index: §f${0} | ${1}"), + QINSPECT_REGISTERED("Cmd Qinspect - Registered", " §2Registered: §f${0}"), + QINSPECT_LAST_SEEN("Cmd Qinspect - Last Seen", " §2Last Seen: §f${0}"), + QINSPECT_GEOLOCATION("Cmd Qinspect - Geolocation", " §2Logged in from: §f${0}"), + QINSPECT_PLAYTIME("Cmd Qinspect - Playtime", " §2Playtime: §f${0}"), + QINSPECT_LONGEST_SESSION("Cmd Qinspect - Longest Session", " §2Longest Session: §f${0}"), + QINSPECT_TIMES_KICKED("Cmd Qinspect - Times Kicked", " §2Times Kicked: §f${0}"), + QINSPECT_PLAYER_KILLS("Cmd Qinspect - Player Kills", " §2Player Kills: §f${0}"), + QINSPECT_MOB_KILLS("Cmd Qinspect - Mob Kills", " §2Mob Kills: §f${0}"), + QINSPECT_DEATHS("Cmd Qinspect - Deaths", " §2Deaths: §f${0}"), + + DISABLE_DISABLED("Cmd Disable - Disabled", "§aPlan systems are now disabled. You can still use /planbungee reload to restart the plugin."), + + UPDATE_WRONG_URL("Cmd Update - Url mismatch", "§cVersion download url did not start with ${0} and might not be trusted. You can download this version manually here (Direct download):"), + UPDATE_CHANGE_LOG("Cmd Update - Change log", "Change Log v${0}:"), + UPDATE_CANCEL_SUCCESS("Cmd Update - Cancel Success", "§aCancel operation performed."), + UPDATE_NOTIFY_CANCEL("Cmd Update - Notify Cancel", "§aYou can cancel the update on servers that haven't rebooted yet with /plan update cancel."), + UPDATE_ONLINE_CHECK("Cmd Update - Online Check", "Checking that all servers are online.."), + UPDATE_FAIL_NOT_ONLINE("Cmd Update - Fail Not Online", "§cNot all servers were online or accessible, you can still update available servers using /plan update -u -force"), + UPDATE_SCHEDULED("Cmd Update - Scheduled", "§a${0} scheduled for update."), + UPDATE_FAIL_FORCED("Cmd Update - Fail Force Notify", "§e${0} failed to update, -force specified, continuing update."), + UPDATE_FAIL_CANCEL("Cmd Update - Fail Cacnel", "§cUpdate failed on a server, cancelling update on all servers.."), + UPDATE_CANCELLED("Cmd Update - Cancelled", "§cUpdate cancelled."), + + RELOAD_COMPLETE("Cmd Info - Reload Complete", "§aReload Complete"), + RELOAD_FAILED("Cmd Info - Reload Failed", "§cSomething went wrong during reload of the plugin, a restart is recommended."); + + private final String identifier; + private final String defaultValue; + + CommandLang(String identifier, String defaultValue) { + this.identifier = identifier; + this.defaultValue = defaultValue; + } + + @Override + public String getIdentifier() { + return identifier; + } + + @Override + public String getDefault() { + return defaultValue; + } +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/CommonHtmlLang.java b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/CommonHtmlLang.java new file mode 100644 index 000000000..e837c5182 --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/CommonHtmlLang.java @@ -0,0 +1,43 @@ +package com.djrapitops.plan.system.locale.lang; + +/** + * {@link Lang} implementation for commonly used .html replacement values. + * + * @author Rsl1122 + */ +public enum CommonHtmlLang implements Lang { + PLEASE_WAIT("Please wait..."), + + NAV_INFORMATION("Information"), + NAV_SESSIONS("Sessions"), + NAV_OVERVIEW("Overview"), + NAV_PLUGINS("Plugins"), + NAV_ONLINE_ACTIVITY("Online Activity"), + NAV_SEVER_HEALTH("Server Health"), + NAV_PERFORMANCE("Performance"), + NAV_PLAYERS("Players"), + NAV_GEOLOCATIONS("Geolocations"), + NAV_COMMAND_USAGE("Command Usage"), + NAV_NETWORK_PLAYERS("Network Players"), + + AVERAGE_PING("Average Ping"), + BEST_PING("Best Ping"), + WORST_PING("Worst Ping"), + PLAYERS_ONLINE_TEXT("Players Online"); + + private final String defaultValue; + + CommonHtmlLang(String defaultValue) { + this.defaultValue = defaultValue; + } + + @Override + public String getIdentifier() { + return "HTML - " + name(); + } + + @Override + public String getDefault() { + return defaultValue; + } +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/DeepHelpLang.java b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/DeepHelpLang.java new file mode 100644 index 000000000..e7f4b498f --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/DeepHelpLang.java @@ -0,0 +1,54 @@ +package com.djrapitops.plan.system.locale.lang; + +/** + * {@link Lang} implementation for in depth help language when /command ? is used. + * + * @author Rsl1122 + */ +public enum DeepHelpLang implements Lang { + PLAN("In Depth Help - /plan ?", "> §2Main Command\\ Access to subcommands and help\\ §2/plan §fList subcommands\\ §2/plan ? §fIn depth help"), + ANALYZE("In Depth Help - /plan analyze ?", "> §2Analysis Command\\ Refreshes server page and displays link to the web page."), + SETUP("In Depth Help - /planbungee setup ?", "> §2Set-up toggle Command\\ Toggles set-up mode on Bungee.\\ Safeguard against unauthorized MySQL snooping with another server."), + DISABLE("In Depth Help - /planbungee disable ?", "> §2Disable Command\\ Runs onDisable on PlanBungee.\\ Plugin can be enabled with /planbungee reload afterwards.\\ §bDoes not support swapping jar on the fly"), + INSPECT("In Depth Help - /plan inspect ?", "> §2Inspect Command\\ Refreshes player page and displays link to the web page."), + PLAYERS("In Depth Help - /plan players ?", "> §2Players Command\\ Displays link to the players page."), + SERVERS("In Depth Help - /plan servers ?", "> §2Servers Command\\ Displays list of Plan servers in the Database.\\ Can be used to debug issues with database registration on a network."), + MANAGE("In Depth Help - /plan manage ?", "> §2Manage Command\\ Manage MySQL and SQLite database of Plan.\\ §2/plan m §fList subcommands\\ §2/plan m ? §fIn depth help"), + NETWORK("In Depth Help - /plan network ?", "> §2Network Command\\ Displays link to the network page.\\ If not on a network, this page displays the server page."), + QINSPECT("In Depth Help - /plan qinspect ?", "> §2Quick Inspect Command\\ Displays some information about the player in game."), + RELOAD("In Depth Help - /plan reload ?", "> §2Reload Command\\ Restarts the plugin using onDisable and onEnable.\\ §bDoes not support swapping jar on the fly"), + SEARCH("In Depth Help - /plan search ?", "> §2Search Command\\ Get a list of Player names that match the given argument.\\§7 Example: /plan search 123 - Finds all users with 123 in their name."), + UPDATE("In Depth Help - /plan update ?", "> §2Update Command\\ Used to update the plugin on the next shutdown\\ /plan update - Changelog link\\ /plan update -u - Schedule update to happen on all network servers that are online, next time they reboot.\\ /plan update cancel - Cancel scheduled update on servers that haven't rebooted yet."), + WEB("In Depth Help - /plan web ?", "< §2Web User Manage Command.\\ §2/plan web §fList subcommands\\ §2/plan web ? §fIn Depth help"), + + MANAGE_BACKUP("In Depth Help - /plan manage backup ?", "> §2Backup Subcommand\\ Creates a new SQLite database (.db file) with contents of currently active database in the Plan plugin folder."), + MANAGE_CLEAR("In Depth Help - /plan manage clear ?", "> §2Clear Subcommand\\ Removes everything in the active database. Use with caution."), + MANAGE_CON("In Depth Help - /plan manage con ?", "> §2Connection Debug Subcommand\\ Used to debug connections in the network.\\ Sends a request to each server in the database."), + MANAGE_DISABLE("In Depth Help - /plan manage disable ?", "> §2Disable Subcommand\\ Can disable parts of the plugin until next reload.\\ Accepted arguments:\\ §2kickcount §fDisables kick counts in case /kickall is used on shutdown macro."), + MANAGE_IMPORT("In Depth Help - /plan manage import ?", "> §2Import Subcommand\\ Import data from other sources.\\ Accepted Arguments:\\ §2offline §fBukkit player data, only register date and name."), + MANAGE_MOVE("In Depth Help - /plan manage move ?", "> §2Move Subcommand\\ Move data from SQLite to MySQL or other way around.\\ Target database is cleared before transfer."), + MANAGE_REMOVE("In Depth Help - /plan manage remove ?", "> §2Remove Subcommand\\ Remove player's data from the active database."), + MANAGE_RESTORE("In Depth Help - /plan manage restore ?", "> §2Restore Subcommand\\ Restore a previous backup SQLite database (.db file)\\ You can also restore database.db from another server to MySQL.\\ Target database is cleared before transfer."), + MANAGE_SETUP("In Depth Help - /plan manage setup ?", "> §2Setup Subcommand\\ Set-up a connection between Bungee and this server for network functionality.\\ BungeeAddress can be found in the enable log on console when Plan enables on Bungee."), + + WEB_REGISTER("In Depth Help - /plan web register ?", "> §2Register Subcommand\\ Registers a new Web User.\\ Registering a user for another player requires plan.webmanage permission.\\ Passwords are hashed with PBKDF2 (64,000 iterations of SHA1) using a cryptographically-random salt."); + + private final String identifier; + private final String defaultValue; + + DeepHelpLang(String identifier, String defaultValue) { + this.identifier = identifier; + this.defaultValue = defaultValue; + } + + @Override + public String getIdentifier() { + return identifier; + } + + @Override + public String getDefault() { + return defaultValue; + } + +} diff --git a/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/ErrorPageLang.java b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/ErrorPageLang.java new file mode 100644 index 000000000..0a7577e28 --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/ErrorPageLang.java @@ -0,0 +1,38 @@ +package com.djrapitops.plan.system.locale.lang; + +/** + * {@link Lang} implementation for all error pages. + * + * @author Rsl1122 + */ +public enum ErrorPageLang implements Lang { + UUID_404("Player UUID was not found in the database."), + NO_SERVERS_404("No Servers online to perform the request."), + NOT_PLAYED_404("Player has not played on this server."), + UNKNOWN_PAGE_404("Make sure you're accessing a link given by a command, Examples:

/player/PlayerName
/server/ServerName

"), + UNAUTHORIZED_401("Unauthorized"), + AUTHENTICATION_FAIlED_401("Authentication Failed."), + AUTH_FAIL_TIPS_401("- Ensure you have registered a user with /plan register
- Check that the username and password are correct
- Username and password are case-sensitive

If you have forgotten your password, ask a staff member to delete your old user and re-register."), + FORBIDDEN_403("Forbidden"), + ACCESS_DENIED_403("Access Denied"), + NOT_FOUND_404("Not Found"), + PAGE_NOT_FOUND_404("Page does not exist."), + ANALYSIS_REFRESH("Analysis is being refreshed.."), + ANALYSIS_REFRESH_LONG("Analysis is being run, refresh the page after a few seconds.."); + + private final String defaultValue; + + ErrorPageLang(String defaultValue) { + this.defaultValue = defaultValue; + } + + @Override + public String getIdentifier() { + return "HTML ERRORS - " + name(); + } + + @Override + public String getDefault() { + return defaultValue; + } +} diff --git a/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/GenericLang.java b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/GenericLang.java new file mode 100644 index 000000000..b6ef6a87e --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/GenericLang.java @@ -0,0 +1,30 @@ +package com.djrapitops.plan.system.locale.lang; + +/** + * {@link Lang} implementation for single words. + * + * @author Rsl1122 + */ +public enum GenericLang implements Lang { + YES("Positive", "Yes"), + NO("Negative", "No"), + UNKNOWN("Unknown", "Unknown"); + + private final String identifier; + private final String defaultValue; + + GenericLang(String identifier, String defaultValue) { + this.identifier = identifier; + this.defaultValue = defaultValue; + } + + @Override + public String getIdentifier() { + return identifier; + } + + @Override + public String getDefault() { + return defaultValue; + } +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/Lang.java b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/Lang.java new file mode 100644 index 000000000..fad732748 --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/Lang.java @@ -0,0 +1,14 @@ +package com.djrapitops.plan.system.locale.lang; + +/** + * Interface for splitting different Language categories into different classes. + * + * @author Rsl1122 + */ +public interface Lang { + + String getIdentifier(); + + String getDefault(); + +} diff --git a/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/ManageLang.java b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/ManageLang.java new file mode 100644 index 000000000..6b9324afb --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/ManageLang.java @@ -0,0 +1,50 @@ +package com.djrapitops.plan.system.locale.lang; + +/** + * {@link Lang} implementation for Manage command related subcommand language. + * + * @author Rsl1122 + */ +public enum ManageLang implements Lang { + + HOTSWAP_REMINDER("Manage - Remind HotSwap", "§eRemember to swap to the new database (/plan m hotswap ${0}) & reload the plugin."), + PROGRESS_START("Manage - Start", "> §2Processing data.."), + PROGRESS_SUCCESS("Manage - Success", "> §aSuccess!"), + PROGRESS_FAIL("Manage - Fail", "> §cSomething went wrong: ${0}"), + + CONFIRMATION("Manage - Fail, Confirmation", "> §cAdd '-a' argument to confirm execution: ${0}"), + IMPORTERS("Manage - List Importers", "Importers: "), + + CON_NO_SERVERS("Manage - Fail, No Servers", "§cNo Servers found in the database."), + CON_EXCEPTION("Manage - Fail, Unexpected Exception", "§eOdd Exception: ${0}"), + CON_UNAUTHORIZED("Manage - Fail, Unauthorized", "§eFail reason: Unauthorized. Server might be using different database."), + CON_GENERIC_FAIL("Manage - Fail, Connection Exception", "§eFail reason: "), + CON_EXTERNAL_URL("Manage - Notify External Url", "§eNon-local address, check that port is open"), + CON_OLD_VERSION("Manage - Fail, Old version", "§eFail reason: Older Plan version on receiving server"), + + CONFIRM_OVERWRITE("Manage - Confirm Overwrite", "Data in ${0} will be overwritten!"), + CONFIRM_REMOVAL("Manage - Confirm Removal", "Data in ${0} will be removed!"), + + FAIL_SAME_DB("Manage - Fail Same Database", "> §cCan not operate on to and from the same database!"), + FAIL_INCORRECT_DB("Manage - Fail Incorrect Database", "> §c'${0}' is not a supported database."), + FAIL_FILE_NOT_FOUND("Manage - Fail File not found", "> §cNo File found at ${0}"), + FAIL_IMPORTER_NOT_FOUND("Manage - Fail No Importer", "§eImporter '${0}' doesn't exist"); + + private final String identifier; + private final String defaultValue; + + ManageLang(String identifier, String defaultValue) { + this.identifier = identifier; + this.defaultValue = defaultValue; + } + + @Override + public String getIdentifier() { + return identifier; + } + + @Override + public String getDefault() { + return defaultValue; + } +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/NetworkPageLang.java b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/NetworkPageLang.java new file mode 100644 index 000000000..7cdb996fc --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/NetworkPageLang.java @@ -0,0 +1,31 @@ +package com.djrapitops.plan.system.locale.lang; + +/** + * {@link Lang} implementation for player.html replacement values. + * + * @author Rsl1122 + */ +public enum NetworkPageLang implements Lang { + NETWORK("Network"), + NETWORK_INFORMATION("NETWORK INFORMATION"), + PLAYERS_TEXT("Players"), + PLAYERS("PLAYERS"), + NEW_TEXT("New"), + HEALTH_ESTIMATE("Health Estimate"); + + private final String defaultValue; + + NetworkPageLang(String defaultValue) { + this.defaultValue = defaultValue; + } + + @Override + public String getIdentifier() { + return "HTML - " + name(); + } + + @Override + public String getDefault() { + return defaultValue; + } +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/PlayerPageLang.java b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/PlayerPageLang.java new file mode 100644 index 000000000..caa7e1c18 --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/PlayerPageLang.java @@ -0,0 +1,81 @@ +package com.djrapitops.plan.system.locale.lang; + +/** + * {@link Lang} implementation for player.html replacement values. + * + * @author Rsl1122 + */ +public enum PlayerPageLang implements Lang { + ONLINE(" Online"), + OFFLINE(" Offline"), + TIMES_KICKED("Times Kicked"), + PLAYER_KILLS("Player Kills"), + MOB_KILLS("Mob Kills"), + DEATHS("Deaths"), + SESSIONS("Sessions"), + TOTAL_PLAYTIME("Total Playtime"), + PLAYTIME("Playtime"), + TOTAL_ACTIVE_TEXT("Total Active"), + TOTAL_AFK("Total AFK"), + SESSION_MEDIAN("Session Median"), + LONGEST("Longest"), + SESSION("Session"), + ACTIVITY_INDEX("Activity Index"), + INDEX_ACTIVE("Active"), + INDEX_VERY_ACTIVE("Very Active"), + INDEX_REGULAR("Regular"), + INDEX_IRREGULAR("Irregular"), + INDEX_INACTIVE("Inactive"), + FAVORITE_SERVER("Favorite Server"), + REGISTERED("REGISTERED"), + LAST_SEEN("LAST SEEN"), + PUNCH_CARD("Punchcard"), + SEEN_NICKNAMES("Seen Nicknames"), + NICKNAME("Nickname"), + SERVER("Server"), + LAST_SEEN_TEXT("Last Seen"), + CONNECTION_INFORMATION("Connection Information"), + IP_ADDRESS("IP-address"), + GEOLOCATION("Geolocation"), + LAST_CONNECTED("Last Connected"), + LOCAL_MACHINE("Local Machine"), + CALENDAR_TEXT(" Calendar"), + MOST_RECENT_SESSIONS("Most Recent Sessions"), + SESSION_ENDED("Session Ended"), + SESSION_LENGTH("Session Lenght"), + + WORLD(" World"), + SERVER_PREFERENCE("Server Preference"), + LAST_30_DAYS("LAST 30 DAYS"), + LAST_7_DAYS("LAST 7 DAYS"), + LAST_24_HOURS("LAST 24 HOURS"), + SERVERS("Servers"), + OPERATOR("Operator"), + BANNED("Banned"), + OVERVIEW("OVERVIEW"), + PLAYER_CAUSED_DEATHS("Player caused Deaths"), + MOB_CAUSED_DEATHS("Mob caused Deaths"), + MOB_KDR("Mob KDR"), + TIME(" Time"), + KILLED("Killed"), + WITH("With"), + KILLED_BY("Killed by"), + NO_KILLS("No Kills"), + NO_PLAYER_CAUSED_DEATHS("No Player caused Deaths"); + + private final String defaultValue; + + PlayerPageLang(String defaultValue) { + this.defaultValue = defaultValue; + } + + @Override + public String getIdentifier() { + return "HTML - " + name(); + } + + @Override + public String getDefault() { + return defaultValue; + } +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/PluginLang.java b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/PluginLang.java new file mode 100644 index 000000000..69ba6f188 --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/PluginLang.java @@ -0,0 +1,68 @@ +package com.djrapitops.plan.system.locale.lang; + +/** + * {@link Lang} implementation for Language that is logged when the plugin enables or disables. + * + * @author Rsl1122 + */ +public enum PluginLang implements Lang { + ENABLED("Enable", "Player Analytics Enabled."), + ENABLED_WEB_SERVER("Enable - WebServer", "Webserver running on PORT ${0} (${1})"), + ENABLED_DATABASE("Enable - Database", "${0}-database connection established."), + + ENABLE_NOTIFY_EMPTY_IP("Enable - Notify Empty IP", "IP in server.properties is empty & AlternativeIP is not in use. Incorrect links will be given!"), + ENABLE_NOTIFY_WEB_SERVER_DISABLED("Enable - Notify Webserver disabled", "WebServer was not initialized. (WebServer.DisableWebServer: true)"), + ENABLE_NOTIFY_GEOLOCATIONS_INTERNET_REQUIRED("Enable - Notify Geolocations Internet Required", "Plan Requires internet access on first run to download GeoLite2 Geolocation database."), + ENABLE_NOTIFY_GEOLOCATIONS_DISABLED("Enable - Notify Geolocations disabled", "Geolocation gathering is not active. (Data.Geolocations: false)"), + ENABLE_NOTIFY_ADDRESS_CONFIRMATION("Enable - Notify Address Confirmation", "Make sure that this address points to THIS Server: ${0}"), + + ENABLE_FAIL_DB("Enable FAIL - Database", "${0}-Database Connection failed: ${1}"), + ENABLE_FAIL_WRONG_DB("Enable FAIL - Wrong Database Type", "${0} is not a supported Database"), + ENABLE_FAIL_DB_PATCH("Enable FAIL - Database Patch", "Database Patching failed, plugin has to be disabled. Please report this issue"), + ENABLE_FAIL_NO_WEB_SERVER_BUNGEE("Enable FAIL - WebServer (Bungee)", "WebServer did not initialize!"), + ENABLE_FAIL_GEODB_WRITE("Enable FAIL - GeoDB Write", "Something went wrong saving the downloaded GeoLite2 Geolocation database"), + + WEB_SERVER_FAIL_PORT_BIND("WebServer FAIL - Port Bind", "WebServer was not initialized successfully. Is the port (${0}) in use?"), + WEB_SERVER_FAIL_SSL_CONTEXT("WebServer FAIL - SSL Context", "WebServer: SSL Context Initialization Failed."), + WEB_SERVER_FAIL_STORE_LOAD("WebServer FAIL - Store Load", "WebServer: SSL Certificate loading Failed."), + WEB_SERVER_NOTIFY_NO_CERT_FILE("WebServer - Notify no Cert file", "WebServer: Certificate KeyStore File not Found: ${0}"), + WEB_SERVER_NOTIFY_HTTP("WebServer - Notify HTTP", "WebServer: No Certificate -> Using HTTP-server for Visualization."), + WEB_SERVER_NOTIFY_HTTP_USER_AUTH("WebServer - Notify HTTP User Auth", "WebServer: User Authorization Disabled! (Not secure over HTTP)"), + + DISABLED("Disable", "Player Analytics Disabled."), + DISABLED_WEB_SERVER("Disable - WebServer", "Webserver has been disabled."), + DISABLED_PROCESSING("Disable - Processing", "Processing critical unprocessed tasks. (${0})"), + DISABLED_PROCESSING_COMPLETE("Disable - Processing Complete", "Processing complete."), + + VERSION_NEWEST("Version - Latest", "You're using the latest version."), + VERSION_AVAILABLE("Version - New", "New Release (${0}) is available ${1}"), + VERSION_AVAILABLE_SPIGOT("Version - New (old)", "New Version is available at ${0}"), + VERSION_AVAILABLE_DEV("Version - DEV", " This is a DEV release."), + VERSION_FAIL_READ_VERSIONS("Version FAIL - Read versions.txt", "Version information could not be loaded from Github/versions.txt"), + VERSION_FAIL_READ_OLD("Version FAIL - Read info (old)", "Failed to check newest version number"), + + DB_APPLY_PATCH("Database - Apply Patch", "Applying Patch: ${0}.."), + DB_APPLIED_PATCHES("Database - Patches Applied", "All database patches applied successfully."), + DB_APPLIED_PATCHES_ALREADY("Database - Patches Applied Already", "All database patches already applied."), + DB_NOTIFY_CLEAN("Database Notify - Clean", "Removed data of ${0} players."), + DB_NOTIFY_SQLITE_WAL("Database Notify - SQLite No WAL", "SQLite WAL mode not supported on this server version, using default. This may or may not affect performance."), + DB_MYSQL_LAUNCH_OPTIONS_FAIL("Database MySQL - Launch Options Error", "Launch Options were faulty, using default (${0})"); + + private final String identifier; + private final String defaultValue; + + PluginLang(String identifier, String defaultValue) { + this.identifier = identifier; + this.defaultValue = defaultValue; + } + + @Override + public String getIdentifier() { + return identifier; + } + + @Override + public String getDefault() { + return defaultValue; + } +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/ServerPageLang.java b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/ServerPageLang.java new file mode 100644 index 000000000..435f97f00 --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/ServerPageLang.java @@ -0,0 +1,71 @@ +package com.djrapitops.plan.system.locale.lang; + +/** + * {@link Lang} implementation for player.html replacement values. + * + * @author Rsl1122 + */ +public enum ServerPageLang implements Lang { + SERVER_ANALYSIS("Server Analysis"), + PLAYERS_ONLINE("PLAYERS ONLINE"), + UNIQUE("UNIQUE"), + NEW("NEW"), + REGULAR("REGULAR"), + TOTAL_PLAYERS("Total Players"), + UNIQUE_PLAYERS_TEXT("Unique Players"), + NEW_PLAYERS_TEXT("New Players"), + PER_DAY("/ Day"), + LAST_PEAK("Last Peak"), + ALL_TIME_PEAK("All Time Peak"), + SERVER_INFORMATION("SERVER INFORMATION"), + USER_INFORMATION("USER INFORMATION"), + RECENT_LOGINS("RECENT LOGINS"), + ONLINE_ACTIVITY("ONLINE ACTIVITY"), + UNIQUE_PLAYERS("UNIQUE PLAYERS"), + CALENDAR("CALENDAR"), + PUNCHCARD("PUNCHCARD"), + UNIQUE_CALENDAR("Unique:"), + NEW_CALENDAR("New:"), + NEW_RETENTION("New Player Retention"), + PREDICETED_RETENTION("Predicted Retention"), + SERVER_HEALTH_ESTIMATE("Server Health Estimate"), + LAST_30_DAYS_TEXT("Last 30 Days"), + PLAYERBASE_DEVELOPMENT("Playerbase Development"), + CURRENT_PLAYERBASE("Current Playerbase"), + WORLD_PLAYTIME("World Playtime"), + WORLD_LOAD("WORLD LOAD"), + ALL("ALL"), + LOW_TPS_SPIKES("Low TPS Spikes"), + USAGE(" Usage"), + LOADED_ENTITIES("Loaded Entities"), + LOADED_CHUNKS("Loaded Chunks"), + ENTITIES("Entities"), + CHUNKS("Chunks"), + AVG("AVG"), + PLAYER_LIST("Player List"), + NAME(" Name"), + REGISTERED_TEXT("Registered"), + GEOLOCATION_TEXT("Geolocation"), + COUNTRY("Country"), + COMMNAND_USAGE("Command Usage"), + USED_COMMANDS("Used Commands"), + UNIQUE_TEXT("Unique"), + COMMAND(" Command"), + TIMES_USED("Times Used"); + + private final String defaultValue; + + ServerPageLang(String defaultValue) { + this.defaultValue = defaultValue; + } + + @Override + public String getIdentifier() { + return "HTML - " + name(); + } + + @Override + public String getDefault() { + return defaultValue; + } +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/processing/Processing.java b/Plan/src/main/java/com/djrapitops/plan/system/processing/Processing.java index edc5cef7a..ac2326af6 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/processing/Processing.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/processing/Processing.java @@ -4,19 +4,25 @@ import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.api.exceptions.EnableException; import com.djrapitops.plan.system.PlanSystem; import com.djrapitops.plan.system.SubSystem; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.PluginLang; import com.djrapitops.plugin.StaticHolder; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.utilities.Verify; import java.util.List; import java.util.concurrent.*; +import java.util.function.Supplier; public class Processing implements SubSystem { + private final Supplier locale; + private final ExecutorService nonCriticalExecutor; private final ExecutorService criticalExecutor; - public Processing() { + public Processing(Supplier locale) { + this.locale = locale; nonCriticalExecutor = Executors.newFixedThreadPool(6); criticalExecutor = Executors.newFixedThreadPool(2); saveInstance(nonCriticalExecutor); @@ -129,7 +135,7 @@ public class Processing implements SubSystem { public void disable() { nonCriticalExecutor.shutdown(); List criticalTasks = criticalExecutor.shutdownNow(); - Log.info("Processing critical unprocessed tasks. (" + criticalTasks.size() + ")"); + Log.info(locale.get().getString(PluginLang.DISABLED_PROCESSING, criticalTasks.size())); for (Runnable runnable : criticalTasks) { try { runnable.run(); @@ -137,6 +143,6 @@ public class Processing implements SubSystem { Log.toLog(this.getClass(), e); } } - Log.info("Processing complete."); + Log.info(locale.get().getString(PluginLang.DISABLED_PROCESSING_COMPLETE)); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/processing/importing/importers/Importer.java b/Plan/src/main/java/com/djrapitops/plan/system/processing/importing/importers/Importer.java index e0f39dc20..7c5f299d9 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/processing/importing/importers/Importer.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/processing/importing/importers/Importer.java @@ -24,7 +24,6 @@ import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.utilities.Verify; import com.google.common.collect.ImmutableMap; -import java.io.UnsupportedEncodingException; import java.security.NoSuchAlgorithmException; import java.util.*; import java.util.concurrent.ExecutorService; @@ -233,7 +232,7 @@ public abstract class Importer { String geoLoc = GeolocationCache.getCountry(ip); try { return new GeoInfo(ip, geoLoc, date, new SHA256Hash(ip).create()); - } catch (UnsupportedEncodingException | NoSuchAlgorithmException e) { + } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); } }).collect(Collectors.toList()); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/info/InspectCacheRequestProcessor.java b/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/info/InspectCacheRequestProcessor.java index cfc0a8b8d..5e593a688 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/info/InspectCacheRequestProcessor.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/info/InspectCacheRequestProcessor.java @@ -8,8 +8,8 @@ import com.djrapitops.plan.api.exceptions.connection.*; import com.djrapitops.plan.system.cache.SessionCache; import com.djrapitops.plan.system.info.InfoSystem; import com.djrapitops.plan.system.info.connection.ConnectionSystem; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.CommandLang; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.command.CommandUtils; import com.djrapitops.plugin.command.ISender; @@ -26,11 +26,13 @@ public class InspectCacheRequestProcessor implements Runnable { private final UUID uuid; private final ISender sender; private final String playerName; + private final Locale locale; - public InspectCacheRequestProcessor(UUID uuid, ISender sender, String playerName) { + public InspectCacheRequestProcessor(UUID uuid, ISender sender, String playerName, Locale locale) { this.uuid = uuid; this.sender = sender; this.playerName = playerName; + this.locale = locale; } @Override @@ -47,19 +49,20 @@ public class InspectCacheRequestProcessor implements Runnable { } } + // TODO Move to InspectCommand somehow. private void sendInspectMsg(ISender sender, String playerName) { - sender.sendMessage(Locale.get(Msg.CMD_HEADER_INSPECT) + " " + playerName); + sender.sendMessage(locale.getString(CommandLang.HEADER_INSPECT, playerName)); // Link String url = ConnectionSystem.getInstance().getMainAddress() + "/player/" + playerName; - String message = Locale.get(Msg.CMD_INFO_LINK).toString(); + String linkPrefix = locale.getString(CommandLang.LINK_PREFIX); boolean console = !CommandUtils.isPlayer(sender); if (console) { - sender.sendMessage(message + url); + sender.sendMessage(linkPrefix + url); } else { - sender.sendMessage(message); - sender.sendLink(" ", Locale.get(Msg.CMD_INFO_CLICK_ME).toString(), url); + sender.sendMessage(linkPrefix); + sender.sendLink(" ", locale.getString(CommandLang.LINK_CLICK_ME), url); } - sender.sendMessage(Locale.get(Msg.CMD_CONSTANT_FOOTER).toString()); + sender.sendMessage(">"); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/info/PlayerPageUpdateProcessor.java b/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/info/PlayerPageUpdateProcessor.java index 19fb85ed3..98d0cfaa7 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/info/PlayerPageUpdateProcessor.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/info/PlayerPageUpdateProcessor.java @@ -2,6 +2,7 @@ package com.djrapitops.plan.system.processing.processors.info; import com.djrapitops.plan.system.info.InfoSystem; import com.djrapitops.plan.system.info.connection.WebExceptionLogger; +import com.djrapitops.plugin.api.Check; import com.djrapitops.plugin.api.TimeAmount; import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.task.RunnableFactory; @@ -18,17 +19,20 @@ public class PlayerPageUpdateProcessor implements Runnable { @Override public void run() { - RunnableFactory.createNew("Generate Inspect page: " + uuid, new AbsRunnable() { - @Override - public void run() { - try { - WebExceptionLogger.logIfOccurs(PlayerPageUpdateProcessor.class, - () -> InfoSystem.getInstance().generateAndCachePlayerPage(uuid) - ); - } finally { - cancel(); + if (!InfoSystem.getInstance().getConnectionSystem().isServerAvailable() || Check.isBungeeAvailable()) { + RunnableFactory.createNew("Generate Inspect page: " + uuid, new AbsRunnable() { + @Override + public void run() { + try { + + WebExceptionLogger.logIfOccurs(PlayerPageUpdateProcessor.class, + () -> InfoSystem.getInstance().generateAndCachePlayerPage(uuid) + ); + } finally { + cancel(); + } } - } - }).runTaskLaterAsynchronously(TimeAmount.SECOND.ticks() * 20); + }).runTaskLaterAsynchronously(TimeAmount.SECOND.ticks() * 20); + } } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/player/IPUpdateProcessor.java b/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/player/IPUpdateProcessor.java index 7e1ff57e6..895202631 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/player/IPUpdateProcessor.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/player/IPUpdateProcessor.java @@ -11,7 +11,6 @@ import com.djrapitops.plan.system.processing.CriticalRunnable; import com.djrapitops.plan.system.settings.Settings; import com.djrapitops.plugin.api.utility.log.Log; -import java.io.UnsupportedEncodingException; import java.net.InetAddress; import java.security.NoSuchAlgorithmException; import java.util.UUID; @@ -40,7 +39,7 @@ public class IPUpdateProcessor implements CriticalRunnable { try { GeoInfo geoInfo = new GeoInfo(ip, country, time); Database.getActive().save().geoInfo(uuid, geoInfo); - } catch (UnsupportedEncodingException | NoSuchAlgorithmException e) { + } catch (NoSuchAlgorithmException e) { Log.toLog(this.getClass(), e); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/player/RegisterProcessor.java b/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/player/RegisterProcessor.java index 58f39af63..2cc024848 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/player/RegisterProcessor.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/player/RegisterProcessor.java @@ -10,6 +10,7 @@ import com.djrapitops.plan.system.processing.Processing; import com.djrapitops.plugin.utilities.Verify; import java.util.UUID; +import java.util.function.Supplier; /** * Registers the user to the database and marks first session if the user has no actions. @@ -19,11 +20,11 @@ import java.util.UUID; public class RegisterProcessor implements CriticalRunnable { private final UUID uuid; - private final long registered; + private final Supplier registered; private final String name; private final Runnable[] afterProcess; - public RegisterProcessor(UUID uuid, long registered, String name, Runnable... afterProcess) { + public RegisterProcessor(UUID uuid, Supplier registered, String name, Runnable... afterProcess) { this.uuid = uuid; this.registered = registered; this.name = name; @@ -36,10 +37,10 @@ public class RegisterProcessor implements CriticalRunnable { Verify.nullCheck(uuid, () -> new IllegalStateException("UUID was null")); try { if (!db.check().isPlayerRegistered(uuid)) { - db.save().registerNewUser(uuid, registered, name); + db.save().registerNewUser(uuid, registered.get(), name); } if (!db.check().isPlayerRegisteredOnThisServer(uuid)) { - db.save().registerNewUserOnThisServer(uuid, registered); + db.save().registerNewUserOnThisServer(uuid, registered.get()); } } finally { for (Runnable runnable : afterProcess) { diff --git a/Plan/src/main/java/com/djrapitops/plan/system/settings/Permissions.java b/Plan/src/main/java/com/djrapitops/plan/system/settings/Permissions.java index 56c294685..0a5377ccd 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/settings/Permissions.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/settings/Permissions.java @@ -16,7 +16,6 @@ public enum Permissions { QUICK_INSPECT_OTHER("plan.qinspect.other"), ANALYZE("plan.analyze"), - QUICK_ANALYZE("plan.qanalyze"), SEARCH("plan.search"), diff --git a/Plan/src/main/java/com/djrapitops/plan/system/settings/config/ConfigSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/settings/config/ConfigSystem.java index 11186b96d..9cb57f7a1 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/settings/config/ConfigSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/settings/config/ConfigSystem.java @@ -9,7 +9,6 @@ import com.djrapitops.plan.system.PlanSystem; import com.djrapitops.plan.system.SubSystem; import com.djrapitops.plan.system.file.FileSystem; import com.djrapitops.plan.system.settings.Settings; -import com.djrapitops.plan.system.settings.locale.Locale; import com.djrapitops.plan.system.settings.theme.Theme; import com.djrapitops.plugin.api.config.Config; import com.djrapitops.plugin.api.utility.log.Log; @@ -25,11 +24,9 @@ import java.io.IOException; public abstract class ConfigSystem implements SubSystem { protected Config config; - protected final Locale locale; protected final Theme theme; public ConfigSystem() { - locale = new Locale(); theme = new Theme(); } @@ -57,7 +54,6 @@ public abstract class ConfigSystem implements SubSystem { } catch (IOException e) { throw new EnableException("Failed to save default config.", e); } - locale.loadLocale(); theme.enable(); } @@ -71,7 +67,6 @@ public abstract class ConfigSystem implements SubSystem { @Override public void disable() { theme.disable(); - locale.unload(); } public void reload() { @@ -81,8 +76,4 @@ public abstract class ConfigSystem implements SubSystem { Log.toLog(ConfigSystem.class, e); } } - - public Locale getLocale() { - return getInstance().locale; - } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/settings/locale/Locale.java b/Plan/src/main/java/com/djrapitops/plan/system/settings/locale/Locale.java deleted file mode 100644 index 408b48710..000000000 --- a/Plan/src/main/java/com/djrapitops/plan/system/settings/locale/Locale.java +++ /dev/null @@ -1,335 +0,0 @@ -package com.djrapitops.plan.system.settings.locale; - -import com.djrapitops.plan.PlanPlugin; -import com.djrapitops.plan.system.file.FileSystem; -import com.djrapitops.plan.system.settings.Permissions; -import com.djrapitops.plan.system.settings.Settings; -import com.djrapitops.plan.system.settings.config.ConfigSystem; -import com.djrapitops.plan.utilities.comparators.LocaleEntryComparator; -import com.djrapitops.plan.utilities.comparators.StringLengthComparator; -import com.djrapitops.plan.utilities.file.FileUtil; -import com.djrapitops.plan.utilities.html.Html; -import com.djrapitops.plugin.api.Benchmark; -import com.djrapitops.plugin.api.config.Config; -import com.djrapitops.plugin.api.utility.log.Log; -import com.djrapitops.plugin.settings.ColorScheme; -import com.djrapitops.plugin.settings.DefaultMessages; -import com.djrapitops.plugin.utilities.Verify; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.util.EnumMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; - -/** - * Class responsible for message localization. - *

- * Successor to Phrase Enum system. - * - * @author Rsl1122 - * @since 3.6.2 - */ -public class Locale { - - private final Map messages; - - public Locale() { - messages = new EnumMap<>(Msg.class); - } - - public static Locale getInstance() { - Locale locale = ConfigSystem.getInstance().getLocale(); - Verify.nullCheck(locale, () -> new IllegalStateException("Locale has not been initialized.")); - return locale; - } - - public static Message get(Msg msg) { - return getInstance().getMessage(msg); - } - - public void unload() { - messages.clear(); - } - - public void loadLocale() { - String locale = Settings.LOCALE.toString().toUpperCase(); - Benchmark.start("Initializing locale"); - loadDefault(); - try { - if (Settings.WRITE_NEW_LOCALE.isTrue()) { - writeNewDefaultLocale(); - } - File localeFile = FileSystem.getLocaleFile(); - if (localeFile.exists()) { - loadFromFile(localeFile); - } else if (locale.equals("DEFAULT")) { - Log.info("Using Locale: Default (EN)"); - } else { - loadFromResource("locale/locale_" + locale + ".txt"); - } - } catch (IOException e) { - Log.toLog(this.getClass(), e); - } finally { - Benchmark.stop("Enable", "Initializing locale"); - } - } - - private void writeNewDefaultLocale() throws IOException { - Optional key = messages.keySet().stream() - .map(Msg::getIdentifier) - .sorted(new StringLengthComparator()) - .findFirst(); - if (!key.isPresent()) { - throw new IllegalStateException("Locale has not been loaded."); - } - final int length = key.get().length() + 2; - List lines = messages.entrySet().stream() - .sorted(new LocaleEntryComparator()) - .map(entry -> getSpacedIdentifier(entry.getKey().getIdentifier(), length) + "|| " + entry.getValue().toString()) - .collect(Collectors.toList()); - Files.write(FileSystem.getLocaleFile().toPath(), lines, StandardCharsets.UTF_8); - - Config config = ConfigSystem.getConfig(); - config.set(Settings.WRITE_NEW_LOCALE.getPath(), false); - config.save(); - } - - private String getSpacedIdentifier(String identifier, int length) { - StringBuilder b = new StringBuilder(identifier); - while (b.length() < length) { - b.append(" "); - } - return b.toString(); - } - - private void loadDefault() { - // TODO Move to Msg as DefaultMessages - - String analysis = "Analysis | "; - String prefix = "[Plan] "; - String green = "§a"; - String yellow = "§e"; - String red = "§c"; - String arrowsRight = DefaultMessages.ARROWS_RIGHT.parse(); - ColorScheme cs = PlanPlugin.getInstance().getColorScheme(); - String mCol = cs.getMainColor(); - String sCol = cs.getSecondaryColor(); - String tCol = cs.getTertiaryColor(); - String cmdFooter = tCol + arrowsRight; - - add(Msg.ENABLED, "Player Analytics Enabled."); - add(Msg.ENABLE_DB_INIT, "Database init.."); - add(Msg.ENABLE_DB_INFO, "${0}-database connection established."); - add(Msg.ENABLE_WEBSERVER, "Initializing Webserver.."); - add(Msg.ENABLE_WEBSERVER_INFO, "Webserver running on PORT ${0}"); - add(Msg.ENABLE_BOOT_ANALYSIS_INFO, analysis + "Boot analysis in 30 seconds.."); - add(Msg.ENABLE_BOOT_ANALYSIS_RUN_INFO, analysis + "Starting Boot Analysis.."); - - add(Msg.ENABLE_NOTIFY_EMPTY_IP, yellow + "IP in server.properties is empty & AlternativeServerIP is not used, incorrect links will be given!"); - add(Msg.ENABLE_NOTIFY_NO_DATA_VIEW, yellow + "Webserver disabled but Alternative IP not used, no way to view data!"); - add(Msg.ENABLE_NOTIFY_DISABLED_CHATLISTENER, yellow + "Chat listener disabled, nickname info inaccurate."); - add(Msg.ENABLE_NOTIFY_DISABLED_COMMANDLISTENER, yellow + "Command usage listener disabled."); - add(Msg.ENABLE_NOTIFY_DISABLED_DEATHLISTENER, yellow + "Death listener disabled, player & mob kills not recorded."); - - add(Msg.ENABLE_FAIL_WRONG_DB, "That database type doesn't exist."); - add(Msg.ENABLE_FAIL_DB, "${0}-Database Connection failed: ${1}"); - add(Msg.ENABLE_DB_FAIL_DISABLE_INFO, "Database initialization has failed, disabling Plan."); - - add(Msg.RUN_WARN_QUEUE_SIZE, "Queue size is too small! (${0}), change the setting to a higher number! (Currently ${1})"); - - add(Msg.DISABLED, "Player Analytics Disabled."); - add(Msg.DISABLE_CACHE_SAVE, "Saving cached data.."); - add(Msg.DISABLE_WEBSERVER, "Shutting down Webserver.."); - - add(Msg.ANALYSIS_START, analysis + "Beginning analysis of user data.."); - add(Msg.ANALYSIS_FETCH_UUID, analysis + "Checking for available players.."); - add(Msg.ANALYSIS_FETCH, analysis + "Fetching Data.."); - add(Msg.ANALYSIS_PHASE_START, analysis + "Data Fetched (${0} users, took ${1}ms), beginning Analysis of data.."); - add(Msg.ANALYSIS_3RD_PARTY, analysis + "Analyzing additional data sources (3rd party)"); - add(Msg.ANALYSIS_FINISHED, analysis + "Analysis Complete. (took ${0} ms) ${1}"); - add(Msg.ANALYSIS_FAIL_NO_PLAYERS, analysis + "Analysis failed, no known players."); - add(Msg.ANALYSIS_FAIL_NO_DATA, analysis + "Analysis failed, no data in the database."); - add(Msg.ANALYSIS_FAIL_FETCH_EXCEPTION, analysis + "Failed to fetch data for Analysis, Exception occurred."); - - add(Msg.MANAGE_INFO_CONFIG_REMINDER, yellow + prefix + "Remember to swap to the new database and reload plugin"); - add(Msg.MANAGE_INFO_START, arrowsRight + sCol + " Processing data.."); - add(Msg.MANAGE_INFO_IMPORT, cmdFooter + " " + mCol + " Importing Data.."); - add(Msg.MANAGE_INFO_FAIL, red + prefix + "Something went wrong while processing the data!"); - add(Msg.MANAGE_INFO_SUCCESS, cmdFooter + " " + mCol + " Success!"); - add(Msg.MANAGE_INFO_COPY_SUCCESS, green + prefix + "All data copied successfully!"); - add(Msg.MANAGE_INFO_MOVE_SUCCESS, green + prefix + "All data moved successfully!"); - add(Msg.MANAGE_INFO_CLEAR_SUCCESS, green + prefix + "All data cleared successfully!"); - add(Msg.MANAGE_INFO_REMOVE_SUCCESS, cmdFooter + " " + mCol + "Data of " + tCol + "${0}" + mCol + " was removed from Database " + tCol + "${1}" + mCol + "."); - - add(Msg.MANAGE_FAIL_INCORRECT_PLUGIN, red + prefix + "Plugin not supported: "); - add(Msg.MANAGE_FAIL_PLUGIN_NOT_ENABLED, red + prefix + "Plugin is not enabled: "); - add(Msg.MANAGE_FAIL_SAME_DB, red + prefix + "Can't move to the same database!"); - add(Msg.MANAGE_FAIL_INCORRECT_DB, red + prefix + "Incorrect database! (sqlite/mysql accepted): "); - add(Msg.MANAGE_FAIL_FAULTY_DB, red + prefix + "One of the databases was not initialized properly."); - add(Msg.MANAGE_FAIL_NO_PLAYERS, red + prefix + "Database has no player data!"); - add(Msg.MANAGE_FAIL_FILE_NOT_FOUND, red + prefix + "Backup file doesn't exist!"); - - add(Msg.MANAGE_FAIL_CONFIRM, red + prefix + "Add -a to confirm execution! ${0}"); - add(Msg.MANAGE_NOTIFY_REWRITE, "Data in ${0}-database will be rewritten!"); - add(Msg.MANAGE_NOTIFY_OVERWRITE, "Data in ${0}-database will be overwritten!"); - add(Msg.MANAGE_NOTIFY_PARTIAL_OVERWRITE, "Some data in ${0}-database will be overwritten!"); - add(Msg.MANAGE_NOTIFY_REMOVE, "Data in ${0}-database will be removed!"); - - add(Msg.CMD_FAIL_REQ_ARGS, red + prefix + "Command requires arguments. ${0}"); - add(Msg.CMD_FAIL_REQ_ONE_ARG, red + prefix + "Command requires one argument."); - add(Msg.CMD_FAIL_NO_PERMISSION, red + prefix + "You do not have the required permission."); - add(Msg.CMD_FAIL_USERNAME_NOT_VALID, red + prefix + "This Player doesn't exist."); - add(Msg.CMD_FAIL_USERNAME_NOT_SEEN, red + prefix + "This Player has not played on this server."); - add(Msg.CMD_FAIL_USERNAME_NOT_KNOWN, red + prefix + "Player not found from the database."); - add(Msg.CMD_FAIL_TIMEOUT, red + prefix + "${0} Command timed out! Check '/plan status' & console."); - add(Msg.CMD_FAIL_NO_DATA_VIEW, yellow + "" + prefix + "No Way to view Data Available."); - - add(Msg.CMD_INFO_ANALYSIS_TEMP_DISABLE, yellow + "Analysis has been temporarily disabled due to expensive task, use /plan status for info."); - add(Msg.CMD_INFO_RELOAD_COMPLETE, green + prefix + "Reload complete."); - add(Msg.CMD_INFO_FETCH_DATA, tCol + arrowsRight + mCol + " Fetching data to cache.."); - add(Msg.CMD_INFO_CLICK_ME, "Click Me"); - add(Msg.CMD_INFO_LINK, sCol + " • " + mCol + "Link: " + tCol); - add(Msg.CMD_INFO_RESULTS, sCol + " Matching players: " + tCol); - add(Msg.CMD_INFO_NO_RESULTS, sCol + " • " + mCol + "No results for " + sCol + "${0}" + mCol + "."); - add(Msg.CMD_INFO_SEARCHING, cmdFooter + mCol + "Searching.."); - - add(Msg.CMD_USG_ANALYZE, "View the Server Analysis"); - add(Msg.CMD_USG_QANALYZE, "View the Server Analysis as Text"); - add(Msg.CMD_USG_HELP, "Show command list."); - add(Msg.CMD_USG_INFO, "Check the version of Plan"); - add(Msg.CMD_USG_INSPECT, "Inspect player's data"); - add(Msg.CMD_USG_QINSPECT, "Inspect player's data in game"); - add(Msg.CMD_USG_LIST, "List to all cached players"); - add(Msg.CMD_USG_MANAGE, "Database management command"); - add(Msg.CMD_USG_MANAGE_BACKUP, "Backup a database to .db file"); - add(Msg.CMD_USG_MANAGE_CLEAN, "Clear old data from the database"); - add(Msg.CMD_USG_MANAGE_CLEAR, "Clear ALL data from the database"); - add(Msg.CMD_USG_MANAGE_DUMP, "Create a Hastebin log for Dev for easier Issue reporting."); - add(Msg.CMD_USG_MANAGE_HOTSWAP, "Hotswap database & restart the plugin"); - add(Msg.CMD_USG_MANAGE_IMPORT, "Import Data from plugins"); - add(Msg.CMD_USG_MANAGE_MOVE, "Move data between databases"); - add(Msg.CMD_USG_MANAGE_REMOVE, "Remove players's data from the Active Database."); - add(Msg.CMD_USG_MANAGE_RESTORE, "Restore a database"); - add(Msg.CMD_USG_RELOAD, "Restart the Plugin (Reloads config)"); - add(Msg.CMD_USG_SEARCH, "Search for player"); - add(Msg.CMD_USG_WEB, "Manage Web users"); - add(Msg.CMD_USG_WEB_CHECK, "Check a web user's permission level."); - add(Msg.CMD_USG_WEB_DELETE, "Delete a web user"); - add(Msg.CMD_USG_WEB_LEVEL, "Info about permission levels."); - add(Msg.CMD_USG_WEB_REGISTER, "Register a web user"); - - add(Msg.CMD_HELP_ANALYZE, mCol + "Analysis Command" - + "\\" + tCol + " Used to Refresh analysis cache & Access the result page" - + "\\" + sCol + " /plan status can be used to check status of analysis while it is running."); - add(Msg.CMD_HELP_QANALYZE, mCol + "Quick Analysis command" - + "\\" + tCol + " Used to get in game info about analysis." - + "\\" + sCol + " Has less info than full Analysis web page."); - add(Msg.CMD_HELP_PLAN, mCol + "/plan - Main Command" - + "\\" + tCol + " Used to access all SubCommands & help" - + "\\" + sCol + " /plan - List subcommands" - + "\\" + sCol + " /plan ? - in depth help"); - add(Msg.CMD_HELP_INSPECT, mCol + "Inspect command" - + "\\" + tCol + " Used to get a link to User's inspect page." - + "\\" + sCol + " Own inspect page can be accessed with /plan inspect" - + "\\" + sCol + " Alias: /plan "); - add(Msg.CMD_HELP_QINSPECT, mCol + "Quick Inspect command" - + "\\" + tCol + " Used to get some inspect info in game." - + "\\" + sCol + " Has less info than full Inspect web page."); - add(Msg.CMD_HELP_LIST, mCol + "List command" - + "\\" + tCol + " Used to get a link to players page." - + "\\" + sCol + " Players page contains links to all cached inspect pages."); - add(Msg.CMD_HELP_MANAGE, mCol + "Manage command\\" - + tCol + " Used to Manage Database of the plugin." - + "\\" + sCol + " /plan m - List subcommands" - + "\\" + sCol + " /plan m ? - in depth help"); - add(Msg.CMD_HELP_MANAGE_CLEAR, mCol + "Manage Clear command" - + "\\" + tCol + " Used to delete ALL data in the active database." - + "\\" + sCol + " Plugin should be reloaded after successful clear."); - add(Msg.CMD_HELP_MANAGE_DUMP, mCol + "Manage Dump command" - + "\\" + tCol + " Used to dump important data for bug reporting to hastebin."); - add(Msg.CMD_HELP_MANAGE_HOTSWAP, mCol + "Manage Hotswap command" - + "\\" + tCol + " Used to change database in use on the fly." - + "\\" + sCol + " Does not change database if connection fails"); - add(Msg.CMD_HELP_MANAGE_IMPORT, mCol + "Manage Import command" - + "\\" + tCol + " Used to import data from other sources" - + "\\" + sCol + " Analysis will be disabled during import."); - add(Msg.CMD_HELP_MANAGE_REMOVE, mCol + "Manage Remove command" - + "\\" + tCol + " Used to Remove user's data from the active database."); - add(Msg.CMD_HELP_SEARCH, mCol + "Search command" - + "\\" + tCol + " Used to get a list of Player names that match the given argument." - + "\\" + sCol + " Example: /plan search 123 - Finds all users with 123 in their name."); - add(Msg.CMD_HELP_WEB, mCol + "Web User Manage command" - + "\\" + tCol + " Used to manage web users of the plugin" - + "\\" + sCol + " Users have a permission level:" - + "\\" + tCol + " 0 - Access to all pages" - + "\\" + tCol + " 1 - Access to /players & all inspect pages" - + "\\" + tCol + " 2 - Access to own inspect page"); - add(Msg.CMD_HELP_WEB_REGISTER, mCol + "Web Register command" - + "\\" + tCol + " Used to register a new user for the webserver." - + "\\" + sCol + " Registering a user for another player requires " + Permissions.MANAGE_WEB.getPerm() + " permission." - + "\\" + sCol + " Passwords are hashed with PBKDF2 (64,000 iterations of SHA1) using a cryptographically-random salt."); - - add(Msg.CMD_HEADER_ANALYZE, cmdFooter + mCol + " Player Analytics - Analysis results"); - add(Msg.CMD_HEADER_INSPECT, cmdFooter + mCol + " Player Analytics - Inspect results"); - add(Msg.CMD_HEADER_INFO, cmdFooter + mCol + " Player Analytics - Info"); - add(Msg.CMD_HEADER_SEARCH, cmdFooter + mCol + " Player Analytics - Search results: "); - - add(Msg.CMD_CONSTANT_FOOTER, tCol + arrowsRight); - add(Msg.CMD_CONSTANT_LIST_BALL, sCol + " " + "•" + mCol); - - add(Msg.HTML_NO_PLUGINS, "

No extra plugins registered.

"); - add(Msg.HTML_BANNED, "| " + Html.SPAN.parse(Html.COLOR_4.parse() + "Banned")); - add(Msg.HTML_OP, ", Operator (Op)"); - add(Msg.HTML_ONLINE, "| " + Html.SPAN.parse(Html.COLOR_2.parse() + "Online")); - add(Msg.HTML_OFFLINE, "| " + Html.SPAN.parse(Html.COLOR_4.parse() + "Offline")); - add(Msg.HTML_ACTIVE, "Player is Active"); - add(Msg.HTML_INACTIVE, "Player is inactive"); - add(Msg.HTML_TABLE_NO_KILLS, "No Kills"); - } - - private void add(Msg msg, String message) { - Verify.nullCheck(msg, message); - messages.put(msg, new Message(message)); - } - - private void loadFromFile(File localeFile) throws IOException { - loadFromContents(FileUtil.lines(localeFile), "Custom File"); - } - - private void loadFromResource(String fileName) { - try { - loadFromContents(FileSystem.readFromResource(fileName), fileName); - } catch (FileNotFoundException e) { - Log.error("Could not find file inside the jar: " + fileName); - Log.info("Using Locale: Default (EN)"); - } catch (Exception e) { - Log.toLog(this.getClass(), e); - Log.info("Using Locale: Default (EN)"); - } - } - - private void loadFromContents(List locale, String name) { - Log.info("Using Locale: " + name); - Map identifiers = Msg.getIdentifiers(); - locale.forEach(line -> { - String[] split = line.split(" \\|\\| "); - if (split.length == 2) { - String identifier = split[0].trim(); - Msg msg = identifiers.get(identifier); - if (msg != null) { - add(msg, split[1]); - } - } - }); - } - - public Message getMessage(Msg msg) { - return messages.getOrDefault(msg, new Message("")); - } -} diff --git a/Plan/src/main/java/com/djrapitops/plan/system/settings/locale/Msg.java b/Plan/src/main/java/com/djrapitops/plan/system/settings/locale/Msg.java deleted file mode 100644 index 39b6dc989..000000000 --- a/Plan/src/main/java/com/djrapitops/plan/system/settings/locale/Msg.java +++ /dev/null @@ -1,157 +0,0 @@ -package com.djrapitops.plan.system.settings.locale; - -import java.util.Arrays; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; - -public enum Msg { - - ENABLED("Enable"), - ENABLE_DB_INIT("Enable - Db"), - ENABLE_DB_INFO("Enable - Db Info"), - ENABLE_WEBSERVER("Enable - WebServer"), - ENABLE_WEBSERVER_INFO("Enable - WebServer Info"), - ENABLE_BOOT_ANALYSIS_INFO("Enable - Boot Analysis 30s Notify"), - ENABLE_BOOT_ANALYSIS_RUN_INFO("Enable - Boot Analysis Notify"), - - ENABLE_NOTIFY_EMPTY_IP("Enable Notify-Empty IP"), - ENABLE_NOTIFY_NO_DATA_VIEW("Enable Notify - No data view"), - ENABLE_NOTIFY_DISABLED_CHATLISTENER("Enable Notify - ChatListener"), - ENABLE_NOTIFY_DISABLED_COMMANDLISTENER("Enable Notify - Disabled CommandListener"), - ENABLE_NOTIFY_DISABLED_DEATHLISTENER("Enable Notify - Disabled DeathListener"), - - ENABLE_FAIL_WRONG_DB("Enable FAIL - Wrong Db Type"), - ENABLE_FAIL_DB("Enable FAIL-Db"), - ENABLE_DB_FAIL_DISABLE_INFO("Enable Db FAIL - Disable Info"), - - RUN_WARN_QUEUE_SIZE("WARN - Too Small Queue Size"), - - DISABLED("Disable"), - DISABLE_CACHE_SAVE("Disable - Save"), - DISABLE_WEBSERVER("Disable - WebServer"), - - ANALYSIS_START("Analysis - Start"), - ANALYSIS_FETCH_UUID("Analysis - Fetch Phase Start"), - ANALYSIS_FETCH("Analysis - Fetch Phase"), - ANALYSIS_PHASE_START("Analysis - Begin Analysis"), - ANALYSIS_3RD_PARTY("Analysis - Third Party"), - ANALYSIS_FINISHED("Analysis - Complete"), - ANALYSIS_FAIL_NO_PLAYERS("Analysis FAIL - No Players"), - ANALYSIS_FAIL_NO_DATA("Analysis FAIL - No Data"), - ANALYSIS_FAIL_FETCH_EXCEPTION("Analysis FAIL - Fetch Exception"), - - MANAGE_INFO_CONFIG_REMINDER("Manage - Remind Config Change"), - MANAGE_INFO_START("Manage - Start"), - MANAGE_INFO_IMPORT("Manage - Import"), - MANAGE_INFO_FAIL("Manage - Process Fail"), - MANAGE_INFO_SUCCESS("Manage - Success"), - MANAGE_INFO_COPY_SUCCESS("Manage - Copy Success"), - MANAGE_INFO_MOVE_SUCCESS("Manage - Move Success"), - MANAGE_INFO_CLEAR_SUCCESS("Manage - Clear Success"), - MANAGE_INFO_REMOVE_SUCCESS("Manage - Remove Success"), - - MANAGE_FAIL_INCORRECT_PLUGIN("Manage FAIL - Incorrect Plugin"), - MANAGE_FAIL_PLUGIN_NOT_ENABLED("Manage FAIL - Unenabled Plugin"), - MANAGE_FAIL_SAME_DB("Manage FAIL - Same DB"), - MANAGE_FAIL_INCORRECT_DB("Manage FAIL - Incorrect DB"), - MANAGE_FAIL_FAULTY_DB("Manage FAIL - Faulty DB Connection"), - MANAGE_FAIL_NO_PLAYERS("Manage FAIL - Empty DB"), - MANAGE_FAIL_FILE_NOT_FOUND("Manage FAIL - Backup File Not Found"), - - MANAGE_FAIL_CONFIRM("Manage FAIL - Confirm Action"), - MANAGE_NOTIFY_REWRITE("Manage NOTIFY - Rewrite"), - MANAGE_NOTIFY_OVERWRITE("Manage NOTIFY - Overwrite"), - MANAGE_NOTIFY_PARTIAL_OVERWRITE("Manage NOTIFY - Partial Overwrite"), - MANAGE_NOTIFY_REMOVE("Manage NOTIFY - Remove"), - - CMD_FAIL_REQ_ARGS("Cmd FAIL - Requires Arguments"), - CMD_FAIL_REQ_ONE_ARG("Cmd FAIL - Require only one Argument"), - CMD_FAIL_NO_PERMISSION("Cmd FAIL - No Permission"), - CMD_FAIL_USERNAME_NOT_VALID("Cmd FAIL - Invalid Username"), - CMD_FAIL_USERNAME_NOT_SEEN("Cmd FAIL - Unseen Username"), - CMD_FAIL_USERNAME_NOT_KNOWN("Cmd FAIL - Unknown Username"), - CMD_FAIL_TIMEOUT("Cmd FAIL - Timeout"), - CMD_FAIL_NO_DATA_VIEW("Cmd FAIL - No Data View"), - - CMD_INFO_ANALYSIS_TEMP_DISABLE("Analysis NOTIFY - Temporary Disable"), - CMD_INFO_CLICK_ME("Cmd - Click Me"), - CMD_INFO_LINK("Cmd - Link"), - CMD_INFO_RESULTS("Cmd - Results"), - CMD_INFO_NO_RESULTS("Cmd - No Results"), - CMD_INFO_RELOAD_COMPLETE("Cmd - Reload Success"), - CMD_INFO_FETCH_DATA("Cmd - Fetch Data"), - CMD_INFO_SEARCHING("Cmd - Searching"), - - CMD_USG_ANALYZE("Cmd - Usage /plan analyze"), - CMD_USG_QANALYZE("Cmd - Usage /plan qanalyze"), - CMD_USG_HELP("Cmd - Usage /plan help"), - CMD_USG_INFO("Cmd - Usage /plan info"), - CMD_USG_INSPECT("Cmd - Usage /plan inspect"), - CMD_USG_QINSPECT("Cmd - Usage /plan qinspect"), - CMD_USG_LIST("Cmd - Usage /plan list"), - CMD_USG_MANAGE("Cmd - Usage /plan manage"), - CMD_USG_MANAGE_BACKUP("Cmd - Usage /plan manage backup"), - CMD_USG_MANAGE_CLEAN("Cmd - Usage /plan manage clean"), - CMD_USG_MANAGE_CLEAR("Cmd - Usage /plan manage clear"), - CMD_USG_MANAGE_DUMP("Cmd - Usage /plan manage dump"), - CMD_USG_MANAGE_HOTSWAP("Cmd - Usage /plan manage hotswap"), - CMD_USG_MANAGE_IMPORT("Cmd - Usage /plan manage import"), - CMD_USG_MANAGE_MOVE("Cmd - Usage /plan manage move"), - CMD_USG_MANAGE_REMOVE("Cmd - Usage /plan manage remove"), - CMD_USG_MANAGE_RESTORE("Cmd - Usage /plan manage restore"), - CMD_USG_RELOAD("Cmd - Usage /plan reload"), - CMD_USG_SEARCH("Cmd - Usage /plan search"), - CMD_USG_WEB("Cmd - Usage /plan webuser"), - CMD_USG_WEB_CHECK("Cmd - Usage /plan webuser check"), - CMD_USG_WEB_DELETE("Cmd - Usage /plan webuser delete"), - CMD_USG_WEB_LEVEL("Cmd - Usage /plan webuser level"), - CMD_USG_WEB_REGISTER("Cmd - Usage /plan webuser register"), - - CMD_HELP_ANALYZE("In Depth Help - /plan analyze ?"), - CMD_HELP_QANALYZE("In Depth Help - /plan qanalyze ?"), - CMD_HELP_PLAN("In Depth Help - /plan ?"), - CMD_HELP_INSPECT("In Depth Help - /plan inspect ?"), - CMD_HELP_QINSPECT("In Depth Help - /plan qinspect ?"), - CMD_HELP_LIST("In Depth Help - /plan list ?"), - CMD_HELP_MANAGE("In Depth Help - /plan manage ?"), - CMD_HELP_MANAGE_CLEAR("In Depth Help - /plan manage clear ?"), - CMD_HELP_MANAGE_DUMP("In Depth Help - /plan manage dump ?"), - CMD_HELP_MANAGE_HOTSWAP("In Depth Help - /plan manage hotswap ?"), - CMD_HELP_MANAGE_IMPORT("In Depth Help - /plan manage import ?"), - CMD_HELP_MANAGE_REMOVE("In Depth Help - /plan manage remove ?"), - CMD_HELP_SEARCH("In Depth Help - /plan search ?"), - CMD_HELP_WEB("In Depth Help - /plan webuser ?"), - CMD_HELP_WEB_REGISTER("In Depth Help - /plan webuser register ?"), - - CMD_HEADER_ANALYZE("Cmd Header - Analysis"), - CMD_HEADER_INSPECT("Cmd Header - Inspect"), - CMD_HEADER_INFO("Cmd Header - Info"), - CMD_HEADER_SEARCH("Cmd Header - Search"), - - CMD_CONSTANT_LIST_BALL(">Constant - List Ball"), - CMD_CONSTANT_FOOTER(">Constant - CMD Footer"), - - HTML_NO_PLUGINS("Html - No Extra Plugins"), - HTML_BANNED("Html - Banned"), - HTML_OP("Html - OP"), - HTML_ONLINE("Html - Online"), - HTML_OFFLINE("Html - Offline"), - HTML_ACTIVE("Html - Active"), - HTML_INACTIVE("Html - Inactive"), - HTML_TABLE_NO_KILLS("Html - Table No Kills"),; - - private final String identifier; - - Msg(String identifier) { - this.identifier = identifier; - } - - public static Map getIdentifiers() { - return Arrays.stream(values()).collect(Collectors.toMap(Msg::getIdentifier, Function.identity())); - } - - public String getIdentifier() { - return identifier; - } -} diff --git a/Plan/src/main/java/com/djrapitops/plan/system/settings/network/NetworkSettings.java b/Plan/src/main/java/com/djrapitops/plan/system/settings/network/NetworkSettings.java index 4f747851b..7bc6990ad 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/settings/network/NetworkSettings.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/settings/network/NetworkSettings.java @@ -5,7 +5,7 @@ package com.djrapitops.plan.system.settings.network; import com.djrapitops.plan.api.exceptions.connection.UnsupportedTransferDatabaseException; -import com.djrapitops.plan.api.exceptions.database.DBException; +import com.djrapitops.plan.api.exceptions.database.DBOpException; import com.djrapitops.plan.system.database.databases.Database; import com.djrapitops.plan.system.info.server.ServerInfo; import com.djrapitops.plan.system.processing.Processing; @@ -59,7 +59,7 @@ public class NetworkSettings { Processing.submitCritical(() -> { try { new NetworkSettings().placeToDatabase(); - } catch (DBException | UnsupportedTransferDatabaseException e) { + } catch (DBOpException | UnsupportedTransferDatabaseException e) { Log.toLog(NetworkSettings.class, e); } }); @@ -108,7 +108,7 @@ public class NetworkSettings { return pathValueMap; } - public void placeToDatabase() throws DBException, UnsupportedTransferDatabaseException { + public void placeToDatabase() throws UnsupportedTransferDatabaseException { Map configValues = getConfigValues(); Log.debug("NetworkSettings: Building Base64 String.."); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/tasks/BukkitTaskSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/tasks/BukkitTaskSystem.java index a6f962973..d73db3f6e 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/tasks/BukkitTaskSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/tasks/BukkitTaskSystem.java @@ -30,10 +30,12 @@ public class BukkitTaskSystem extends ServerTaskSystem { @Override public void enable() { super.enable(); - PingCountTimer pingCountTimer = new PingCountTimer(); - ((Plan) plugin).registerListener(pingCountTimer); - RunnableFactory.createNew("PingCountTimer", pingCountTimer) - .runTaskTimer(20L, PingCountTimer.PING_INTERVAL); + if (Check.isSpigotAvailable()) { + PingCountTimer pingCountTimer = new PingCountTimer(); + ((Plan) plugin).registerListener(pingCountTimer); + RunnableFactory.createNew("PingCountTimer", pingCountTimer) + .runTaskTimer(20L, PingCountTimer.PING_INTERVAL); + } } @Override diff --git a/Plan/src/main/java/com/djrapitops/plan/system/tasks/ServerTaskSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/tasks/ServerTaskSystem.java index 2cec38fce..c757da73d 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/tasks/ServerTaskSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/tasks/ServerTaskSystem.java @@ -2,15 +2,12 @@ package com.djrapitops.plan.system.tasks; import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.system.settings.Settings; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plan.system.tasks.server.BootAnalysisTask; import com.djrapitops.plan.system.tasks.server.NetworkPageRefreshTask; import com.djrapitops.plan.system.tasks.server.PeriodicAnalysisTask; import com.djrapitops.plan.utilities.file.export.HtmlExport; import com.djrapitops.plugin.api.Benchmark; import com.djrapitops.plugin.api.TimeAmount; -import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.task.ITask; import com.djrapitops.plugin.task.RunnableFactory; @@ -42,8 +39,6 @@ public class ServerTaskSystem extends TaskSystem { boolean analysisRefreshTaskIsEnabled = analysisRefreshMinutes > 0; long analysisPeriod = analysisRefreshMinutes * TimeAmount.MINUTE.ticks(); - Log.info(Locale.get(Msg.ENABLE_BOOT_ANALYSIS_INFO).toString()); - registerTask(tpsCountTimer).runTaskTimer(1000, TimeAmount.SECOND.ticks()); registerTask(new NetworkPageRefreshTask()).runTaskTimerAsynchronously(20L, 5L * TimeAmount.MINUTE.ticks()); bootAnalysisTask = registerTask(new BootAnalysisTask()).runTaskLaterAsynchronously(30L * TimeAmount.SECOND.ticks()); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/tasks/TaskSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/tasks/TaskSystem.java index 81f2db30a..a35235548 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/tasks/TaskSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/tasks/TaskSystem.java @@ -5,7 +5,6 @@ package com.djrapitops.plan.system.tasks; import com.djrapitops.plan.PlanPlugin; -import com.djrapitops.plan.system.PlanSystem; import com.djrapitops.plan.system.SubSystem; import com.djrapitops.plugin.api.systems.TaskCenter; import com.djrapitops.plugin.task.AbsRunnable; @@ -27,10 +26,6 @@ public abstract class TaskSystem implements SubSystem { this.tpsCountTimer = tpsCountTimer; } - public static TaskSystem getInstance() { - return PlanSystem.getInstance().getTaskSystem(); - } - protected IRunnable registerTask(AbsRunnable runnable) { String taskName = runnable.getName(); return registerTask(taskName != null ? taskName : runnable.getClass().getSimpleName(), runnable); @@ -45,7 +40,4 @@ public abstract class TaskSystem implements SubSystem { TaskCenter.cancelAllKnownTasks(PlanPlugin.getInstance().getClass()); } - public TPSCountTimer getTpsCountTimer() { - return tpsCountTimer; - } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/tasks/server/BootAnalysisTask.java b/Plan/src/main/java/com/djrapitops/plan/system/tasks/server/BootAnalysisTask.java index beb14d174..7c1277a1c 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/tasks/server/BootAnalysisTask.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/tasks/server/BootAnalysisTask.java @@ -5,8 +5,6 @@ import com.djrapitops.plan.system.info.InfoSystem; import com.djrapitops.plan.system.info.connection.WebExceptionLogger; import com.djrapitops.plan.system.info.request.GenerateAnalysisPageRequest; import com.djrapitops.plan.system.info.server.ServerInfo; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.task.AbsRunnable; @@ -19,8 +17,6 @@ public class BootAnalysisTask extends AbsRunnable { @Override public void run() { try { - String bootAnalysisRunMsg = Locale.get(Msg.ENABLE_BOOT_ANALYSIS_RUN_INFO).toString(); - Log.info(bootAnalysisRunMsg); WebExceptionLogger.logIfOccurs(this.getClass(), () -> InfoSystem.getInstance().sendRequest(new GenerateAnalysisPageRequest(ServerInfo.getServerUUID())) ); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/tasks/server/BukkitTPSCountTimer.java b/Plan/src/main/java/com/djrapitops/plan/system/tasks/server/BukkitTPSCountTimer.java index 421d4b8d9..7ace91d0a 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/tasks/server/BukkitTPSCountTimer.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/tasks/server/BukkitTPSCountTimer.java @@ -5,6 +5,7 @@ import com.djrapitops.plan.data.container.TPS; import com.djrapitops.plan.system.tasks.TPSCountTimer; import com.djrapitops.plugin.api.TimeAmount; import com.djrapitops.plugin.api.utility.log.Log; +import org.bukkit.World; import java.lang.management.ManagementFactory; import java.lang.management.OperatingSystemMXBean; @@ -107,7 +108,11 @@ public class BukkitTPSCountTimer extends TPSCountTimer { * @return amount of loaded chunks */ private int getLoadedChunks() { - return plugin.getServer().getWorlds().stream().mapToInt(world -> world.getLoadedChunks().length).sum(); + int sum = 0; + for (World world : plugin.getServer().getWorlds()) { + sum += world.getLoadedChunks().length; + } + return sum; } /** @@ -116,6 +121,10 @@ public class BukkitTPSCountTimer extends TPSCountTimer { * @return amount of entities */ protected int getEntityCount() { - return plugin.getServer().getWorlds().stream().mapToInt(world -> world.getEntities().size()).sum(); + int sum = 0; + for (World world : plugin.getServer().getWorlds()) { + sum += world.getEntities().size(); + } + return sum; } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/tasks/server/SpongeTPSCountTimer.java b/Plan/src/main/java/com/djrapitops/plan/system/tasks/server/SpongeTPSCountTimer.java index 1ba5cf2ff..2e3356bab 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/tasks/server/SpongeTPSCountTimer.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/tasks/server/SpongeTPSCountTimer.java @@ -32,17 +32,16 @@ public class SpongeTPSCountTimer extends TPSCountTimer { return; } - history.add(calculateTPS(diff, now)); + history.add(calculateTPS(now)); } /** * Calculates the TPS * - * @param diff The time difference between the last run and the new run * @param now The time right now * @return the TPS */ - private TPS calculateTPS(long diff, long now) { + private TPS calculateTPS(long now) { OperatingSystemMXBean operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean(); int availableProcessors = operatingSystemMXBean.getAvailableProcessors(); double averageCPUUsage = operatingSystemMXBean.getSystemLoadAverage() / availableProcessors * 100.0; diff --git a/Plan/src/main/java/com/djrapitops/plan/system/update/VersionCheckSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/update/VersionCheckSystem.java index a46196221..159b637e7 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/update/VersionCheckSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/update/VersionCheckSystem.java @@ -6,6 +6,8 @@ package com.djrapitops.plan.system.update; import com.djrapitops.plan.system.PlanSystem; import com.djrapitops.plan.system.SubSystem; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.PluginLang; import com.djrapitops.plan.system.settings.Settings; import com.djrapitops.plugin.api.Priority; import com.djrapitops.plugin.api.systems.NotificationCenter; @@ -15,6 +17,7 @@ import com.djrapitops.plugin.utilities.Verify; import java.io.IOException; import java.util.List; +import java.util.function.Supplier; import java.util.stream.Collectors; /** @@ -25,10 +28,12 @@ import java.util.stream.Collectors; public class VersionCheckSystem implements SubSystem { private final String currentVersion; + private final Supplier locale; private VersionInfo newVersionAvailable; - public VersionCheckSystem(String currentVersion) { + public VersionCheckSystem(String currentVersion, Supplier locale) { this.currentVersion = currentVersion; + this.locale = locale; } public static VersionCheckSystem getInstance() { @@ -56,20 +61,21 @@ public class VersionCheckSystem implements SubSystem { VersionInfo newestVersion = versions.get(0); if (Version.isNewVersionAvailable(new Version(currentVersion), newestVersion.getVersion())) { newVersionAvailable = newestVersion; - String notification = - "New Release (" + newestVersion.getVersion().toString() + ") is available " + -// "and can be updated to using update subcommand." + - newestVersion.getChangeLogUrl() + - (newestVersion.isRelease() ? "" : " This is a DEV release."); + String notification = locale.get().getString( + PluginLang.VERSION_AVAILABLE, + newestVersion.getVersion().toString(), + newestVersion.getChangeLogUrl() + ) + (newestVersion.isRelease() ? "" : locale.get().getString(PluginLang.VERSION_AVAILABLE_DEV)); Log.infoColor("§a----------------------------------------"); Log.infoColor("§a" + notification); Log.infoColor("§a----------------------------------------"); + NotificationCenter.getNotifications().clear(); NotificationCenter.addNotification(newestVersion.isRelease() ? Priority.HIGH : Priority.MEDIUM, notification); } else { - Log.info("You're using the latest version."); + Log.info(locale.get().getString(PluginLang.VERSION_NEWEST)); } } catch (IOException e) { - Log.error("Version information could not be loaded from Github/versions.txt"); + Log.error(locale.get().getString(PluginLang.VERSION_FAIL_READ_VERSIONS)); } } else { checkForNewVersion(); @@ -89,16 +95,16 @@ public class VersionCheckSystem implements SubSystem { } } if (newVersionAvailable) { - String newVersionNotification = "New Version is available at " + spigotUrl; + String newVersionNotification = locale.get().getString(PluginLang.VERSION_AVAILABLE_SPIGOT, spigotUrl); Log.infoColor("§a----------------------------------------"); Log.infoColor("§a" + newVersionNotification); Log.infoColor("§a----------------------------------------"); NotificationCenter.addNotification(Priority.HIGH, newVersionNotification); } else { - Log.info("You're using the latest version."); + Log.info(locale.get().getString(PluginLang.VERSION_NEWEST)); } } catch (IOException e) { - Log.error("Failed to check newest version number"); + Log.error(locale.get().getString(PluginLang.VERSION_FAIL_READ_OLD)); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/Request.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/Request.java index dc7926699..47ec0edd7 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/Request.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/Request.java @@ -4,6 +4,7 @@ */ package com.djrapitops.plan.system.webserver; +import com.djrapitops.plan.system.locale.Locale; import com.djrapitops.plan.system.webserver.auth.Authentication; import com.sun.net.httpserver.HttpExchange; @@ -22,15 +23,18 @@ public class Request { private final String target; private final HttpExchange exchange; private final String remoteAddress; + private final Locale locale; private Authentication auth; - public Request(HttpExchange exchange) { + public Request(HttpExchange exchange, Locale locale) { this.requestMethod = exchange.getRequestMethod(); this.target = exchange.getRequestURI().toString(); remoteAddress = exchange.getRemoteAddress().getAddress().getHostAddress(); this.exchange = exchange; + + this.locale = locale; } public Optional getAuth() { @@ -61,4 +65,8 @@ public class Request { public String getRemoteAddress() { return remoteAddress; } + + public Locale getLocale() { + return locale; + } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/RequestHandler.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/RequestHandler.java index 6b76559b1..936d727ca 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/RequestHandler.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/RequestHandler.java @@ -4,6 +4,7 @@ */ package com.djrapitops.plan.system.webserver; +import com.djrapitops.plan.system.locale.Locale; import com.djrapitops.plan.system.settings.Settings; import com.djrapitops.plan.system.webserver.auth.Authentication; import com.djrapitops.plan.system.webserver.auth.BasicAuthentication; @@ -17,6 +18,7 @@ import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import java.util.List; +import java.util.function.Supplier; /** * HttpHandler for WebServer request management. @@ -25,17 +27,19 @@ import java.util.List; */ public class RequestHandler implements HttpHandler { + private final Supplier locale; private final ResponseHandler responseHandler; RequestHandler(WebServer webServer) { responseHandler = new ResponseHandler(webServer); + locale = webServer.getLocaleSupplier(); } @Override public void handle(HttpExchange exchange) { Headers requestHeaders = exchange.getRequestHeaders(); Headers responseHeaders = exchange.getResponseHeaders(); - Request request = new Request(exchange); + Request request = new Request(exchange, locale.get()); request.setAuth(getAuthorization(requestHeaders)); String requestString = request.toString(); @@ -49,7 +53,7 @@ public class RequestHandler implements HttpHandler { } response.setResponseHeaders(responseHeaders); - response.send(exchange); + response.send(exchange, locale.get()); } catch (Exception e) { if (Settings.DEV_MODE.isTrue()) { Log.warn("THIS ERROR IS ONLY LOGGED IN DEV MODE:"); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/ResponseHandler.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/ResponseHandler.java index 42565b157..dfc5999e7 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/ResponseHandler.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/ResponseHandler.java @@ -7,6 +7,7 @@ package com.djrapitops.plan.system.webserver; import com.djrapitops.plan.api.exceptions.WebUserAuthException; import com.djrapitops.plan.api.exceptions.connection.*; import com.djrapitops.plan.system.info.connection.InfoRequestPageHandler; +import com.djrapitops.plan.system.locale.lang.ErrorPageLang; import com.djrapitops.plan.system.webserver.auth.Authentication; import com.djrapitops.plan.system.webserver.pages.*; import com.djrapitops.plan.system.webserver.response.*; @@ -43,9 +44,14 @@ public class ResponseHandler extends TreePageHandler { ServerPageHandler serverPageHandler = new ServerPageHandler(); registerPage("network", serverPageHandler); registerPage("server", serverPageHandler); - if (webServer.isAuthRequired()) { - registerPage("", new RootPageHandler(this)); - } + registerPage("", webServer.isAuthRequired() + ? new RootPageHandler(this) + : new PageHandler() { + @Override + public Response getResponse(Request request, List target) { + return new RedirectResponse("/server"); + } + }); } public void registerWebAPIPages() { @@ -107,7 +113,7 @@ public class ResponseHandler extends TreePageHandler { } PageHandler pageHandler = getPageHandler(target); if (pageHandler == null) { - return DefaultResponses.NOT_FOUND.get(); + return new NotFoundResponse(request.getLocale().getString(ErrorPageLang.UNKNOWN_PAGE_404)); } else { boolean isAuthorized = authentication.isPresent() && pageHandler.isAuthorized(authentication.get(), target); if (!isAuthRequired || isAuthorized) { diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/WebServer.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/WebServer.java index 237ac722f..c8d90b4e3 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/WebServer.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/WebServer.java @@ -4,9 +4,9 @@ import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.api.exceptions.EnableException; import com.djrapitops.plan.system.SubSystem; import com.djrapitops.plan.system.file.FileSystem; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.PluginLang; import com.djrapitops.plan.system.settings.Settings; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plan.utilities.html.HtmlUtils; import com.djrapitops.plugin.StaticHolder; import com.djrapitops.plugin.api.Check; @@ -30,12 +30,15 @@ import java.security.cert.CertificateException; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; /** * @author Rsl1122 */ public class WebServer implements SubSystem { + private final Supplier locale; + private int port; private boolean enabled = false; private HttpServer server; @@ -45,6 +48,10 @@ public class WebServer implements SubSystem { private RequestHandler requestHandler; private ResponseHandler responseHandler; + public WebServer(Supplier locale) { + this.locale = locale; + } + public static WebServer getInstance() { WebServer webServer = WebServerSystem.getInstance().getWebServer(); Verify.nullCheck(webServer, () -> new IllegalStateException("WebServer was not initialized.")); @@ -66,21 +73,16 @@ public class WebServer implements SubSystem { if (!isEnabled()) { if (Check.isBungeeAvailable()) { - throw new EnableException("WebServer did not initialize!"); + throw new EnableException(locale.get().getString(PluginLang.ENABLE_FAIL_NO_WEB_SERVER_BUNGEE)); } if (Settings.WEBSERVER_DISABLED.isTrue()) { - Log.warn("WebServer was not initialized. (WebServer.DisableWebServer: true)"); + Log.warn(locale.get().getString(PluginLang.ENABLE_NOTIFY_WEB_SERVER_DISABLED)); } else { - Log.error("WebServer was not initialized successfully. Is the port (" + Settings.WEBSERVER_PORT.getNumber() + ") in use?"); + Log.error(locale.get().getString(PluginLang.WEB_SERVER_FAIL_PORT_BIND, port)); } } } - @Override - public void disable() { - stop(); - } - /** * Starts up the WebServer in a new Thread Pool. */ @@ -95,14 +97,13 @@ public class WebServer implements SubSystem { return; } - Log.info(Locale.get(Msg.ENABLE_WEBSERVER).toString()); try { usingHttps = startHttpsServer(); Log.debug(usingHttps ? "Https Start Successful." : "Https Start Failed."); if (!usingHttps) { - Log.infoColor("§eUser Authorization Disabled! (Not possible over http)"); + Log.infoColor("§e" + locale.get().getString(PluginLang.WEB_SERVER_NOTIFY_HTTP_USER_AUTH)); server = HttpServer.create(new InetSocketAddress(Settings.WEBSERVER_IP.toString(), port), 10); } server.createContext("/", requestHandler); @@ -112,7 +113,7 @@ public class WebServer implements SubSystem { enabled = true; - Log.info(Locale.get(Msg.ENABLE_WEBSERVER_INFO).parse(server.getAddress().getPort()) + " (" + getAccessAddress() + ")"); + Log.info(locale.get().getString(PluginLang.ENABLED_WEB_SERVER, server.getAddress().getPort(), getAccessAddress())); } catch (IllegalArgumentException | IllegalStateException | IOException e) { Log.toLog(this.getClass(), e); enabled = false; @@ -136,7 +137,11 @@ public class WebServer implements SubSystem { keystore.load(fIn, storepass); Certificate cert = keystore.getCertificate(alias); - Log.info("Found Certificate: " + cert.getType()); + if (cert == null) { + throw new IllegalStateException("Certificate with Alias: " + alias + " was not found in the Keystore."); + } + + Log.info("Certificate: " + cert.getType()); KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509"); keyManagerFactory.init(keystore, keypass); @@ -162,17 +167,20 @@ public class WebServer implements SubSystem { } }); startSuccessful = true; + } catch (IllegalStateException e) { + Log.error(e.getMessage()); + Log.toLog(this.getClass(), e); } catch (KeyManagementException | NoSuchAlgorithmException e) { - Log.error("WebServer: SSL Context Initialization Failed."); + Log.error(locale.get().getString(PluginLang.WEB_SERVER_FAIL_SSL_CONTEXT)); Log.toLog(this.getClass(), e); } catch (FileNotFoundException e) { - Log.infoColor("§eWebServer: SSL Certificate KeyStore File not Found: " + keyStorePath); - Log.info("No Certificate -> Using Http server for Visualization."); + Log.infoColor("§e" + locale.get().getString(PluginLang.WEB_SERVER_NOTIFY_NO_CERT_FILE, keyStorePath)); + Log.info(locale.get().getString(PluginLang.WEB_SERVER_NOTIFY_HTTP)); } catch (IOException e) { Log.error("WebServer: " + e); Log.toLog(this.getClass(), e); } catch (KeyStoreException | CertificateException | UnrecoverableKeyException e) { - Log.error("WebServer: SSL Certificate loading Failed."); + Log.error(locale.get().getString(PluginLang.WEB_SERVER_FAIL_STORE_LOAD)); Log.toLog(this.getClass(), e); } return startSuccessful; @@ -188,9 +196,10 @@ public class WebServer implements SubSystem { /** * Shuts down the server - Async thread is closed with shutdown boolean. */ - public void stop() { + @Override + public void disable() { if (server != null) { - Log.info(Locale.get(Msg.DISABLE_WEBSERVER).toString()); + Log.info(locale.get().getString(PluginLang.DISABLED_WEB_SERVER)); server.stop(0); } enabled = false; @@ -219,4 +228,8 @@ public class WebServer implements SubSystem { public ResponseHandler getResponseHandler() { return responseHandler; } + + Supplier getLocaleSupplier() { + return locale; + } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/WebServerSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/WebServerSystem.java index d3f66d1b4..432376555 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/WebServerSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/WebServerSystem.java @@ -7,9 +7,12 @@ package com.djrapitops.plan.system.webserver; import com.djrapitops.plan.api.exceptions.EnableException; import com.djrapitops.plan.system.PlanSystem; import com.djrapitops.plan.system.SubSystem; +import com.djrapitops.plan.system.locale.Locale; import com.djrapitops.plan.system.webserver.response.cache.ResponseCache; import com.djrapitops.plugin.api.Benchmark; +import java.util.function.Supplier; + /** * WebServer subsystem for managing WebServer initialization. * @@ -19,8 +22,8 @@ public class WebServerSystem implements SubSystem { private WebServer webServer; - public WebServerSystem() { - webServer = new WebServer(); + public WebServerSystem(Supplier locale) { + webServer = new WebServer(locale); } public static WebServerSystem getInstance() { @@ -36,16 +39,16 @@ public class WebServerSystem implements SubSystem { public void enable() throws EnableException { Benchmark.start("WebServer Initialization"); webServer.enable(); - Benchmark.stop("Enable", "WebServer Initialization"); ResponseHandler responseHandler = webServer.getResponseHandler(); responseHandler.registerWebAPIPages(); responseHandler.registerDefaultPages(); + Benchmark.stop("Enable", "WebServer Initialization"); } @Override public void disable() { ResponseCache.clearCache(); - webServer.stop(); + webServer.disable(); } public WebServer getWebServer() { diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/auth/FailReason.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/auth/FailReason.java index b49a5f422..b3e15ab6a 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/auth/FailReason.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/auth/FailReason.java @@ -4,13 +4,15 @@ */ package com.djrapitops.plan.system.webserver.auth; +import com.djrapitops.plan.system.locale.lang.Lang; + /** * Reason for WebUserAuthException. * * @author Rsl1122 * @see com.djrapitops.plan.api.exceptions.WebUserAuthException */ -public enum FailReason { +public enum FailReason implements Lang { USER_AND_PASS_NOT_SPECIFIED("User and Password not specified"), USER_DOES_NOT_EXIST("User does not exist"), USER_PASS_MISMATCH("User and Password did not match"), @@ -25,4 +27,14 @@ public enum FailReason { public String getReason() { return reason; } + + @Override + public String getIdentifier() { + return "HTML - " + name(); + } + + @Override + public String getDefault() { + return getReason(); + } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/PlayerPageHandler.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/PlayerPageHandler.java index 2c5a4dc82..bead14036 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/PlayerPageHandler.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/PlayerPageHandler.java @@ -10,9 +10,10 @@ import com.djrapitops.plan.api.exceptions.connection.WebException; import com.djrapitops.plan.data.WebUser; import com.djrapitops.plan.system.database.databases.Database; import com.djrapitops.plan.system.info.InfoSystem; +import com.djrapitops.plan.system.locale.Locale; +import com.djrapitops.plan.system.locale.lang.ErrorPageLang; import com.djrapitops.plan.system.webserver.Request; import com.djrapitops.plan.system.webserver.auth.Authentication; -import com.djrapitops.plan.system.webserver.response.DefaultResponses; import com.djrapitops.plan.system.webserver.response.Response; import com.djrapitops.plan.system.webserver.response.cache.PageId; import com.djrapitops.plan.system.webserver.response.cache.ResponseCache; @@ -33,14 +34,15 @@ public class PlayerPageHandler extends PageHandler { @Override public Response getResponse(Request request, List target) throws WebException { if (target.isEmpty()) { - return DefaultResponses.NOT_FOUND.get(); + return new NotFoundResponse(request.getLocale().getString(ErrorPageLang.UNKNOWN_PAGE_404)); } String playerName = target.get(0); UUID uuid = UUIDUtility.getUUIDOf(playerName); + Locale locale = request.getLocale(); if (uuid == null) { - return notFound("Player UUID was not found in the database."); + return notFound(locale.getString(ErrorPageLang.UUID_404)); } try { if (Database.getActive().check().isPlayerRegistered(uuid)) { @@ -49,9 +51,9 @@ public class PlayerPageHandler extends PageHandler { InfoSystem.getInstance().generateAndCachePlayerPage(uuid); response = ResponseCache.loadResponse(PageId.PLAYER.of(uuid)); } - return response != null ? response : notFound("No Bukkit servers online to perform the request."); + return response != null ? response : notFound(locale.getString(ErrorPageLang.NO_SERVERS_404)); } else { - return notFound("Player has not played on this server."); + return notFound(locale.getString(ErrorPageLang.NOT_PLAYED_404)); } } catch (NoServersException e) { ResponseCache.loadResponse(PageId.PLAYER.of(uuid), () -> new NotFoundResponse(e.getMessage())); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/TreePageHandler.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/TreePageHandler.java index 6e38808df..1930f809c 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/TreePageHandler.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/TreePageHandler.java @@ -6,10 +6,11 @@ package com.djrapitops.plan.system.webserver.pages; import com.djrapitops.plan.api.exceptions.WebUserAuthException; import com.djrapitops.plan.api.exceptions.connection.WebException; +import com.djrapitops.plan.system.locale.lang.ErrorPageLang; import com.djrapitops.plan.system.webserver.Request; import com.djrapitops.plan.system.webserver.auth.Authentication; -import com.djrapitops.plan.system.webserver.response.DefaultResponses; import com.djrapitops.plan.system.webserver.response.Response; +import com.djrapitops.plan.system.webserver.response.errors.NotFoundResponse; import java.util.HashMap; import java.util.List; @@ -51,7 +52,7 @@ public abstract class TreePageHandler extends PageHandler { PageHandler pageHandler = getPageHandler(target); return pageHandler != null ? pageHandler.getResponse(request, target) - : DefaultResponses.NOT_FOUND.get(); + : new NotFoundResponse(request.getLocale().getString(ErrorPageLang.UNKNOWN_PAGE_404)); } public PageHandler getPageHandler(List target) { diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/parsing/InspectPage.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/parsing/InspectPage.java index 0aca97c53..bbcbbbad4 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/parsing/InspectPage.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/parsing/InspectPage.java @@ -14,6 +14,7 @@ import com.djrapitops.plan.data.store.mutators.formatting.Formatter; import com.djrapitops.plan.data.store.mutators.formatting.Formatters; import com.djrapitops.plan.data.store.mutators.formatting.PlaceholderReplacer; import com.djrapitops.plan.data.time.WorldTimes; +import com.djrapitops.plan.system.cache.CacheSystem; import com.djrapitops.plan.system.cache.SessionCache; import com.djrapitops.plan.system.database.databases.Database; import com.djrapitops.plan.system.info.server.ServerInfo; @@ -59,7 +60,7 @@ public class InspectPage implements Page { } Benchmark.start("Inspect Parse, Fetch"); Database db = Database.getActive(); - PlayerContainer container = db.fetch().getPlayerContainer(uuid); + PlayerContainer container = CacheSystem.getInstance().getDataContainerCache().getPlayerContainer(uuid); if (!container.getValue(PlayerKeys.REGISTERED).isPresent()) { throw new IllegalStateException("Player is not registered"); } @@ -123,9 +124,10 @@ public class InspectPage implements Page { double averagePing = pingMutator.average(); int minPing = pingMutator.min(); int maxPing = pingMutator.max(); - replacer.put("avgPing", averagePing != -1 ? FormatUtils.cutDecimals(averagePing) + " ms" : "Unavailable"); - replacer.put("minPing", minPing != -1 ? minPing + " ms" : "Unavailable"); - replacer.put("maxPing", maxPing != -1 ? maxPing + " ms" : "Unavailable"); + String unavailable = "Unavailable"; + replacer.put("avgPing", averagePing != -1 ? FormatUtils.cutDecimals(averagePing) + " ms" : unavailable); + replacer.put("minPing", minPing != -1 ? minPing + " ms" : unavailable); + replacer.put("maxPing", maxPing != -1 ? maxPing + " ms" : unavailable); List allSessions = player.getValue(PlayerKeys.SESSIONS).orElse(new ArrayList<>()); SessionsMutator sessionsMutator = SessionsMutator.forContainer(player); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/parsing/NetworkPage.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/parsing/NetworkPage.java index 3095a2053..333e0c6de 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/parsing/NetworkPage.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/parsing/NetworkPage.java @@ -7,7 +7,6 @@ package com.djrapitops.plan.system.webserver.pages.parsing; import com.djrapitops.plan.api.exceptions.ParseException; import com.djrapitops.plan.data.store.containers.NetworkContainer; import com.djrapitops.plan.data.store.mutators.formatting.PlaceholderReplacer; -import com.djrapitops.plan.system.database.databases.Database; import com.djrapitops.plan.system.webserver.response.cache.PageId; import com.djrapitops.plan.system.webserver.response.cache.ResponseCache; import com.djrapitops.plan.system.webserver.response.pages.parts.NetworkPageContent; @@ -22,12 +21,15 @@ import static com.djrapitops.plan.data.store.keys.NetworkKeys.*; */ public class NetworkPage implements Page { + private final NetworkContainer networkContainer; + + public NetworkPage(NetworkContainer networkContainer) { + this.networkContainer = networkContainer; + } + @Override public String toHtml() throws ParseException { try { - Database database = Database.getActive(); - NetworkContainer networkContainer = database.fetch().getNetworkContainer(); - PlaceholderReplacer placeholderReplacer = new PlaceholderReplacer(); placeholderReplacer.addAllPlaceholdersFrom(networkContainer, VERSION, NETWORK_NAME, TIME_ZONE, diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/DefaultResponses.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/DefaultResponses.java index 0634726c8..5096e47d3 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/DefaultResponses.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/DefaultResponses.java @@ -5,7 +5,6 @@ package com.djrapitops.plan.system.webserver.response; import com.djrapitops.plan.system.webserver.response.api.SuccessResponse; -import com.djrapitops.plan.system.webserver.response.errors.NotFoundResponse; /** * Enum containing default responses that don't need to be cached because they're always the same. @@ -13,11 +12,6 @@ import com.djrapitops.plan.system.webserver.response.errors.NotFoundResponse; * @author Rsl1122 */ public enum DefaultResponses { - NOT_FOUND( - new NotFoundResponse("Make sure you're accessing a link given by a command, Examples:

" - + "

/player/PlayerName
" + - "/server/ServerName

") - ), BASIC_AUTH(PromptAuthorizationResponse.getBasicAuthResponse()), SUCCESS(new SuccessResponse()); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/RedirectResponse.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/RedirectResponse.java index e29e566a0..86fa225a4 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/RedirectResponse.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/RedirectResponse.java @@ -1,5 +1,10 @@ package com.djrapitops.plan.system.webserver.response; +import com.djrapitops.plan.system.locale.Locale; +import com.sun.net.httpserver.HttpExchange; + +import java.io.IOException; + /** * @author Rsl1122 * @since 3.5.2 @@ -8,6 +13,12 @@ public class RedirectResponse extends Response { public RedirectResponse(String direct) { super.setHeader("HTTP/1.1 302 Found"); - super.setContent("Location: " + direct); + super.setContent(direct); + } + + @Override + public void send(HttpExchange exchange, Locale locale) throws IOException { + responseHeaders.set("Location", getContent()); + super.send(exchange, locale); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/Response.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/Response.java index 728642226..0456b76ba 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/Response.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/Response.java @@ -1,10 +1,12 @@ package com.djrapitops.plan.system.webserver.response; +import com.djrapitops.plan.system.locale.Locale; import com.sun.net.httpserver.Headers; import com.sun.net.httpserver.HttpExchange; import java.io.ByteArrayInputStream; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.Objects; import java.util.zip.GZIPOutputStream; @@ -18,7 +20,7 @@ public abstract class Response { private String header; private String content; - private Headers responseHeaders; + protected Headers responseHeaders; public Response(ResponseType type) { this.type = type.get(); @@ -81,13 +83,17 @@ public abstract class Response { this.responseHeaders = responseHeaders; } - public void send(HttpExchange exchange) throws IOException { + public void send(HttpExchange exchange, Locale locale) throws IOException { responseHeaders.set("Content-Type", type); responseHeaders.set("Content-Encoding", "gzip"); exchange.sendResponseHeaders(getCode(), 0); + String sentContent = this instanceof JavaScriptResponse + ? getContent() + : locale.replaceMatchingLanguage(getContent()); + try (GZIPOutputStream out = new GZIPOutputStream(exchange.getResponseBody()); - ByteArrayInputStream bis = new ByteArrayInputStream(getContent().getBytes())) { + ByteArrayInputStream bis = new ByteArrayInputStream(sentContent.getBytes(StandardCharsets.UTF_8))) { byte[] buffer = new byte[2048]; int count; while ((count = bis.read(buffer)) != -1) { diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/ResponseType.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/ResponseType.java index 17536e8f4..85ea8b115 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/ResponseType.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/ResponseType.java @@ -10,7 +10,7 @@ package com.djrapitops.plan.system.webserver.response; * @author Rsl1122 */ public enum ResponseType { - HTML("text/html;charset=utf-8"), + HTML("text/html; charset=utf-8"), CSS("text/css"), JSON("application/json"), JAVASCRIPT("application/javascript"); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/cache/PageId.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/cache/PageId.java index ed9966741..f1b657004 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/cache/PageId.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/cache/PageId.java @@ -20,14 +20,11 @@ public enum PageId { ERROR("error:"), FORBIDDEN(ERROR.of("Forbidden")), NOT_FOUND(ERROR.of("Not Found")), - TRUE("true"), - FALSE("false"), JS("js:"), CSS("css:"), FAVICON_REDIRECT("Redirect:Favicon"), - AUTH_PROMPT("PromptAuth"), PLAYER_PLUGINS_TAB("playerPluginsTab:"), NETWORK_CONTENT("networkContent"); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/errors/ForbiddenResponse.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/errors/ForbiddenResponse.java index c7d1a416d..3ac171516 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/errors/ForbiddenResponse.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/errors/ForbiddenResponse.java @@ -8,10 +8,6 @@ import com.djrapitops.plan.utilities.html.icon.Icon; * @since 3.5.2 */ public class ForbiddenResponse extends ErrorResponse { - public ForbiddenResponse() { - super.setHeader("HTTP/1.1 403 Forbidden"); - super.setTitle(Icon.called("hand-paper").of(Family.REGULAR) + " 403 Forbidden - Access Denied"); - } public ForbiddenResponse(String msg) { super.setHeader("HTTP/1.1 403 Forbidden"); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/pages/DebugPageResponse.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/pages/DebugPageResponse.java index 0bb6ed9a4..b31b49cb0 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/pages/DebugPageResponse.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/pages/DebugPageResponse.java @@ -5,12 +5,10 @@ package com.djrapitops.plan.system.webserver.response.pages; import com.djrapitops.plan.PlanPlugin; -import com.djrapitops.plan.api.exceptions.database.DBOpException; import com.djrapitops.plan.data.store.mutators.formatting.Formatter; import com.djrapitops.plan.data.store.mutators.formatting.Formatters; import com.djrapitops.plan.data.store.objects.DateHolder; import com.djrapitops.plan.system.database.databases.Database; -import com.djrapitops.plan.system.database.databases.sql.SQLDB; import com.djrapitops.plan.system.info.connection.ConnectionLog; import com.djrapitops.plan.system.info.connection.ConnectionSystem; import com.djrapitops.plan.system.info.server.Server; @@ -123,15 +121,6 @@ public class DebugPageResponse extends ErrorResponse { Database database = Database.getActive(); content.append("**Database:** ").append(database.getName()); - - if (database instanceof SQLDB) { - try { - content.append(" schema v").append(((SQLDB) database).getVersion()); - } catch (DBOpException e) { - Log.toLog(this.getClass(), e); - } - } - content.append("

"); RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/pages/parts/NetworkPageContent.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/pages/parts/NetworkPageContent.java index c0b3f2b5c..3eaa8bfb3 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/pages/parts/NetworkPageContent.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/pages/parts/NetworkPageContent.java @@ -23,11 +23,6 @@ public class NetworkPageContent extends Response { content = new HashMap<>(); } - public NetworkPageContent(String serverName, String html) { - this(); - content.put(serverName, html); - } - public void addElement(String serverName, String html) { content.put(serverName, html); } diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/Base64Util.java b/Plan/src/main/java/com/djrapitops/plan/utilities/Base64Util.java index 0e3a2e5bb..009d34e1e 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/Base64Util.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/Base64Util.java @@ -21,11 +21,19 @@ public class Base64Util { private Base64Util() { } + public static String encodeBytes(byte[] bytes) { + return new String(Base64.getEncoder().encode(bytes)); + } + public static String encode(String decoded) { byte[] encoded = Base64.getEncoder().encode(decoded.getBytes()); return new String(encoded); } + public static byte[] decodeBytes(String encoded) { + return Base64.getDecoder().decode(encoded.getBytes()); + } + public static String decode(String encoded) { byte[] decoded = Base64.getDecoder().decode(encoded.getBytes()); return new String(decoded); diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/MiscUtils.java b/Plan/src/main/java/com/djrapitops/plan/utilities/MiscUtils.java index c44cafac3..c16c7a46a 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/MiscUtils.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/MiscUtils.java @@ -4,8 +4,6 @@ import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.system.database.databases.Database; import com.djrapitops.plan.system.settings.Permissions; import com.djrapitops.plan.system.settings.Settings; -import com.djrapitops.plan.system.settings.locale.Locale; -import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plugin.api.TimeAmount; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.command.CommandUtils; @@ -55,11 +53,11 @@ public class MiscUtils { * * @param args Arguments of a command, must not be empty if console sender. * @param sender Command sender - * @param perm Permission to use when checking. No permission will notify user. - * @return The name of the player (first argument or sender) + * @param perm Permission to use when checking. + * @return The name of the player (first argument or sender) or null if sender has no permission. */ public static String getPlayerName(String[] args, ISender sender, Permissions perm) { - String playerName = ""; + String playerName; boolean isConsole = !CommandUtils.isPlayer(sender); if (isConsole) { playerName = args[0]; @@ -69,7 +67,7 @@ public class MiscUtils { } else if (args[0].equalsIgnoreCase(sender.getName())) { playerName = sender.getName(); } else { - sender.sendMessage(Locale.get(Msg.CMD_FAIL_NO_PERMISSION).toString()); + return null; } } else { playerName = sender.getName(); diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/SHA256Hash.java b/Plan/src/main/java/com/djrapitops/plan/utilities/SHA256Hash.java index 0335912f6..396e455bc 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/SHA256Hash.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/SHA256Hash.java @@ -1,6 +1,6 @@ package com.djrapitops.plan.utilities; -import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Base64; @@ -13,9 +13,9 @@ public class SHA256Hash { this.original = original; } - public String create() throws NoSuchAlgorithmException, UnsupportedEncodingException { + public String create() throws NoSuchAlgorithmException { MessageDigest digest = MessageDigest.getInstance("SHA-256"); - digest.update(original.getBytes("UTF-8")); + digest.update(original.getBytes(StandardCharsets.UTF_8)); return Base64.getEncoder().encodeToString(digest.digest()); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/AnalysisUtils.java b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/AnalysisUtils.java index ac5903b38..dadfca03e 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/AnalysisUtils.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/AnalysisUtils.java @@ -6,7 +6,6 @@ import com.djrapitops.plan.data.store.mutators.RetentionData; import com.djrapitops.plan.data.time.WorldTimes; import com.djrapitops.plan.system.settings.WorldAliasSettings; import com.djrapitops.plan.utilities.FormatUtils; -import com.djrapitops.plugin.api.TimeAmount; import java.util.*; import java.util.stream.Collectors; @@ -51,36 +50,6 @@ public class AnalysisUtils { }).collect(Collectors.toList()); } - public static double getAveragePerDay(long after, long before, long total) { - return (double) total / getNumberOfDaysBetween(after, before); - } - - public static long getNumberOfDaysBetween(long start, long end) { - long value = 0; - long test = start; - long day = TimeAmount.DAY.ms(); - while (test < end) { - test += day; - value++; - } - return value == 0 ? 1 : value; - } - - public static Map> sortSessionsByUser(Map>> allSessions) { - Map> userSessions = new HashMap<>(); - - for (Map> sessions : allSessions.values()) { - for (Map.Entry> entry : sessions.entrySet()) { - UUID uuid = entry.getKey(); - List list = userSessions.getOrDefault(uuid, new ArrayList<>()); - list.addAll(entry.getValue()); - userSessions.put(uuid, list); - } - } - - return userSessions; - } - public static Map getPlaytimePerAlias(WorldTimes worldTimes) { // WorldTimes Map Map playtimePerWorld = worldTimes.getWorldTimes() diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/LocaleEntryComparator.java b/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/LocaleEntryComparator.java index eb16cf4e0..d3a669fbe 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/LocaleEntryComparator.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/LocaleEntryComparator.java @@ -1,7 +1,7 @@ package com.djrapitops.plan.utilities.comparators; -import com.djrapitops.plan.system.settings.locale.Message; -import com.djrapitops.plan.system.settings.locale.Msg; +import com.djrapitops.plan.system.locale.Message; +import com.djrapitops.plan.system.locale.lang.Lang; import java.util.Comparator; import java.util.Map; @@ -12,10 +12,10 @@ import java.util.Map; * @author Rsl1122 * @since 3.6.2 */ -public class LocaleEntryComparator implements Comparator> { +public class LocaleEntryComparator implements Comparator> { @Override - public int compare(Map.Entry o1, Map.Entry o2) { - return String.CASE_INSENSITIVE_ORDER.compare(o1.getKey().name(), o2.getKey().name()); + public int compare(Map.Entry o1, Map.Entry o2) { + return String.CASE_INSENSITIVE_ORDER.compare(o1.getKey().getIdentifier(), o2.getKey().getIdentifier()); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/PlayerKillComparator.java b/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/PlayerKillComparator.java deleted file mode 100644 index 580937df4..000000000 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/PlayerKillComparator.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.djrapitops.plan.utilities.comparators; - -/** - * Compares PlayerKills so that most recent is first. - * - * @author Rsl1122 - */ -public class PlayerKillComparator extends DateHolderRecentComparator { - -} diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/SessionLengthComparator.java b/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/SessionLengthComparator.java deleted file mode 100644 index 04e8478ad..000000000 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/SessionLengthComparator.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.djrapitops.plan.utilities.comparators; - -import com.djrapitops.plan.data.container.Session; - -import java.util.Comparator; - -/** - * Comparator for Sessions in descending length order. - * - * @author Rsl1122 - */ -public class SessionLengthComparator implements Comparator { - - @Override - public int compare(Session s1, Session s2) { - return -Long.compare(s1.getLength(), s2.getLength()); - } -} diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/HtmlStructure.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/HtmlStructure.java index 810de7303..82206c59b 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/HtmlStructure.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/HtmlStructure.java @@ -15,9 +15,9 @@ import com.djrapitops.plan.utilities.html.icon.Color; import com.djrapitops.plan.utilities.html.icon.Icon; import com.djrapitops.plan.utilities.html.icon.Icons; import com.djrapitops.plugin.api.utility.log.Log; -import com.djrapitops.plugin.utilities.Verify; +import org.apache.commons.text.TextStringBuilder; -import java.util.*; +import java.util.UUID; import java.util.concurrent.ThreadLocalRandom; /** @@ -28,18 +28,8 @@ import java.util.concurrent.ThreadLocalRandom; public class HtmlStructure { public static String separateWithDots(String... elements) { - if (elements.length == 0) { - return ""; - } - StringBuilder builder = new StringBuilder(elements[0]); - for (int i = 1; i < elements.length; i++) { - String element = elements[i]; - if (element.isEmpty()) { - continue; - } - builder.append(" • "); - builder.append(element); - } + TextStringBuilder builder = new TextStringBuilder(); + builder.appendWithSeparators(elements, " • "); return builder.toString(); } @@ -72,28 +62,6 @@ public class HtmlStructure { return new String[]{"
  • Calculating... Refresh shortly
  • ", tab}; } - public static String createNetworkPageContent(Map networkPageContents) { - if (Verify.isEmpty(networkPageContents)) { - return ""; - } - int i = 0; - StringBuilder b = new StringBuilder(); - List values = new ArrayList<>(networkPageContents.values()); - Collections.sort(values); - int size = values.size(); - for (String server : values) { - if (i % 2 == 0) { - b.append("
    "); - } - b.append(server); - if ((i + 1) % 2 == 0 || i + 1 == size) { - b.append("
    "); - } - i++; - } - return b.toString(); - } - // TODO Rework into NetworkPage generation public static String createServerContainer() { ServerProperties properties = ServerInfo.getServerProperties(); @@ -168,22 +136,16 @@ public class HtmlStructure { public static String playerStatus(boolean online, boolean banned, boolean op) { StringBuilder html = new StringBuilder("

    "); if (online) { - html.append(Icon.called("circle").of(Color.GREEN)) - .append(" Online"); + html.append(Icon.called("circle").of(Color.GREEN)).append(" Online"); } else { - html.append(Icon.called("circle").of(Color.RED)) - .append(" Offline"); + html.append(Icon.called("circle").of(Color.RED)).append(" Offline"); } html.append("

    "); if (op) { - html.append("

    ") - .append(Icons.OPERATOR) - .append(" Operator

    "); + html.append("

    ").append(Icons.OPERATOR).append(" Operator

    "); } if (banned) { - html.append("

    ") - .append(Icons.BANNED) - .append(" Banned"); + html.append("

    ").append(Icons.BANNED).append(" Banned

    "); } return html.toString(); } diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/WorldMap.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/WorldMap.java index 2d28a5eba..0fb9d6c4e 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/WorldMap.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/WorldMap.java @@ -1,6 +1,7 @@ package com.djrapitops.plan.utilities.html.graphs; import com.djrapitops.plan.data.store.mutators.PlayersMutator; +import org.apache.commons.text.TextStringBuilder; import java.util.HashMap; import java.util.List; @@ -52,25 +53,16 @@ public class WorldMap implements HighChart { } } - StringBuilder dataBuilder = new StringBuilder("["); + TextStringBuilder dataBuilder = new TextStringBuilder("["); - int i = 0; - int size = geoCodeCounts.size(); - for (Map.Entry entry : geoCodeCounts.entrySet()) { - String geoCode = entry.getKey(); - Integer players = entry.getValue(); + dataBuilder.appendWithSeparators( + geoCodeCounts.entrySet().stream() + .filter(entry -> entry.getValue() != 0) + .map(entry -> "{'code':'" + entry.getKey() + "','value':" + entry.getValue() + "}") + .iterator(), + "," + ); - if (players != 0) { - dataBuilder.append("{'code':'").append(geoCode).append("','value':").append(players).append("}"); - if (i < size - 1) { - dataBuilder.append(","); - } - } - - i++; - } - - dataBuilder.append("]"); - return dataBuilder.toString(); + return dataBuilder.append("]").toString(); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/bar/BarGraph.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/bar/BarGraph.java index af17e7048..0c82b5361 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/bar/BarGraph.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/bar/BarGraph.java @@ -1,6 +1,7 @@ package com.djrapitops.plan.utilities.html.graphs.bar; import com.djrapitops.plan.utilities.html.graphs.HighChart; +import org.apache.commons.text.TextStringBuilder; import java.util.List; @@ -13,35 +14,15 @@ public class BarGraph implements HighChart { } public String toHighChartsCategories() { - StringBuilder categories = new StringBuilder("["); - - int i = 0; - int size = bars.size(); - for (Bar bar : bars) { - categories.append("'").append(bar.getLabel()).append("'"); - if (i < size - 1) { - categories.append(","); - } - i++; - } - + TextStringBuilder categories = new TextStringBuilder("["); + categories.appendWithSeparators(bars.stream().map(bar -> "'" + bar.getLabel() + "'").iterator(), ","); return categories.append("]").toString(); } @Override public String toHighChartsSeries() { - StringBuilder series = new StringBuilder("["); - - int i = 0; - int size = bars.size(); - for (Bar bar : bars) { - series.append(bar.getValue()); - if (i < size - 1) { - series.append(","); - } - i++; - } - + TextStringBuilder series = new TextStringBuilder("["); + series.appendWithSeparators(bars.stream().map(Bar::getValue).iterator(), ","); return series.append("]").toString(); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/pie/AbstractPieChart.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/pie/AbstractPieChart.java index c69d71e27..101c8234d 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/pie/AbstractPieChart.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/pie/AbstractPieChart.java @@ -5,6 +5,7 @@ package com.djrapitops.plan.utilities.html.graphs.pie; import com.djrapitops.plan.utilities.html.graphs.HighChart; +import org.apache.commons.text.TextStringBuilder; import java.util.ArrayList; import java.util.List; @@ -29,19 +30,9 @@ public class AbstractPieChart implements HighChart { @Override public String toHighChartsSeries() { - StringBuilder seriesBuilder = new StringBuilder("["); - int i = 0; - int size = slices.size(); - for (PieSlice slice : slices) { - seriesBuilder.append(slice.toString()); - if (i < size - 1) { - seriesBuilder.append(","); - } - i++; - } - seriesBuilder.append("]"); - - return seriesBuilder.toString(); + TextStringBuilder series = new TextStringBuilder("["); + series.appendWithSeparators(slices, ","); + return series.append("]").toString(); } public void setSlices(List slices) { diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/icon/Family.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/icon/Family.java index 1ac0ea7bd..405d2b812 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/icon/Family.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/icon/Family.java @@ -1,22 +1,20 @@ package com.djrapitops.plan.utilities.html.icon; public enum Family { - SOLID(""), - REGULAR(""), - BRAND(""), - LINE("", ""); + SOLID(" fa fa-", "\">"), + REGULAR(" far fa-", "\">"), + BRAND(" fab fa-", "\">"), + LINE(" material-icons\">", ""); - private final String prefix; private final String middle; private final String suffix; - Family(String prefix, String middle, String suffix) { - this.prefix = prefix; + Family(String middle, String suffix) { this.middle = middle; this.suffix = suffix; } public String appendAround(String color, String name) { - return prefix + color + middle + name + suffix; + return " { + + private final Type type; + + public Serializer(Type type) { + this.type = type; + } + + /** + * Serializes an object. + * + * @param object Object to Serialize. + * @return byte array that contains the serialized object. + * @throws IOException If output fails. + * @throws NotSerializableException If object does not implement Serializable. + */ + public byte[] serialize(T object) throws IOException { + try (ByteArrayOutputStream out = new ByteArrayOutputStream()) { + try (ObjectOutput oo = new ObjectOutputStream(out)) { + oo.writeObject(object); + } + return out.toByteArray(); + } + } + + /** + * De-serializes an object. + * + * @param bytes byte array that contains the serialized object. + * @return De-serialized object. + * @throws IOException If input fails. + * @throws ClassNotFoundException If a Serialized class is not found. + */ + public T deserialize(byte[] bytes) throws IOException, ClassNotFoundException { + try (ObjectInput oi = new ObjectInputStream(new ByteArrayInputStream(bytes))) { + return (T) oi.readObject(); + } + } +} \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/metrics/Metrics.java b/Plan/src/main/java/com/djrapitops/plan/utilities/metrics/Metrics.java index 20a6cd319..126b34e15 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/metrics/Metrics.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/metrics/Metrics.java @@ -18,6 +18,7 @@ import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URL; +import java.nio.charset.StandardCharsets; import java.util.*; import java.util.concurrent.Callable; import java.util.logging.Level; @@ -169,7 +170,7 @@ public class Metrics { } ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); GZIPOutputStream gzip = new GZIPOutputStream(outputStream); - gzip.write(str.getBytes("UTF-8")); + gzip.write(str.getBytes(StandardCharsets.UTF_8)); gzip.close(); return outputStream.toByteArray(); } diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/queue/Consumer.java b/Plan/src/main/java/com/djrapitops/plan/utilities/queue/Consumer.java deleted file mode 100644 index 7cd1cc621..000000000 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/queue/Consumer.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.djrapitops.plan.utilities.queue; - -import com.djrapitops.plugin.task.AbsRunnable; - -import java.util.concurrent.BlockingQueue; - -/** - * Abstract class representing a queue consumer. - * - * @param - * @author Rsl1122 - */ -public abstract class Consumer extends AbsRunnable { - - protected final BlockingQueue queue; - protected boolean run; - - /** - * Constructor, defines queue. - * - * @param queue Queue to consume from. - * @param name Name of the queue. - */ - public Consumer(BlockingQueue queue, String name) { - super(name); - this.queue = queue; - run = true; - } - - @Override - public void run() { - try { - while (run) { - consume(queue.take()); - } - } catch (InterruptedException ex) { - Thread.currentThread().interrupt(); - } - } - - protected void stop() { - run = false; - try { - super.cancel(); - } catch (NullPointerException | IllegalArgumentException ignore) { - /*ignored*/ - } - } - - protected abstract void consume(T toConsume); -} diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/queue/Queue.java b/Plan/src/main/java/com/djrapitops/plan/utilities/queue/Queue.java deleted file mode 100644 index 35b407e32..000000000 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/queue/Queue.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.djrapitops.plan.utilities.queue; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.BlockingQueue; - -/** - * Abstract implementation of a Queue. - * - * @param Object this queue consumes - * @author Rsl1122 - */ -public abstract class Queue { - - protected boolean run = true; - protected final BlockingQueue queue; - protected Setup setup; - - /** - * Constructor, defines queue. - * - * @param queue BlockingQueue to use for this queue. - */ - public Queue(BlockingQueue queue) { - this.queue = queue; - } - - /** - * Add a object to the queue, default implementation. - * - * @param object Object to add. - */ - public void add(T object) { - if (run) { - queue.add(object); - } - } - - /** - * Used to stop the queue processing and get the unprocessed objects. - * - * @return List of unprocessed objects. - */ - public List stopAndReturnLeftovers() { - run = false; - try { - if (setup != null) { - setup.stop(); - return new ArrayList<>(queue); - } - return new ArrayList<>(); - } finally { - stop(); - } - } - - /** - * Stops all activity and clears the queue. - */ - public void stop() { - run = false; - if (setup != null) { - setup.stop(); - } - setup = null; - queue.clear(); - } - - /** - * Get how many objects are in the queue. - * - * @return size of the queue. - */ - public int size() { - return queue.size(); - } -} diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/queue/Setup.java b/Plan/src/main/java/com/djrapitops/plan/utilities/queue/Setup.java deleted file mode 100644 index f0031cdc1..000000000 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/queue/Setup.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.djrapitops.plan.utilities.queue; - -import com.djrapitops.plugin.task.RunnableFactory; - -/** - * Abstract representation of a queue setup. - * - * @param Object this queue consumes. - * @author Rsl1122 - */ -public abstract class Setup { - - private final Consumer[] consumers; - - /** - * Constructor, defines consumers. - * - * @param consumers Consumers for the new threads. - */ - @SafeVarargs - public Setup(Consumer... consumers) { - this.consumers = consumers; - } - - public void go() { - for (Consumer consumer : consumers) { - RunnableFactory.createNew(consumer).runTaskAsynchronously(); - } - } - - public void stop() { - for (Consumer consumer : consumers) { - consumer.stop(); - } - } -} diff --git a/Plan/src/main/resources/bungee.yml b/Plan/src/main/resources/bungee.yml index ab1404920..c92fc52e9 100644 --- a/Plan/src/main/resources/bungee.yml +++ b/Plan/src/main/resources/bungee.yml @@ -1,4 +1,4 @@ name: Plan author: Rsl1122 main: com.djrapitops.plan.PlanBungee -version: 4.4.1 \ No newline at end of file +version: 4.4.2 \ No newline at end of file diff --git a/Plan/src/main/resources/locale/locale_CN.txt b/Plan/src/main/resources/locale/locale_CN.txt new file mode 100644 index 000000000..332781af1 --- /dev/null +++ b/Plan/src/main/resources/locale/locale_CN.txt @@ -0,0 +1,314 @@ +Cmd - Click Me || 点击此处 +Cmd - Link || §7 •§2 链接:§f +Cmd Disable - Disabled || §aPlan systems are now disabled. You can still use /planbungee reload to restart the plugin. +Cmd FAIL - Invalid Username || §c[计划] 此玩家不存在。 +Cmd FAIL - No Feature || §eDefine a feature to disable! (currently supports ${0}) +Cmd FAIL - No Permission || §c[计划] 阁下没有所需权限。 +Cmd FAIL - Require only one Argument || §c[计划] 命令需要一个参数。 +Cmd FAIL - Requires Arguments || §c[计划] 命令缺少参数。${0} +Cmd FAIL - Unknown Username || §c[计划] 未在数据库中找到此玩家。 +Cmd FAIL - WebUser does not exists || §cUser does not exists! +Cmd FAIL - WebUser exists || §cUser already exists! +Cmd Header - Analysis || §f»§2 玩家统计 - 统计结果 +Cmd Header - Info || §f»§2 玩家统计 - 信息 +Cmd Header - Inspect || §f»§2 玩家统计 - 检视结果: +Cmd Header - Network || > §2Network Page +Cmd Header - Players || > §2Players +Cmd Header - Search || §f»§2 玩家统计 - 搜索结果: +Cmd Header - Servers || > §2Servers +Cmd Header - Web Users || > §2${0} Web Users +Cmd Info - Bungee Connection || §2Connected to Bungee: §f${0} +Cmd Info - Database || §2Active Database: §f${0} +Cmd Info - Reload Complete || §aReload Complete +Cmd Info - Reload Failed || §cSomething went wrong during reload of the plugin, a restart is recommended. +Cmd Info - Update || §2Update Available: §f${0} +Cmd Info - Version || §2Version: §f${0} +Cmd Notify - No WebUser || You might not have a web user, use /plan register +Cmd Notify - WebUser register || Registered new user: '${0}' Perm level: ${1} +Cmd Qinspect - Activity Index || §2Activity Index: §f${0} | ${1} +Cmd Qinspect - Deaths || §2Deaths: §f${0} +Cmd Qinspect - Geolocation || §2Logged in from: §f${0} +Cmd Qinspect - Last Seen || §2Last Seen: §f${0} +Cmd Qinspect - Longest Session || §2Longest Session: §f${0} +Cmd Qinspect - Mob Kills || §2Mob Kills: §f${0} +Cmd Qinspect - Player Kills || §2Player Kills: §f${0} +Cmd Qinspect - Playtime || §2Playtime: §f${0} +Cmd Qinspect - Registered || §2Registered: §f${0} +Cmd Qinspect - Times Kicked || §2Times Kicked: §f${0} +Cmd Setup - Allowed || §aSet-up is now Allowed +Cmd Setup - Bad Request || §eConnection succeeded, but Receiving server was not a Bungee server. Use Bungee address instead. +Cmd Setup - Disallowed || §cSet-up is now Forbidden +Cmd Setup - Forbidden || §eConnection succeeded, but Bungee has set-up mode disabled - use '/planbungee setup' to enable it. +Cmd Setup - Gateway Error || §eConnection succeeded, but Bungee failed to connect to this server (Did current web server restart?). Use /plan m con & /planbungee con to debug. +Cmd Setup - Generic Fail || §eConnection failed: ${0} +Cmd Setup - Internal Error || §eConnection succeeded. ${0}, check possible ErrorLog on receiving server's debug page. +Cmd Setup - Success || §aConnection successful, Plan may restart in a few seconds.. +Cmd Setup - Unauthorized || §eConnection succeeded, but Receiving server didn't authorize this server. Contact Discord for support +Cmd Setup - Url mistake || §cMake sure you're using the full address (Starts with http:// or https://) - Check Bungee enable log for the full address. +Cmd Setup - WebServer not Enabled || §cWebServer is not enabled on this server! Make sure it enables on boot! +Cmd SUCCESS - Feature disabled || §aDisabled '${0}' temporarily until next plugin reload. +Cmd SUCCESS - WebUser register || §aAdded a new user (${0}) successfully! +Cmd Update - Cancel Success || §aCancel operation performed. +Cmd Update - Cancelled || §cUpdate cancelled. +Cmd Update - Change log || Change Log v${0}: +Cmd Update - Fail Cacnel || §cUpdate failed on a server, cancelling update on all servers.. +Cmd Update - Fail Force Notify || §e${0} failed to update, -force specified, continuing update. +Cmd Update - Fail Not Online || §cNot all servers were online or accessible, you can still update available servers using /plan update -u -force +Cmd Update - Notify Cancel || §aYou can cancel the update on servers that haven't rebooted yet with /plan update cancel. +Cmd Update - Online Check || Checking that all servers are online.. +Cmd Update - Scheduled || §a${0} scheduled for update. +Cmd Update - Url mismatch || §cVersion download url did not start with ${0} and might not be trusted. You can download this version manually here (Direct download): +Cmd Web - Permission Levels || >\§70: Access all pages\§71: Access '/players' and all player pages\§72: Access player page with the same username as the webuser\§73+: No permissions +Command Help - /plan analyze || 查看服务器分析 +Command Help - /plan dev || Development mode command +Command Help - /plan help || 查看命令列表。 +Command Help - /plan info || 查看计划版本 +Command Help - /plan inspect || 检视玩家数据 +Command Help - /plan manage || 数据库管理命令 +Command Help - /plan manage backup || 备份数据库至 .db 文件 +Command Help - /plan manage clear || 从数据库中清空所有数据 +Command Help - /plan manage con || Debug Server-Bungee connections +Command Help - /plan manage disable || Disable a feature temporarily +Command Help - /plan manage hotswap || 热插拔数据库并重启插件 +Command Help - /plan manage import || 从插件中导入数据 +Command Help - /plan manage move || 在数据库间移动数据 +Command Help - /plan manage remove || 从活跃数据库中移除玩家数据 +Command Help - /plan manage restore || 恢复数据库 +Command Help - /plan manage setup || Set-up Server-Bungee connection +Command Help - /plan network || View the Network Page +Command Help - /plan players || 列出所有已缓存玩家名单 +Command Help - /plan qinspect || 在游戏内检视玩家数据 +Command Help - /plan register || Register a Web User +Command Help - /plan reload || 重新启动插件(重载配置) +Command Help - /plan search || 搜索玩家 +Command Help - /plan servers || List servers in Database +Command Help - /plan update || Get change log link or update plugin +Command Help - /plan web check || 检查网页用户的权限级别。 +Command Help - /plan web delete || 删除网页用户 +Command Help - /plan web level || 权限级别信息 +Command Help - /plan web list || List Web Users +Command Help - /plan webuser || 管理网页用户 +Command Help - /planbungee con || Debug Bungee-Server connections +Command Help - /planbungee disable || Disable the plugin temporarily +Command Help - /planbungee setup || Toggle set-up mode +Database - Apply Patch || Applying Patch: ${0}.. +Database - Patches Applied || All database patches applied successfully. +Database - Patches Applied Already || All database patches already applied. +Database MySQL - Launch Options Error || Launch Options were faulty, using default (${0}) +Database Notify - Clean || Removed data of ${0} players. +Database Notify - SQLite No WAL || SQLite WAL mode not supported on this server version, using default. This may or may not affect performance. +Disable || 已禁用玩家分析。 +Disable - Processing || Processing critical unprocessed tasks. (${0}) +Disable - Processing Complete || Processing complete. +Disable - WebServer || 正在关闭网页服务器··· +Enable || 已启用玩家分析。 +Enable - Database || ${0}-已建立数据库连接。 +Enable - Notify Address Confirmation || Make sure that this address points to THIS Server: ${0} +Enable - Notify Empty IP || IP in server.properties is empty & AlternativeIP is not in use. Incorrect links will be given! +Enable - Notify Geolocations disabled || Geolocation gathering is not active. (Data.Geolocations: false) +Enable - Notify Geolocations Internet Required || Plan Requires internet access on first run to download GeoLite2 Geolocation database. +Enable - Notify Webserver disabled || WebServer was not initialized. (WebServer.DisableWebServer: true) +Enable - WebServer || 正在初始化网页服务器··· +Enable FAIL - Database || ${0}-连接数据库失败:${1} +Enable FAIL - Database Patch || Database Patching failed, plugin has to be disabled. Please report this issue +Enable FAIL - GeoDB Write || Something went wrong saving the downloaded GeoLite2 Geolocation database +Enable FAIL - WebServer (Bungee) || WebServer did not initialize! +Enable FAIL - Wrong Database Type || ${0} 此数据类型不存在。 +HTML - ACTIVITY_INDEX || Activity Index +HTML - ALL || ALL +HTML - ALL_TIME_PEAK || All Time Peak +HTML - AVERAGE_PING || Average Ping +HTML - AVG || AVG +HTML - BANNED || Banned +HTML - BEST_PING || Best Ping +HTML - CALENDAR || CALENDAR +HTML - CALENDAR_TEXT || Calendar +HTML - CHUNKS || Chunks +HTML - COMMAND || Command +HTML - COMMNAND_USAGE || Command Usage +HTML - CONNECTION_INFORMATION || Connection Information +HTML - COUNTRY || Country +HTML - CURRENT_PLAYERBASE || Current Playerbase +HTML - DEATHS || Deaths +HTML - ENTITIES || Entities +HTML - ERROR || Authentication failed due to error +HTML - FAVORITE_SERVER || Favorite Server +HTML - GEOLOCATION || Geolocation +HTML - GEOLOCATION_TEXT || Geolocation +HTML - HEALTH_ESTIMATE || Health Estimate +HTML - INDEX_ACTIVE || Active +HTML - INDEX_INACTIVE || Inactive +HTML - INDEX_IRREGULAR || Irregular +HTML - INDEX_REGULAR || Regular +HTML - INDEX_VERY_ACTIVE || Very Active +HTML - IP_ADDRESS || IP-address +HTML - KILLED || Killed +HTML - KILLED_BY || Killed by +HTML - LAST_24_HOURS || LAST 24 HOURS +HTML - LAST_30_DAYS || LAST 30 DAYS +HTML - LAST_30_DAYS_TEXT || Last 30 Days +HTML - LAST_7_DAYS || LAST 7 DAYS +HTML - LAST_CONNECTED || Last Connected +HTML - LAST_PEAK || Last Peak +HTML - LAST_SEEN || LAST SEEN +HTML - LAST_SEEN_TEXT || Last Seen +HTML - LOADED_CHUNKS || Loaded Chunks +HTML - LOADED_ENTITIES || Loaded Entities +HTML - LOCAL_MACHINE || Local Machine +HTML - LONGEST || Longest +HTML - LOW_TPS_SPIKES || Low TPS Spikes +HTML - MOB_CAUSED_DEATHS || Mob caused Deaths +HTML - MOB_KDR || Mob KDR +HTML - MOB_KILLS || Mob Kills +HTML - MOST_RECENT_SESSIONS || Most Recent Sessions +HTML - NAME || Name +HTML - NAV_COMMAND_USAGE || Command Usage +HTML - NAV_GEOLOCATIONS || Geolocations +HTML - NAV_INFORMATION || Information +HTML - NAV_NETWORK_PLAYERS || Network Players +HTML - NAV_ONLINE_ACTIVITY || Online Activity +HTML - NAV_OVERVIEW || Overview +HTML - NAV_PERFORMANCE || Performance +HTML - NAV_PLAYERS || Players +HTML - NAV_PLUGINS || Plugins +HTML - NAV_SESSIONS || Sessions +HTML - NAV_SEVER_HEALTH || Server Health +HTML - NETWORK || Network +HTML - NETWORK_INFORMATION || NETWORK INFORMATION +HTML - NEW || NEW +HTML - NEW_CALENDAR || New: +HTML - NEW_PLAYERS_TEXT || New Players +HTML - NEW_RETENTION || New Player Retention +HTML - NEW_TEXT || New +HTML - NICKNAME || Nickname +HTML - NO_KILLS || No Kills +HTML - NO_PLAYER_CAUSED_DEATHS || No Player caused Deaths +HTML - OFFLINE || Offline +HTML - ONLINE || Online +HTML - ONLINE_ACTIVITY || ONLINE ACTIVITY +HTML - OPERATOR || Operator +HTML - OVERVIEW || OVERVIEW +HTML - PER_DAY || / Day +HTML - PLAYER_CAUSED_DEATHS || Player caused Deaths +HTML - PLAYER_KILLS || Player Kills +HTML - PLAYER_LIST || Player List +HTML - PLAYERBASE_DEVELOPMENT || Playerbase Development +HTML - PLAYERS || PLAYERS +HTML - PLAYERS_ONLINE || PLAYERS ONLINE +HTML - PLAYERS_ONLINE_TEXT || Players Online +HTML - PLAYERS_TEXT || Players +HTML - PLAYTIME || Playtime +HTML - PLEASE_WAIT || Please wait... +HTML - PREDICETED_RETENTION || Predicted Retention +HTML - PUNCH_CARD || Punchcard +HTML - PUNCHCARD || PUNCHCARD +HTML - RECENT_LOGINS || RECENT LOGINS +HTML - REGISTERED || REGISTERED +HTML - REGISTERED_TEXT || Registered +HTML - REGULAR || REGULAR +HTML - SEEN_NICKNAMES || Seen Nicknames +HTML - SERVER || Server +HTML - SERVER_ANALYSIS || Server Analysis +HTML - SERVER_HEALTH_ESTIMATE || Server Health Estimate +HTML - SERVER_INFORMATION || SERVER INFORMATION +HTML - SERVER_PREFERENCE || Server Preference +HTML - SERVERS || Servers +HTML - SESSION || Session +HTML - SESSION_ENDED || Session Ended +HTML - SESSION_LENGTH || Session Lenght +HTML - SESSION_MEDIAN || Session Median +HTML - SESSIONS || Sessions +HTML - TIME || Time +HTML - TIMES_KICKED || Times Kicked +HTML - TIMES_USED || Times Used +HTML - TOTAL_ACTIVE_TEXT || Total Active +HTML - TOTAL_AFK || Total AFK +HTML - TOTAL_PLAYERS || Total Players +HTML - TOTAL_PLAYTIME || Total Playtime +HTML - UNIQUE || UNIQUE +HTML - UNIQUE_CALENDAR || Unique: +HTML - UNIQUE_PLAYERS || UNIQUE PLAYERS +HTML - UNIQUE_PLAYERS_TEXT || Unique Players +HTML - UNIQUE_TEXT || Unique +HTML - USAGE || Usage +HTML - USED_COMMANDS || Used Commands +HTML - USER_AND_PASS_NOT_SPECIFIED || User and Password not specified +HTML - USER_DOES_NOT_EXIST || User does not exist +HTML - USER_INFORMATION || USER INFORMATION +HTML - USER_PASS_MISMATCH || User and Password did not match +HTML - WITH || With +HTML - WORLD || World +HTML - WORLD_LOAD || WORLD LOAD +HTML - WORLD_PLAYTIME || World Playtime +HTML - WORST_PING || Worst Ping +HTML ERRORS - ACCESS_DENIED_403 || Access Denied +HTML ERRORS - ANALYSIS_REFRESH || Analysis is being refreshed.. +HTML ERRORS - ANALYSIS_REFRESH_LONG || Analysis is being run, refresh the page after a few seconds.. +HTML ERRORS - AUTH_FAIL_TIPS_401 || - Ensure you have registered a user with /plan register
    - Check that the username and password are correct
    - Username and password are case-sensitive

    If you have forgotten your password, ask a staff member to delete your old user and re-register. +HTML ERRORS - AUTHENTICATION_FAIlED_401 || Authentication Failed. +HTML ERRORS - FORBIDDEN_403 || Forbidden +HTML ERRORS - NO_SERVERS_404 || No Servers online to perform the request. +HTML ERRORS - NOT_FOUND_404 || Not Found +HTML ERRORS - NOT_PLAYED_404 || Player has not played on this server. +HTML ERRORS - PAGE_NOT_FOUND_404 || Page does not exist. +HTML ERRORS - UNAUTHORIZED_401 || Unauthorized +HTML ERRORS - UNKNOWN_PAGE_404 || Make sure you're accessing a link given by a command, Examples:

    /player/PlayerName
    /server/ServerName

    +HTML ERRORS - UUID_404 || Player UUID was not found in the database. +In Depth Help - /plan ? || §2/plan - 主命令\§f 用于访问所有子命令及帮助\§7 /plan - 列出子命令\§7 /plan <子命令> ? - 详细帮助 +In Depth Help - /plan analyze ? || §2分析命令\§f 用于刷新分析缓存及访问结果页面\§7 /plan status 可用于在网页在线时检查分析状态fen.\§7 别名:analyze, analyse, analysis, a +In Depth Help - /plan inspect ? || §2检视命令\§f 用于获取用户检视页链接。\§7 个人检视页可通过输入 /plan inspect 访问\§7 别名:/plan <名称> +In Depth Help - /plan manage ? || §2管理命令\§f 用于管理插件数据库。\§7 别名:/plan m\§7 /plan m - Auflistung der Unterbefehle\§7 /plan m <子命令> ? - 详细帮助 +In Depth Help - /plan manage backup ? || > §2Backup Subcommand\ Creates a new SQLite database (.db file) with contents of currently active database in the Plan plugin folder. +In Depth Help - /plan manage clear ? || §2管理清除命令\§f 用于清除活跃数据库中的所有数据。\§7 插件在清理完毕后应被重载。\§7 别名:/plan pl +In Depth Help - /plan manage con ? || > §2Connection Debug Subcommand\ Used to debug connections in the network.\ Sends a request to each server in the database. +In Depth Help - /plan manage disable ? || > §2Disable Subcommand\ Can disable parts of the plugin until next reload.\ Accepted arguments:\ §2kickcount §fDisables kick counts in case /kickall is used on shutdown macro. +In Depth Help - /plan manage import ? || §2管理导入命令\§f 用于从其它来源导入数据\§7 在导入过程中将禁用数据分析。 +In Depth Help - /plan manage move ? || > §2Move Subcommand\ Move data from SQLite to MySQL or other way around.\ Target database is cleared before transfer. +In Depth Help - /plan manage remove ? || §2管理移除命令\§f 用于从活跃数据库中移除用户数据。 +In Depth Help - /plan manage restore ? || > §2Restore Subcommand\ Restore a previous backup SQLite database (.db file)\ You can also restore database.db from another server to MySQL.\ Target database is cleared before transfer. +In Depth Help - /plan manage setup ? || > §2Setup Subcommand\ Set-up a connection between Bungee and this server for network functionality.\ BungeeAddress can be found in the enable log on console when Plan enables on Bungee. +In Depth Help - /plan network ? || > §2Network Command\ Displays link to the network page.\ If not on a network, this page displays the server page. +In Depth Help - /plan players ? || > §2Players Command\ Displays link to the players page. +In Depth Help - /plan qinspect ? || §2快速检视命令\§f 用于获取游戏内关于检视的信息。\§7 相比检视网页有着更少的信息。\§7 别名:/plan qi +In Depth Help - /plan reload ? || > §2Reload Command\ Restarts the plugin using onDisable and onEnable.\ §bDoes not support swapping jar on the fly +In Depth Help - /plan search ? || §2搜索命令\§f 用于获取匹配特定参数的玩家名列表。\§7 示例:/plan search 123 - 搜索名称中包含 123 的所有玩家。 +In Depth Help - /plan servers ? || > §2Servers Command\ Displays list of Plan servers in the Database.\ Can be used to debug issues with database registration on a network. +In Depth Help - /plan update ? || > §2Update Command\ Used to update the plugin on the next shutdown\ /plan update - Changelog link\ /plan update -u - Schedule update to happen on all network servers that are online, next time they reboot.\ /plan update cancel - Cancel scheduled update on servers that haven't rebooted yet. +In Depth Help - /plan web ? || < §2Web User Manage Command.\ §2/plan web §fList subcommands\ §2/plan web ? §fIn Depth help +In Depth Help - /plan web register ? || > §2Register Subcommand\ Registers a new Web User.\ Registering a user for another player requires plan.webmanage permission.\ Passwords are hashed with PBKDF2 (64,000 iterations of SHA1) using a cryptographically-random salt. +In Depth Help - /planbungee disable ? || > §2Disable Command\ Runs onDisable on PlanBungee.\ Plugin can be enabled with /planbungee reload afterwards.\ §bDoes not support swapping jar on the fly +In Depth Help - /planbungee setup ? || > §2Set-up toggle Command\ Toggles set-up mode on Bungee.\ Safeguard against unauthorized MySQL snooping with another server. +Manage - Confirm Overwrite || 数据库 ${0} 中的数据将被覆盖! +Manage - Confirm Removal || 数据库 ${0} 中的数据将被移除! +Manage - Fail || > §c[计划] 处理数据时发生错误! ${0} +Manage - Fail File not found || > §c[计划] 备份文件不存在! ${0} +Manage - Fail Incorrect Database || > §c'${0}' is not a supported database. +Manage - Fail No Importer || §eImporter '${0}' doesn't exist +Manage - Fail Same Database || > §c[计划] 无法移动至相同的数据库! +Manage - Fail, Confirmation || > §c[计划] 请添加 -a 以确认执行!${0} +Manage - Fail, Connection Exception || §eFail reason: +Manage - Fail, No Servers || §cNo Servers found in the database. +Manage - Fail, Old version || §eFail reason: Older Plan version on receiving server +Manage - Fail, Unauthorized || §eFail reason: Unauthorized. Server might be using different database. +Manage - Fail, Unexpected Exception || §eOdd Exception: ${0} +Manage - List Importers || Importers: +Manage - Notify External Url || §eNon-local address, check that port is open +Manage - Remind HotSwap || §e[计划] 请记住要切换至新数据库并重新载入插件 (/plan m hotswap ${0}) +Manage - Start || »§7 正在处理数据··· +Manage - Success || §f» §2 成功! +Negative || No +Positive || Yes +Unknown || Unknown +Version - DEV || This is a DEV release. +Version - Latest || You're using the latest version. +Version - New || New Release (${0}) is available ${1} +Version - New (old) || New Version is available at ${0} +Version FAIL - Read info (old) || Failed to check newest version number +Version FAIL - Read versions.txt || Version information could not be loaded from Github/versions.txt +Web User Listing || §2${0} §7: §f${1} +WebServer - Notify HTTP || WebServer: No Certificate -> Using HTTP-server for Visualization. +WebServer - Notify HTTP User Auth || WebServer: User Authorization Disabled! (Not secure over HTTP) +WebServer - Notify no Cert file || WebServer: Certificate KeyStore File not Found: ${0} +WebServer FAIL - Port Bind || WebServer was not initialized successfully. Is the port (${0}) in use? +WebServer FAIL - SSL Context || WebServer: SSL Context Initialization Failed. +WebServer FAIL - Store Load || WebServer: SSL Certificate loading Failed. \ No newline at end of file diff --git a/Plan/src/main/resources/locale/locale_CZ.txt b/Plan/src/main/resources/locale/locale_CZ.txt new file mode 100644 index 000000000..29f63a3f2 --- /dev/null +++ b/Plan/src/main/resources/locale/locale_CZ.txt @@ -0,0 +1,314 @@ +Cmd - Click Me || Click me +Cmd - Link || §2Link: §f +Cmd Disable - Disabled || §aPlan systems are now disabled. You can still use /planbungee reload to restart the plugin. +Cmd FAIL - Invalid Username || §cUser does not have an UUID. +Cmd FAIL - No Feature || §eDefine a feature to disable! (currently supports ${0}) +Cmd FAIL - No Permission || §cYou do not have the required permission. +Cmd FAIL - Require only one Argument || §cSingle Argument required ${1} +Cmd FAIL - Requires Arguments || §cArguments required (${0}) ${1} +Cmd FAIL - Unknown Username || §cUser has not been seen on this server +Cmd FAIL - WebUser does not exists || §cUser does not exists! +Cmd FAIL - WebUser exists || §cUser already exists! +Cmd Header - Analysis || > §2Analysis Results +Cmd Header - Info || > §2Player Analytics +Cmd Header - Inspect || > §2Player: §f${0} +Cmd Header - Network || > §2Network Page +Cmd Header - Players || > §2Players +Cmd Header - Search || > §2${0} Results for §f${1}§2: +Cmd Header - Servers || > §2Servers +Cmd Header - Web Users || > §2${0} Web Users +Cmd Info - Bungee Connection || §2Connected to Bungee: §f${0} +Cmd Info - Database || §2Active Database: §f${0} +Cmd Info - Reload Complete || §aReload Complete +Cmd Info - Reload Failed || §cSomething went wrong during reload of the plugin, a restart is recommended. +Cmd Info - Update || §2Update Available: §f${0} +Cmd Info - Version || §2Version: §f${0} +Cmd Notify - No WebUser || You might not have a web user, use /plan register +Cmd Notify - WebUser register || Registered new user: '${0}' Perm level: ${1} +Cmd Qinspect - Activity Index || §2Activity Index: §f${0} | ${1} +Cmd Qinspect - Deaths || §2Deaths: §f${0} +Cmd Qinspect - Geolocation || §2Logged in from: §f${0} +Cmd Qinspect - Last Seen || §2Last Seen: §f${0} +Cmd Qinspect - Longest Session || §2Longest Session: §f${0} +Cmd Qinspect - Mob Kills || §2Mob Kills: §f${0} +Cmd Qinspect - Player Kills || §2Player Kills: §f${0} +Cmd Qinspect - Playtime || §2Playtime: §f${0} +Cmd Qinspect - Registered || §2Registered: §f${0} +Cmd Qinspect - Times Kicked || §2Times Kicked: §f${0} +Cmd Setup - Allowed || §aSet-up is now Allowed +Cmd Setup - Bad Request || §eConnection succeeded, but Receiving server was not a Bungee server. Use Bungee address instead. +Cmd Setup - Disallowed || §cSet-up is now Forbidden +Cmd Setup - Forbidden || §eConnection succeeded, but Bungee has set-up mode disabled - use '/planbungee setup' to enable it. +Cmd Setup - Gateway Error || §eConnection succeeded, but Bungee failed to connect to this server (Did current web server restart?). Use /plan m con & /planbungee con to debug. +Cmd Setup - Generic Fail || §eConnection failed: ${0} +Cmd Setup - Internal Error || §eConnection succeeded. ${0}, check possible ErrorLog on receiving server's debug page. +Cmd Setup - Success || §aConnection successful, Plan may restart in a few seconds.. +Cmd Setup - Unauthorized || §eConnection succeeded, but Receiving server didn't authorize this server. Contact Discord for support +Cmd Setup - Url mistake || §cMake sure you're using the full address (Starts with http:// or https://) - Check Bungee enable log for the full address. +Cmd Setup - WebServer not Enabled || §cWebServer is not enabled on this server! Make sure it enables on boot! +Cmd SUCCESS - Feature disabled || §aDisabled '${0}' temporarily until next plugin reload. +Cmd SUCCESS - WebUser register || §aAdded a new user (${0}) successfully! +Cmd Update - Cancel Success || §aCancel operation performed. +Cmd Update - Cancelled || §cUpdate cancelled. +Cmd Update - Change log || Change Log v${0}: +Cmd Update - Fail Cacnel || §cUpdate failed on a server, cancelling update on all servers.. +Cmd Update - Fail Force Notify || §e${0} failed to update, -force specified, continuing update. +Cmd Update - Fail Not Online || §cNot all servers were online or accessible, you can still update available servers using /plan update -u -force +Cmd Update - Notify Cancel || §aYou can cancel the update on servers that haven't rebooted yet with /plan update cancel. +Cmd Update - Online Check || Checking that all servers are online.. +Cmd Update - Scheduled || §a${0} scheduled for update. +Cmd Update - Url mismatch || §cVersion download url did not start with ${0} and might not be trusted. You can download this version manually here (Direct download): +Cmd Web - Permission Levels || >\§70: Access all pages\§71: Access '/players' and all player pages\§72: Access player page with the same username as the webuser\§73+: No permissions +Command Help - /plan analyze || View the Server Page +Command Help - /plan dev || Development mode command +Command Help - /plan help || Show command list +Command Help - /plan info || Check the version of Plan +Command Help - /plan inspect || View a Player Page +Command Help - /plan manage || Manage Plan Database +Command Help - /plan manage backup || Backup a Database +Command Help - /plan manage clear || Clear a Database +Command Help - /plan manage con || Debug Server-Bungee connections +Command Help - /plan manage disable || Disable a feature temporarily +Command Help - /plan manage hotswap || Change Database quickly +Command Help - /plan manage import || Import data from elsewhere +Command Help - /plan manage move || Move data between Databases +Command Help - /plan manage remove || Remove Player's data +Command Help - /plan manage restore || Restore a previous Backup +Command Help - /plan manage setup || Set-up Server-Bungee connection +Command Help - /plan network || View the Network Page +Command Help - /plan players || View the Players Page +Command Help - /plan qinspect || View Player info in game +Command Help - /plan register || Register a Web User +Command Help - /plan reload || Restart Plan +Command Help - /plan search || Search for a player name +Command Help - /plan servers || List servers in Database +Command Help - /plan update || Get change log link or update plugin +Command Help - /plan web check || Inspect a Web User +Command Help - /plan web delete || Delete a Web User +Command Help - /plan web level || Information about permission levels +Command Help - /plan web list || List Web Users +Command Help - /plan webuser || Manage Web Users +Command Help - /planbungee con || Debug Bungee-Server connections +Command Help - /planbungee disable || Disable the plugin temporarily +Command Help - /planbungee setup || Toggle set-up mode +Database - Apply Patch || Applying Patch: ${0}.. +Database - Patches Applied || All database patches applied successfully. +Database - Patches Applied Already || All database patches already applied. +Database MySQL - Launch Options Error || Launch Options were faulty, using default (${0}) +Database Notify - Clean || Removed data of ${0} players. +Database Notify - SQLite No WAL || SQLite WAL mode not supported on this server version, using default. This may or may not affect performance. +Disable || Player Analytics Disabled. +Disable - Processing || Processing critical unprocessed tasks. (${0}) +Disable - Processing Complete || Processing complete. +Disable - WebServer || Webserver has been disabled. +Enable || Player Analytics Enabled. +Enable - Database || ${0}-database connection established. +Enable - Notify Address Confirmation || Make sure that this address points to THIS Server: ${0} +Enable - Notify Empty IP || IP in server.properties is empty & AlternativeIP is not in use. Incorrect links will be given! +Enable - Notify Geolocations disabled || Geolocation gathering is not active. (Data.Geolocations: false) +Enable - Notify Geolocations Internet Required || Plan Requires internet access on first run to download GeoLite2 Geolocation database. +Enable - Notify Webserver disabled || WebServer was not initialized. (WebServer.DisableWebServer: true) +Enable - WebServer || Webserver running on PORT ${0} (${1}) +Enable FAIL - Database || ${0}-Database Connection failed: ${1} +Enable FAIL - Database Patch || Database Patching failed, plugin has to be disabled. Please report this issue +Enable FAIL - GeoDB Write || Something went wrong saving the downloaded GeoLite2 Geolocation database +Enable FAIL - WebServer (Bungee) || WebServer did not initialize! +Enable FAIL - Wrong Database Type || ${0} is not a supported Database +HTML - ACTIVITY_INDEX || Activity Index +HTML - ALL || ALL +HTML - ALL_TIME_PEAK || All Time Peak +HTML - AVERAGE_PING || Average Ping +HTML - AVG || AVG +HTML - BANNED || Banned +HTML - BEST_PING || Best Ping +HTML - CALENDAR || CALENDAR +HTML - CALENDAR_TEXT || Calendar +HTML - CHUNKS || Chunks +HTML - COMMAND || Command +HTML - COMMNAND_USAGE || Command Usage +HTML - CONNECTION_INFORMATION || Connection Information +HTML - COUNTRY || Country +HTML - CURRENT_PLAYERBASE || Current Playerbase +HTML - DEATHS || Deaths +HTML - ENTITIES || Entities +HTML - ERROR || Authentication failed due to error +HTML - FAVORITE_SERVER || Favorite Server +HTML - GEOLOCATION || Geolocation +HTML - GEOLOCATION_TEXT || Geolocation +HTML - HEALTH_ESTIMATE || Health Estimate +HTML - INDEX_ACTIVE || Active +HTML - INDEX_INACTIVE || Inactive +HTML - INDEX_IRREGULAR || Irregular +HTML - INDEX_REGULAR || Regular +HTML - INDEX_VERY_ACTIVE || Very Active +HTML - IP_ADDRESS || IP-address +HTML - KILLED || Killed +HTML - KILLED_BY || Killed by +HTML - LAST_24_HOURS || LAST 24 HOURS +HTML - LAST_30_DAYS || LAST 30 DAYS +HTML - LAST_30_DAYS_TEXT || Last 30 Days +HTML - LAST_7_DAYS || LAST 7 DAYS +HTML - LAST_CONNECTED || Last Connected +HTML - LAST_PEAK || Last Peak +HTML - LAST_SEEN || LAST SEEN +HTML - LAST_SEEN_TEXT || Last Seen +HTML - LOADED_CHUNKS || Loaded Chunks +HTML - LOADED_ENTITIES || Loaded Entities +HTML - LOCAL_MACHINE || Local Machine +HTML - LONGEST || Longest +HTML - LOW_TPS_SPIKES || Low TPS Spikes +HTML - MOB_CAUSED_DEATHS || Mob caused Deaths +HTML - MOB_KDR || Mob KDR +HTML - MOB_KILLS || Mob Kills +HTML - MOST_RECENT_SESSIONS || Most Recent Sessions +HTML - NAME || Name +HTML - NAV_COMMAND_USAGE || Command Usage +HTML - NAV_GEOLOCATIONS || Geolocations +HTML - NAV_INFORMATION || Information +HTML - NAV_NETWORK_PLAYERS || Network Players +HTML - NAV_ONLINE_ACTIVITY || Online Activity +HTML - NAV_OVERVIEW || Overview +HTML - NAV_PERFORMANCE || Performance +HTML - NAV_PLAYERS || Players +HTML - NAV_PLUGINS || Plugins +HTML - NAV_SESSIONS || Sessions +HTML - NAV_SEVER_HEALTH || Server Health +HTML - NETWORK || Network +HTML - NETWORK_INFORMATION || NETWORK INFORMATION +HTML - NEW || NEW +HTML - NEW_CALENDAR || New: +HTML - NEW_PLAYERS_TEXT || New Players +HTML - NEW_RETENTION || New Player Retention +HTML - NEW_TEXT || New +HTML - NICKNAME || Nickname +HTML - NO_KILLS || No Kills +HTML - NO_PLAYER_CAUSED_DEATHS || No Player caused Deaths +HTML - OFFLINE || Offline +HTML - ONLINE || Online +HTML - ONLINE_ACTIVITY || ONLINE ACTIVITY +HTML - OPERATOR || Operator +HTML - OVERVIEW || OVERVIEW +HTML - PER_DAY || / Day +HTML - PLAYER_CAUSED_DEATHS || Player caused Deaths +HTML - PLAYER_KILLS || Player Kills +HTML - PLAYER_LIST || Player List +HTML - PLAYERBASE_DEVELOPMENT || Playerbase Development +HTML - PLAYERS || PLAYERS +HTML - PLAYERS_ONLINE || PLAYERS ONLINE +HTML - PLAYERS_ONLINE_TEXT || Players Online +HTML - PLAYERS_TEXT || Players +HTML - PLAYTIME || Playtime +HTML - PLEASE_WAIT || Please wait... +HTML - PREDICETED_RETENTION || Predicted Retention +HTML - PUNCH_CARD || Punchcard +HTML - PUNCHCARD || PUNCHCARD +HTML - RECENT_LOGINS || RECENT LOGINS +HTML - REGISTERED || REGISTERED +HTML - REGISTERED_TEXT || Registered +HTML - REGULAR || REGULAR +HTML - SEEN_NICKNAMES || Seen Nicknames +HTML - SERVER || Server +HTML - SERVER_ANALYSIS || Server Analysis +HTML - SERVER_HEALTH_ESTIMATE || Server Health Estimate +HTML - SERVER_INFORMATION || SERVER INFORMATION +HTML - SERVER_PREFERENCE || Server Preference +HTML - SERVERS || Servers +HTML - SESSION || Session +HTML - SESSION_ENDED || Session Ended +HTML - SESSION_LENGTH || Session Lenght +HTML - SESSION_MEDIAN || Session Median +HTML - SESSIONS || Sessions +HTML - TIME || Time +HTML - TIMES_KICKED || Times Kicked +HTML - TIMES_USED || Times Used +HTML - TOTAL_ACTIVE_TEXT || Total Active +HTML - TOTAL_AFK || Total AFK +HTML - TOTAL_PLAYERS || Total Players +HTML - TOTAL_PLAYTIME || Total Playtime +HTML - UNIQUE || UNIQUE +HTML - UNIQUE_CALENDAR || Unique: +HTML - UNIQUE_PLAYERS || UNIQUE PLAYERS +HTML - UNIQUE_PLAYERS_TEXT || Unique Players +HTML - UNIQUE_TEXT || Unique +HTML - USAGE || Usage +HTML - USED_COMMANDS || Used Commands +HTML - USER_AND_PASS_NOT_SPECIFIED || User and Password not specified +HTML - USER_DOES_NOT_EXIST || User does not exist +HTML - USER_INFORMATION || USER INFORMATION +HTML - USER_PASS_MISMATCH || User and Password did not match +HTML - WITH || With +HTML - WORLD || World +HTML - WORLD_LOAD || WORLD LOAD +HTML - WORLD_PLAYTIME || World Playtime +HTML - WORST_PING || Worst Ping +HTML ERRORS - ACCESS_DENIED_403 || Access Denied +HTML ERRORS - ANALYSIS_REFRESH || Analysis is being refreshed.. +HTML ERRORS - ANALYSIS_REFRESH_LONG || Analysis is being run, refresh the page after a few seconds.. +HTML ERRORS - AUTH_FAIL_TIPS_401 || - Ensure you have registered a user with /plan register
    - Check that the username and password are correct
    - Username and password are case-sensitive

    If you have forgotten your password, ask a staff member to delete your old user and re-register. +HTML ERRORS - AUTHENTICATION_FAIlED_401 || Authentication Failed. +HTML ERRORS - FORBIDDEN_403 || Forbidden +HTML ERRORS - NO_SERVERS_404 || No Servers online to perform the request. +HTML ERRORS - NOT_FOUND_404 || Not Found +HTML ERRORS - NOT_PLAYED_404 || Player has not played on this server. +HTML ERRORS - PAGE_NOT_FOUND_404 || Page does not exist. +HTML ERRORS - UNAUTHORIZED_401 || Unauthorized +HTML ERRORS - UNKNOWN_PAGE_404 || Make sure you're accessing a link given by a command, Examples:

    /player/PlayerName
    /server/ServerName

    +HTML ERRORS - UUID_404 || Player UUID was not found in the database. +In Depth Help - /plan ? || > §2Main Command\ Access to subcommands and help\ §2/plan §fList subcommands\ §2/plan ? §fIn depth help +In Depth Help - /plan analyze ? || > §2Analysis Command\ Refreshes server page and displays link to the web page. +In Depth Help - /plan inspect ? || > §2Inspect Command\ Refreshes player page and displays link to the web page. +In Depth Help - /plan manage ? || > §2Manage Command\ Manage MySQL and SQLite database of Plan.\ §2/plan m §fList subcommands\ §2/plan m ? §fIn depth help +In Depth Help - /plan manage backup ? || > §2Backup Subcommand\ Creates a new SQLite database (.db file) with contents of currently active database in the Plan plugin folder. +In Depth Help - /plan manage clear ? || > §2Clear Subcommand\ Removes everything in the active database. Use with caution. +In Depth Help - /plan manage con ? || > §2Connection Debug Subcommand\ Used to debug connections in the network.\ Sends a request to each server in the database. +In Depth Help - /plan manage disable ? || > §2Disable Subcommand\ Can disable parts of the plugin until next reload.\ Accepted arguments:\ §2kickcount §fDisables kick counts in case /kickall is used on shutdown macro. +In Depth Help - /plan manage import ? || > §2Import Subcommand\ Import data from other sources.\ Accepted Arguments:\ §2offline §fBukkit player data, only register date and name. +In Depth Help - /plan manage move ? || > §2Move Subcommand\ Move data from SQLite to MySQL or other way around.\ Target database is cleared before transfer. +In Depth Help - /plan manage remove ? || > §2Remove Subcommand\ Remove player's data from the active database. +In Depth Help - /plan manage restore ? || > §2Restore Subcommand\ Restore a previous backup SQLite database (.db file)\ You can also restore database.db from another server to MySQL.\ Target database is cleared before transfer. +In Depth Help - /plan manage setup ? || > §2Setup Subcommand\ Set-up a connection between Bungee and this server for network functionality.\ BungeeAddress can be found in the enable log on console when Plan enables on Bungee. +In Depth Help - /plan network ? || > §2Network Command\ Displays link to the network page.\ If not on a network, this page displays the server page. +In Depth Help - /plan players ? || > §2Players Command\ Displays link to the players page. +In Depth Help - /plan qinspect ? || > §2Quick Inspect Command\ Displays some information about the player in game. +In Depth Help - /plan reload ? || > §2Reload Command\ Restarts the plugin using onDisable and onEnable.\ §bDoes not support swapping jar on the fly +In Depth Help - /plan search ? || > §2Search Command\ Get a list of Player names that match the given argument.\§7 Example: /plan search 123 - Finds all users with 123 in their name. +In Depth Help - /plan servers ? || > §2Servers Command\ Displays list of Plan servers in the Database.\ Can be used to debug issues with database registration on a network. +In Depth Help - /plan update ? || > §2Update Command\ Used to update the plugin on the next shutdown\ /plan update - Changelog link\ /plan update -u - Schedule update to happen on all network servers that are online, next time they reboot.\ /plan update cancel - Cancel scheduled update on servers that haven't rebooted yet. +In Depth Help - /plan web ? || < §2Web User Manage Command.\ §2/plan web §fList subcommands\ §2/plan web ? §fIn Depth help +In Depth Help - /plan web register ? || > §2Register Subcommand\ Registers a new Web User.\ Registering a user for another player requires plan.webmanage permission.\ Passwords are hashed with PBKDF2 (64,000 iterations of SHA1) using a cryptographically-random salt. +In Depth Help - /planbungee disable ? || > §2Disable Command\ Runs onDisable on PlanBungee.\ Plugin can be enabled with /planbungee reload afterwards.\ §bDoes not support swapping jar on the fly +In Depth Help - /planbungee setup ? || > §2Set-up toggle Command\ Toggles set-up mode on Bungee.\ Safeguard against unauthorized MySQL snooping with another server. +Manage - Confirm Overwrite || Data in ${0} will be overwritten! +Manage - Confirm Removal || Data in ${0} will be removed! +Manage - Fail || > §cSomething went wrong: ${0} +Manage - Fail File not found || > §cNo File found at ${0} +Manage - Fail Incorrect Database || > §c'${0}' is not a supported database. +Manage - Fail No Importer || §eImporter '${0}' doesn't exist +Manage - Fail Same Database || > §cCan not operate on to and from the same database! +Manage - Fail, Confirmation || > §cAdd '-a' argument to confirm execution: ${0} +Manage - Fail, Connection Exception || §eFail reason: +Manage - Fail, No Servers || §cNo Servers found in the database. +Manage - Fail, Old version || §eFail reason: Older Plan version on receiving server +Manage - Fail, Unauthorized || §eFail reason: Unauthorized. Server might be using different database. +Manage - Fail, Unexpected Exception || §eOdd Exception: ${0} +Manage - List Importers || Importers: +Manage - Notify External Url || §eNon-local address, check that port is open +Manage - Remind HotSwap || §eRemember to swap to the new database (/plan m hotswap ${0}) & reload the plugin. +Manage - Start || > §2Processing data.. +Manage - Success || > §aSuccess! +Negative || No +Positive || Yes +Unknown || Unknown +Version - DEV || This is a DEV release. +Version - Latest || You're using the latest version. +Version - New || New Release (${0}) is available ${1} +Version - New (old) || New Version is available at ${0} +Version FAIL - Read info (old) || Failed to check newest version number +Version FAIL - Read versions.txt || Version information could not be loaded from Github/versions.txt +Web User Listing || §2${0} §7: §f${1} +WebServer - Notify HTTP || WebServer: No Certificate -> Using HTTP-server for Visualization. +WebServer - Notify HTTP User Auth || WebServer: User Authorization Disabled! (Not secure over HTTP) +WebServer - Notify no Cert file || WebServer: Certificate KeyStore File not Found: ${0} +WebServer FAIL - Port Bind || WebServer was not initialized successfully. Is the port (${0}) in use? +WebServer FAIL - SSL Context || WebServer: SSL Context Initialization Failed. +WebServer FAIL - Store Load || WebServer: SSL Certificate loading Failed. diff --git a/Plan/src/main/resources/locale/locale_DE.txt b/Plan/src/main/resources/locale/locale_DE.txt index 72bd1f471..5e0c30a3e 100644 --- a/Plan/src/main/resources/locale/locale_DE.txt +++ b/Plan/src/main/resources/locale/locale_DE.txt @@ -1,117 +1,314 @@ -Analysis - Third Party || Analysis | Analysiere zusätzliche Datenquellen (von Dritten) -Analysis FAIL - Fetch Exception || Analysis | Das Abrufen von Daten für die Analyse ist fehlgeschlagen, ein Fehler ist aufgetreten. -Analysis FAIL - No Data || Analyse | Analyse fehlgeschlagen, keine Daten in der Datenbank. -Analysis FAIL - No Players || Analyse | Analyse fehlgeschlagen, keine bekannten Spieler. -Analysis - Fetch Phase || Analyse | Hole Daten... -Analysis - Fetch Phase Start || Analyse | Suche nach verfügbaren Spieler... -Analysis - Complete || Analyse | Analyse vollständig. (dauerte ${0}ms) ${1} -Analysis - Begin Analysis || Analyse | Daten geholt (${0} Spieler, dauerte ${1}ms), beginne mit der Analyse der Daten... -Analysis - Start || Analyse | Beginne die Analyse der Spieler Daten... ->Constant - CMD Footer || §f» ->Constant - List Ball || §7 •§2 -Cmd FAIL - No Data View || §e[Plan] Dieser Befehl kann nur benutzt werden wenn der WebServer oder das TextUI auf dem Server aktiviert ist. -Cmd FAIL - No Permission || §c[Plan] Du hast nicht die benötigte Berechtigung. -Cmd FAIL - Requires Arguments || §c[Plan] Dieser Befehl erfordert Argumente. ${0} -Cmd FAIL - Require only one Argument || §c[Plan] Der Befehl benötigt ein Argument. -Cmd FAIL - Timeout || §c[Plan] ${0} Befehl ausgetimed! Mehr Infos unter '/plan status' und in der Serverkonsole. -Cmd FAIL - Unknown Username || §c[Plan] Der Spielername konnte in der Datenbank nicht gefunden werden. -Cmd FAIL - Unseen Username || §c[Plan] Dieser Spieler war noch nie auf diesem Server. -Cmd FAIL - Invalid Username || §c[Plan] Dieser Spieler existiert nicht. -Cmd Header - Analysis || §f»§2 Player Analytics - Analyse Ergebnisse -Cmd Header - Info || §f»§2 Player Analytics - Info -Cmd Header - Inspect || §f»§2 Player Analytics - Überprüfe die Ergebnisse: -Cmd Header - Search || §f»§2 Player Analytics - Suchergebnisse für: -In Depth Help - /plan analyze ? || §2Analyse Befehl\§f Wird benutzt um den Analysecache neu zu laden und auf die Resultatseite zuzugreifen\§7 /plan status kann benutzt werden, um den Status der laufenden Analyse zu überprüfen.\§7 Aliasse: analyze, analyse, analysis, a -In Depth Help - /plan inspect ? || §2Inspect Befehl\§f Wird benutzt um den Link zur Inspektionsseite des Spielers zu bekommen.\§7 Die eigene Inspektionseite kann mit /plan inspect aufgerufen werden\§7 Alias: /plan -In Depth Help - /plan list ? || §2List Befehl\§f Wird benutzt um den Link zur Spielerübersichtsseite zu bekommen.\§7 Die Spielerübersichtsseite beinhaltet die Links von allen gecachten Inspektionsseiten.\§7 Alias: /plan pl -In Depth Help - /plan manage ? || §2Manage Befehl\§f Wird benutzt um die Datenbank des Plugins zu verwalten.\§7 Alias: /plan m\§7 /plan m - Auflistung der Unterbefehle\§7 /plan m ? - Ausführliche Hilfe -In Depth Help - /plan manage clear ? || §2Manage Clear Befehl\§f Wird benutzt um ALLE Daten der aktiven Datenbank zu löschen.\§7 Das Plugin sollte nach einer erfolgreichen Reinigung neugeladen werden.\§7 Alias: /plan pl -In Depth Help - /plan manage dump ? || §2Manage Dump Befehl\§f Wird benutzt um wichtige Daten für das Melden von Fehlern auf Hastebin hochzuladen. -In Depth Help - /plan manage hotswap ? || §2Manage Hotswap Befehl\§f Wird benutzt um die benutzte Datenbank direkt zu ändern.\§7 Die Datenbank wird nicht geändert, wenn die Verbindung fehlschlägt -In Depth Help - /plan manage import ? || §2Manage Import Befehl\§f Wird benutzt um Daten von anderen Quellen zu importieren\§7 Die Analyse wird während dem Importieren deaktiviert. -In Depth Help - /plan manage remove ? || §2Manage Remove Befehl\§f Wird benutzt um die Daten des Spielers zu entfernen. -In Depth Help - /plan ? || §2/plan - Hauptbefehl\§f Wird benutzt um alle Unterbefehle & die Hilfe aufzurufen\§7 /plan - Auflistung der Unterbefehle\§7 /plan ? - Ausführliche Hilfe -In Depth Help - /plan qanalyze ? || §2Quick Analysis Befehl\§f Wird benutzt um im Spiel Analyseinformationen zu bekommen.\§7 Diese Informationen beinhalten weniger Informationen als die Analyseinternetseite.\§7 Aliasse: qanalyze, ganalyse, qanalysis, qa -In Depth Help - /plan qinspect ? || §2Quick Inspect Befehl\§f Wird benutzt um im Spiel Inspizierungsinformationen zu bekommen.\§7 Diese Informationen beinhalten weniger Informationen als die Inspizierungsinternetseite.\§7 Alias: /plan qi -In Depth Help - /plan search ? || §2Search Befehl\§f Wird benutzt um eine Liste der Spieler die dem gegebenen Argument entsprechen zu bekommen.\§7 Beispiel: /plan search 123 - Zeigt alle Spieler mit 123 im Namen an. -In Depth Help - /plan webuser ? || §2Web User Manage Befehl\§f Wird benutzt um die Webbenutzer vom Plugin zu verwalten\§7 Die Benutzer haben ein Zugriffslevel:\§f 0 - Zugriff auf alle Seiten\§f 1 - Zugriff auf /players & alle Inspizierungsseiten\§f 2 - Zugriff auf die eigene Inspizierungsseite\§7 Alias: /plan web -In Depth Help - /plan webuser register ? || §2Web Register Befehl\§f Wird benutzt um einen neuen Benutzer für den Webserver zu registrieren.\§7 Um einen Benutzer für einen anderen Spieler zu registrieren, braucht man das plan.webmanage Recht.\§7 Die Passwörter werden mit PBKDF2 (64.000 Iterationen von SHA1) gehasht, es wird ein kryptograpisch zufälliger Salt benutzt. -Analysis NOTIFY - Temporary Disable || §eAnalyse wurde temporär aufgrund von einer leistungstechnisch aufwendigen Aufgabe deaktiviert, benutze /plan status für mehr Informationen. -Cmd - Click Me || Klick Mich -Cmd - Fetch Data || §f»§2 Hole Daten in den Cache... -Cmd - Link || §7 •§2 Link: §f -Cmd - No Results || §7 •§2 Keine Ergebnisse für §7${0}§2. -Cmd - Reload Success || §a[Plan] Reload abgeschlossen. -Cmd - Results || §7 Übereinstimmender Spieler: §f -Cmd - Searching || §f»§2Suchen... -Cmd - Usage /plan analyze || Zeigt die Server Analyse -Cmd - Usage /plan help || Zeigt die Befehlsliste -Cmd - Usage /plan info || Zeigt die Version von Plan -Cmd - Usage /plan inspect || Prüft Spieler Daten -Cmd - Usage /plan list || Liste zu allen gecachten Spielern -Cmd - Usage /plan manage || Datenbank Verwaltungs Befehl -Cmd - Usage /plan manage backup || Erstellt eine Sicherheitskopie der Datenbank als .db Datei -Cmd - Usage /plan manage clean || Beseitigt alte Daten von der Datenbank -Cmd - Usage /plan manage clear || Leert Daten aus der Datenbank -Cmd - Usage /plan manage dump || Erstellt ein Hastebin Log für das einfache Melden von Fehlern -Cmd - Usage /plan manage hotswap || Wechselt zu einer anderen Datenbank & starte das Plugin neu -Cmd - Usage /plan manage import || Importiert Daten von unterstützten Plugins zur aktiven Datenbank -Cmd - Usage /plan manage move || Kopiert Daten von einer Datenbank zur anderen & überschreibe die Werte -Cmd - Usage /plan manage remove || Entfernt die Spieler Daten aus der aktiven Datenbank. -Cmd - Usage /plan manage restore || Stellt eine Sicherheitskopie einer Datenbank aus einer Datei wieder her -Cmd - Usage /plan qanalyze || Zeigt die Serveranalyse als Text an -Cmd - Usage /plan qinspect || Zeigt die Daten vom Spieler als Text an -Cmd - Usage /plan reload || Lädt die Plugin Konfiguration neu -Cmd - Usage /plan search || Sucht nach einem Spieler -Cmd - Usage /plan webuser || Verwaltet die Webbenutzer -Cmd - Usage /plan webuser check || Überprüft einen Webbenutzer und sein Zugriffslevel -Cmd - Usage /plan webuser delete || Löscht einen Webbenutzer -Cmd - Usage /plan webuser level || Informationen über die Zugriffslevel -Cmd - Usage /plan webuser register || Registriert einen Webbenutzer -Disable || Player Analytics deaktiviert. -Disable - Save || Daten im Cache werden gespeichert... -Disable - WebServer || Webserver wird heruntergefahren... -Enable || Player Analytics aktiviert. -Enable - Boot Analysis 30s Notify || Analyse | Boot Analyse in 30 Sekunden... -Enable - Boot Analysis Notify || Analyse | Starte Boot Analyse... -Enable Db FAIL - Disable Info || Datenbank Initialisierung fehlgeschlagen, deaktiviere Plan. -Enable - Db Info || ${0}-Datenbank Verbindung hergestellt. -Enable - Db || Datenbank Initialisierung... -Enable FAIL-Db || ${0}-Datenbank Verbindung fehlgeschlagen: ${1} -Enable FAIL - Wrong Db Type || Dieser Datenbank Typ existiert nicht. -Enable Notify - ChatListener || §eChataufzeichnung deaktiviert, die Information der Nicknamen ist nicht akkurat. -Enable Notify - Disabled CommandListener || §eBefehlsaufzeichnung deaktiviert. -Enable Notify - Disabled DeathListener || §eTodesaufzeichnung deaktiviert, Spieler & Mob Kills werden nicht aufgezeichnet. -Enable Notify - No data view || §eWebserver deaktiviert, aber es wird keine alternative IP benutzt, sodass Daten nicht angezeigt werden können! -Enable - WebServer || Initialisiere Webserver... -Enable - WebServer Info || Webserver läuft auf PORT ${0} -Html - Active || Spieler ist aktiv -Html - Banned || | Gesperrt -Html - Inactive || Spieler ist inaktiv -Html - No Extra Plugins ||

    Keine zusätzlichen Plugins registriert.

    -Html - Offline || | Offline -Html - Online || | Online -Html - OP || , Operator (Op) -Html - Table No Kills || Keine Kills -Manage FAIL - Confirm Action || §c[Plan] Füge -a hinzu um den Befehl zu bestätigen! ${0} -Manage FAIL - Faulty DB Connection || §c[Plan] Eine der Datenbanken wurde nicht richtig initialisiert. -Manage FAIL - Backup File Not Found || §c[Plan] Es existiert keine Sicherheitskopie! -Manage FAIL - Incorrect DB || §c[Plan] Falsche Datenbank! (SQlite/MySQL wird unterstützt): -Manage FAIL - Incorrect Plugin || §c[Plan] Plugin nicht unterstützt: -Manage FAIL - Empty DB || §c[Plan] Datenbank hat keine Spieler Daten! -Manage FAIL - Unenabled Plugin || §c[Plan] Plugin ist nicht aktiviert: -Manage FAIL - Same DB || §c[Plan] Kann nicht zur selben Datenbank bewegen! -Manage - Clear Success || §a[Plan] Alle Daten wurden erfolgreich gesäubert! -Manage - Remind Config Change || §e[Plan] Vergiss nicht zur neuen Datenbank zu wechseln und das Plugin neu zu laden -Manage - Copy Success || §a[Plan] Alle Daten wurden erfolgreich kopiert! -Manage - Process Fail || §c[Plan] Irgendwas lief schief während die Daten verarbeitet wurden! -Manage - Import || §f» §2 Importiere Daten... -Manage - Move Success || §a[Plan] Alle Daten wurden erfolgreich verschoben! -Manage - Remove Success || §f» §2Daten von §f${0}§2 wurden aus dieser Datenbank entfernt §f${1}§2. -Manage - Start || »§7 Verarbeite Daten... -Manage - Success || §f» §2 Erfolgreich! -Manage NOTIFY - Overwrite || Daten in ${0}-Datenbank werden überschrieben! -Manage NOTIFY - Partial Overwrite || Einige Daten in ${0}-Datenbank werden überschrieben! -Manage NOTIFY - Remove || Daten in ${0}-Datenbank werden entfernt! -Manage NOTIFY - Rewrite || Daten in ${0}-Datenbank werden neu geschrieben! -WARN - Too Small Queue Size || Die Warteschlagengröße ist zu klein! (${0}), änder' diese Einstellung zu einer höheren! (Derzeit ${1}) +Cmd - Click Me || Klicke hier +Cmd - Link || §2Link: §f +Cmd Disable - Disabled || §aPlan ist nun deaktiviert. Nutze /planbungee reload um das Plugin neu zu starten. +Cmd FAIL - Invalid Username || §cDieser Benutzer besitzt keine UUID. +Cmd FAIL - No Feature || §eWelches Feature soll deaktiviert werden? (momentan unterstützt: ${0}) +Cmd FAIL - No Permission || §cDafür fehlt dir die Berechtigung. +Cmd FAIL - Require only one Argument || §cNur ein Argument erforderlich ${1} +Cmd FAIL - Requires Arguments || §cArgumente erforderlich (${0}) ${1} +Cmd FAIL - Unknown Username || §cDieser Benutzer war noch nie auf dem Server. +Cmd FAIL - WebUser does not exists || §cDieser Benutzer existiert nicht! +Cmd FAIL - WebUser exists || §cDieser Benutzer existiert schon! +Cmd Header - Analysis || > §2Analyse-Ergebnis: +Cmd Header - Info || > §2Benutzeranalyse: +Cmd Header - Inspect || > §2Benutzer: §f${0} +Cmd Header - Network || > §2Netzwerkseite +Cmd Header - Players || > §2Spieler +Cmd Header - Search || > §2${0} Ergebnisse für §f${1}§2: +Cmd Header - Servers || > §2Server +Cmd Header - Web Users || > §2${0} Accounts +Cmd Info - Bungee Connection || §2Verbuunden mit Bungee: §f${0} +Cmd Info - Database || §2Genutzte Datenbank: §f${0} +Cmd Info - Reload Complete || §aReload erfolgreich. +Cmd Info - Reload Failed || §cBeim Reload ist etwas schief gelaufen, ein Neustart wird empfohlen. +Cmd Info - Update || §2Update verfügbar: §f${0} +Cmd Info - Version || §2Version: §f${0} +Cmd Notify - No WebUser || Möglicherweise hast du keinen Account. Erstelle einen mit /plan register +Cmd Notify - WebUser register || Neuer Account hinzugefügt: '${0}' Rechte-Level: ${1} +Cmd Qinspect - Activity Index || §2Aktivitätsindex: §f${0} | ${1} +Cmd Qinspect - Deaths || §2Tode: §f${0} +Cmd Qinspect - Geolocation || §2Eingeloggt aus: §f${0} +Cmd Qinspect - Last Seen || §2Zuletzt gesehen: §f${0} +Cmd Qinspect - Longest Session || §2Längste Sitzung: §f${0} +Cmd Qinspect - Mob Kills || §2Getötete Mobs: §f${0} +Cmd Qinspect - Player Kills || §2Getötete Spieler: §f${0} +Cmd Qinspect - Playtime || §Spielzeit: §f${0} +Cmd Qinspect - Registered || §2Registrierung: §f${0} +Cmd Qinspect - Times Kicked || §2Kicks: §f${0} +Cmd Setup - Allowed || §aSet-up ist nun erlaubt. +Cmd Setup - Bad Request || §eVerbindung hergestellt, der empfangende Server ist kein Bungee-Server. Nutze stattdessen die Bungee-Adresse. +Cmd Setup - Disallowed || §cSet-up ist nun nicht mehr erlaubt. +Cmd Setup - Forbidden || §eVerbindung hergestellt, aber der Bungee-Server hat den Set-up-Modus ausgeschaltet - nutze '/planbungee setup' um ihn zu aktivieren. +Cmd Setup - Gateway Error || §eVerbindung hergestellt, aber der Bungee-Server konnte sich nicht mit diesem Server verbinden (Wurde der aktuelle Server neugestartet?). Nutze /plan m con & /planbungee con zum debuggen. +Cmd Setup - Generic Fail || §eVerbindung fehlgeschlagen: ${0} +Cmd Setup - Internal Error || §eVerbindung hergestellt. ${0}, eventuelle Fehler kannst du dem Error-Log auf der Debugseite des empfangenden Servers einsehen. +Cmd Setup - Success || §aVerbindung erfolgreich, Plan startet eventuell in ein paar Sekunden neu. +Cmd Setup - Unauthorized || §eVerbindung erfolgreich, aber der empfangende Server hat diesen Server nicht autorisiert. Auf dem Plan-Discord bekommst du Hilfe. +Cmd Setup - Url mistake || §cNutze die gesamte Adresse (Beginnend mit http:// oder https://) - Diese kannst du dem Bungee enable log entnehmen. +Cmd Setup - WebServer not Enabled || §cWebServer ist auf diesem Server deaktiviert! Dies sollte beim Start aktiviert werden! +Cmd SUCCESS - Feature disabled || §a'${0}' wurde bist zum nächsten Reload des Plugins deaktiviert. +Cmd SUCCESS - WebUser register || §aNeuer Account (${0}) erfolgreich hinzugefügt! +Cmd Update - Cancel Success || §aAbbruch erfolgreich. +Cmd Update - Cancelled || §cUpdate abgebrochen. +Cmd Update - Change log || Change Log v${0}: +Cmd Update - Fail Cacnel || §cAuf einem Server war das Update nicht erfolgreich, breche auf allen anderen Servern die Updates ab... +Cmd Update - Fail Force Notify || §e${0} wurde nicht geupdated, -force wurde angegeben, fahre mit Updates fort. +Cmd Update - Fail Not Online || §cNicht alle Server sind online oder erreichbar, erreichbare Server kannst du mit /plan update -u -force updaten +Cmd Update - Notify Cancel || §aDu kannst das Update auf Servern, die noch nicht neugestartet wurden verwerfen mit: /plan update cancel. +Cmd Update - Online Check || Überprüfe, ob alle Server online sind. +Cmd Update - Scheduled || §aUpdate für ${0} geplant. +Cmd Update - Url mismatch || §cDie Download-URL beginnt nicht mit ${0} und ist evtl. nicht vertrauenswürdig. Du kannst diese Version manuell hier downloaden (direkter Download): +Cmd Web - Permission Levels || >\§70: Zugriff auf alle Seiten\§71: Zugriff auf '/players' Und alle Spielerseiten\§72: Zugriff auf alle Spielerseiten mit dem gleichen Username wie der Web-Account\§73+: Keine Berechtigung +Command Help - /plan analyze || Server-Übersicht +Command Help - /plan dev || Entwicklungsmodus-Befehl +Command Help - /plan help || Zeigt eine Befehlsliste +Command Help - /plan info || Zeigt die Version von Plan +Command Help - /plan inspect || Zeigt eine Spielerseite +Command Help - /plan manage || Verwaltet die Plan-Datenbank +Command Help - /plan manage backup || Erstellt ein Backup der Datenbank +Command Help - /plan manage clear || Leer die Datenbank +Command Help - /plan manage con || Debug Server-Bungee Verbindungen +Command Help - /plan manage disable || Schalte eine Funktion temporär aus +Command Help - /plan manage hotswap || Ändere die Datenbank schnell +Command Help - /plan manage import || Importiere Daten +Command Help - /plan manage move || Bewege die Daten zwischen Datenbanken +Command Help - /plan manage remove || Entferne die Daten eines Spielers +Command Help - /plan manage restore || Spiele ein Backup ein +Command Help - /plan manage setup || Stelle die Server-Bungee-Verbindung her +Command Help - /plan network || Netzwerk-Seite +Command Help - /plan players || Spieler-Seite +Command Help - /plan qinspect || Zeige Spielerinfo im Spiel +Command Help - /plan register || Registriere einen Account +Command Help - /plan reload || Starte Plan neu +Command Help - /plan search || Suche nach einem Spieler +Command Help - /plan servers || Liste die Server in der Datenbank auf +Command Help - /plan update || Zeige das Änderungsprotokoll oder update den Server +Command Help - /plan web check || Infos über einen Account +Command Help - /plan web delete || Lösche einen Account +Command Help - /plan web level || Informationen über Rechte +Command Help - /plan web list || Liste Accounts +Command Help - /plan webuser || Verwalte Accounts +Command Help - /planbungee con || Debug Bungee-Server Verbindungen +Command Help - /planbungee disable || Deaktiviert das Plugin temporär +Command Help - /planbungee setup || Schaltet Setup-Modus an oder aus +Database - Apply Patch || Wende Patch an: ${0}.. +Database - Patches Applied || Alle Datenbankpatches wurden erfolgreich angewandt. +Database - Patches Applied Already || Alle Datenbankpatches wurden bereits angewandt. +Database MySQL - Launch Options Error || Startoptionen sind falsch, nutze Voreinstellungen (${0}) +Database Notify - Clean || Daten von ${0} Spielern gelöscht. +Database Notify - SQLite No WAL || SQLite WAL auf dieser Serverversion nicht unterstützt, nutze Voreinstellungen. Dies beeinträchtigt möglicherweise die Serverperformance. +Disable || Player Analytics ausgeschaltet. +Disable - Processing || Verarbeite kritische unverarbeitete Aufgaben. (${0}) +Disable - Processing Complete || Verarbeitung komplett. +Disable - WebServer || Webserver deaktiviert. +Enable || Player Analytics angeschaltet. +Enable - Database || ${0}-dDatenbankverbindung hergestellt. +Enable - Notify Address Confirmation || Versichere dich, dass die Adresse auf DIESEN Server verweist: ${0} +Enable - Notify Empty IP || IP in der server.properties ist leer & AlternativeIP ist nicht in Verwendung. Falsche Links werden verwendet! +Enable - Notify Geolocations disabled || Geolocation wird nicht aufgezeichnet (Data.Geolocations: false) +Enable - Notify Geolocations Internet Required || Plan braucht Internetzugang um die GeoLite2 Geolocation Datenbank runterzuladen. +Enable - Notify Webserver disabled || WebServer wurde nicht initialisiert. (WebServer.DisableWebServer: true) +Enable - WebServer || Webserver läuft auf PORT ${0} (${1}) +Enable FAIL - Database || ${0}-Datenbankverbindung fehlgeschlagen: ${1} +Enable FAIL - Database Patch || Datenbank-Patch ist fehlgeschlagen, Plugin wurde deaktiviert. Bitte melde dies. +Enable FAIL - GeoDB Write || Etwas ist beim Speichern der GeoLite2 Geolocation Datenbank fehlgeschlagen +Enable FAIL - WebServer (Bungee) || Webserver ist nicht initialisiert! +Enable FAIL - Wrong Database Type || ${0} ist keine gültige Datenbank +HTML - ACTIVITY_INDEX || Aktivitätsindex +HTML - ALL || Gesamt +HTML - ALL_TIME_PEAK || Rekord +HTML - AVERAGE_PING || Durchschnittlicher Ping +HTML - AVG || AVG +HTML - BANNED || Gebannt +HTML - BEST_PING || Bester Ping +HTML - CALENDAR || KALENDER +HTML - CALENDAR_TEXT || Kalender +HTML - CHUNKS || Chunks +HTML - COMMAND || Befehl +HTML - COMMNAND_USAGE || Befehlsverwendung +HTML - CONNECTION_INFORMATION || Verbindungsinformationen +HTML - COUNTRY || Land +HTML - CURRENT_PLAYERBASE || Aktuelle Playerbase +HTML - DEATHS || Tode +HTML - ENTITIES || Entitäten +HTML - ERROR || Authentifikation fehlgeschlagen +HTML - FAVORITE_SERVER || Lieblingsserver +HTML - GEOLOCATION || Geolocation +HTML - GEOLOCATION_TEXT || Geolocation +HTML - HEALTH_ESTIMATE || Geschätzte Gesundheit +HTML - INDEX_ACTIVE || Aktiv +HTML - INDEX_INACTIVE || Inaktiv +HTML - INDEX_IRREGULAR || Unregelmäßig +HTML - INDEX_REGULAR || Regelmäßig +HTML - INDEX_VERY_ACTIVE || Sehr aktiv +HTML - IP_ADDRESS || IP-Adresse +HTML - KILLED || Getötet +HTML - KILLED_BY || Getötet von +HTML - LAST_24_HOURS || Letzte 24 Stunden +HTML - LAST_30_DAYS || Letzte 30 Tage +HTML - LAST_30_DAYS_TEXT || Letzte 30 Tage +HTML - LAST_7_DAYS || Letzte 7 Tage +HTML - LAST_CONNECTED || Letzte Verbindung +HTML - LAST_PEAK || Letzter Höchststand +HTML - LAST_SEEN || Zuletzt gesehen +HTML - LAST_SEEN_TEXT || Zuletzt gesehen +HTML - LOADED_CHUNKS || Geladene Chunks +HTML - LOADED_ENTITIES || Geladenen Entitäten +HTML - LOCAL_MACHINE || Lokale Maschine +HTML - LONGEST || Längste +HTML - LOW_TPS_SPIKES || Geringe TPS Spikes +HTML - MOB_CAUSED_DEATHS || Tode durch Mobs +HTML - MOB_KDR || Mob KDR +HTML - MOB_KILLS || Mob Kills +HTML - MOST_RECENT_SESSIONS || Letzte Sessions +HTML - NAME || Name +HTML - NAV_COMMAND_USAGE || Befehlsverwendung +HTML - NAV_GEOLOCATIONS || Geolocations +HTML - NAV_INFORMATION || Information +HTML - NAV_NETWORK_PLAYERS || Netzwerk Spieler +HTML - NAV_ONLINE_ACTIVITY || Online Aktivität +HTML - NAV_OVERVIEW || Übersicht +HTML - NAV_PERFORMANCE || Performance +HTML - NAV_PLAYERS || Spieler +HTML - NAV_PLUGINS || Plugins +HTML - NAV_SESSIONS || Sessions +HTML - NAV_SEVER_HEALTH || Servergesundheit +HTML - NETWORK || Netzwerk +HTML - NETWORK_INFORMATION || Netzwerkinformationen +HTML - NEW || Neu +HTML - NEW_CALENDAR || Neu: +HTML - NEW_PLAYERS_TEXT || Neue Spieler +HTML - NEW_RETENTION || Erhaltung neuer Spieler +HTML - NEW_TEXT || Neu +HTML - NICKNAME || Nickname +HTML - NO_KILLS || Keine Kills +HTML - NO_PLAYER_CAUSED_DEATHS || Keine Tode durch Spieler +HTML - OFFLINE || Offline +HTML - ONLINE || Online +HTML - ONLINE_ACTIVITY || ONLINE AKTIVITÄT +HTML - OPERATOR || Operator +HTML - OVERVIEW || ÜBERSICHT +HTML - PER_DAY || / Tag +HTML - PLAYER_CAUSED_DEATHS || Tode durch Spieler +HTML - PLAYER_KILLS || Getötete Spieler +HTML - PLAYER_LIST || Spielerliste +HTML - PLAYERBASE_DEVELOPMENT || Entwicklung der Playerbase +HTML - PLAYERS || SPIELER +HTML - PLAYERS_ONLINE || SPIELER ONLINE +HTML - PLAYERS_ONLINE_TEXT || Spieler Online +HTML - PLAYERS_TEXT || Spieler +HTML - PLAYTIME || Spielzeit +HTML - PLEASE_WAIT || Bitte warten... +HTML - PREDICETED_RETENTION || Vorhersage Erhaltung +HTML - PUNCH_CARD || Lochkarte +HTML - PUNCHCARD || LOCHKARTE +HTML - RECENT_LOGINS || Letzte LOGINS +HTML - REGISTERED || REGISTRIERT +HTML - REGISTERED_TEXT || Registriert +HTML - REGULAR || REGELMÄSSIG +HTML - SEEN_NICKNAMES || Registrierte Nicknames +HTML - SERVER || Server +HTML - SERVER_ANALYSIS || Server Analyse +HTML - SERVER_HEALTH_ESTIMATE || Server Gesundheitsschätzung +HTML - SERVER_INFORMATION || SERVER Information +HTML - SERVER_PREFERENCE || Bevorzugter Server +HTML - SERVERS || Server +HTML - SESSION || Session +HTML - SESSION_ENDED || Session beendet +HTML - SESSION_LENGTH || Session Länge +HTML - SESSION_MEDIAN || Session Durchschnitt +HTML - SESSIONS || Sessions +HTML - TIME || Zeit +HTML - TIMES_KICKED || Mal gekickt +HTML - TIMES_USED || Mal benutzt +HTML - TOTAL_ACTIVE_TEXT || Gesamt Aktiv +HTML - TOTAL_AFK || Gesamt AFK +HTML - TOTAL_PLAYERS || Gesamte Spieler +HTML - TOTAL_PLAYTIME || Gesamte Spielzeit +HTML - UNIQUE || EINZIGARTIG +HTML - UNIQUE_CALENDAR || Einzigartig: +HTML - UNIQUE_PLAYERS || EINZIGARTIGE SPIELER +HTML - UNIQUE_PLAYERS_TEXT || Einzigartige Spieler +HTML - UNIQUE_TEXT || Einzigartig +HTML - USAGE || Nutzung +HTML - USED_COMMANDS || Benutzte Befehle +HTML - USER_AND_PASS_NOT_SPECIFIED || User und Passwort nicht spezifiziert +HTML - USER_DOES_NOT_EXIST || User existiert nicht +HTML - USER_INFORMATION || USER INFORMATION +HTML - USER_PASS_MISMATCH || User und Password stimmen nicht überein +HTML - WITH || Breite +HTML - WORLD || Welt +HTML - WORLD_LOAD || Weltenladung +HTML - WORLD_PLAYTIME || Spielzeit in der Welt +HTML - WORST_PING || Schlechtester Ping +HTML ERRORS - ACCESS_DENIED_403 || Zugriff verweigert +HTML ERRORS - ANALYSIS_REFRESH || Plan wird aktualisiert... +HTML ERRORS - ANALYSIS_REFRESH_LONG || Plan wird ausgeführt, lade in ein paar Sekunden neu +HTML ERRORS - AUTH_FAIL_TIPS_401 || - Stelle sicher, dass du einen Account mit /plan register hinzugefügt hast.
    - Überprüfe, ob Passwort und Benutzername korrekt sind
    - Bei Benutzername und Passwort auf Groß- und Kleinschreibung achten!

    - Wenn du dein Passwort vergessen hast, bitte ein Teammitglied deinen Account zu löschen und neu zu erstellen. +HTML ERRORS - AUTHENTICATION_FAIlED_401 || Authentifizierung fehlgeschlagen. +HTML ERRORS - FORBIDDEN_403 || Verboten +HTML ERRORS - NO_SERVERS_404 || Keine Server online, die die Anfrage ausführen können. +HTML ERRORS - NOT_FOUND_404 || Nicht gefunden. +HTML ERRORS - NOT_PLAYED_404 || Der Spieler war nie auf dem Server. +HTML ERRORS - PAGE_NOT_FOUND_404 || Diese Seite existiert nicht. +HTML ERRORS - UNAUTHORIZED_401 || Unautorisiert +HTML ERRORS - UNKNOWN_PAGE_404 || Stelle sicher, dass du einen Link benutzt, der von einem Command generiert wurde. Beispielsweise:

    /player/PlayerName
    /server/ServerName

    +HTML ERRORS - UUID_404 || Die UUID des Spielers wurde nicht in der Datenbank gefunden. +In Depth Help - /plan ? || > §2Hauptbefehl\ Zugriff auf Unterbefehle und Hilfe\ §2/plan §fListe Unterbefehle\ §2/plan ? §fAusführliche Hilfe +In Depth Help - /plan analyze ? || > §2Analysebefehl\ Aktualisiert die Serverseite und stellt einen Zugriffslink bereit. +In Depth Help - /plan inspect ? || > §2Inspect-Befehl\ Aktualisiert die Spielerseite und stellt einen Zugriffslink bereit. +In Depth Help - /plan manage ? || > §2Manage-Befehl\ Verwalte die MySQL und SQLite Datenbank von Plan.\ §2/plan m §fListe Unterbefehle\ §2/plan m ? §fAusführliche Hilfe +In Depth Help - /plan manage backup ? || > §2Backup-Unterbefehl\ Erstellt eine neue SQLite Datenbank (.db file) mit dem Inhalt der aktuell aktiven Datenbank im Plugin-Ordner +In Depth Help - /plan manage clear ? || > §2Clear-Unterbefehl\ Entfernt ALLES aus der aktuellen Datenbank. Vorsicht! +In Depth Help - /plan manage con ? || > §2Verbindungs-Debug-Unterbefehl\ Zum debuggen der Verbindungen im Netzwerk.\ Schickt eine Anfrage an jeden Server in der Datenbank. +In Depth Help - /plan manage disable ? || > §2Ausschalten-Subcommand\ Damit können Teile des Plugins bis zum nächsten Neustart ausgeschaltet werden.\ Akzeptierte Argumente:\ §2kickcount §fDeaktiviert den Zähler für Kicks falls /kickall im Ausschalt-Makro genutzt wird. +In Depth Help - /plan manage import ? || > §2Import-Unterbefehl\ Importiere Daten aus anderen Quellen.\ Akzeptierte Argumente:\ §2offline §fBukkit Spielerdaten, registriere nur Name und Datum. +In Depth Help - /plan manage move ? || > §2Move-Unterbefehl\ Verschiebe die Daten von SQLite zu MySQL oder andersherum\ Zieldatenbank wird vor dem Transfer geleert. +In Depth Help - /plan manage remove ? || > §2Remove-Unterbefehl\ Löscht die Daten eines Spielers aus der Datenbank. +In Depth Help - /plan manage restore ? || > §2Restore-Unterbefehl\ Stellt ein Backup einer SQLite Datenbank (.db file) wieder her\ Die database.db kann auch von einem anderen Server zu MySQL wiederhergestellt werden.\ Zieldatenbank wird vor dem Transfer geleert. +In Depth Help - /plan manage setup ? || > §2Setup Unterbefehl\ Richte eine Verbindung zwischen Bungee und diesem Server für Netzwerkfunktionalität ein.\ Die Bungee-Adresse kann dem Log in der Bungee-Konsole entnommen werden, wenn Plan aktiviert wird. +In Depth Help - /plan network ? || > §2Netzwerk-Befehl\ Erstellt einen Link zur Netzwerkseite. Wenn du in einem Netzwerk bist, wird die Serverseite angezeigt. +In Depth Help - /plan players ? || > §2Spieler-Befehl\ Erstellt einen Link zur Spielerseite. +In Depth Help - /plan qinspect ? || > §2Schnell-Untersuchungs-Befehl\ Zeigt einige Informationen zu einem Spieler im Spiel. +In Depth Help - /plan reload ? || > §2Reload-Befehl\ Restartet das plugin mit onDisable and onEnable.\ §bDamit kann NICHT die jar getauscht werden +In Depth Help - /plan search ? || > §2Such-Befehl\ Erstellt eine Liste mit Spielernamen, die mit der Suche übereinstimmen.\§7 Beispiel: /plan search 123 - Gibt alle Spieler mit 123 im Namen aus. +In Depth Help - /plan servers ? || > §2Server-Command\ Zeigt eine Liste mit allen Servern in der datenbank.\ Kann verwendet werden, um Probleme mit Registrierungen in der Datenbank in einem Netzwerk zu beheben. +In Depth Help - /plan update ? || > §2Update-Befehl\ Updatet das Plugin beim nächsten Restart\ /plan update - Link zum Änderungsprotokoll\ /plan update -u - Plant das Update auf allen Servern im Netzwerk, die online sind, wenn sie das nächste Mal restarten.\ /plan update cancel - Bricht das geplante Update ab, solange der Server noch nicht restartet wurde. +In Depth Help - /plan web ? || > §2Account-Verwaltungs-Befehl.\ §2/plan web §fListe Unterbefehle\ §2/plan web ? §fAusfürliche Hilfe +In Depth Help - /plan web register ? || > §2Registrierungs-Unterbefehl\ Registriert einen neuen Account.\ Um einen Account für einen anderen Usernamen als den eigenen zu erstellen wird plan.webmanage Berechtigung benötigt.\ Passwörter werden mit PBKDF2 (64,000 iterations of SHA1) gehashed dazu wird ein cryptographically-random salt verwendet. +In Depth Help - /planbungee disable ? || > §2Deaktivierungs-Befehl\ Führt onDisable auf PlanBungee aus.\ Plugin kann mit /planbungee reload wieder geladen werden.\ §bDabei kann NICHT die jar ausgetauscht werden. +In Depth Help - /planbungee setup ? || > §2Set-up-Umschalt-Befehl\ Schaltet den Set-Up Modus auf dem Bungee an oder aus.\ Stellt sicher, dass keine unautorisierte MySQL bei einem anderen Server ausschnüffelt. +Manage - Confirm Overwrite || Daten in ${0} werden überschrieben! +Manage - Confirm Removal || Daten in ${0} werden gelöscht! +Manage - Fail || > §cEtwas ist schiefgelaufen: ${0} +Manage - Fail File not found || > §cKeine Daten in ${0} gefunden +Manage - Fail Incorrect Database || > §c'${0}' ist keine unterstützte Datenbank. +Manage - Fail No Importer || §eImporter '${0}' existiert nicht +Manage - Fail Same Database || > §cKann nicht von und zu der gleichen Datenbank agieren! +Manage - Fail, Confirmation || > §cFüge '-a' zum Befehl hinzu um die Ausführung zu bestätigen: ${0} +Manage - Fail, Connection Exception || §eFehlgeschlagen: +Manage - Fail, No Servers || §cKein Server in der Datenbank. +Manage - Fail, Old version || §eFehlgeschlagen: Veraltete Version von Plan auf dem empfangenden Server. +Manage - Fail, Unauthorized || §eFehlgeschlagen: Zugriff verweigert. Server verwendet möglicherweise eine andere Datenbank. +Manage - Fail, Unexpected Exception || §eUnerwartete Ausnahme: ${0} +Manage - List Importers || Importer: +Manage - Notify External Url || §eNicht-lokale Adresse, ist der Port offen? +Manage - Remind HotSwap || §eDenk dran, zur neuen Datenbank zu wechseln (/plan m hotswap ${0}) und das Plugin neu zu laden. +Manage - Start || > §2Verarbeite Daten... +Manage - Success || > §aErfolgreich! +Negative || Nein +Positive || Ja +Unknown || Unbekannt +Version - DEV || Dies ist eine Entwicklungsversion! +Version - Latest || Du verwendest die neuste Version +Version - New || Eine neue Version (${0}) ist verfügbar! ${1} +Version - New (old) || Eine Neue Version ist hier verfügbar: ${0} +Version FAIL - Read info (old) || Überprüfung auf die neuste Versionsnummer fehlgeschlagen. +Version FAIL - Read versions.txt || Versionsinformationen konnten nicht ovn Github/versions.txt gelesen werden. +Web User Listing || §2${0} §7: §f${1} +WebServer - Notify HTTP || WebServer: Kein Zertifikat -> Benutze HTTP-server zur Visualisierung. +WebServer - Notify HTTP User Auth || WebServer: Benutzer-Authentifizierung abgeschaltet! (Nicht sicher über HTTP) +WebServer - Notify no Cert file || WebServer: Zertifikat KeyStore Datei nicht gefunden: ${0} +WebServer FAIL - Port Bind || WebServer wurde nicht erfolgreich initalisiert. Ist der Port (${0}) schon benutzt? +WebServer FAIL - SSL Context || WebServer: SSL Context Initialisierung fehlgeschlagen. +WebServer FAIL - Store Load || WebServer: SSL Zertifikat konnte nicht geladen werden. diff --git a/Plan/src/main/resources/locale/locale_EN.txt b/Plan/src/main/resources/locale/locale_EN.txt new file mode 100644 index 000000000..29f63a3f2 --- /dev/null +++ b/Plan/src/main/resources/locale/locale_EN.txt @@ -0,0 +1,314 @@ +Cmd - Click Me || Click me +Cmd - Link || §2Link: §f +Cmd Disable - Disabled || §aPlan systems are now disabled. You can still use /planbungee reload to restart the plugin. +Cmd FAIL - Invalid Username || §cUser does not have an UUID. +Cmd FAIL - No Feature || §eDefine a feature to disable! (currently supports ${0}) +Cmd FAIL - No Permission || §cYou do not have the required permission. +Cmd FAIL - Require only one Argument || §cSingle Argument required ${1} +Cmd FAIL - Requires Arguments || §cArguments required (${0}) ${1} +Cmd FAIL - Unknown Username || §cUser has not been seen on this server +Cmd FAIL - WebUser does not exists || §cUser does not exists! +Cmd FAIL - WebUser exists || §cUser already exists! +Cmd Header - Analysis || > §2Analysis Results +Cmd Header - Info || > §2Player Analytics +Cmd Header - Inspect || > §2Player: §f${0} +Cmd Header - Network || > §2Network Page +Cmd Header - Players || > §2Players +Cmd Header - Search || > §2${0} Results for §f${1}§2: +Cmd Header - Servers || > §2Servers +Cmd Header - Web Users || > §2${0} Web Users +Cmd Info - Bungee Connection || §2Connected to Bungee: §f${0} +Cmd Info - Database || §2Active Database: §f${0} +Cmd Info - Reload Complete || §aReload Complete +Cmd Info - Reload Failed || §cSomething went wrong during reload of the plugin, a restart is recommended. +Cmd Info - Update || §2Update Available: §f${0} +Cmd Info - Version || §2Version: §f${0} +Cmd Notify - No WebUser || You might not have a web user, use /plan register +Cmd Notify - WebUser register || Registered new user: '${0}' Perm level: ${1} +Cmd Qinspect - Activity Index || §2Activity Index: §f${0} | ${1} +Cmd Qinspect - Deaths || §2Deaths: §f${0} +Cmd Qinspect - Geolocation || §2Logged in from: §f${0} +Cmd Qinspect - Last Seen || §2Last Seen: §f${0} +Cmd Qinspect - Longest Session || §2Longest Session: §f${0} +Cmd Qinspect - Mob Kills || §2Mob Kills: §f${0} +Cmd Qinspect - Player Kills || §2Player Kills: §f${0} +Cmd Qinspect - Playtime || §2Playtime: §f${0} +Cmd Qinspect - Registered || §2Registered: §f${0} +Cmd Qinspect - Times Kicked || §2Times Kicked: §f${0} +Cmd Setup - Allowed || §aSet-up is now Allowed +Cmd Setup - Bad Request || §eConnection succeeded, but Receiving server was not a Bungee server. Use Bungee address instead. +Cmd Setup - Disallowed || §cSet-up is now Forbidden +Cmd Setup - Forbidden || §eConnection succeeded, but Bungee has set-up mode disabled - use '/planbungee setup' to enable it. +Cmd Setup - Gateway Error || §eConnection succeeded, but Bungee failed to connect to this server (Did current web server restart?). Use /plan m con & /planbungee con to debug. +Cmd Setup - Generic Fail || §eConnection failed: ${0} +Cmd Setup - Internal Error || §eConnection succeeded. ${0}, check possible ErrorLog on receiving server's debug page. +Cmd Setup - Success || §aConnection successful, Plan may restart in a few seconds.. +Cmd Setup - Unauthorized || §eConnection succeeded, but Receiving server didn't authorize this server. Contact Discord for support +Cmd Setup - Url mistake || §cMake sure you're using the full address (Starts with http:// or https://) - Check Bungee enable log for the full address. +Cmd Setup - WebServer not Enabled || §cWebServer is not enabled on this server! Make sure it enables on boot! +Cmd SUCCESS - Feature disabled || §aDisabled '${0}' temporarily until next plugin reload. +Cmd SUCCESS - WebUser register || §aAdded a new user (${0}) successfully! +Cmd Update - Cancel Success || §aCancel operation performed. +Cmd Update - Cancelled || §cUpdate cancelled. +Cmd Update - Change log || Change Log v${0}: +Cmd Update - Fail Cacnel || §cUpdate failed on a server, cancelling update on all servers.. +Cmd Update - Fail Force Notify || §e${0} failed to update, -force specified, continuing update. +Cmd Update - Fail Not Online || §cNot all servers were online or accessible, you can still update available servers using /plan update -u -force +Cmd Update - Notify Cancel || §aYou can cancel the update on servers that haven't rebooted yet with /plan update cancel. +Cmd Update - Online Check || Checking that all servers are online.. +Cmd Update - Scheduled || §a${0} scheduled for update. +Cmd Update - Url mismatch || §cVersion download url did not start with ${0} and might not be trusted. You can download this version manually here (Direct download): +Cmd Web - Permission Levels || >\§70: Access all pages\§71: Access '/players' and all player pages\§72: Access player page with the same username as the webuser\§73+: No permissions +Command Help - /plan analyze || View the Server Page +Command Help - /plan dev || Development mode command +Command Help - /plan help || Show command list +Command Help - /plan info || Check the version of Plan +Command Help - /plan inspect || View a Player Page +Command Help - /plan manage || Manage Plan Database +Command Help - /plan manage backup || Backup a Database +Command Help - /plan manage clear || Clear a Database +Command Help - /plan manage con || Debug Server-Bungee connections +Command Help - /plan manage disable || Disable a feature temporarily +Command Help - /plan manage hotswap || Change Database quickly +Command Help - /plan manage import || Import data from elsewhere +Command Help - /plan manage move || Move data between Databases +Command Help - /plan manage remove || Remove Player's data +Command Help - /plan manage restore || Restore a previous Backup +Command Help - /plan manage setup || Set-up Server-Bungee connection +Command Help - /plan network || View the Network Page +Command Help - /plan players || View the Players Page +Command Help - /plan qinspect || View Player info in game +Command Help - /plan register || Register a Web User +Command Help - /plan reload || Restart Plan +Command Help - /plan search || Search for a player name +Command Help - /plan servers || List servers in Database +Command Help - /plan update || Get change log link or update plugin +Command Help - /plan web check || Inspect a Web User +Command Help - /plan web delete || Delete a Web User +Command Help - /plan web level || Information about permission levels +Command Help - /plan web list || List Web Users +Command Help - /plan webuser || Manage Web Users +Command Help - /planbungee con || Debug Bungee-Server connections +Command Help - /planbungee disable || Disable the plugin temporarily +Command Help - /planbungee setup || Toggle set-up mode +Database - Apply Patch || Applying Patch: ${0}.. +Database - Patches Applied || All database patches applied successfully. +Database - Patches Applied Already || All database patches already applied. +Database MySQL - Launch Options Error || Launch Options were faulty, using default (${0}) +Database Notify - Clean || Removed data of ${0} players. +Database Notify - SQLite No WAL || SQLite WAL mode not supported on this server version, using default. This may or may not affect performance. +Disable || Player Analytics Disabled. +Disable - Processing || Processing critical unprocessed tasks. (${0}) +Disable - Processing Complete || Processing complete. +Disable - WebServer || Webserver has been disabled. +Enable || Player Analytics Enabled. +Enable - Database || ${0}-database connection established. +Enable - Notify Address Confirmation || Make sure that this address points to THIS Server: ${0} +Enable - Notify Empty IP || IP in server.properties is empty & AlternativeIP is not in use. Incorrect links will be given! +Enable - Notify Geolocations disabled || Geolocation gathering is not active. (Data.Geolocations: false) +Enable - Notify Geolocations Internet Required || Plan Requires internet access on first run to download GeoLite2 Geolocation database. +Enable - Notify Webserver disabled || WebServer was not initialized. (WebServer.DisableWebServer: true) +Enable - WebServer || Webserver running on PORT ${0} (${1}) +Enable FAIL - Database || ${0}-Database Connection failed: ${1} +Enable FAIL - Database Patch || Database Patching failed, plugin has to be disabled. Please report this issue +Enable FAIL - GeoDB Write || Something went wrong saving the downloaded GeoLite2 Geolocation database +Enable FAIL - WebServer (Bungee) || WebServer did not initialize! +Enable FAIL - Wrong Database Type || ${0} is not a supported Database +HTML - ACTIVITY_INDEX || Activity Index +HTML - ALL || ALL +HTML - ALL_TIME_PEAK || All Time Peak +HTML - AVERAGE_PING || Average Ping +HTML - AVG || AVG +HTML - BANNED || Banned +HTML - BEST_PING || Best Ping +HTML - CALENDAR || CALENDAR +HTML - CALENDAR_TEXT || Calendar +HTML - CHUNKS || Chunks +HTML - COMMAND || Command +HTML - COMMNAND_USAGE || Command Usage +HTML - CONNECTION_INFORMATION || Connection Information +HTML - COUNTRY || Country +HTML - CURRENT_PLAYERBASE || Current Playerbase +HTML - DEATHS || Deaths +HTML - ENTITIES || Entities +HTML - ERROR || Authentication failed due to error +HTML - FAVORITE_SERVER || Favorite Server +HTML - GEOLOCATION || Geolocation +HTML - GEOLOCATION_TEXT || Geolocation +HTML - HEALTH_ESTIMATE || Health Estimate +HTML - INDEX_ACTIVE || Active +HTML - INDEX_INACTIVE || Inactive +HTML - INDEX_IRREGULAR || Irregular +HTML - INDEX_REGULAR || Regular +HTML - INDEX_VERY_ACTIVE || Very Active +HTML - IP_ADDRESS || IP-address +HTML - KILLED || Killed +HTML - KILLED_BY || Killed by +HTML - LAST_24_HOURS || LAST 24 HOURS +HTML - LAST_30_DAYS || LAST 30 DAYS +HTML - LAST_30_DAYS_TEXT || Last 30 Days +HTML - LAST_7_DAYS || LAST 7 DAYS +HTML - LAST_CONNECTED || Last Connected +HTML - LAST_PEAK || Last Peak +HTML - LAST_SEEN || LAST SEEN +HTML - LAST_SEEN_TEXT || Last Seen +HTML - LOADED_CHUNKS || Loaded Chunks +HTML - LOADED_ENTITIES || Loaded Entities +HTML - LOCAL_MACHINE || Local Machine +HTML - LONGEST || Longest +HTML - LOW_TPS_SPIKES || Low TPS Spikes +HTML - MOB_CAUSED_DEATHS || Mob caused Deaths +HTML - MOB_KDR || Mob KDR +HTML - MOB_KILLS || Mob Kills +HTML - MOST_RECENT_SESSIONS || Most Recent Sessions +HTML - NAME || Name +HTML - NAV_COMMAND_USAGE || Command Usage +HTML - NAV_GEOLOCATIONS || Geolocations +HTML - NAV_INFORMATION || Information +HTML - NAV_NETWORK_PLAYERS || Network Players +HTML - NAV_ONLINE_ACTIVITY || Online Activity +HTML - NAV_OVERVIEW || Overview +HTML - NAV_PERFORMANCE || Performance +HTML - NAV_PLAYERS || Players +HTML - NAV_PLUGINS || Plugins +HTML - NAV_SESSIONS || Sessions +HTML - NAV_SEVER_HEALTH || Server Health +HTML - NETWORK || Network +HTML - NETWORK_INFORMATION || NETWORK INFORMATION +HTML - NEW || NEW +HTML - NEW_CALENDAR || New: +HTML - NEW_PLAYERS_TEXT || New Players +HTML - NEW_RETENTION || New Player Retention +HTML - NEW_TEXT || New +HTML - NICKNAME || Nickname +HTML - NO_KILLS || No Kills +HTML - NO_PLAYER_CAUSED_DEATHS || No Player caused Deaths +HTML - OFFLINE || Offline +HTML - ONLINE || Online +HTML - ONLINE_ACTIVITY || ONLINE ACTIVITY +HTML - OPERATOR || Operator +HTML - OVERVIEW || OVERVIEW +HTML - PER_DAY || / Day +HTML - PLAYER_CAUSED_DEATHS || Player caused Deaths +HTML - PLAYER_KILLS || Player Kills +HTML - PLAYER_LIST || Player List +HTML - PLAYERBASE_DEVELOPMENT || Playerbase Development +HTML - PLAYERS || PLAYERS +HTML - PLAYERS_ONLINE || PLAYERS ONLINE +HTML - PLAYERS_ONLINE_TEXT || Players Online +HTML - PLAYERS_TEXT || Players +HTML - PLAYTIME || Playtime +HTML - PLEASE_WAIT || Please wait... +HTML - PREDICETED_RETENTION || Predicted Retention +HTML - PUNCH_CARD || Punchcard +HTML - PUNCHCARD || PUNCHCARD +HTML - RECENT_LOGINS || RECENT LOGINS +HTML - REGISTERED || REGISTERED +HTML - REGISTERED_TEXT || Registered +HTML - REGULAR || REGULAR +HTML - SEEN_NICKNAMES || Seen Nicknames +HTML - SERVER || Server +HTML - SERVER_ANALYSIS || Server Analysis +HTML - SERVER_HEALTH_ESTIMATE || Server Health Estimate +HTML - SERVER_INFORMATION || SERVER INFORMATION +HTML - SERVER_PREFERENCE || Server Preference +HTML - SERVERS || Servers +HTML - SESSION || Session +HTML - SESSION_ENDED || Session Ended +HTML - SESSION_LENGTH || Session Lenght +HTML - SESSION_MEDIAN || Session Median +HTML - SESSIONS || Sessions +HTML - TIME || Time +HTML - TIMES_KICKED || Times Kicked +HTML - TIMES_USED || Times Used +HTML - TOTAL_ACTIVE_TEXT || Total Active +HTML - TOTAL_AFK || Total AFK +HTML - TOTAL_PLAYERS || Total Players +HTML - TOTAL_PLAYTIME || Total Playtime +HTML - UNIQUE || UNIQUE +HTML - UNIQUE_CALENDAR || Unique: +HTML - UNIQUE_PLAYERS || UNIQUE PLAYERS +HTML - UNIQUE_PLAYERS_TEXT || Unique Players +HTML - UNIQUE_TEXT || Unique +HTML - USAGE || Usage +HTML - USED_COMMANDS || Used Commands +HTML - USER_AND_PASS_NOT_SPECIFIED || User and Password not specified +HTML - USER_DOES_NOT_EXIST || User does not exist +HTML - USER_INFORMATION || USER INFORMATION +HTML - USER_PASS_MISMATCH || User and Password did not match +HTML - WITH || With +HTML - WORLD || World +HTML - WORLD_LOAD || WORLD LOAD +HTML - WORLD_PLAYTIME || World Playtime +HTML - WORST_PING || Worst Ping +HTML ERRORS - ACCESS_DENIED_403 || Access Denied +HTML ERRORS - ANALYSIS_REFRESH || Analysis is being refreshed.. +HTML ERRORS - ANALYSIS_REFRESH_LONG || Analysis is being run, refresh the page after a few seconds.. +HTML ERRORS - AUTH_FAIL_TIPS_401 || - Ensure you have registered a user with /plan register
    - Check that the username and password are correct
    - Username and password are case-sensitive

    If you have forgotten your password, ask a staff member to delete your old user and re-register. +HTML ERRORS - AUTHENTICATION_FAIlED_401 || Authentication Failed. +HTML ERRORS - FORBIDDEN_403 || Forbidden +HTML ERRORS - NO_SERVERS_404 || No Servers online to perform the request. +HTML ERRORS - NOT_FOUND_404 || Not Found +HTML ERRORS - NOT_PLAYED_404 || Player has not played on this server. +HTML ERRORS - PAGE_NOT_FOUND_404 || Page does not exist. +HTML ERRORS - UNAUTHORIZED_401 || Unauthorized +HTML ERRORS - UNKNOWN_PAGE_404 || Make sure you're accessing a link given by a command, Examples:

    /player/PlayerName
    /server/ServerName

    +HTML ERRORS - UUID_404 || Player UUID was not found in the database. +In Depth Help - /plan ? || > §2Main Command\ Access to subcommands and help\ §2/plan §fList subcommands\ §2/plan ? §fIn depth help +In Depth Help - /plan analyze ? || > §2Analysis Command\ Refreshes server page and displays link to the web page. +In Depth Help - /plan inspect ? || > §2Inspect Command\ Refreshes player page and displays link to the web page. +In Depth Help - /plan manage ? || > §2Manage Command\ Manage MySQL and SQLite database of Plan.\ §2/plan m §fList subcommands\ §2/plan m ? §fIn depth help +In Depth Help - /plan manage backup ? || > §2Backup Subcommand\ Creates a new SQLite database (.db file) with contents of currently active database in the Plan plugin folder. +In Depth Help - /plan manage clear ? || > §2Clear Subcommand\ Removes everything in the active database. Use with caution. +In Depth Help - /plan manage con ? || > §2Connection Debug Subcommand\ Used to debug connections in the network.\ Sends a request to each server in the database. +In Depth Help - /plan manage disable ? || > §2Disable Subcommand\ Can disable parts of the plugin until next reload.\ Accepted arguments:\ §2kickcount §fDisables kick counts in case /kickall is used on shutdown macro. +In Depth Help - /plan manage import ? || > §2Import Subcommand\ Import data from other sources.\ Accepted Arguments:\ §2offline §fBukkit player data, only register date and name. +In Depth Help - /plan manage move ? || > §2Move Subcommand\ Move data from SQLite to MySQL or other way around.\ Target database is cleared before transfer. +In Depth Help - /plan manage remove ? || > §2Remove Subcommand\ Remove player's data from the active database. +In Depth Help - /plan manage restore ? || > §2Restore Subcommand\ Restore a previous backup SQLite database (.db file)\ You can also restore database.db from another server to MySQL.\ Target database is cleared before transfer. +In Depth Help - /plan manage setup ? || > §2Setup Subcommand\ Set-up a connection between Bungee and this server for network functionality.\ BungeeAddress can be found in the enable log on console when Plan enables on Bungee. +In Depth Help - /plan network ? || > §2Network Command\ Displays link to the network page.\ If not on a network, this page displays the server page. +In Depth Help - /plan players ? || > §2Players Command\ Displays link to the players page. +In Depth Help - /plan qinspect ? || > §2Quick Inspect Command\ Displays some information about the player in game. +In Depth Help - /plan reload ? || > §2Reload Command\ Restarts the plugin using onDisable and onEnable.\ §bDoes not support swapping jar on the fly +In Depth Help - /plan search ? || > §2Search Command\ Get a list of Player names that match the given argument.\§7 Example: /plan search 123 - Finds all users with 123 in their name. +In Depth Help - /plan servers ? || > §2Servers Command\ Displays list of Plan servers in the Database.\ Can be used to debug issues with database registration on a network. +In Depth Help - /plan update ? || > §2Update Command\ Used to update the plugin on the next shutdown\ /plan update - Changelog link\ /plan update -u - Schedule update to happen on all network servers that are online, next time they reboot.\ /plan update cancel - Cancel scheduled update on servers that haven't rebooted yet. +In Depth Help - /plan web ? || < §2Web User Manage Command.\ §2/plan web §fList subcommands\ §2/plan web ? §fIn Depth help +In Depth Help - /plan web register ? || > §2Register Subcommand\ Registers a new Web User.\ Registering a user for another player requires plan.webmanage permission.\ Passwords are hashed with PBKDF2 (64,000 iterations of SHA1) using a cryptographically-random salt. +In Depth Help - /planbungee disable ? || > §2Disable Command\ Runs onDisable on PlanBungee.\ Plugin can be enabled with /planbungee reload afterwards.\ §bDoes not support swapping jar on the fly +In Depth Help - /planbungee setup ? || > §2Set-up toggle Command\ Toggles set-up mode on Bungee.\ Safeguard against unauthorized MySQL snooping with another server. +Manage - Confirm Overwrite || Data in ${0} will be overwritten! +Manage - Confirm Removal || Data in ${0} will be removed! +Manage - Fail || > §cSomething went wrong: ${0} +Manage - Fail File not found || > §cNo File found at ${0} +Manage - Fail Incorrect Database || > §c'${0}' is not a supported database. +Manage - Fail No Importer || §eImporter '${0}' doesn't exist +Manage - Fail Same Database || > §cCan not operate on to and from the same database! +Manage - Fail, Confirmation || > §cAdd '-a' argument to confirm execution: ${0} +Manage - Fail, Connection Exception || §eFail reason: +Manage - Fail, No Servers || §cNo Servers found in the database. +Manage - Fail, Old version || §eFail reason: Older Plan version on receiving server +Manage - Fail, Unauthorized || §eFail reason: Unauthorized. Server might be using different database. +Manage - Fail, Unexpected Exception || §eOdd Exception: ${0} +Manage - List Importers || Importers: +Manage - Notify External Url || §eNon-local address, check that port is open +Manage - Remind HotSwap || §eRemember to swap to the new database (/plan m hotswap ${0}) & reload the plugin. +Manage - Start || > §2Processing data.. +Manage - Success || > §aSuccess! +Negative || No +Positive || Yes +Unknown || Unknown +Version - DEV || This is a DEV release. +Version - Latest || You're using the latest version. +Version - New || New Release (${0}) is available ${1} +Version - New (old) || New Version is available at ${0} +Version FAIL - Read info (old) || Failed to check newest version number +Version FAIL - Read versions.txt || Version information could not be loaded from Github/versions.txt +Web User Listing || §2${0} §7: §f${1} +WebServer - Notify HTTP || WebServer: No Certificate -> Using HTTP-server for Visualization. +WebServer - Notify HTTP User Auth || WebServer: User Authorization Disabled! (Not secure over HTTP) +WebServer - Notify no Cert file || WebServer: Certificate KeyStore File not Found: ${0} +WebServer FAIL - Port Bind || WebServer was not initialized successfully. Is the port (${0}) in use? +WebServer FAIL - SSL Context || WebServer: SSL Context Initialization Failed. +WebServer FAIL - Store Load || WebServer: SSL Certificate loading Failed. diff --git a/Plan/src/main/resources/locale/locale_FI.txt b/Plan/src/main/resources/locale/locale_FI.txt index 15c7740a9..806e94a76 100644 --- a/Plan/src/main/resources/locale/locale_FI.txt +++ b/Plan/src/main/resources/locale/locale_FI.txt @@ -1,118 +1,313 @@ -Analysis - Third Party || Analyysi | Analysoidaan Kolmannen osapuolen lähteitä -Analysis FAIL - Fetch Exception || Analyysi | Datan haku ei onnistunut, Virhe. -Analysis FAIL - No Data || Analyysi | Analyysi ei onnistunut, Ei dataa. -Analysis FAIL - No Players || Analyysi | Analyysi ei onnistunut, Ei tunnettuja pelaajia -Analysis - Fetch Phase || Analyysi | Haetaan Dataa.. -Analysis - Fetch Phase Start || Analyysi | Tarkistetaan saatavilla olevia pelaajia.. -Analysis - Complete || Analyysi | Analyysi Valmis. (meni ${0}ms) ${1} -Analysis - Begin Analysis || Analyysi | Data Haettu (${0} käyttäjää, meni ${1}ms), aloitetaan Datan analysointi.. -Analysis - Start || Analyysi | Aloitetaan Analyysi.. ->Constant - CMD Footer || §f» ->Constant - List Ball || §7 •§2 -Cmd FAIL - No Data View || §e[Plan] Dataa ei voida näyttää. -Cmd FAIL - No Permission || §c[Plan] Sinulla ei ole lupaa tähän komentoon. -Cmd FAIL - Requires Arguments || §c[Plan] Komento tarvitsee argumentteja. ${0} -Cmd FAIL - Require only one Argument || §c[Plan] Komento tarvitsee yhden argumentin. -Cmd FAIL - Timeout || §c[Plan] ${0} komento aikakatkaistu! Tarkista '/plan status' & konsoli. -Cmd FAIL - Unknown Username || §c[Plan] Pelaajaa ei löytynyt tietokannasta -Cmd FAIL - Unseen Username || §c[Plan] Pelaaja ei ole pelannut palvelimella. -Cmd FAIL - Invalid Username || §c[Plan] Pelaajaa ei ole olemassa. -Cmd Header - Analysis || §f»§2 Player Analytics - Analyysin tulokset -Cmd Header - Info || §f»§2 Player Analytics - Tietoja -Cmd Header - Inspect || §f»§2 Player Analytics - Pelaajan tiedot: -Cmd Header - Search || §f»§2 Player Analytics - Haun tulokset: -In Depth Help - /plan analyze ? || §2Analyysi Komento\§f Päivittää Analyysin ja antaa linkin sen sivulle.\§7 /plan status-komentoa voidaan käyttää Analyysin tilan tarkistamiseen\§7 Vaihtoehtoiset komennot: analyze, analyse, analysis, a -In Depth Help - /plan inspect ? || §2Inspect Komento\§f Antaa linkin pelaajan sivulle.\§7 Oman sivun voi nähdä komennolla /plan inspect\§7 Vaihtoehtoiset komennot /plan -In Depth Help - /plan list ? || §2List Komento\§f Antaa linkin pelaajalista sivulle.\§7 Pelaajalista sivulla näkyy kaikki välimuistissa olevat pelaajien sivut.\§7 Vaihtoehtoiset komennot: /plan pl -In Depth Help - /plan manage ? || §2Manage Komento\§f Käytetään Tietokannan hallitsemiseen\§7 Vaihtoehtoiset komennot /plan m\§7 /plan m - Listaa komennot\§7 /plan m ? - tarkempi apu -In Depth Help - /plan manage clear ? || §2Manage Clear Komento\§f Tyhjentää kaiken tiedon tietokannasta\§7 Plan kannattaa uudelleenkäynnistää onnistuneen tyhjennyksen jälkeen\§7 Vaihtoehtoiset komennot /plan pl -In Depth Help - /plan manage dump ? || §2Manage Dump Komento\§f Heittää kaiken tiedon hastebiniin kehittäjän avuksi -In Depth Help - /plan manage hotswap ? || §2Manage Hotswap Komento\§f Vaihtaa tietokantaa lennossa\§7 Ei vaihda tietokantaa mikäli yhteyttä ei saada muodostettua -In Depth Help - /plan manage import ? || §2Manage Import Komento\§f Tuo Dataa muista lähteistä\§7 Analyysi poistetaan käytöstä tuonnin ajaksi -In Depth Help - /plan manage remove ? || §2Manage Remove Komento\§f Poistaa käyttäjän datan aktiivisesta tietokannasta -In Depth Help - /plan ? || §2/plan - Pää komento\§f Käytetään kaikkien komentojen käyttämiseen\§7 /plan - Listaa komennot\§7 /plan ? - tarkempi apu -In Depth Help - /plan qanalyze ? || §2Quick Analysis Komento\§f Näyttää osan analyysin tietoja pelissä\§7 Vähemmän tietoa kuin nettisivulla.\§7 Vaihtoehtoiset komennot: qanalyze, ganalyse, qanalysis, qa -In Depth Help - /plan qinspect ? || §2Quick Inspect Komento\§f Näyttää osan pelaajan tiedoista pelissä.\§7 Vähemmän tietoa kuin nettisivulla.\§7 Vaihtoehtoiset komennot /plan qi -In Depth Help - /plan search ? || §2Search Komento\§f Hakee pelaajia joiden nimestä löytyy haettava osa.\§7 Esim: /plan search 123 - Hakee pelaajat joiden nimestä löytyy 123 -In Depth Help - /plan webuser ? || §2Web User Manage Komento\§f Hallitsee Nettiserverin käyttäjiä\§7 Käyttäjillä on lupa taso:\§f 0 - Kaikki sivut\§f 1 - /players & kaikki pelaaja sivut\§f 2 - Oma pelaajan sivu\§7 Vaihtoehtoiset komennot /plan web -In Depth Help - /plan webuser register ? || §2Web Register Komento\§f Rekisteröi uuden käyttäjän nettiserverille.\§7 Toiselle henkilölle rekisteröinti tarvitsee plan.webmanage luvan.\§7 Passwords are hashed with PBKDF2 (64,000 iterations of SHA1) using a cryptographically-random salt. -Analysis NOTIFY - Temporary Disable || §eAnalyysi poistettu käytöstä toistaiseksi, /plan status kertoo lisää -Cmd - Click Me || Klikkaa minua -Cmd - Fetch Data || §f»§2 Haetaan tietoja välimuistiin.. -Cmd - Link || §7 • §2Linkki: §f -Cmd - No Results || §7 • §2Ei tuloksia hakusanalle §7${0}§2. -Cmd - Reload Success || §a[Plan] Uudelleenkäynnistys Valmis. -Cmd - Results || §7 Sopivat pelaajat: §f -Cmd - Searching || §f»§2Haetaaan.. -Cmd - Usage /plan analyze || Katso serverin analyysi -Cmd - Usage /plan help || Katso komentolista. -Cmd - Usage /plan info || Tarkista Plan versio -Cmd - Usage /plan inspect || Tutki pelaajan sivua -Cmd - Usage /plan list || Listaa välimuistissa olevat pelaajat -Cmd - Usage /plan manage || Tietokannan hallinta komento -Cmd - Usage /plan manage backup || Varmuuskopioi tietokanta .db tiedostoon -Cmd - Usage /plan manage clean || Putsaa vanha data tietokannasta -Cmd - Usage /plan manage clear || Putsaa KAIKKI data tietokannasta -Cmd - Usage /plan manage dump || Luo Hastebin loki kehittäjän avuksi. -Cmd - Usage /plan manage hotswap || Vaihda tietokantaa lennossa ja käynnistä Plan uudelleen -Cmd - Usage /plan manage import || Tuo dataa muualta aktiiviseen tietokantaan -Cmd - Usage /plan manage move || Kopioi tiedot tietokannasta toiseen, ylikirjoittaen vanhat arvot. -Cmd - Usage /plan manage remove || Poista pelaajan tiedot aktiivisesta tietokannasta -Cmd - Usage /plan manage restore || Palauta varmuuskopio -Cmd - Usage /plan qanalyze || Tutki pika-analyysia -Cmd - Usage /plan qinspect || Tutki pelaajan tietoja pelissä -Cmd - Usage /plan reload || Restart the Plugin (Reloads config) -Cmd - Usage /plan search || Hae pelaajaa -Cmd - Usage /plan webuser || Hallitse nettikäyttäjiä -Cmd - Usage /plan webuser check || Tarkista nettikäyttäjä ja sen lupa taso -Cmd - Usage /plan webuser delete || Poista nettikäyttäjä -Cmd - Usage /plan webuser level || Tietoa lupa tasoista -Cmd - Usage /plan webuser register || Register a user for the webserver -Disable || Player Analytics Disabled. -Disable - Save || Tallennetaan välimuistia.. -Disable - WebServer || Sammutetaan Web palvelin.. -Enable || Player Analytics Enabled. -Enable - Boot Analysis 30s Notify || Analyysi | Käynnistyksen yhteinen analyysi 30 sekunnin kuluttua.. -Enable - Boot Analysis Notify || Analysis | Aloitetaan Käynnistyksen yhteinen analyysi.. -Enable Db FAIL - Disable Info || Database initialization has failed, disabling Plan. -Enable - Db Info || ${0}-tietokantayhteys onnistui. -Enable - Db || Tietokannan käynnistys.. -Enable FAIL-Db || ${0}-Database Connection failed: ${1} -Enable FAIL - Wrong Db Type || Tietokantatyyppiä ei ole olemassa -Enable Notify - ChatListener || §eViestien kuuntelu pois käytöstä, nimi tieto voi olla väärin. -Enable Notify - Disabled CommandListener || §eKomentojen kuuntelu pois käytöstä. -Enable Notify - Disabled DeathListener || §eKuolema kuuntelu pois käytöstä, tappoja ei lasketa. -Enable Notify-Empty IP || §eIP in server.properties is empty & AlternativeServerIP is not used, incorrect links will be given! -Enable Notify - No data view || §eNetti Palvelin Poissa käytöstä, mutta Alternative IP/TextUI ei ole käytössä, dataa ei voi tarkastella! -Enable - WebServer || Käynnistetään Netti Palvelin.. -Enable - WebServer Info || Netti Palvelin pyörii PORTILLA ${0} -Html - Active || Pelaaja on aktiivinen -Html - Banned || | Pannassa -Html - Inactive || Pelaaja ei ole aktiivinen -Html - No Extra Plugins ||

    Ei kauheasti lisä plugineita.

    -Html - Offline || | Offline -Html - Online || | Online -Html - OP || , Operaattori (Op) -Html - Table No Kills || Ei tappoja -Manage FAIL - Confirm Action || §c[Plan] Lisää -a vahvistaaksesi! ${0} -Manage FAIL - Faulty DB Connection || §c[Plan] Toinen tietokannoista ei käynnistynyt odotetusti. -Manage FAIL - Backup File Not Found || §c[Plan] Varmuuskopiota ei ole olemassa! -Manage FAIL - Incorrect DB || §c[Plan] Väärä tietokanta! (sqlite/mysql hyväksytään): -Manage FAIL - Incorrect Plugin || §c[Plan] Plugin ei ole tuettu: -Manage FAIL - Empty DB || §c[Plan] Tietokannassa ei ole pelaaja dataa! -Manage FAIL - Unenabled Plugin || §c[Plan] Plugin ei ole käynnissä: -Manage FAIL - Same DB || §c[Plan] Ei voida siirtää samaan tietokantaan! -Manage - Clear Success || §a[Plan] Kaikki data siirretty onnistuneesti! -Manage - Remind Config Change || §e[Plan] Muista vaihtaa tietokantaa ja käynnistää Plan uudelleen. -Manage - Copy Success || §a[Plan] Kaikki tiedot kopioitu onnistuneesti! -Manage - Process Fail || §c[Plan] Jokin meni vikaan dataa käsitellessä! -Manage - Import || §f» §2 Tuodaan Dataa.. -Manage - Move Success || §a[Plan] Kaikki data siirretty onnistuneesti! -Manage - Remove Success || §f» §f${0}:n§2 data poistettiin tietokannasta §f${1}§2. -Manage - Start || »§7 Käsitellään Dataa.. -Manage - Success || §f» §2 Onnistui! -Manage NOTIFY - Overwrite || Tiedot ${0}-tietokannassa ylikirjoitetaan! -Manage NOTIFY - Partial Overwrite || Osa tiedoista ${0}-tietokannassa ylikirjoitetaan! -Manage NOTIFY - Remove || Tiedot ${0}-tietokannassa poistetaan! -Manage NOTIFY - Rewrite || Tiedot ${0}-tietokannassa uudelleenkirjoitetaan! -WARN - Too Small Queue Size || Queue size is too small! (${0}), change the setting to a higher number! (Currently ${1}) +Cmd - Click Me || Klikkaa minua +Cmd - Link || §2Linkki: §f +Cmd Disable - Disabled || §aPlan on nyt poissa päältä. Voit käyttää /planbungee reload komentoa uudelleenkäynnistykseen. +Cmd FAIL - Invalid Username || §cPelaajalla ei löytynyt UUID:ta. +Cmd FAIL - No Feature || §eValitse sammutettava osa! (tällähetkellä tuetut: ${0}) +Cmd FAIL - No Permission || §cSinulla ei ole lupaa. +Cmd FAIL - Require only one Argument || §cAnna ainakin yksi muuttuja ${1} +Cmd FAIL - Requires Arguments || §cMääritä enemmän muuttujia (${0}) ${1} +Cmd FAIL - Unknown Username || §cPleaajaa ei ole nähty tällä palvelimella. +Cmd FAIL - WebUser does not exists || §cKäyttäjää ei ole olemassa! +Cmd FAIL - WebUser exists || §cKäyttäjä on jo olemassa! +Cmd Header - Analysis || > §2Analyysin tulokset +Cmd Header - Info || > §2Player Analytics +Cmd Header - Inspect || > §2Pelaaja: §f${0} +Cmd Header - Network || > §2Verkoston Sivu +Cmd Header - Players || > §2Pelaajat +Cmd Header - Search || > §2${0} Tulosta haulle §f${1}§2: +Cmd Header - Servers || > §2Palvelimet +Cmd Header - Web Users || > §2${0} Web Käyttäjät +Cmd Info - Bungee Connection || §2Yhdistetty BungeeCord:iin: §f${0} +Cmd Info - Database || §2Aktiivinen Tietokanta: §f${0} +Cmd Info - Reload Complete || §aUudelleenlataus onnistui! +Cmd Info - Reload Failed || §cUudelleenlatauksessa esiintyi ongelmia. Käynnistystä uudelleen suositellaan. +Cmd Info - Update || §2Päivitys saatavilla: §f${0} +Cmd Info - Version || §2Versio: §f${0} +Cmd Notify - No WebUser || Sinulla ei ehkä ole Web Käyttäjää, käytä /plan register -komentoa +Cmd Notify - WebUser register || Rekisteröitiin uusi Web Käyttäjä: '${0}' Lupa taso: ${1} +Cmd Qinspect - Activity Index || §2Aktiivisuus Indeksi: §f${0} | ${1} +Cmd Qinspect - Deaths || §2Kuolemat: §f${0} +Cmd Qinspect - Geolocation || §2Kirjautui sisään maasta: §f${0} +Cmd Qinspect - Last Seen || §2Viimeksi nähty: §f${0} +Cmd Qinspect - Longest Session || §2Pisin istunto: §f${0} +Cmd Qinspect - Mob Kills || §2Otusten Tappoja: §f${0} +Cmd Qinspect - Player Kills || §2Pelaajien Tappoja: §f${0} +Cmd Qinspect - Playtime || §2Peliaika: §f${0} +Cmd Qinspect - Registered || §2Rekisteröitynyt: §f${0} +Cmd Qinspect - Times Kicked || §2Potkittu Pellolle: §f${0} +Cmd Setup - Allowed || §aYhteydenotto on nyt sallittu. +Cmd Setup - Bad Request || §eYhteys onnistui, mutta Vastaanottava palvelin ei ollut BungeeCord. Käytä BungeeCord:in osoitetta. +Cmd Setup - Disallowed || §cYhteydenotto on nyt kielletty. +Cmd Setup - Forbidden || §eYhteys onnistui, mutta BungeeCord:n set-up tila oli poissa käytöstä - käytä '/planbungee setup' laittaaksesi sen päälle. +Cmd Setup - Gateway Error || §eYhteys onnistui, mutta BungeeCord ei saanut yhteyttä tähän palvelimeen (Käynnistyikö Web palvelin uudelleen?). Käytä /plan m con & /planbungee con tutkiaksesi ongelmia. +Cmd Setup - Generic Fail || §eYhteys ei onnistunut: ${0} +Cmd Setup - Internal Error || §eYhteys onnistui. ${0}, tarkista mahdollinen virheloki vastaanottavalla palvelimella. +Cmd Setup - Success || §aYhteys onnistui, Plan saattaa käynnistyä uudelleen muutaman sekunnin kuluttua.. +Cmd Setup - Unauthorized || §eYhteys onnistui, mutta Vastaanottava palvelin ei hyväksynyt tätä palvelinta. Pyydä apua Discordissa. +Cmd Setup - Url mistake || §cVarmista käyttäväsi kokonaista osoitetta (http:// tai https:// alkuinen) - Tarkista osoite BungeeCord:in käynnistyslokista. +Cmd Setup - WebServer not Enabled || §cWeb Palevlin ei ole käynnissä tällä palvelimella! Varmista että se käynnistyy pelin mukana! +Cmd SUCCESS - Feature disabled || §aSammutettiin '${0}' toistaiseksi, kunnes Plan ladataan uudelleen. +Cmd SUCCESS - WebUser register || §aLisättiin uusi Web Käyttäjä (${0})! +Cmd Update - Cancel Success || §aPeruutettu. +Cmd Update - Cancelled || §cPäivitys peruutettu. +Cmd Update - Change log || Muutosloki v${0}: +Cmd Update - Fail Cacnel || §cPäivitys epäonnistui palvelimella, peruutetaan päivitys kaikilla palvelimilla.. +Cmd Update - Fail Force Notify || §e${0} ei voitu päivittää, -force käytössä, jatketaan päivitystä. +Cmd Update - Fail Not Online || §cKaikki palvelimet eivät olleet saatavilla, voit silti päivittää käyttämällä komentoa /plan update -u -force +Cmd Update - Notify Cancel || §aVoit peruuttaa päivityksen palvelimilla, joita ei ole käynnistetty uudelleen, komennolla /plan update cancel. +Cmd Update - Online Check || Varmistetaan että palvelimet ovat päällä.. +Cmd Update - Scheduled || §a${0} astettu päivittymään. +Cmd Update - Url mismatch || §cVersio URL ei alkanut ${0} joten siihen ei voi ehkä luottaa. Voit ladata sen manuaalisesti täältä (Suora lataus): +Cmd Web - Permission Levels || >\§70: Pääsy kaikille sivuille\§71: Pääsy '/players' ja pelaajien sivuille\§72: Pääsy pelaajan sivulle, jolla on sama nimi kuin Web Käyttäjällä\§73+: Ei pääsyä +Command Help - /plan analyze || Katso Palvelimen sivua +Command Help - /plan dev || Kehitys komento +Command Help - /plan help || Komentojen lista +Command Help - /plan info || Tarkista Plan versio +Command Help - /plan inspect || Katso Pelaajan sivua +Command Help - /plan manage || Hallitse Plan tietokantaa +Command Help - /plan manage backup || Varmuuskopioi tietokanta +Command Help - /plan manage clear || Tyhjennä tietokanta +Command Help - /plan manage con || Tutki Palvelin-BungeeCord yhteys ongelmia +Command Help - /plan manage disable || Sammuta osa toistaiseksi +Command Help - /plan manage hotswap || Vaihda tietokantaa lennosta +Command Help - /plan manage import || Tuo tietoa muualta +Command Help - /plan manage move || Siirrä tietoa tietokantojen välillä +Command Help - /plan manage remove || Poista pelaajan tiedot +Command Help - /plan manage restore || Palauta teitokannan varmuuskopio +Command Help - /plan manage setup || Muodosta Palvelin-BungeeCord yhteys +Command Help - /plan network || Katso Verkoston sivua +Command Help - /plan players || Katso Pelaajat sivua +Command Help - /plan qinspect || Katso pelaajan tietoja pelissä +Command Help - /plan register || Rekisteröi Web Käyttäjä +Command Help - /plan reload || Käynnistä Plan uudelleen +Command Help - /plan search || Etsi pelaajan nimeä +Command Help - /plan servers || Listaa tietokannassa olevat palvelimet +Command Help - /plan update || Muutosloki linkki tai Plan:in päivitys +Command Help - /plan web check || Tarkista Web Käyttäjän tiedot +Command Help - /plan web delete || Poista Web Käyttäjä +Command Help - /plan web level || Tietoa Web lupatasoista +Command Help - /plan web list || Listaa Web Käyttäjät +Command Help - /plan webuser || Halliste Web Käyttäjiä +Command Help - /planbungee con || Tutki BungeeCord-Palvelin yhteys ongelmia +Command Help - /planbungee disable || Sammuta Plan toistaiseksi +Command Help - /planbungee setup || Vaihda asennustilaa +Database - Apply Patch || Muutetaan Tietokantaa: ${0}.. +Database - Patches Applied || Tietokannan muutokset suoritettu onnistuneesti. +Database - Patches Applied Already || Kaikki tietokannan muutokset oli jo tehty. +Database MySQL - Launch Options Error || LauchOptions-asetus oli virheellinen, käytetään oletusta (${0}) +Database Notify - Clean || Poistetiin ${0}n pelaajan tiedot. +Database Notify - SQLite No WAL || SQLite WAL tilaa ei tueta tällä versiolla, Käytetään perustilaa. Tämä voi vaikuttaa suorituskykyyn. +Disable || Player Analytics Sammutettu. +Disable - Processing || Suoritetaan kriittisiä suorittamattomia toimintoja. (${0}) +Disable - Processing Complete || Suoritus valmis. +Disable - WebServer || Web palvelin on sammutettu. +Enable || Player Analytics Käynnistetty. +Enable - Database || ${0}-tietokanta yhteys luotu. +Enable - Notify Address Confirmation || Varmista että tämä osoite osoittaa TÄHÄN palvelimeen: ${0} +Enable - Notify Empty IP || IP server.properties tiedostossa on tyhjä & AlternativeIP ei ole käytössä. Linkit ovat virheellisiä! +Enable - Notify Geolocations disabled || Sijaintien keräys ei ole päällä. (Data.Geolocations: false) +Enable - Notify Geolocations Internet Required || Plan Vaatii internetin ensimmäisellä käynnistyskerralla GeoLite2 tietokannan lataamiseen. +Enable - Notify Webserver disabled || Web Palvelinta ei käynnistetty. (WebServer.DisableWebServer: true) +Enable - WebServer || Web Palvelin pyörii PORTILLA ${0} (${1}) +Enable FAIL - Database || ${0}-Tietokanta yhteys epäonnistui: ${1} +Enable FAIL - Database Patch || Tietokannan muutokset epäonnistuivat, Plan jouduttiin sulkemaan. Ilmoita tästä ongelmasta +Enable FAIL - GeoDB Write || Jokin meni pieleen tallentaessa GeoLite2 tietokantaa +Enable FAIL - WebServer (Bungee) || Web Palvelin ei käynnistynyt! +Enable FAIL - Wrong Database Type || ${0} ei ole tuettu Tietokanta +HTML - ACTIVITY_INDEX || Aktiivisuus Indeksi +HTML - ALL || KAIKKI +HTML - ALL_TIME_PEAK || Paras Huippu +HTML - AVERAGE_PING || Keskimääräinen Ping +HTML - AVG || AVG +HTML - BANNED || Pannassa +HTML - BEST_PING || Paras Ping +HTML - CALENDAR || KALENTERI +HTML - CALENDAR_TEXT || Kalenteri +HTML - CHUNKS || Chunkit +HTML - COMMAND || Komento +HTML - COMMNAND_USAGE || Komentojen Käyttö +HTML - CONNECTION_INFORMATION || Yhteydet +HTML - COUNTRY || Maa +HTML - CURRENT_PLAYERBASE || Nykyiset pelaajat +HTML - DEATHS || Kuolemat +HTML - ENTITIES || Entiteetit +HTML - ERROR || Autentisointi epäonnistui virheen vuoksi +HTML - FAVORITE_SERVER || Lempipalvelin +HTML - GEOLOCATION || Sijainti +HTML - GEOLOCATION_TEXT || Sijainti +HTML - HEALTH_ESTIMATE || Terveysarvio +HTML - INDEX_ACTIVE || Aktiivinen +HTML - INDEX_INACTIVE || Inaktiivinen +HTML - INDEX_IRREGULAR || Epäsäännöllinen +HTML - INDEX_REGULAR || Säännöllinen +HTML - INDEX_VERY_ACTIVE || Todella Aktiivinen +HTML - IP_ADDRESS || IP-osoite +HTML - KILLED || Tappanut +HTML - KILLED_BY || Tappanut +HTML - LAST_24_HOURS || VIIMEISET 24 TUNTIA +HTML - LAST_30_DAYS || VIIMEISET 30 PÄIVÄÄ +HTML - LAST_30_DAYS_TEXT || Viimeiset 30 Päivää +HTML - LAST_7_DAYS || VIIMEISET 7 PÄIVÄÄ +HTML - LAST_CONNECTED || Viimeisin yhteys +HTML - LAST_PEAK || Viimeisin huippu +HTML - LAST_SEEN || NÄHTY VIIMEKSI +HTML - LAST_SEEN_TEXT || Nähty Viimeksi +HTML - LOADED_CHUNKS || Ladatut Chunkit +HTML - LOADED_ENTITIES || Ladatut Entiteetit +HTML - LOCAL_MACHINE || Paikallinen laite +HTML - LONGEST || Pisin +HTML - LOW_TPS_SPIKES || Matalat TPS Harjat +HTML - MOB_CAUSED_DEATHS || Otusten aiheuttamat Kuolemat +HTML - MOB_KILLS || Tapetut Otukset +HTML - MOST_RECENT_SESSIONS || Viimeisimmät Istunnot +HTML - NAME || Nimi +HTML - NAV_COMMAND_USAGE || Komentojen Käyttö +HTML - NAV_GEOLOCATIONS || Sijainnit +HTML - NAV_INFORMATION || Tiedot +HTML - NAV_NETWORK_PLAYERS || Verkoston Pelaajat +HTML - NAV_ONLINE_ACTIVITY || Aktiivisuus +HTML - NAV_OVERVIEW || Yhteenveto +HTML - NAV_PERFORMANCE || Suorituskyky +HTML - NAV_PLAYERS || Pelaajat +HTML - NAV_PLUGINS || Lisäosat +HTML - NAV_SESSIONS || Istunnot +HTML - NAV_SEVER_HEALTH || Palvelimen Terveys +HTML - NETWORK || Verkosto +HTML - NETWORK_INFORMATION || VERKOSTON TIEDOT +HTML - NEW || UUDET +HTML - NEW_CALENDAR || Uudet: +HTML - NEW_PLAYERS_TEXT || Uudet Pelaajat +HTML - NEW_RETENTION || Uusien Pelaajien pysyvyys +HTML - NEW_TEXT || Uudet +HTML - NICKNAME || Lempinimi +HTML - NO_KILLS || Ei Tappoja +HTML - NO_PLAYER_CAUSED_DEATHS || Ei Pelaajien auheuttamia kuolemia +HTML - OFFLINE || Ei Paikalla +HTML - ONLINE || Paikalla +HTML - ONLINE_ACTIVITY || AKTIIVISUUS +HTML - OPERATOR || Operaattori +HTML - OVERVIEW || YHTEENVETO +HTML - PER_DAY || / Päivä +HTML - PLAYER_CAUSED_DEATHS || Pelaajien aiheuttamat Kuolemat +HTML - PLAYER_KILLS || Tapetut Pelaajat +HTML - PLAYER_LIST || Pelaajalista +HTML - PLAYERBASE_DEVELOPMENT || Pelaajakunnan kehitys +HTML - PLAYERS || PELAAJAT +HTML - PLAYERS_ONLINE || PELAAJIA PAIKALLA +HTML - PLAYERS_ONLINE_TEXT || Pelaajia Paikalla +HTML - PLAYERS_TEXT || Pelaajia +HTML - PLAYTIME || Peliaika +HTML - PLEASE_WAIT || Odota Hetki... +HTML - PREDICETED_RETENTION || Pysyvyyden Ennuste +HTML - PUNCH_CARD || Reikäkortti +HTML - PUNCHCARD || REIKÄKORTTI +HTML - RECENT_LOGINS || VIIMEAIKAISET KIRJAUTUMISET +HTML - REGISTERED || REKISTERÖITYNYT +HTML - REGISTERED_TEXT || Rekisteröitynyt +HTML - REGULAR || SÄÄNNÖLLISET +HTML - SEEN_NICKNAMES || Nähdyt Lempinimet +HTML - SERVER || Palvelin +HTML - SERVER_ANALYSIS || Palvelimen Analyysi +HTML - SERVER_HEALTH_ESTIMATE || Palvelimen Terveysarvio +HTML - SERVER_INFORMATION || PALVELIMEN TIEDOT +HTML - SERVER_PREFERENCE || Palvelinten mieleisyys +HTML - SERVERS || Palvelimet +HTML - SESSION || Istunto +HTML - SESSION_ENDED || Istunto Päättyi +HTML - SESSION_LENGTH || Istunnon Pituus +HTML - SESSION_MEDIAN || Istuntojen Mediaani +HTML - SESSIONS || Istunnot +HTML - TIME || Aika +HTML - TIMES_KICKED || Potkimis Kerrat +HTML - TIMES_USED || Käyttökerrat +HTML - TOTAL_ACTIVE || Aktiivinen Peliaika +HTML - TOTAL_AFK || AFK +HTML - TOTAL_PLAYERS || Kaikki Pelaajat +HTML - TOTAL_PLAYTIME || Peliaika +HTML - UNIQUE || UNIIKIT +HTML - UNIQUE_CALENDAR || Uniikit: +HTML - UNIQUE_PLAYERS || UNIIKIT PELAAJAT +HTML - UNIQUE_PLAYERS_TEXT || Uniikit Pelaajat +HTML - UNIQUE_TEXT || Uniikit +HTML - USAGE || Käyttö +HTML - USED_COMMANDS || Käytetyt Komennot +HTML - USER_AND_PASS_NOT_SPECIFIED || Käyttäjää ja salasana vaaditaan. +HTML - USER_DOES_NOT_EXIST || Käyttäjää ei ole olemassa +HTML - USER_INFORMATION || KÄYTTÄJIEN TIEDOT +HTML - USER_PASS_MISMATCH || Käyttäjä ja salasana ei täsmää +HTML - WITH || Millä +HTML - WORLD || Maailma +HTML - WORLD_LOAD || MAAILMAN VARAUS +HTML - WORLD_PLAYTIME || Maailman Peliaika +HTML - WORST_PING || Huonoin Ping +HTML ERRORS - ACCESS_DENIED_403 || Pääsy Kielletty +HTML ERRORS - ANALYSIS_REFRESH || Analyysiä suoritetaan.. +HTML ERRORS - ANALYSIS_REFRESH_LONG || Analyysiä suoritetaan, sivu päivittyy hetken kuluttua.. +HTML ERRORS - AUTH_FAIL_TIPS_401 || - Varmista että olet rekisteröinyt käyttäjän komennolla /plan register
    - Tarkista että käyttäjänimi ja salaasana ovat oikein
    - Nimi ja salasana ovat CASE SENSITIVE

    Jos unohdit salasanasi, pyydä valvojia poistamaan käyttäjäsi ja uudelleenrekisteröidy. +HTML ERRORS - AUTHENTICATION_FAIlED_401 || Autentikaatio ei onnistunut. +HTML ERRORS - FORBIDDEN_403 || Kielletty +HTML ERRORS - NO_SERVERS_404 || Ei palvelimia jolla toiminto voitaisiin suorittaa. +HTML ERRORS - NOT_FOUND_404 || Ei löytynyt +HTML ERRORS - NOT_PLAYED_404 || Pelaaja ei ole pelannut palvelimella. +HTML ERRORS - PAGE_NOT_FOUND_404 || Sivua ei ole olemassa. +HTML ERRORS - UNAUTHORIZED_401 || Ei Autentikoitu +HTML ERRORS - UNKNOWN_PAGE_404 || Varmista menneeesi komennon antamaan osoitteeseen, Esim:

    /player/PelaajanNimi
    /server/PalvelimenNimi

    +HTML ERRORS - UUID_404 || Pelaajan UUID:ta ei löytynyt tietokannasta. +In Depth Help - /plan ? || > §2Pääkomento\ Käytä alikomentoja ja apua\ §2/plan §fListaa alikomennot\ §2/plan ? §fYksityiskohtainen apu +In Depth Help - /plan analyze ? || > §2Analyysi Komento\ Päivittää palvelin sivun ja näyttää linkin sivustolle. +In Depth Help - /plan inspect ? || > §2Tutkimus Komento\ Päivittää pelaajan sivun ja näyttää linkin sivustolle +In Depth Help - /plan manage ? || > §2Hallinto Komento\ Hallitse Plan MySQL and SQLite tietokantoja.\ §2/plan m §fListaa alikomennot\ §2/plan m ? §fYksityiskohtainen apu +In Depth Help - /plan manage backup ? || > §2Varmuuskopio Alikomento\ Luo uuden SQLite tietokannan (.db file) nykyisen tietokannan tiedoilla Plan plugins kansioon.. +In Depth Help - /plan manage clear ? || > §2Poisto Alikomento\ Poistaa kaiken aktiivisesta tietokannasta. Käytä varoen +In Depth Help - /plan manage con ? || > §2Yhteyksien tutkimus Alikomento\ Käytetään yhteys ongelmien tutkimiseen verkostoissa.\ Lähettää viestin jokaiselle palvelimelle tietokannassa. +In Depth Help - /plan manage disable ? || > §2Sammutus Alikomento\ Voi poistaa osia käytöstä tilapäisesti.\ Hyväksytyt muuttujat:\ §2kickcount §fSulkee potkimisten laskun, mikäli /kickall komentoa käytetään sammutus makrossa. +In Depth Help - /plan manage import ? || > §2Tuonti Alikomento\ Tuo tietoa muualta.\ Hyväksytyt muuttujat:\ §2offline §fBukkitin pelaajatiedot, rekisteröitymispäivä ja nimi. +In Depth Help - /plan manage move ? || > §2Siirto Alikomento\ Siirrä tietoa SQLite ja MySQL tietokantojen välillä.\ Kohde tietokanta tyhjennetään ennen siirtoa. +In Depth Help - /plan manage remove ? || > §2Poisto Alikomento\ Poistaa pelaajan tiedot aktiivisesta tietokannasta. +In Depth Help - /plan manage restore ? || > §2Palautus Alikomento\ Palauta edellinen varmuuskopio SQLite tietokanta (.db tiedosto)\ Voit myös palauttaa database.db tiedoston toiselta palvelimelta MySQL-tietokantan.\ Kohde tietokanta tyhjennetään ennen siirtoa. +In Depth Help - /plan manage setup ? || > §2Asennus Alikomento\ Muodosta yhteys BungeeCordin ja tämän palvelimen välille.\ BungeeAddress löytyy BungeeCordin käynnistyslokista +In Depth Help - /plan network ? || > §2Verkosto Komento\ Näyttää linkin verkosto sivulle.\ Jos palvelin ei ole verkostossa, näyttää tämä sivu palvelimen sivun. +In Depth Help - /plan players ? || > §2Pelaajat Komento\ Näyttää linkin pelaajan sivulle. +In Depth Help - /plan qinspect ? || > §2Pika-tutkimus Komento\ Näyttää tietoja pelaajasta pelin sisällä. +In Depth Help - /plan reload ? || > §2Uudelleenlataus Komento\ Käynnistää Plan:in uudelleen.\ §bEi tue jar:in vaihtoa lennosta +In Depth Help - /plan search ? || > §2Haku Komento\ Hae pelaajannimiä jollain hakusanalla.\§7 Esim: /plan search 123 - Etsii kaikki pelaajat joilla on 123 nimessään. +In Depth Help - /plan servers ? || > §2Palvelimet Komento\ Näyttää tietokannassa olevat Plan palvelimet.\ Voidaan käyttää yhteys ongelmien tutkimiseen. +In Depth Help - /plan update ? || > §2Päivitys Komento\ Päivittää Plan:in seuraavan käynnistyksen yhteydessä\ /plan update - Muutosloki linkki\ /plan update -u - Ajoita päivitys kaikissa päällä olevissa palvelimissa seuraavalle käynnistyskerralle.\ /plan update cancel - Peruuta ajoitettu päivitys palvelimilla jotka eivät ole vielä käynnistyneet uudelleen. +In Depth Help - /plan web ? || < §2Web Käyttäjähallinto Komento.\ §2/plan web §fList alikomentos\ §2/plan web ? §fYksityiskohtainen apu +In Depth Help - /plan web register ? || > §2Rekisteröinti Alikomento\ Rekisteröi uuden Web Käyttäjän.\ Toiselle pelaajalle käyttäjän rekisteröinti vaatii plan.webmanage permission.\ Salasanat salataan PBKDF2 (64,000 iterations of SHA1) algoritmilla. +In Depth Help - /planbungee disable ? || > §2Sammutus Komento\ Sammuttaa PlanBungee:n.\ /planbungee reload käynnistää Plan:in uudelleen.\ §bEi tue jar:in vaihtoa lennossa +In Depth Help - /planbungee setup ? || > §2Asennustilan vaihto Komento\ Vaihtaa asennustilaa Bungee:lla.\ Turvatoimi MySQL haistelulle toisella Plan palvelimella. +Manage - Confirm Overwrite || Tiedot ${0}:ssa ylikirjoitetaan! +Manage - Confirm Removal || Tiedot ${0}:ssa poistetaan! +Manage - Fail || > §cJokin meni vikaan: ${0} +Manage - Fail File not found || > §cTiedostoa ei löytynyt ${0} +Manage - Fail Incorrect Database || > §c'${0}' ei ole tuettu tietokanta. +Manage - Fail No Importer || §eTuojaa '${0}' ei ole olemassa +Manage - Fail Same Database || > §cEi voi käyttää samaa tietokantaa molempiin asioihin! +Manage - Fail, Confirmation || > §cLisää '-a' vahvistaaksesi: ${0} +Manage - Fail, Connection Exception || §eEpäonnistumisen syy: +Manage - Fail, No Servers || §cEi Palvelimia tietokannassa. +Manage - Fail, Old version || §eSyy: Vanhempi versio vastaanottavalla palvelimella +Manage - Fail, Unauthorized || §eSyy: Ei authentikoitu, palvelin voi käyttää toista tietokantaa +Manage - Fail, Unexpected Exception || §eKummallinen Virhe: ${0} +Manage - List Importers || Tuojat: +Manage - Notify External Url || §eEi-lokaali osoite, tarkista että portti on auki +Manage - Remind HotSwap || §eMuista vaihtaa tietokantaa (/plan m hotswap ${0}) & käynnistä Plan uudelleen. +Manage - Start || > §2Prosessoidaan tietoa.. +Manage - Success || > §aOnnistui! +Negative || Ei +Positive || Kyllä +Unknown || Tuntematon +Version - DEV || Tämä on KEHITYS julkaisu. +Version - Latest || Käytät uusinta versiota. +Version - New || Uusi Julkaisu (${0}) on saatavilla ${1} +Version - New (old) || Uusi Versio on saatavilla ${0} +Version FAIL - Read info (old) || Uuden version tarkistus epäonnistui +Version FAIL - Read versions.txt || Uuden version tarkistus epäonnistui Github/versions.txt:ta +Web User Listing || §2${0} §7: §f${1} +WebServer - Notify HTTP || Web Palvelin: Ei Sertifikaattia -> Käytetään HTTP-Palvelinta. +WebServer - Notify HTTP User Auth || Web Palvelin: Käyttäjien varmennus ei käytössä! (Ei turvallista HTTP-protokollalla) +WebServer - Notify no Cert file || Web Palvelin: Sertifikaatti AvainKirjasto tiedostoa ei löytynyt: ${0} +WebServer FAIL - Port Bind || Web Palvelin ei käynnistynyt. Onko portti (${0}) käytössä? +WebServer FAIL - SSL Context || Web Palvelin: SSL Kontekstin käynnistys ei onnistunut. +WebServer FAIL - Store Load || Web Palvelin: SSL Sertifikaatin lataus ei onnistunut. diff --git a/Plan/src/main/resources/locale/locale_FR.txt b/Plan/src/main/resources/locale/locale_FR.txt index 6cdfddc45..29f63a3f2 100644 --- a/Plan/src/main/resources/locale/locale_FR.txt +++ b/Plan/src/main/resources/locale/locale_FR.txt @@ -1,118 +1,314 @@ -Analysis - Third Party || Analyse | Analyse des sources de données supplémentaires (tierce partie). -Analysis FAIL - Fetch Exception || Analyse | Échec de l’extraction des données pour l’analyse, une exception s'est produite. -Analysis FAIL - No Data || Analyse | L'analyse a échoué, aucune donnée dans la base de données. -Analysis FAIL - No Players || Analyse | L'analyse a échoué, aucun joueur connu. -Analysis - Fetch Phase || Analyse | Récupération des données.. -Analysis - Fetch Phase Start || Analyse | Vérification des joueurs disponibles.. -Analysis - Complete || Analyse | Analyse terminée. (En ${0}ms) ${1} -Analysis - Begin Analysis || Analyse | Données récupérées (${0} utilisateurs, en ${1}ms), début Analyse des données.. -Analysis - Start || Analyse | Début de l'analyse des données utilisateur.. ->Constant - CMD Footer || §f» ->Constant - List Ball || §7 •§2 -Cmd FAIL - No Data View || §e[Plan] Aucun moyen de voir les données disponibles. -Cmd FAIL - No Permission || §c[Plan] Vous n'avez pas la permission requise. -Cmd FAIL - Requires Arguments || §c[Plan] La commande nécessite des arguments. ${0} -Cmd FAIL - Require only one Argument || §c[Plan] La commande nécessite un argument. -Cmd FAIL - Timeout || §c[Plan] ${0} La commande a expiré ! Vérifiez avec '/plan status' et la console. -Cmd FAIL - Unknown Username || §c[Plan] Joueur introuvable dans la base de données. -Cmd FAIL - Unseen Username || §c[Plan] Ce joueur n'a pas joué sur ce serveur. -Cmd FAIL - Invalid Username || §c[Plan] Ce joueur n'existe pas. -Cmd Header - Analysis || §f»§2 Player Analytics - Résultats de l’analyse -Cmd Header - Info || §f»§2 Player Analytics - Info -Cmd Header - Inspect || §f»§2 Player Analytics - Résultats de l’inspection -Cmd Header - Search || §f»§2 Player Analytics - Résultats de la recherche: -In Depth Help - /plan analyze ? || §2Commande d’analyse\§f Utilisé pour actualiser le cache d'analyse et accéder à la page de résultats\§7 /plan status peut être utilisé pour vérifier le statut de l'analyse pendant son exécution.\§7 Alias: analyze, analyse, analysis, a -In Depth Help - /plan inspect ? || §2Commande d’inspection\§f Utilisé pour obtenir un lien vers la page d'inspection d’un utilisateur.\§7 Votre propre page d'inspection peut être consultée avec /plan inspect\§7 Alias: /plan -In Depth Help - /plan list ? || §2Commande de listing\§f Utilisé pour obtenir un lien vers la page des joueurs.\§7 La page des joueurs contient des liens vers toutes les pages d'inspection mises en cache.\§7 Alias: /plan pl -In Depth Help - /plan manage ? || §2Commande de gestion\§f Utilisé pour gérer la base de données du plugin.\§7 Alias: /plan m\§7 /plan m - Liste des sous-commandes\§7 /plan m ? - aide approfondie -In Depth Help - /plan manage clear ? || §2Gestion: Commande d’effacement.\§f Utilisé pour supprimer TOUTES les données dans la base de données active.\§7 Le plugin doit être rechargé après l’effacement terminé.\§7 Alias: /plan pl -In Depth Help - /plan manage dump ? || §2Gestion: Commande de listage\§f Utilisé pour lister des données importantes pour le rapport de bug à hastebin. -In Depth Help - /plan manage hotswap ? || §2Gestion: Commande de Hotswap\§f Utilisé pour modifier la base de données en cours d'utilisation.\§7 Ne change pas la base de données si la connexion échoue. -In Depth Help - /plan manage import ? || §2Gestion: Commande d'importation\§f Utilisé pour importer des données d'autres sources\§7 L'analyse sera désactivée pendant l'importation. -In Depth Help - /plan manage remove ? || §2Gestion: Commande de suppression\§f Utilisé pour supprimer les données de l'utilisateur de la base de données active. -In Depth Help - /plan ? || §2/plan - Commande principale\§f Utilisé pour accéder à toutes les sous-commandes et aide\§7 /plan - Liste des sous-commandes\§7 /plan ? - aide approfondie -In Depth Help - /plan qanalyze ? || §2Commande d'analyse rapide\§f Utilisé pour obtenir des informations en jeu sur l'analyse.\§7 A moins d'informations que la page Web d'analyse complète.\§7 Alias: qanalyze, ganalyse, qanalysis, qa -In Depth Help - /plan qinspect ? || §2Commande d'inspection rapide\§f Utilisé pour obtenir des informations d'inspection en jeu.\§7 A moins d'informations que la page Web d'inspection complète.\§7 Alias: /plan qi -In Depth Help - /plan search ? || §2Commande de recherche\§f Utilisé pour obtenir une liste des noms de joueurs qui correspondent à l'argument donné.\§7 Exemple: /plan search 123 - Trouve tous les utilisateurs avec 123 dans leur nom. -In Depth Help - /plan webuser ? || §2Commande de gestion des utilisateurs Web\§f Utilisé pour gérer les utilisateurs Web du plugin\§7 Les utilisateurs ont un niveau de permission:\§f 0 - Accès à toutes les pages\§f 1 - Accès à /players et toutes les pages d'inspection\§f 2 - Accès à sa propre page d'inspection\§7 Alias: /plan web -In Depth Help - /plan webuser register ? || §2Commande Web Register\§f Utilisé pour enregistrer un nouvel utilisateur pour le serveur Web.\§7 L'inscription d'un utilisateur pour un autre joueur nécessite la permission plan.webmanage.\§7 Les mots de passe sont hachés avec PBKDF2 (64,000 itérations de SHA1) en utilisant un sel cryptographiquement aléatoire. -Analysis NOTIFY - Temporary Disable || §eL'analyse a été temporairement désactivée en raison d’un charge trop importante, faites /plan status pour plus d'informations. -Cmd - Click Me || Cliquez ici -Cmd - Fetch Data || §f»§2 Récupération des données dans le cache.. -Cmd - Link || §7 • §2Lien: §f -Cmd - No Results || §7 • §2Aucun résultat pour §7${0}§2. -Cmd - Reload Success || §a[Plan] Recharge terminée. -Cmd - Results || §7 Joueurs correspondants: §f -Cmd - Searching || §f»§2Recherche.. -Cmd - Usage /plan analyze || Voir l'analyse du serveur -Cmd - Usage /plan help || Afficher la liste des commandes. -Cmd - Usage /plan info || Vérifier la version de of Plan -Cmd - Usage /plan inspect || Inspecter les données du joueur -Cmd - Usage /plan list || Liste à tous les joueurs mis en cache -Cmd - Usage /plan manage || Commande de gestion de base de données -Cmd - Usage /plan manage backup || Sauvegarder une base de données dans un fichier .db -Cmd - Usage /plan manage clean || Effacer les anciennes données de la base de données -Cmd - Usage /plan manage clear || Effacer TOUTES les données de la base de données -Cmd - Usage /plan manage dump || Créez un journal Hastebin pour les développeurs pour faciliter le rapport de bug -Cmd - Usage /plan manage hotswap || Hot Swap à une autre base de données et redémarrer le plugin -Cmd - Usage /plan manage import || Importer des données depuis les plugins pris en charge vers la base de données active. -Cmd - Usage /plan manage move || Copier les données d'une base de données à une autre et remplacer les valeurs -Cmd - Usage /plan manage remove || Supprimer les données des joueurs de la base de données active. -Cmd - Usage /plan manage restore || Restaurer une base de données à partir d'un fichier de sauvegarde -Cmd - Usage /plan qanalyze || Voir l'analyse du serveur sous forme de texte -Cmd - Usage /plan qinspect || Inspecter les données du joueur sous forme de texte -Cmd - Usage /plan reload || Redémarrer le plugin (Recharge la configuration) -Cmd - Usage /plan search || Rechercher un joueur -Cmd - Usage /plan webuser || Gérer les utilisateurs Web -Cmd - Usage /plan webuser check || Vérifiez un utilisateur Web et son niveau de permission. -Cmd - Usage /plan webuser delete || Supprimer un utilisateur Web -Cmd - Usage /plan webuser level || Informations sur les niveaux de permission. -Cmd - Usage /plan webuser register || Enregistrer un utilisateur pour le serveur Web -Disable || Player Analytics Désactivé. -Disable - Save || Sauvegarde des données mises en cache.. -Disable - WebServer || Arrêt du serveur Web.. -Enable || Player Analytics Activé. -Enable - Boot Analysis 30s Notify || Analyse | Analyse de démarrage dans 30 secondes.. -Enable - Boot Analysis Notify || Analyse | Démarrage l'analyse de démarrage.. -Enable Db FAIL - Disable Info || L'initialisation de la base de données a échoué, désactivation de Plan. -Enable - Db Info || ${0}-connexion à la base de données établie. -Enable - Db || Initialisation de la base de données.. -Enable FAIL-Db || ${0}-Connexion à la base de données échouée: ${1} -Enable FAIL - Wrong Db Type || Ce type de base de données n'existe pas. -Enable Notify - ChatListener || §eÉcouteur de chat désactivé, information de pseudo inexacte. -Enable Notify - Disabled CommandListener || §eÉcouteur d'utilisation des commandes désactivé. -Enable Notify - Disabled DeathListener || §eÉcouteur de morts désactivé, morts de joueur et de mob non enregistrées.. -Enable Notify-Empty IP || §eL’IP dans server.properties est vide et AlternativeServerIP n'est pas utilisé, des liens incorrects seront donnés ! -Enable Notify - No data view || §eServeur Web désactivé mais AlternativeIP non utilisé, aucun moyen d'afficher les données ! -Enable - WebServer || Initialisation du serveur Web.. -Enable - WebServer Info || Serveur Web en cours d'exécution sur le PORT ${0} -Html - Active || Le joueur est actif -Html - Banned || | Banni -Html - Inactive || Le joueur est inactif -Html - No Extra Plugins ||

    Aucun plugin supplémentaire enregistré.

    -Html - Offline || | Hors ligne -Html - Online || | En ligne -Html - OP || , Opérateur (Op) -Html - Table No Kills || Pas de kills -Manage FAIL - Confirm Action || §c[Plan] Ajoutez -a pour confirmer l'exécution ! ${0} -Manage FAIL - Faulty DB Connection || §c[Plan] Une des bases de données n'a pas été initialisée correctement. -Manage FAIL - Backup File Not Found || §c[Plan] Le fichier de sauvegarde n'existe pas ! -Manage FAIL - Incorrect DB || §c[Plan] Base de données incorrecte ! (sqlite/mysql accepté): -Manage FAIL - Incorrect Plugin || §c[Plan] Plugin non supporté: -Manage FAIL - Empty DB || §c[Plan] La base de données n'a pas de données de joueur ! -Manage FAIL - Unenabled Plugin || §c[Plan] Le plugin n'est pas activé: -Manage FAIL - Same DB || §c[Plan] Impossible de passer à la même base de données ! -Manage - Clear Success || §a[Plan] Toutes les données ont été effacées avec succès! -Manage - Remind Config Change || §e[Plan] N'oubliez pas de basculer vers la nouvelle base de données et de recharger le plugin -Manage - Copy Success || §a[Plan] Toutes les données ont été copiées avec succès ! -Manage - Process Fail || §c[Plan] Quelque chose s'est mal passé pendant le traitement des données ! -Manage - Import || §f» §2 Importation de données.. -Manage - Move Success || §a[Plan] Toutes les données ont été déplacées avec succès ! -Manage - Remove Success || §f» §2Les données de §f${0}§2 ont été supprimées de la base de données §f${1}§2. -Manage - Start || »§7 Traitement des données.. -Manage - Success || §f» §2 Succès ! -Manage NOTIFY - Overwrite || Les données dans la base de données ${0} seront écrasées ! -Manage NOTIFY - Partial Overwrite || Quelques données dans la base de données ${0} seront écrasées ! -Manage NOTIFY - Remove || Les données dans la base de données ${0} seront supprimées ! -Manage NOTIFY - Rewrite || Les données dans la base de données ${0} seront réécrites ! -WARN - Too Small Queue Size || La taille de la file d'attente est trop petite ! (${0}), changez le réglage à un nombre plus élevé ! (Actuellement ${1}) +Cmd - Click Me || Click me +Cmd - Link || §2Link: §f +Cmd Disable - Disabled || §aPlan systems are now disabled. You can still use /planbungee reload to restart the plugin. +Cmd FAIL - Invalid Username || §cUser does not have an UUID. +Cmd FAIL - No Feature || §eDefine a feature to disable! (currently supports ${0}) +Cmd FAIL - No Permission || §cYou do not have the required permission. +Cmd FAIL - Require only one Argument || §cSingle Argument required ${1} +Cmd FAIL - Requires Arguments || §cArguments required (${0}) ${1} +Cmd FAIL - Unknown Username || §cUser has not been seen on this server +Cmd FAIL - WebUser does not exists || §cUser does not exists! +Cmd FAIL - WebUser exists || §cUser already exists! +Cmd Header - Analysis || > §2Analysis Results +Cmd Header - Info || > §2Player Analytics +Cmd Header - Inspect || > §2Player: §f${0} +Cmd Header - Network || > §2Network Page +Cmd Header - Players || > §2Players +Cmd Header - Search || > §2${0} Results for §f${1}§2: +Cmd Header - Servers || > §2Servers +Cmd Header - Web Users || > §2${0} Web Users +Cmd Info - Bungee Connection || §2Connected to Bungee: §f${0} +Cmd Info - Database || §2Active Database: §f${0} +Cmd Info - Reload Complete || §aReload Complete +Cmd Info - Reload Failed || §cSomething went wrong during reload of the plugin, a restart is recommended. +Cmd Info - Update || §2Update Available: §f${0} +Cmd Info - Version || §2Version: §f${0} +Cmd Notify - No WebUser || You might not have a web user, use /plan register +Cmd Notify - WebUser register || Registered new user: '${0}' Perm level: ${1} +Cmd Qinspect - Activity Index || §2Activity Index: §f${0} | ${1} +Cmd Qinspect - Deaths || §2Deaths: §f${0} +Cmd Qinspect - Geolocation || §2Logged in from: §f${0} +Cmd Qinspect - Last Seen || §2Last Seen: §f${0} +Cmd Qinspect - Longest Session || §2Longest Session: §f${0} +Cmd Qinspect - Mob Kills || §2Mob Kills: §f${0} +Cmd Qinspect - Player Kills || §2Player Kills: §f${0} +Cmd Qinspect - Playtime || §2Playtime: §f${0} +Cmd Qinspect - Registered || §2Registered: §f${0} +Cmd Qinspect - Times Kicked || §2Times Kicked: §f${0} +Cmd Setup - Allowed || §aSet-up is now Allowed +Cmd Setup - Bad Request || §eConnection succeeded, but Receiving server was not a Bungee server. Use Bungee address instead. +Cmd Setup - Disallowed || §cSet-up is now Forbidden +Cmd Setup - Forbidden || §eConnection succeeded, but Bungee has set-up mode disabled - use '/planbungee setup' to enable it. +Cmd Setup - Gateway Error || §eConnection succeeded, but Bungee failed to connect to this server (Did current web server restart?). Use /plan m con & /planbungee con to debug. +Cmd Setup - Generic Fail || §eConnection failed: ${0} +Cmd Setup - Internal Error || §eConnection succeeded. ${0}, check possible ErrorLog on receiving server's debug page. +Cmd Setup - Success || §aConnection successful, Plan may restart in a few seconds.. +Cmd Setup - Unauthorized || §eConnection succeeded, but Receiving server didn't authorize this server. Contact Discord for support +Cmd Setup - Url mistake || §cMake sure you're using the full address (Starts with http:// or https://) - Check Bungee enable log for the full address. +Cmd Setup - WebServer not Enabled || §cWebServer is not enabled on this server! Make sure it enables on boot! +Cmd SUCCESS - Feature disabled || §aDisabled '${0}' temporarily until next plugin reload. +Cmd SUCCESS - WebUser register || §aAdded a new user (${0}) successfully! +Cmd Update - Cancel Success || §aCancel operation performed. +Cmd Update - Cancelled || §cUpdate cancelled. +Cmd Update - Change log || Change Log v${0}: +Cmd Update - Fail Cacnel || §cUpdate failed on a server, cancelling update on all servers.. +Cmd Update - Fail Force Notify || §e${0} failed to update, -force specified, continuing update. +Cmd Update - Fail Not Online || §cNot all servers were online or accessible, you can still update available servers using /plan update -u -force +Cmd Update - Notify Cancel || §aYou can cancel the update on servers that haven't rebooted yet with /plan update cancel. +Cmd Update - Online Check || Checking that all servers are online.. +Cmd Update - Scheduled || §a${0} scheduled for update. +Cmd Update - Url mismatch || §cVersion download url did not start with ${0} and might not be trusted. You can download this version manually here (Direct download): +Cmd Web - Permission Levels || >\§70: Access all pages\§71: Access '/players' and all player pages\§72: Access player page with the same username as the webuser\§73+: No permissions +Command Help - /plan analyze || View the Server Page +Command Help - /plan dev || Development mode command +Command Help - /plan help || Show command list +Command Help - /plan info || Check the version of Plan +Command Help - /plan inspect || View a Player Page +Command Help - /plan manage || Manage Plan Database +Command Help - /plan manage backup || Backup a Database +Command Help - /plan manage clear || Clear a Database +Command Help - /plan manage con || Debug Server-Bungee connections +Command Help - /plan manage disable || Disable a feature temporarily +Command Help - /plan manage hotswap || Change Database quickly +Command Help - /plan manage import || Import data from elsewhere +Command Help - /plan manage move || Move data between Databases +Command Help - /plan manage remove || Remove Player's data +Command Help - /plan manage restore || Restore a previous Backup +Command Help - /plan manage setup || Set-up Server-Bungee connection +Command Help - /plan network || View the Network Page +Command Help - /plan players || View the Players Page +Command Help - /plan qinspect || View Player info in game +Command Help - /plan register || Register a Web User +Command Help - /plan reload || Restart Plan +Command Help - /plan search || Search for a player name +Command Help - /plan servers || List servers in Database +Command Help - /plan update || Get change log link or update plugin +Command Help - /plan web check || Inspect a Web User +Command Help - /plan web delete || Delete a Web User +Command Help - /plan web level || Information about permission levels +Command Help - /plan web list || List Web Users +Command Help - /plan webuser || Manage Web Users +Command Help - /planbungee con || Debug Bungee-Server connections +Command Help - /planbungee disable || Disable the plugin temporarily +Command Help - /planbungee setup || Toggle set-up mode +Database - Apply Patch || Applying Patch: ${0}.. +Database - Patches Applied || All database patches applied successfully. +Database - Patches Applied Already || All database patches already applied. +Database MySQL - Launch Options Error || Launch Options were faulty, using default (${0}) +Database Notify - Clean || Removed data of ${0} players. +Database Notify - SQLite No WAL || SQLite WAL mode not supported on this server version, using default. This may or may not affect performance. +Disable || Player Analytics Disabled. +Disable - Processing || Processing critical unprocessed tasks. (${0}) +Disable - Processing Complete || Processing complete. +Disable - WebServer || Webserver has been disabled. +Enable || Player Analytics Enabled. +Enable - Database || ${0}-database connection established. +Enable - Notify Address Confirmation || Make sure that this address points to THIS Server: ${0} +Enable - Notify Empty IP || IP in server.properties is empty & AlternativeIP is not in use. Incorrect links will be given! +Enable - Notify Geolocations disabled || Geolocation gathering is not active. (Data.Geolocations: false) +Enable - Notify Geolocations Internet Required || Plan Requires internet access on first run to download GeoLite2 Geolocation database. +Enable - Notify Webserver disabled || WebServer was not initialized. (WebServer.DisableWebServer: true) +Enable - WebServer || Webserver running on PORT ${0} (${1}) +Enable FAIL - Database || ${0}-Database Connection failed: ${1} +Enable FAIL - Database Patch || Database Patching failed, plugin has to be disabled. Please report this issue +Enable FAIL - GeoDB Write || Something went wrong saving the downloaded GeoLite2 Geolocation database +Enable FAIL - WebServer (Bungee) || WebServer did not initialize! +Enable FAIL - Wrong Database Type || ${0} is not a supported Database +HTML - ACTIVITY_INDEX || Activity Index +HTML - ALL || ALL +HTML - ALL_TIME_PEAK || All Time Peak +HTML - AVERAGE_PING || Average Ping +HTML - AVG || AVG +HTML - BANNED || Banned +HTML - BEST_PING || Best Ping +HTML - CALENDAR || CALENDAR +HTML - CALENDAR_TEXT || Calendar +HTML - CHUNKS || Chunks +HTML - COMMAND || Command +HTML - COMMNAND_USAGE || Command Usage +HTML - CONNECTION_INFORMATION || Connection Information +HTML - COUNTRY || Country +HTML - CURRENT_PLAYERBASE || Current Playerbase +HTML - DEATHS || Deaths +HTML - ENTITIES || Entities +HTML - ERROR || Authentication failed due to error +HTML - FAVORITE_SERVER || Favorite Server +HTML - GEOLOCATION || Geolocation +HTML - GEOLOCATION_TEXT || Geolocation +HTML - HEALTH_ESTIMATE || Health Estimate +HTML - INDEX_ACTIVE || Active +HTML - INDEX_INACTIVE || Inactive +HTML - INDEX_IRREGULAR || Irregular +HTML - INDEX_REGULAR || Regular +HTML - INDEX_VERY_ACTIVE || Very Active +HTML - IP_ADDRESS || IP-address +HTML - KILLED || Killed +HTML - KILLED_BY || Killed by +HTML - LAST_24_HOURS || LAST 24 HOURS +HTML - LAST_30_DAYS || LAST 30 DAYS +HTML - LAST_30_DAYS_TEXT || Last 30 Days +HTML - LAST_7_DAYS || LAST 7 DAYS +HTML - LAST_CONNECTED || Last Connected +HTML - LAST_PEAK || Last Peak +HTML - LAST_SEEN || LAST SEEN +HTML - LAST_SEEN_TEXT || Last Seen +HTML - LOADED_CHUNKS || Loaded Chunks +HTML - LOADED_ENTITIES || Loaded Entities +HTML - LOCAL_MACHINE || Local Machine +HTML - LONGEST || Longest +HTML - LOW_TPS_SPIKES || Low TPS Spikes +HTML - MOB_CAUSED_DEATHS || Mob caused Deaths +HTML - MOB_KDR || Mob KDR +HTML - MOB_KILLS || Mob Kills +HTML - MOST_RECENT_SESSIONS || Most Recent Sessions +HTML - NAME || Name +HTML - NAV_COMMAND_USAGE || Command Usage +HTML - NAV_GEOLOCATIONS || Geolocations +HTML - NAV_INFORMATION || Information +HTML - NAV_NETWORK_PLAYERS || Network Players +HTML - NAV_ONLINE_ACTIVITY || Online Activity +HTML - NAV_OVERVIEW || Overview +HTML - NAV_PERFORMANCE || Performance +HTML - NAV_PLAYERS || Players +HTML - NAV_PLUGINS || Plugins +HTML - NAV_SESSIONS || Sessions +HTML - NAV_SEVER_HEALTH || Server Health +HTML - NETWORK || Network +HTML - NETWORK_INFORMATION || NETWORK INFORMATION +HTML - NEW || NEW +HTML - NEW_CALENDAR || New: +HTML - NEW_PLAYERS_TEXT || New Players +HTML - NEW_RETENTION || New Player Retention +HTML - NEW_TEXT || New +HTML - NICKNAME || Nickname +HTML - NO_KILLS || No Kills +HTML - NO_PLAYER_CAUSED_DEATHS || No Player caused Deaths +HTML - OFFLINE || Offline +HTML - ONLINE || Online +HTML - ONLINE_ACTIVITY || ONLINE ACTIVITY +HTML - OPERATOR || Operator +HTML - OVERVIEW || OVERVIEW +HTML - PER_DAY || / Day +HTML - PLAYER_CAUSED_DEATHS || Player caused Deaths +HTML - PLAYER_KILLS || Player Kills +HTML - PLAYER_LIST || Player List +HTML - PLAYERBASE_DEVELOPMENT || Playerbase Development +HTML - PLAYERS || PLAYERS +HTML - PLAYERS_ONLINE || PLAYERS ONLINE +HTML - PLAYERS_ONLINE_TEXT || Players Online +HTML - PLAYERS_TEXT || Players +HTML - PLAYTIME || Playtime +HTML - PLEASE_WAIT || Please wait... +HTML - PREDICETED_RETENTION || Predicted Retention +HTML - PUNCH_CARD || Punchcard +HTML - PUNCHCARD || PUNCHCARD +HTML - RECENT_LOGINS || RECENT LOGINS +HTML - REGISTERED || REGISTERED +HTML - REGISTERED_TEXT || Registered +HTML - REGULAR || REGULAR +HTML - SEEN_NICKNAMES || Seen Nicknames +HTML - SERVER || Server +HTML - SERVER_ANALYSIS || Server Analysis +HTML - SERVER_HEALTH_ESTIMATE || Server Health Estimate +HTML - SERVER_INFORMATION || SERVER INFORMATION +HTML - SERVER_PREFERENCE || Server Preference +HTML - SERVERS || Servers +HTML - SESSION || Session +HTML - SESSION_ENDED || Session Ended +HTML - SESSION_LENGTH || Session Lenght +HTML - SESSION_MEDIAN || Session Median +HTML - SESSIONS || Sessions +HTML - TIME || Time +HTML - TIMES_KICKED || Times Kicked +HTML - TIMES_USED || Times Used +HTML - TOTAL_ACTIVE_TEXT || Total Active +HTML - TOTAL_AFK || Total AFK +HTML - TOTAL_PLAYERS || Total Players +HTML - TOTAL_PLAYTIME || Total Playtime +HTML - UNIQUE || UNIQUE +HTML - UNIQUE_CALENDAR || Unique: +HTML - UNIQUE_PLAYERS || UNIQUE PLAYERS +HTML - UNIQUE_PLAYERS_TEXT || Unique Players +HTML - UNIQUE_TEXT || Unique +HTML - USAGE || Usage +HTML - USED_COMMANDS || Used Commands +HTML - USER_AND_PASS_NOT_SPECIFIED || User and Password not specified +HTML - USER_DOES_NOT_EXIST || User does not exist +HTML - USER_INFORMATION || USER INFORMATION +HTML - USER_PASS_MISMATCH || User and Password did not match +HTML - WITH || With +HTML - WORLD || World +HTML - WORLD_LOAD || WORLD LOAD +HTML - WORLD_PLAYTIME || World Playtime +HTML - WORST_PING || Worst Ping +HTML ERRORS - ACCESS_DENIED_403 || Access Denied +HTML ERRORS - ANALYSIS_REFRESH || Analysis is being refreshed.. +HTML ERRORS - ANALYSIS_REFRESH_LONG || Analysis is being run, refresh the page after a few seconds.. +HTML ERRORS - AUTH_FAIL_TIPS_401 || - Ensure you have registered a user with /plan register
    - Check that the username and password are correct
    - Username and password are case-sensitive

    If you have forgotten your password, ask a staff member to delete your old user and re-register. +HTML ERRORS - AUTHENTICATION_FAIlED_401 || Authentication Failed. +HTML ERRORS - FORBIDDEN_403 || Forbidden +HTML ERRORS - NO_SERVERS_404 || No Servers online to perform the request. +HTML ERRORS - NOT_FOUND_404 || Not Found +HTML ERRORS - NOT_PLAYED_404 || Player has not played on this server. +HTML ERRORS - PAGE_NOT_FOUND_404 || Page does not exist. +HTML ERRORS - UNAUTHORIZED_401 || Unauthorized +HTML ERRORS - UNKNOWN_PAGE_404 || Make sure you're accessing a link given by a command, Examples:

    /player/PlayerName
    /server/ServerName

    +HTML ERRORS - UUID_404 || Player UUID was not found in the database. +In Depth Help - /plan ? || > §2Main Command\ Access to subcommands and help\ §2/plan §fList subcommands\ §2/plan ? §fIn depth help +In Depth Help - /plan analyze ? || > §2Analysis Command\ Refreshes server page and displays link to the web page. +In Depth Help - /plan inspect ? || > §2Inspect Command\ Refreshes player page and displays link to the web page. +In Depth Help - /plan manage ? || > §2Manage Command\ Manage MySQL and SQLite database of Plan.\ §2/plan m §fList subcommands\ §2/plan m ? §fIn depth help +In Depth Help - /plan manage backup ? || > §2Backup Subcommand\ Creates a new SQLite database (.db file) with contents of currently active database in the Plan plugin folder. +In Depth Help - /plan manage clear ? || > §2Clear Subcommand\ Removes everything in the active database. Use with caution. +In Depth Help - /plan manage con ? || > §2Connection Debug Subcommand\ Used to debug connections in the network.\ Sends a request to each server in the database. +In Depth Help - /plan manage disable ? || > §2Disable Subcommand\ Can disable parts of the plugin until next reload.\ Accepted arguments:\ §2kickcount §fDisables kick counts in case /kickall is used on shutdown macro. +In Depth Help - /plan manage import ? || > §2Import Subcommand\ Import data from other sources.\ Accepted Arguments:\ §2offline §fBukkit player data, only register date and name. +In Depth Help - /plan manage move ? || > §2Move Subcommand\ Move data from SQLite to MySQL or other way around.\ Target database is cleared before transfer. +In Depth Help - /plan manage remove ? || > §2Remove Subcommand\ Remove player's data from the active database. +In Depth Help - /plan manage restore ? || > §2Restore Subcommand\ Restore a previous backup SQLite database (.db file)\ You can also restore database.db from another server to MySQL.\ Target database is cleared before transfer. +In Depth Help - /plan manage setup ? || > §2Setup Subcommand\ Set-up a connection between Bungee and this server for network functionality.\ BungeeAddress can be found in the enable log on console when Plan enables on Bungee. +In Depth Help - /plan network ? || > §2Network Command\ Displays link to the network page.\ If not on a network, this page displays the server page. +In Depth Help - /plan players ? || > §2Players Command\ Displays link to the players page. +In Depth Help - /plan qinspect ? || > §2Quick Inspect Command\ Displays some information about the player in game. +In Depth Help - /plan reload ? || > §2Reload Command\ Restarts the plugin using onDisable and onEnable.\ §bDoes not support swapping jar on the fly +In Depth Help - /plan search ? || > §2Search Command\ Get a list of Player names that match the given argument.\§7 Example: /plan search 123 - Finds all users with 123 in their name. +In Depth Help - /plan servers ? || > §2Servers Command\ Displays list of Plan servers in the Database.\ Can be used to debug issues with database registration on a network. +In Depth Help - /plan update ? || > §2Update Command\ Used to update the plugin on the next shutdown\ /plan update - Changelog link\ /plan update -u - Schedule update to happen on all network servers that are online, next time they reboot.\ /plan update cancel - Cancel scheduled update on servers that haven't rebooted yet. +In Depth Help - /plan web ? || < §2Web User Manage Command.\ §2/plan web §fList subcommands\ §2/plan web ? §fIn Depth help +In Depth Help - /plan web register ? || > §2Register Subcommand\ Registers a new Web User.\ Registering a user for another player requires plan.webmanage permission.\ Passwords are hashed with PBKDF2 (64,000 iterations of SHA1) using a cryptographically-random salt. +In Depth Help - /planbungee disable ? || > §2Disable Command\ Runs onDisable on PlanBungee.\ Plugin can be enabled with /planbungee reload afterwards.\ §bDoes not support swapping jar on the fly +In Depth Help - /planbungee setup ? || > §2Set-up toggle Command\ Toggles set-up mode on Bungee.\ Safeguard against unauthorized MySQL snooping with another server. +Manage - Confirm Overwrite || Data in ${0} will be overwritten! +Manage - Confirm Removal || Data in ${0} will be removed! +Manage - Fail || > §cSomething went wrong: ${0} +Manage - Fail File not found || > §cNo File found at ${0} +Manage - Fail Incorrect Database || > §c'${0}' is not a supported database. +Manage - Fail No Importer || §eImporter '${0}' doesn't exist +Manage - Fail Same Database || > §cCan not operate on to and from the same database! +Manage - Fail, Confirmation || > §cAdd '-a' argument to confirm execution: ${0} +Manage - Fail, Connection Exception || §eFail reason: +Manage - Fail, No Servers || §cNo Servers found in the database. +Manage - Fail, Old version || §eFail reason: Older Plan version on receiving server +Manage - Fail, Unauthorized || §eFail reason: Unauthorized. Server might be using different database. +Manage - Fail, Unexpected Exception || §eOdd Exception: ${0} +Manage - List Importers || Importers: +Manage - Notify External Url || §eNon-local address, check that port is open +Manage - Remind HotSwap || §eRemember to swap to the new database (/plan m hotswap ${0}) & reload the plugin. +Manage - Start || > §2Processing data.. +Manage - Success || > §aSuccess! +Negative || No +Positive || Yes +Unknown || Unknown +Version - DEV || This is a DEV release. +Version - Latest || You're using the latest version. +Version - New || New Release (${0}) is available ${1} +Version - New (old) || New Version is available at ${0} +Version FAIL - Read info (old) || Failed to check newest version number +Version FAIL - Read versions.txt || Version information could not be loaded from Github/versions.txt +Web User Listing || §2${0} §7: §f${1} +WebServer - Notify HTTP || WebServer: No Certificate -> Using HTTP-server for Visualization. +WebServer - Notify HTTP User Auth || WebServer: User Authorization Disabled! (Not secure over HTTP) +WebServer - Notify no Cert file || WebServer: Certificate KeyStore File not Found: ${0} +WebServer FAIL - Port Bind || WebServer was not initialized successfully. Is the port (${0}) in use? +WebServer FAIL - SSL Context || WebServer: SSL Context Initialization Failed. +WebServer FAIL - Store Load || WebServer: SSL Certificate loading Failed. diff --git a/Plan/src/main/resources/locale/locale_FR_old.txt b/Plan/src/main/resources/locale/locale_FR_old.txt new file mode 100644 index 000000000..6cdfddc45 --- /dev/null +++ b/Plan/src/main/resources/locale/locale_FR_old.txt @@ -0,0 +1,118 @@ +Analysis - Third Party || Analyse | Analyse des sources de données supplémentaires (tierce partie). +Analysis FAIL - Fetch Exception || Analyse | Échec de l’extraction des données pour l’analyse, une exception s'est produite. +Analysis FAIL - No Data || Analyse | L'analyse a échoué, aucune donnée dans la base de données. +Analysis FAIL - No Players || Analyse | L'analyse a échoué, aucun joueur connu. +Analysis - Fetch Phase || Analyse | Récupération des données.. +Analysis - Fetch Phase Start || Analyse | Vérification des joueurs disponibles.. +Analysis - Complete || Analyse | Analyse terminée. (En ${0}ms) ${1} +Analysis - Begin Analysis || Analyse | Données récupérées (${0} utilisateurs, en ${1}ms), début Analyse des données.. +Analysis - Start || Analyse | Début de l'analyse des données utilisateur.. +>Constant - CMD Footer || §f» +>Constant - List Ball || §7 •§2 +Cmd FAIL - No Data View || §e[Plan] Aucun moyen de voir les données disponibles. +Cmd FAIL - No Permission || §c[Plan] Vous n'avez pas la permission requise. +Cmd FAIL - Requires Arguments || §c[Plan] La commande nécessite des arguments. ${0} +Cmd FAIL - Require only one Argument || §c[Plan] La commande nécessite un argument. +Cmd FAIL - Timeout || §c[Plan] ${0} La commande a expiré ! Vérifiez avec '/plan status' et la console. +Cmd FAIL - Unknown Username || §c[Plan] Joueur introuvable dans la base de données. +Cmd FAIL - Unseen Username || §c[Plan] Ce joueur n'a pas joué sur ce serveur. +Cmd FAIL - Invalid Username || §c[Plan] Ce joueur n'existe pas. +Cmd Header - Analysis || §f»§2 Player Analytics - Résultats de l’analyse +Cmd Header - Info || §f»§2 Player Analytics - Info +Cmd Header - Inspect || §f»§2 Player Analytics - Résultats de l’inspection +Cmd Header - Search || §f»§2 Player Analytics - Résultats de la recherche: +In Depth Help - /plan analyze ? || §2Commande d’analyse\§f Utilisé pour actualiser le cache d'analyse et accéder à la page de résultats\§7 /plan status peut être utilisé pour vérifier le statut de l'analyse pendant son exécution.\§7 Alias: analyze, analyse, analysis, a +In Depth Help - /plan inspect ? || §2Commande d’inspection\§f Utilisé pour obtenir un lien vers la page d'inspection d’un utilisateur.\§7 Votre propre page d'inspection peut être consultée avec /plan inspect\§7 Alias: /plan +In Depth Help - /plan list ? || §2Commande de listing\§f Utilisé pour obtenir un lien vers la page des joueurs.\§7 La page des joueurs contient des liens vers toutes les pages d'inspection mises en cache.\§7 Alias: /plan pl +In Depth Help - /plan manage ? || §2Commande de gestion\§f Utilisé pour gérer la base de données du plugin.\§7 Alias: /plan m\§7 /plan m - Liste des sous-commandes\§7 /plan m ? - aide approfondie +In Depth Help - /plan manage clear ? || §2Gestion: Commande d’effacement.\§f Utilisé pour supprimer TOUTES les données dans la base de données active.\§7 Le plugin doit être rechargé après l’effacement terminé.\§7 Alias: /plan pl +In Depth Help - /plan manage dump ? || §2Gestion: Commande de listage\§f Utilisé pour lister des données importantes pour le rapport de bug à hastebin. +In Depth Help - /plan manage hotswap ? || §2Gestion: Commande de Hotswap\§f Utilisé pour modifier la base de données en cours d'utilisation.\§7 Ne change pas la base de données si la connexion échoue. +In Depth Help - /plan manage import ? || §2Gestion: Commande d'importation\§f Utilisé pour importer des données d'autres sources\§7 L'analyse sera désactivée pendant l'importation. +In Depth Help - /plan manage remove ? || §2Gestion: Commande de suppression\§f Utilisé pour supprimer les données de l'utilisateur de la base de données active. +In Depth Help - /plan ? || §2/plan - Commande principale\§f Utilisé pour accéder à toutes les sous-commandes et aide\§7 /plan - Liste des sous-commandes\§7 /plan ? - aide approfondie +In Depth Help - /plan qanalyze ? || §2Commande d'analyse rapide\§f Utilisé pour obtenir des informations en jeu sur l'analyse.\§7 A moins d'informations que la page Web d'analyse complète.\§7 Alias: qanalyze, ganalyse, qanalysis, qa +In Depth Help - /plan qinspect ? || §2Commande d'inspection rapide\§f Utilisé pour obtenir des informations d'inspection en jeu.\§7 A moins d'informations que la page Web d'inspection complète.\§7 Alias: /plan qi +In Depth Help - /plan search ? || §2Commande de recherche\§f Utilisé pour obtenir une liste des noms de joueurs qui correspondent à l'argument donné.\§7 Exemple: /plan search 123 - Trouve tous les utilisateurs avec 123 dans leur nom. +In Depth Help - /plan webuser ? || §2Commande de gestion des utilisateurs Web\§f Utilisé pour gérer les utilisateurs Web du plugin\§7 Les utilisateurs ont un niveau de permission:\§f 0 - Accès à toutes les pages\§f 1 - Accès à /players et toutes les pages d'inspection\§f 2 - Accès à sa propre page d'inspection\§7 Alias: /plan web +In Depth Help - /plan webuser register ? || §2Commande Web Register\§f Utilisé pour enregistrer un nouvel utilisateur pour le serveur Web.\§7 L'inscription d'un utilisateur pour un autre joueur nécessite la permission plan.webmanage.\§7 Les mots de passe sont hachés avec PBKDF2 (64,000 itérations de SHA1) en utilisant un sel cryptographiquement aléatoire. +Analysis NOTIFY - Temporary Disable || §eL'analyse a été temporairement désactivée en raison d’un charge trop importante, faites /plan status pour plus d'informations. +Cmd - Click Me || Cliquez ici +Cmd - Fetch Data || §f»§2 Récupération des données dans le cache.. +Cmd - Link || §7 • §2Lien: §f +Cmd - No Results || §7 • §2Aucun résultat pour §7${0}§2. +Cmd - Reload Success || §a[Plan] Recharge terminée. +Cmd - Results || §7 Joueurs correspondants: §f +Cmd - Searching || §f»§2Recherche.. +Cmd - Usage /plan analyze || Voir l'analyse du serveur +Cmd - Usage /plan help || Afficher la liste des commandes. +Cmd - Usage /plan info || Vérifier la version de of Plan +Cmd - Usage /plan inspect || Inspecter les données du joueur +Cmd - Usage /plan list || Liste à tous les joueurs mis en cache +Cmd - Usage /plan manage || Commande de gestion de base de données +Cmd - Usage /plan manage backup || Sauvegarder une base de données dans un fichier .db +Cmd - Usage /plan manage clean || Effacer les anciennes données de la base de données +Cmd - Usage /plan manage clear || Effacer TOUTES les données de la base de données +Cmd - Usage /plan manage dump || Créez un journal Hastebin pour les développeurs pour faciliter le rapport de bug +Cmd - Usage /plan manage hotswap || Hot Swap à une autre base de données et redémarrer le plugin +Cmd - Usage /plan manage import || Importer des données depuis les plugins pris en charge vers la base de données active. +Cmd - Usage /plan manage move || Copier les données d'une base de données à une autre et remplacer les valeurs +Cmd - Usage /plan manage remove || Supprimer les données des joueurs de la base de données active. +Cmd - Usage /plan manage restore || Restaurer une base de données à partir d'un fichier de sauvegarde +Cmd - Usage /plan qanalyze || Voir l'analyse du serveur sous forme de texte +Cmd - Usage /plan qinspect || Inspecter les données du joueur sous forme de texte +Cmd - Usage /plan reload || Redémarrer le plugin (Recharge la configuration) +Cmd - Usage /plan search || Rechercher un joueur +Cmd - Usage /plan webuser || Gérer les utilisateurs Web +Cmd - Usage /plan webuser check || Vérifiez un utilisateur Web et son niveau de permission. +Cmd - Usage /plan webuser delete || Supprimer un utilisateur Web +Cmd - Usage /plan webuser level || Informations sur les niveaux de permission. +Cmd - Usage /plan webuser register || Enregistrer un utilisateur pour le serveur Web +Disable || Player Analytics Désactivé. +Disable - Save || Sauvegarde des données mises en cache.. +Disable - WebServer || Arrêt du serveur Web.. +Enable || Player Analytics Activé. +Enable - Boot Analysis 30s Notify || Analyse | Analyse de démarrage dans 30 secondes.. +Enable - Boot Analysis Notify || Analyse | Démarrage l'analyse de démarrage.. +Enable Db FAIL - Disable Info || L'initialisation de la base de données a échoué, désactivation de Plan. +Enable - Db Info || ${0}-connexion à la base de données établie. +Enable - Db || Initialisation de la base de données.. +Enable FAIL-Db || ${0}-Connexion à la base de données échouée: ${1} +Enable FAIL - Wrong Db Type || Ce type de base de données n'existe pas. +Enable Notify - ChatListener || §eÉcouteur de chat désactivé, information de pseudo inexacte. +Enable Notify - Disabled CommandListener || §eÉcouteur d'utilisation des commandes désactivé. +Enable Notify - Disabled DeathListener || §eÉcouteur de morts désactivé, morts de joueur et de mob non enregistrées.. +Enable Notify-Empty IP || §eL’IP dans server.properties est vide et AlternativeServerIP n'est pas utilisé, des liens incorrects seront donnés ! +Enable Notify - No data view || §eServeur Web désactivé mais AlternativeIP non utilisé, aucun moyen d'afficher les données ! +Enable - WebServer || Initialisation du serveur Web.. +Enable - WebServer Info || Serveur Web en cours d'exécution sur le PORT ${0} +Html - Active || Le joueur est actif +Html - Banned || | Banni +Html - Inactive || Le joueur est inactif +Html - No Extra Plugins ||

    Aucun plugin supplémentaire enregistré.

    +Html - Offline || | Hors ligne +Html - Online || | En ligne +Html - OP || , Opérateur (Op) +Html - Table No Kills || Pas de kills +Manage FAIL - Confirm Action || §c[Plan] Ajoutez -a pour confirmer l'exécution ! ${0} +Manage FAIL - Faulty DB Connection || §c[Plan] Une des bases de données n'a pas été initialisée correctement. +Manage FAIL - Backup File Not Found || §c[Plan] Le fichier de sauvegarde n'existe pas ! +Manage FAIL - Incorrect DB || §c[Plan] Base de données incorrecte ! (sqlite/mysql accepté): +Manage FAIL - Incorrect Plugin || §c[Plan] Plugin non supporté: +Manage FAIL - Empty DB || §c[Plan] La base de données n'a pas de données de joueur ! +Manage FAIL - Unenabled Plugin || §c[Plan] Le plugin n'est pas activé: +Manage FAIL - Same DB || §c[Plan] Impossible de passer à la même base de données ! +Manage - Clear Success || §a[Plan] Toutes les données ont été effacées avec succès! +Manage - Remind Config Change || §e[Plan] N'oubliez pas de basculer vers la nouvelle base de données et de recharger le plugin +Manage - Copy Success || §a[Plan] Toutes les données ont été copiées avec succès ! +Manage - Process Fail || §c[Plan] Quelque chose s'est mal passé pendant le traitement des données ! +Manage - Import || §f» §2 Importation de données.. +Manage - Move Success || §a[Plan] Toutes les données ont été déplacées avec succès ! +Manage - Remove Success || §f» §2Les données de §f${0}§2 ont été supprimées de la base de données §f${1}§2. +Manage - Start || »§7 Traitement des données.. +Manage - Success || §f» §2 Succès ! +Manage NOTIFY - Overwrite || Les données dans la base de données ${0} seront écrasées ! +Manage NOTIFY - Partial Overwrite || Quelques données dans la base de données ${0} seront écrasées ! +Manage NOTIFY - Remove || Les données dans la base de données ${0} seront supprimées ! +Manage NOTIFY - Rewrite || Les données dans la base de données ${0} seront réécrites ! +WARN - Too Small Queue Size || La taille de la file d'attente est trop petite ! (${0}), changez le réglage à un nombre plus élevé ! (Actuellement ${1}) diff --git a/Plan/src/main/resources/locale/locale_GA.txt b/Plan/src/main/resources/locale/locale_GA.txt new file mode 100644 index 000000000..29f63a3f2 --- /dev/null +++ b/Plan/src/main/resources/locale/locale_GA.txt @@ -0,0 +1,314 @@ +Cmd - Click Me || Click me +Cmd - Link || §2Link: §f +Cmd Disable - Disabled || §aPlan systems are now disabled. You can still use /planbungee reload to restart the plugin. +Cmd FAIL - Invalid Username || §cUser does not have an UUID. +Cmd FAIL - No Feature || §eDefine a feature to disable! (currently supports ${0}) +Cmd FAIL - No Permission || §cYou do not have the required permission. +Cmd FAIL - Require only one Argument || §cSingle Argument required ${1} +Cmd FAIL - Requires Arguments || §cArguments required (${0}) ${1} +Cmd FAIL - Unknown Username || §cUser has not been seen on this server +Cmd FAIL - WebUser does not exists || §cUser does not exists! +Cmd FAIL - WebUser exists || §cUser already exists! +Cmd Header - Analysis || > §2Analysis Results +Cmd Header - Info || > §2Player Analytics +Cmd Header - Inspect || > §2Player: §f${0} +Cmd Header - Network || > §2Network Page +Cmd Header - Players || > §2Players +Cmd Header - Search || > §2${0} Results for §f${1}§2: +Cmd Header - Servers || > §2Servers +Cmd Header - Web Users || > §2${0} Web Users +Cmd Info - Bungee Connection || §2Connected to Bungee: §f${0} +Cmd Info - Database || §2Active Database: §f${0} +Cmd Info - Reload Complete || §aReload Complete +Cmd Info - Reload Failed || §cSomething went wrong during reload of the plugin, a restart is recommended. +Cmd Info - Update || §2Update Available: §f${0} +Cmd Info - Version || §2Version: §f${0} +Cmd Notify - No WebUser || You might not have a web user, use /plan register +Cmd Notify - WebUser register || Registered new user: '${0}' Perm level: ${1} +Cmd Qinspect - Activity Index || §2Activity Index: §f${0} | ${1} +Cmd Qinspect - Deaths || §2Deaths: §f${0} +Cmd Qinspect - Geolocation || §2Logged in from: §f${0} +Cmd Qinspect - Last Seen || §2Last Seen: §f${0} +Cmd Qinspect - Longest Session || §2Longest Session: §f${0} +Cmd Qinspect - Mob Kills || §2Mob Kills: §f${0} +Cmd Qinspect - Player Kills || §2Player Kills: §f${0} +Cmd Qinspect - Playtime || §2Playtime: §f${0} +Cmd Qinspect - Registered || §2Registered: §f${0} +Cmd Qinspect - Times Kicked || §2Times Kicked: §f${0} +Cmd Setup - Allowed || §aSet-up is now Allowed +Cmd Setup - Bad Request || §eConnection succeeded, but Receiving server was not a Bungee server. Use Bungee address instead. +Cmd Setup - Disallowed || §cSet-up is now Forbidden +Cmd Setup - Forbidden || §eConnection succeeded, but Bungee has set-up mode disabled - use '/planbungee setup' to enable it. +Cmd Setup - Gateway Error || §eConnection succeeded, but Bungee failed to connect to this server (Did current web server restart?). Use /plan m con & /planbungee con to debug. +Cmd Setup - Generic Fail || §eConnection failed: ${0} +Cmd Setup - Internal Error || §eConnection succeeded. ${0}, check possible ErrorLog on receiving server's debug page. +Cmd Setup - Success || §aConnection successful, Plan may restart in a few seconds.. +Cmd Setup - Unauthorized || §eConnection succeeded, but Receiving server didn't authorize this server. Contact Discord for support +Cmd Setup - Url mistake || §cMake sure you're using the full address (Starts with http:// or https://) - Check Bungee enable log for the full address. +Cmd Setup - WebServer not Enabled || §cWebServer is not enabled on this server! Make sure it enables on boot! +Cmd SUCCESS - Feature disabled || §aDisabled '${0}' temporarily until next plugin reload. +Cmd SUCCESS - WebUser register || §aAdded a new user (${0}) successfully! +Cmd Update - Cancel Success || §aCancel operation performed. +Cmd Update - Cancelled || §cUpdate cancelled. +Cmd Update - Change log || Change Log v${0}: +Cmd Update - Fail Cacnel || §cUpdate failed on a server, cancelling update on all servers.. +Cmd Update - Fail Force Notify || §e${0} failed to update, -force specified, continuing update. +Cmd Update - Fail Not Online || §cNot all servers were online or accessible, you can still update available servers using /plan update -u -force +Cmd Update - Notify Cancel || §aYou can cancel the update on servers that haven't rebooted yet with /plan update cancel. +Cmd Update - Online Check || Checking that all servers are online.. +Cmd Update - Scheduled || §a${0} scheduled for update. +Cmd Update - Url mismatch || §cVersion download url did not start with ${0} and might not be trusted. You can download this version manually here (Direct download): +Cmd Web - Permission Levels || >\§70: Access all pages\§71: Access '/players' and all player pages\§72: Access player page with the same username as the webuser\§73+: No permissions +Command Help - /plan analyze || View the Server Page +Command Help - /plan dev || Development mode command +Command Help - /plan help || Show command list +Command Help - /plan info || Check the version of Plan +Command Help - /plan inspect || View a Player Page +Command Help - /plan manage || Manage Plan Database +Command Help - /plan manage backup || Backup a Database +Command Help - /plan manage clear || Clear a Database +Command Help - /plan manage con || Debug Server-Bungee connections +Command Help - /plan manage disable || Disable a feature temporarily +Command Help - /plan manage hotswap || Change Database quickly +Command Help - /plan manage import || Import data from elsewhere +Command Help - /plan manage move || Move data between Databases +Command Help - /plan manage remove || Remove Player's data +Command Help - /plan manage restore || Restore a previous Backup +Command Help - /plan manage setup || Set-up Server-Bungee connection +Command Help - /plan network || View the Network Page +Command Help - /plan players || View the Players Page +Command Help - /plan qinspect || View Player info in game +Command Help - /plan register || Register a Web User +Command Help - /plan reload || Restart Plan +Command Help - /plan search || Search for a player name +Command Help - /plan servers || List servers in Database +Command Help - /plan update || Get change log link or update plugin +Command Help - /plan web check || Inspect a Web User +Command Help - /plan web delete || Delete a Web User +Command Help - /plan web level || Information about permission levels +Command Help - /plan web list || List Web Users +Command Help - /plan webuser || Manage Web Users +Command Help - /planbungee con || Debug Bungee-Server connections +Command Help - /planbungee disable || Disable the plugin temporarily +Command Help - /planbungee setup || Toggle set-up mode +Database - Apply Patch || Applying Patch: ${0}.. +Database - Patches Applied || All database patches applied successfully. +Database - Patches Applied Already || All database patches already applied. +Database MySQL - Launch Options Error || Launch Options were faulty, using default (${0}) +Database Notify - Clean || Removed data of ${0} players. +Database Notify - SQLite No WAL || SQLite WAL mode not supported on this server version, using default. This may or may not affect performance. +Disable || Player Analytics Disabled. +Disable - Processing || Processing critical unprocessed tasks. (${0}) +Disable - Processing Complete || Processing complete. +Disable - WebServer || Webserver has been disabled. +Enable || Player Analytics Enabled. +Enable - Database || ${0}-database connection established. +Enable - Notify Address Confirmation || Make sure that this address points to THIS Server: ${0} +Enable - Notify Empty IP || IP in server.properties is empty & AlternativeIP is not in use. Incorrect links will be given! +Enable - Notify Geolocations disabled || Geolocation gathering is not active. (Data.Geolocations: false) +Enable - Notify Geolocations Internet Required || Plan Requires internet access on first run to download GeoLite2 Geolocation database. +Enable - Notify Webserver disabled || WebServer was not initialized. (WebServer.DisableWebServer: true) +Enable - WebServer || Webserver running on PORT ${0} (${1}) +Enable FAIL - Database || ${0}-Database Connection failed: ${1} +Enable FAIL - Database Patch || Database Patching failed, plugin has to be disabled. Please report this issue +Enable FAIL - GeoDB Write || Something went wrong saving the downloaded GeoLite2 Geolocation database +Enable FAIL - WebServer (Bungee) || WebServer did not initialize! +Enable FAIL - Wrong Database Type || ${0} is not a supported Database +HTML - ACTIVITY_INDEX || Activity Index +HTML - ALL || ALL +HTML - ALL_TIME_PEAK || All Time Peak +HTML - AVERAGE_PING || Average Ping +HTML - AVG || AVG +HTML - BANNED || Banned +HTML - BEST_PING || Best Ping +HTML - CALENDAR || CALENDAR +HTML - CALENDAR_TEXT || Calendar +HTML - CHUNKS || Chunks +HTML - COMMAND || Command +HTML - COMMNAND_USAGE || Command Usage +HTML - CONNECTION_INFORMATION || Connection Information +HTML - COUNTRY || Country +HTML - CURRENT_PLAYERBASE || Current Playerbase +HTML - DEATHS || Deaths +HTML - ENTITIES || Entities +HTML - ERROR || Authentication failed due to error +HTML - FAVORITE_SERVER || Favorite Server +HTML - GEOLOCATION || Geolocation +HTML - GEOLOCATION_TEXT || Geolocation +HTML - HEALTH_ESTIMATE || Health Estimate +HTML - INDEX_ACTIVE || Active +HTML - INDEX_INACTIVE || Inactive +HTML - INDEX_IRREGULAR || Irregular +HTML - INDEX_REGULAR || Regular +HTML - INDEX_VERY_ACTIVE || Very Active +HTML - IP_ADDRESS || IP-address +HTML - KILLED || Killed +HTML - KILLED_BY || Killed by +HTML - LAST_24_HOURS || LAST 24 HOURS +HTML - LAST_30_DAYS || LAST 30 DAYS +HTML - LAST_30_DAYS_TEXT || Last 30 Days +HTML - LAST_7_DAYS || LAST 7 DAYS +HTML - LAST_CONNECTED || Last Connected +HTML - LAST_PEAK || Last Peak +HTML - LAST_SEEN || LAST SEEN +HTML - LAST_SEEN_TEXT || Last Seen +HTML - LOADED_CHUNKS || Loaded Chunks +HTML - LOADED_ENTITIES || Loaded Entities +HTML - LOCAL_MACHINE || Local Machine +HTML - LONGEST || Longest +HTML - LOW_TPS_SPIKES || Low TPS Spikes +HTML - MOB_CAUSED_DEATHS || Mob caused Deaths +HTML - MOB_KDR || Mob KDR +HTML - MOB_KILLS || Mob Kills +HTML - MOST_RECENT_SESSIONS || Most Recent Sessions +HTML - NAME || Name +HTML - NAV_COMMAND_USAGE || Command Usage +HTML - NAV_GEOLOCATIONS || Geolocations +HTML - NAV_INFORMATION || Information +HTML - NAV_NETWORK_PLAYERS || Network Players +HTML - NAV_ONLINE_ACTIVITY || Online Activity +HTML - NAV_OVERVIEW || Overview +HTML - NAV_PERFORMANCE || Performance +HTML - NAV_PLAYERS || Players +HTML - NAV_PLUGINS || Plugins +HTML - NAV_SESSIONS || Sessions +HTML - NAV_SEVER_HEALTH || Server Health +HTML - NETWORK || Network +HTML - NETWORK_INFORMATION || NETWORK INFORMATION +HTML - NEW || NEW +HTML - NEW_CALENDAR || New: +HTML - NEW_PLAYERS_TEXT || New Players +HTML - NEW_RETENTION || New Player Retention +HTML - NEW_TEXT || New +HTML - NICKNAME || Nickname +HTML - NO_KILLS || No Kills +HTML - NO_PLAYER_CAUSED_DEATHS || No Player caused Deaths +HTML - OFFLINE || Offline +HTML - ONLINE || Online +HTML - ONLINE_ACTIVITY || ONLINE ACTIVITY +HTML - OPERATOR || Operator +HTML - OVERVIEW || OVERVIEW +HTML - PER_DAY || / Day +HTML - PLAYER_CAUSED_DEATHS || Player caused Deaths +HTML - PLAYER_KILLS || Player Kills +HTML - PLAYER_LIST || Player List +HTML - PLAYERBASE_DEVELOPMENT || Playerbase Development +HTML - PLAYERS || PLAYERS +HTML - PLAYERS_ONLINE || PLAYERS ONLINE +HTML - PLAYERS_ONLINE_TEXT || Players Online +HTML - PLAYERS_TEXT || Players +HTML - PLAYTIME || Playtime +HTML - PLEASE_WAIT || Please wait... +HTML - PREDICETED_RETENTION || Predicted Retention +HTML - PUNCH_CARD || Punchcard +HTML - PUNCHCARD || PUNCHCARD +HTML - RECENT_LOGINS || RECENT LOGINS +HTML - REGISTERED || REGISTERED +HTML - REGISTERED_TEXT || Registered +HTML - REGULAR || REGULAR +HTML - SEEN_NICKNAMES || Seen Nicknames +HTML - SERVER || Server +HTML - SERVER_ANALYSIS || Server Analysis +HTML - SERVER_HEALTH_ESTIMATE || Server Health Estimate +HTML - SERVER_INFORMATION || SERVER INFORMATION +HTML - SERVER_PREFERENCE || Server Preference +HTML - SERVERS || Servers +HTML - SESSION || Session +HTML - SESSION_ENDED || Session Ended +HTML - SESSION_LENGTH || Session Lenght +HTML - SESSION_MEDIAN || Session Median +HTML - SESSIONS || Sessions +HTML - TIME || Time +HTML - TIMES_KICKED || Times Kicked +HTML - TIMES_USED || Times Used +HTML - TOTAL_ACTIVE_TEXT || Total Active +HTML - TOTAL_AFK || Total AFK +HTML - TOTAL_PLAYERS || Total Players +HTML - TOTAL_PLAYTIME || Total Playtime +HTML - UNIQUE || UNIQUE +HTML - UNIQUE_CALENDAR || Unique: +HTML - UNIQUE_PLAYERS || UNIQUE PLAYERS +HTML - UNIQUE_PLAYERS_TEXT || Unique Players +HTML - UNIQUE_TEXT || Unique +HTML - USAGE || Usage +HTML - USED_COMMANDS || Used Commands +HTML - USER_AND_PASS_NOT_SPECIFIED || User and Password not specified +HTML - USER_DOES_NOT_EXIST || User does not exist +HTML - USER_INFORMATION || USER INFORMATION +HTML - USER_PASS_MISMATCH || User and Password did not match +HTML - WITH || With +HTML - WORLD || World +HTML - WORLD_LOAD || WORLD LOAD +HTML - WORLD_PLAYTIME || World Playtime +HTML - WORST_PING || Worst Ping +HTML ERRORS - ACCESS_DENIED_403 || Access Denied +HTML ERRORS - ANALYSIS_REFRESH || Analysis is being refreshed.. +HTML ERRORS - ANALYSIS_REFRESH_LONG || Analysis is being run, refresh the page after a few seconds.. +HTML ERRORS - AUTH_FAIL_TIPS_401 || - Ensure you have registered a user with /plan register
    - Check that the username and password are correct
    - Username and password are case-sensitive

    If you have forgotten your password, ask a staff member to delete your old user and re-register. +HTML ERRORS - AUTHENTICATION_FAIlED_401 || Authentication Failed. +HTML ERRORS - FORBIDDEN_403 || Forbidden +HTML ERRORS - NO_SERVERS_404 || No Servers online to perform the request. +HTML ERRORS - NOT_FOUND_404 || Not Found +HTML ERRORS - NOT_PLAYED_404 || Player has not played on this server. +HTML ERRORS - PAGE_NOT_FOUND_404 || Page does not exist. +HTML ERRORS - UNAUTHORIZED_401 || Unauthorized +HTML ERRORS - UNKNOWN_PAGE_404 || Make sure you're accessing a link given by a command, Examples:

    /player/PlayerName
    /server/ServerName

    +HTML ERRORS - UUID_404 || Player UUID was not found in the database. +In Depth Help - /plan ? || > §2Main Command\ Access to subcommands and help\ §2/plan §fList subcommands\ §2/plan ? §fIn depth help +In Depth Help - /plan analyze ? || > §2Analysis Command\ Refreshes server page and displays link to the web page. +In Depth Help - /plan inspect ? || > §2Inspect Command\ Refreshes player page and displays link to the web page. +In Depth Help - /plan manage ? || > §2Manage Command\ Manage MySQL and SQLite database of Plan.\ §2/plan m §fList subcommands\ §2/plan m ? §fIn depth help +In Depth Help - /plan manage backup ? || > §2Backup Subcommand\ Creates a new SQLite database (.db file) with contents of currently active database in the Plan plugin folder. +In Depth Help - /plan manage clear ? || > §2Clear Subcommand\ Removes everything in the active database. Use with caution. +In Depth Help - /plan manage con ? || > §2Connection Debug Subcommand\ Used to debug connections in the network.\ Sends a request to each server in the database. +In Depth Help - /plan manage disable ? || > §2Disable Subcommand\ Can disable parts of the plugin until next reload.\ Accepted arguments:\ §2kickcount §fDisables kick counts in case /kickall is used on shutdown macro. +In Depth Help - /plan manage import ? || > §2Import Subcommand\ Import data from other sources.\ Accepted Arguments:\ §2offline §fBukkit player data, only register date and name. +In Depth Help - /plan manage move ? || > §2Move Subcommand\ Move data from SQLite to MySQL or other way around.\ Target database is cleared before transfer. +In Depth Help - /plan manage remove ? || > §2Remove Subcommand\ Remove player's data from the active database. +In Depth Help - /plan manage restore ? || > §2Restore Subcommand\ Restore a previous backup SQLite database (.db file)\ You can also restore database.db from another server to MySQL.\ Target database is cleared before transfer. +In Depth Help - /plan manage setup ? || > §2Setup Subcommand\ Set-up a connection between Bungee and this server for network functionality.\ BungeeAddress can be found in the enable log on console when Plan enables on Bungee. +In Depth Help - /plan network ? || > §2Network Command\ Displays link to the network page.\ If not on a network, this page displays the server page. +In Depth Help - /plan players ? || > §2Players Command\ Displays link to the players page. +In Depth Help - /plan qinspect ? || > §2Quick Inspect Command\ Displays some information about the player in game. +In Depth Help - /plan reload ? || > §2Reload Command\ Restarts the plugin using onDisable and onEnable.\ §bDoes not support swapping jar on the fly +In Depth Help - /plan search ? || > §2Search Command\ Get a list of Player names that match the given argument.\§7 Example: /plan search 123 - Finds all users with 123 in their name. +In Depth Help - /plan servers ? || > §2Servers Command\ Displays list of Plan servers in the Database.\ Can be used to debug issues with database registration on a network. +In Depth Help - /plan update ? || > §2Update Command\ Used to update the plugin on the next shutdown\ /plan update - Changelog link\ /plan update -u - Schedule update to happen on all network servers that are online, next time they reboot.\ /plan update cancel - Cancel scheduled update on servers that haven't rebooted yet. +In Depth Help - /plan web ? || < §2Web User Manage Command.\ §2/plan web §fList subcommands\ §2/plan web ? §fIn Depth help +In Depth Help - /plan web register ? || > §2Register Subcommand\ Registers a new Web User.\ Registering a user for another player requires plan.webmanage permission.\ Passwords are hashed with PBKDF2 (64,000 iterations of SHA1) using a cryptographically-random salt. +In Depth Help - /planbungee disable ? || > §2Disable Command\ Runs onDisable on PlanBungee.\ Plugin can be enabled with /planbungee reload afterwards.\ §bDoes not support swapping jar on the fly +In Depth Help - /planbungee setup ? || > §2Set-up toggle Command\ Toggles set-up mode on Bungee.\ Safeguard against unauthorized MySQL snooping with another server. +Manage - Confirm Overwrite || Data in ${0} will be overwritten! +Manage - Confirm Removal || Data in ${0} will be removed! +Manage - Fail || > §cSomething went wrong: ${0} +Manage - Fail File not found || > §cNo File found at ${0} +Manage - Fail Incorrect Database || > §c'${0}' is not a supported database. +Manage - Fail No Importer || §eImporter '${0}' doesn't exist +Manage - Fail Same Database || > §cCan not operate on to and from the same database! +Manage - Fail, Confirmation || > §cAdd '-a' argument to confirm execution: ${0} +Manage - Fail, Connection Exception || §eFail reason: +Manage - Fail, No Servers || §cNo Servers found in the database. +Manage - Fail, Old version || §eFail reason: Older Plan version on receiving server +Manage - Fail, Unauthorized || §eFail reason: Unauthorized. Server might be using different database. +Manage - Fail, Unexpected Exception || §eOdd Exception: ${0} +Manage - List Importers || Importers: +Manage - Notify External Url || §eNon-local address, check that port is open +Manage - Remind HotSwap || §eRemember to swap to the new database (/plan m hotswap ${0}) & reload the plugin. +Manage - Start || > §2Processing data.. +Manage - Success || > §aSuccess! +Negative || No +Positive || Yes +Unknown || Unknown +Version - DEV || This is a DEV release. +Version - Latest || You're using the latest version. +Version - New || New Release (${0}) is available ${1} +Version - New (old) || New Version is available at ${0} +Version FAIL - Read info (old) || Failed to check newest version number +Version FAIL - Read versions.txt || Version information could not be loaded from Github/versions.txt +Web User Listing || §2${0} §7: §f${1} +WebServer - Notify HTTP || WebServer: No Certificate -> Using HTTP-server for Visualization. +WebServer - Notify HTTP User Auth || WebServer: User Authorization Disabled! (Not secure over HTTP) +WebServer - Notify no Cert file || WebServer: Certificate KeyStore File not Found: ${0} +WebServer FAIL - Port Bind || WebServer was not initialized successfully. Is the port (${0}) in use? +WebServer FAIL - SSL Context || WebServer: SSL Context Initialization Failed. +WebServer FAIL - Store Load || WebServer: SSL Certificate loading Failed. diff --git a/Plan/src/main/resources/locale/locale_IT.txt b/Plan/src/main/resources/locale/locale_IT.txt index ed11648d9..29f63a3f2 100644 --- a/Plan/src/main/resources/locale/locale_IT.txt +++ b/Plan/src/main/resources/locale/locale_IT.txt @@ -1,118 +1,314 @@ -Analysis - Third Party || Analisi | Sto analizzando ulteriori dati (terze parti) -Analysis FAIL - Fetch Exception || Analisi | Errore durante la raccolta dati per l'analisi. -Analysis FAIL - No Data || Analisi | Analisi fallita, nessun dato nel database. -Analysis FAIL - No Players || Analisi | Analisi fallita, nessun player presente. -Analysis - Fetch Phase || Analisi | Raccolta dati.. -Analysis - Fetch Phase Start || Analisi | Verifica players disponibili.. -Analysis - Complete || Analisi | Analisi completa. (ho impiegato ${0}ms) ${1} -Analysis - Begin Analysis || Analisi | Dati raccolti (${0} utenti, ho impiegato ${1}ms), Inizio l'analisi dei dati.. -Analysis - Start || Analisi | Inizio analisi dei dati utente.. ->Constant - CMD Footer || §f» ->Constant - List Ball || §7 •§2 -Cmd FAIL - No Data View || §e[Plan] Nessun modo per visualizzare i dati disponibili. -Cmd FAIL - No Permission || §c[Plan] Non hai il permesso richiesto. -Cmd FAIL - Requires Arguments || §c[Plan] Il comando richiede argomenti. ${0} -Cmd FAIL - Require only one Argument || §c[Plan] Il comando richiede un argomento. -Cmd FAIL - Timeout || §c[Plan] ${0} Time out del comando! Esegui '/plan status' & console. -Cmd FAIL - Unknown Username || §c[Plan] Player non trovato nel database. -Cmd FAIL - Unseen Username || §c[Plan] Questo player non ha mai giocato nel server. -Cmd FAIL - Invalid Username || §c[Plan] Questo player non esiste. -Cmd Header - Analysis || §f»§2 Player Analytics - Analisi risultati -Cmd Header - Info || §f»§2 Player Analytics - Informazioni -Cmd Header - Inspect || §f»§2 Player Analytics - Risultato ispezione -Cmd Header - Search || §f»§2 Player Analytics - Risultati ricerca: -In Depth Help - /plan analyze ? || §2Comando Analyze\§f Usato per aggiornare la cache di analisi & Accedere alla pagina dei risultati\§7 /plan status pue' essere usato per verificare lo stato dell'analisi in corso.\§7 Alias: analyze, analyse, analysis, a -In Depth Help - /plan inspect ? || §2Comando Inspect\§f Usato per ottenere un link alla Pagina Ispezione Utente.\§7 E' possibile accedere alla propria pagina con /plan inspect\§7 Alias: /plan -In Depth Help - /plan list ? || §2Comando List\§f Usato per ottenere un link alla pagina che elenca i players.\§7 La pagina dei players contiene i links a tutte le pagine di ispezione generate.\§7 Alias: /plan pl -In Depth Help - /plan manage ? || §2Comando Manage\§f USato per gestire il database del plugin.\§7 Alias: /plan m\§7 /plan m - Lista sottocomandi\§7 /plan m ? - Help avanzato -In Depth Help - /plan manage clear ? || §2Comando Manage Clear\§f Usato per cancellare TUTTI i dati del database attivo.\§7 Il plugin deve essere reloadato dopo questo comando.\§7 Alias: /plan pl -In Depth Help - /plan manage dump ? || §2Comando Manage Dump\§f Usato per raccogliere dati e caricarli su hastebin per riportare bug. -In Depth Help - /plan manage hotswap ? || §2Comando Manage Hotswap\§f Usato per cambiare database in uso al volo.\§7 L'operazione non viene effettuata se la connessione al database non viene stabilita correttamente. -In Depth Help - /plan manage import ? || §2Comando Manage Import\§f Usato per importare i dati da altre sorgenti\§7 Durante l'importazione non sara' possibile effettuare analisi. -In Depth Help - /plan manage remove ? || §2Comando Manage Remove\§f Usato per rimuovere dati utente dal database in uso. -In Depth Help - /plan ? || §2/plan - Comando Principale\§f Usato per accedere a tutti i sottocomandi & help\§7 /plan - elenca i sottocomandi\§7 /plan ? - Help avanzato -In Depth Help - /plan qanalyze ? || §2Comando Quick Analysis\§f Usato per avere informazioni sull'analisi in game.\§7 Contiene meno informazioni dell'analisi su pagina web.\§7 Alias: qanalyze, ganalyse, qanalysis, qa -In Depth Help - /plan qinspect ? || §2Comando Quick Inspect\§f Usato per avere alcune informazioni in game.\§7 ontiene meno informazioni dell'inspect su pagina web.\§7 Alias: /plan qi -In Depth Help - /plan search ? || §2Comando Search\§f Visualizza una lista dei nami che includono la stringa cercata.\§7 Esempio: /plan search 123 - Trova tutti gli utenti con "123" nel loro nome. -In Depth Help - /plan webuser ? || §2Comando Web User Manage\§f Usato per gestire gli utenti web del plugin\§7 Livello dei permessi:\§f 0 - Accesso a tutte le pagine\§f 1 - Accesso a /players e tutte le pagine inspect\§f 2 - Accesso alla propria pagina inspect\§7 Alias: /plan web -In Depth Help - /plan webuser register ? || §2Comando Web Register\§f Usato per registrare un nuovo utente nel webserver.\§7 La registrazione di un altro utente richiede il permesso plan.webmanage.\§7 Password criptate con PBKDF2 (64,000 iterazioni di SHA1). -Analysis NOTIFY - Temporary Disable || §eAnalisi temporaneamente disabilitata per sovraccarico, usa /plan status per informazioni. -Cmd - Click Me || Cliccami -Cmd - Fetch Data || §f»§2 Raccolta dati nella cache.. -Cmd - Link || §7 • §2Link: §f -Cmd - No Results || §7 • §2Nessun risultato per §7${0}§2. -Cmd - Reload Success || §a[Plan] Reload completo. -Cmd - Results || §7 Matching players: §f -Cmd - Searching || §f»§2Ricerca.. -Cmd - Usage /plan analyze || Visualizza Analisi Server -Cmd - Usage /plan help || Visualizza elenco comandi. -Cmd - Usage /plan info || Controlla la versione di Plan -Cmd - Usage /plan inspect || Ispeziona i dati dei players -Cmd - Usage /plan list || Lista a tutti i players -Cmd - Usage /plan manage || Comando gestione database -Cmd - Usage /plan manage backup || Backup del database in un file .db -Cmd - Usage /plan manage clean || Cancella i vecchi dati dal database -Cmd - Usage /plan manage clear || Cancella TUTTI i dati dal database -Cmd - Usage /plan manage dump || Crea un log su Hastebin log utile per il Developer per la segnalazione bug. -Cmd - Usage /plan manage hotswap || Cambio rapido del database & restart plugin -Cmd - Usage /plan manage import || Importa data da plugin supportati nel database attivo. -Cmd - Usage /plan manage move || Copia dati da un database all'altro e sovrascrive i valori -Cmd - Usage /plan manage remove || Rimuove i dati dei player dal database attivo. -Cmd - Usage /plan manage restore || Ripristina il database da un file di backup -Cmd - Usage /plan qanalyze || Mostra l'analisi del server come testo in game -Cmd - Usage /plan qinspect || Mostra l'inspect di un player come testo in game -Cmd - Usage /plan reload || Ricarica il plugin (Ricarica i config) -Cmd - Usage /plan search || Ricerca player -Cmd - Usage /plan webuser || Gestisci utenti Web -Cmd - Usage /plan webuser check || Controlla un utente Web e il suo livello di permesso. -Cmd - Usage /plan webuser delete || Cancella un utente Web -Cmd - Usage /plan webuser level || Informazioni sui livelli di permesso degli utenti Web. -Cmd - Usage /plan webuser register || Reegistra un utente Web -Disable || Player Analytics Disabilitato. -Disable - Save || Salvo i dati dalla cache.. -Disable - WebServer || Spegnimento Webserver.. -Enable || Player Analytics Abilitato. -Enable - Boot Analysis 30s Notify || Analisi | Analisi all'avvio in 30 secondi.. -Enable - Boot Analysis Notify || Analisi | Inizio analisi all'avvio.. -Enable Db FAIL - Disable Info || Inizializzazione database fallita, disattivazione Plan. -Enable - Db Info || ${0}-connessione al database stabilita. -Enable - Db || Inizializzazione database.. -Enable FAIL-Db || ${0}-Connessione al database fallita: ${1} -Enable FAIL - Wrong Db Type || Questo tipo di database non esiste. -Enable Notify - ChatListener || §eChatListener disabilitato, informazioni sul nickname non accurate. -Enable Notify - Disabled CommandListener || §eCommandListener disabilitato. -Enable Notify - Disabled DeathListener || §eDeathListener disabilitato, morti e uccisioni mob non disponibili. -Enable Notify-Empty IP || §eL'IP nel server.properties e' vuoto & AlternativeServerIP non e' usato, riceverai link errati! -Enable Notify - No data view || §eWebserver disabilitato e Alternative IP non usato, non potrai vedere i dati! -Enable - WebServer || Inizializzazione Webserver.. -Enable - WebServer Info || Webserver attivo sulla PORTA ${0} -Html - Active || Player Attivo -Html - Banned || | Bannati -Html - Inactive || Player non attivo -Html - No Extra Plugins ||

    NEssun altro plugin registrato.

    -Html - Offline || | Offline -Html - Online || | Online -Html - OP || , Operatore (Op) -Html - Table No Kills || No Kills -Manage FAIL - Confirm Action || §c[Plan] Aggiungi "-a" per confermare esecuzione! ${0} -Manage FAIL - Faulty DB Connection || §c[Plan] Uno dei database non e' stato inizializzato correttamente. -Manage FAIL - Backup File Not Found || §c[Plan] BFile di backup inesistente! -Manage FAIL - Incorrect DB || §c[Plan] Database errato! (accettati sqlite o mysql): -Manage FAIL - Incorrect Plugin || §c[Plan] Plugin non supportato: -Manage FAIL - Empty DB || §c[Plan] Il database non ha dati sui player! -Manage FAIL - Unenabled Plugin || §c[Plan] Plugin non abilitato: -Manage FAIL - Same DB || §c[Plan] Non posso spostare i dati sullo stesso database! -Manage - Clear Success || §a[Plan] Tutti i dati cancellati correttamente! -Manage - Remind Config Change || §e[Plan] Ricardati di selezionare il nuovo database e ricaricare il plugin -Manage - Copy Success || §a[Plan] Tutti i dati copiati correttamente! -Manage - Process Fail || §c[Plan] Qualcosa e' andato storto processando i dati! -Manage - Import || §f» §2 Imporazione dei dati.. -Manage - Move Success || §a[Plan] Tutti i dati spostati correttamente! -Manage - Remove Success || §f» §2Dati di §f${0}§2 rimossi dal database §f${1}§2. -Manage - Start || »§7 Processo dei dati in corso.. -Manage - Success || §f» §2 Completato! -Manage NOTIFY - Overwrite || I dati del database ${0} verranno sovrascritti! -Manage NOTIFY - Partial Overwrite || Alcuni dati del database ${0} verranno sovrascritti! -Manage NOTIFY - Remove || I dati del database ${0} verranno rimossi! -Manage NOTIFY - Rewrite || I dati del database ${0} verranno riscritti! -WARN - Too Small Queue Size || Dimensione della coda troppo piccola! (${0}), cambia le impostazioni in un numero maggiore! (Attualmente ${1}) +Cmd - Click Me || Click me +Cmd - Link || §2Link: §f +Cmd Disable - Disabled || §aPlan systems are now disabled. You can still use /planbungee reload to restart the plugin. +Cmd FAIL - Invalid Username || §cUser does not have an UUID. +Cmd FAIL - No Feature || §eDefine a feature to disable! (currently supports ${0}) +Cmd FAIL - No Permission || §cYou do not have the required permission. +Cmd FAIL - Require only one Argument || §cSingle Argument required ${1} +Cmd FAIL - Requires Arguments || §cArguments required (${0}) ${1} +Cmd FAIL - Unknown Username || §cUser has not been seen on this server +Cmd FAIL - WebUser does not exists || §cUser does not exists! +Cmd FAIL - WebUser exists || §cUser already exists! +Cmd Header - Analysis || > §2Analysis Results +Cmd Header - Info || > §2Player Analytics +Cmd Header - Inspect || > §2Player: §f${0} +Cmd Header - Network || > §2Network Page +Cmd Header - Players || > §2Players +Cmd Header - Search || > §2${0} Results for §f${1}§2: +Cmd Header - Servers || > §2Servers +Cmd Header - Web Users || > §2${0} Web Users +Cmd Info - Bungee Connection || §2Connected to Bungee: §f${0} +Cmd Info - Database || §2Active Database: §f${0} +Cmd Info - Reload Complete || §aReload Complete +Cmd Info - Reload Failed || §cSomething went wrong during reload of the plugin, a restart is recommended. +Cmd Info - Update || §2Update Available: §f${0} +Cmd Info - Version || §2Version: §f${0} +Cmd Notify - No WebUser || You might not have a web user, use /plan register +Cmd Notify - WebUser register || Registered new user: '${0}' Perm level: ${1} +Cmd Qinspect - Activity Index || §2Activity Index: §f${0} | ${1} +Cmd Qinspect - Deaths || §2Deaths: §f${0} +Cmd Qinspect - Geolocation || §2Logged in from: §f${0} +Cmd Qinspect - Last Seen || §2Last Seen: §f${0} +Cmd Qinspect - Longest Session || §2Longest Session: §f${0} +Cmd Qinspect - Mob Kills || §2Mob Kills: §f${0} +Cmd Qinspect - Player Kills || §2Player Kills: §f${0} +Cmd Qinspect - Playtime || §2Playtime: §f${0} +Cmd Qinspect - Registered || §2Registered: §f${0} +Cmd Qinspect - Times Kicked || §2Times Kicked: §f${0} +Cmd Setup - Allowed || §aSet-up is now Allowed +Cmd Setup - Bad Request || §eConnection succeeded, but Receiving server was not a Bungee server. Use Bungee address instead. +Cmd Setup - Disallowed || §cSet-up is now Forbidden +Cmd Setup - Forbidden || §eConnection succeeded, but Bungee has set-up mode disabled - use '/planbungee setup' to enable it. +Cmd Setup - Gateway Error || §eConnection succeeded, but Bungee failed to connect to this server (Did current web server restart?). Use /plan m con & /planbungee con to debug. +Cmd Setup - Generic Fail || §eConnection failed: ${0} +Cmd Setup - Internal Error || §eConnection succeeded. ${0}, check possible ErrorLog on receiving server's debug page. +Cmd Setup - Success || §aConnection successful, Plan may restart in a few seconds.. +Cmd Setup - Unauthorized || §eConnection succeeded, but Receiving server didn't authorize this server. Contact Discord for support +Cmd Setup - Url mistake || §cMake sure you're using the full address (Starts with http:// or https://) - Check Bungee enable log for the full address. +Cmd Setup - WebServer not Enabled || §cWebServer is not enabled on this server! Make sure it enables on boot! +Cmd SUCCESS - Feature disabled || §aDisabled '${0}' temporarily until next plugin reload. +Cmd SUCCESS - WebUser register || §aAdded a new user (${0}) successfully! +Cmd Update - Cancel Success || §aCancel operation performed. +Cmd Update - Cancelled || §cUpdate cancelled. +Cmd Update - Change log || Change Log v${0}: +Cmd Update - Fail Cacnel || §cUpdate failed on a server, cancelling update on all servers.. +Cmd Update - Fail Force Notify || §e${0} failed to update, -force specified, continuing update. +Cmd Update - Fail Not Online || §cNot all servers were online or accessible, you can still update available servers using /plan update -u -force +Cmd Update - Notify Cancel || §aYou can cancel the update on servers that haven't rebooted yet with /plan update cancel. +Cmd Update - Online Check || Checking that all servers are online.. +Cmd Update - Scheduled || §a${0} scheduled for update. +Cmd Update - Url mismatch || §cVersion download url did not start with ${0} and might not be trusted. You can download this version manually here (Direct download): +Cmd Web - Permission Levels || >\§70: Access all pages\§71: Access '/players' and all player pages\§72: Access player page with the same username as the webuser\§73+: No permissions +Command Help - /plan analyze || View the Server Page +Command Help - /plan dev || Development mode command +Command Help - /plan help || Show command list +Command Help - /plan info || Check the version of Plan +Command Help - /plan inspect || View a Player Page +Command Help - /plan manage || Manage Plan Database +Command Help - /plan manage backup || Backup a Database +Command Help - /plan manage clear || Clear a Database +Command Help - /plan manage con || Debug Server-Bungee connections +Command Help - /plan manage disable || Disable a feature temporarily +Command Help - /plan manage hotswap || Change Database quickly +Command Help - /plan manage import || Import data from elsewhere +Command Help - /plan manage move || Move data between Databases +Command Help - /plan manage remove || Remove Player's data +Command Help - /plan manage restore || Restore a previous Backup +Command Help - /plan manage setup || Set-up Server-Bungee connection +Command Help - /plan network || View the Network Page +Command Help - /plan players || View the Players Page +Command Help - /plan qinspect || View Player info in game +Command Help - /plan register || Register a Web User +Command Help - /plan reload || Restart Plan +Command Help - /plan search || Search for a player name +Command Help - /plan servers || List servers in Database +Command Help - /plan update || Get change log link or update plugin +Command Help - /plan web check || Inspect a Web User +Command Help - /plan web delete || Delete a Web User +Command Help - /plan web level || Information about permission levels +Command Help - /plan web list || List Web Users +Command Help - /plan webuser || Manage Web Users +Command Help - /planbungee con || Debug Bungee-Server connections +Command Help - /planbungee disable || Disable the plugin temporarily +Command Help - /planbungee setup || Toggle set-up mode +Database - Apply Patch || Applying Patch: ${0}.. +Database - Patches Applied || All database patches applied successfully. +Database - Patches Applied Already || All database patches already applied. +Database MySQL - Launch Options Error || Launch Options were faulty, using default (${0}) +Database Notify - Clean || Removed data of ${0} players. +Database Notify - SQLite No WAL || SQLite WAL mode not supported on this server version, using default. This may or may not affect performance. +Disable || Player Analytics Disabled. +Disable - Processing || Processing critical unprocessed tasks. (${0}) +Disable - Processing Complete || Processing complete. +Disable - WebServer || Webserver has been disabled. +Enable || Player Analytics Enabled. +Enable - Database || ${0}-database connection established. +Enable - Notify Address Confirmation || Make sure that this address points to THIS Server: ${0} +Enable - Notify Empty IP || IP in server.properties is empty & AlternativeIP is not in use. Incorrect links will be given! +Enable - Notify Geolocations disabled || Geolocation gathering is not active. (Data.Geolocations: false) +Enable - Notify Geolocations Internet Required || Plan Requires internet access on first run to download GeoLite2 Geolocation database. +Enable - Notify Webserver disabled || WebServer was not initialized. (WebServer.DisableWebServer: true) +Enable - WebServer || Webserver running on PORT ${0} (${1}) +Enable FAIL - Database || ${0}-Database Connection failed: ${1} +Enable FAIL - Database Patch || Database Patching failed, plugin has to be disabled. Please report this issue +Enable FAIL - GeoDB Write || Something went wrong saving the downloaded GeoLite2 Geolocation database +Enable FAIL - WebServer (Bungee) || WebServer did not initialize! +Enable FAIL - Wrong Database Type || ${0} is not a supported Database +HTML - ACTIVITY_INDEX || Activity Index +HTML - ALL || ALL +HTML - ALL_TIME_PEAK || All Time Peak +HTML - AVERAGE_PING || Average Ping +HTML - AVG || AVG +HTML - BANNED || Banned +HTML - BEST_PING || Best Ping +HTML - CALENDAR || CALENDAR +HTML - CALENDAR_TEXT || Calendar +HTML - CHUNKS || Chunks +HTML - COMMAND || Command +HTML - COMMNAND_USAGE || Command Usage +HTML - CONNECTION_INFORMATION || Connection Information +HTML - COUNTRY || Country +HTML - CURRENT_PLAYERBASE || Current Playerbase +HTML - DEATHS || Deaths +HTML - ENTITIES || Entities +HTML - ERROR || Authentication failed due to error +HTML - FAVORITE_SERVER || Favorite Server +HTML - GEOLOCATION || Geolocation +HTML - GEOLOCATION_TEXT || Geolocation +HTML - HEALTH_ESTIMATE || Health Estimate +HTML - INDEX_ACTIVE || Active +HTML - INDEX_INACTIVE || Inactive +HTML - INDEX_IRREGULAR || Irregular +HTML - INDEX_REGULAR || Regular +HTML - INDEX_VERY_ACTIVE || Very Active +HTML - IP_ADDRESS || IP-address +HTML - KILLED || Killed +HTML - KILLED_BY || Killed by +HTML - LAST_24_HOURS || LAST 24 HOURS +HTML - LAST_30_DAYS || LAST 30 DAYS +HTML - LAST_30_DAYS_TEXT || Last 30 Days +HTML - LAST_7_DAYS || LAST 7 DAYS +HTML - LAST_CONNECTED || Last Connected +HTML - LAST_PEAK || Last Peak +HTML - LAST_SEEN || LAST SEEN +HTML - LAST_SEEN_TEXT || Last Seen +HTML - LOADED_CHUNKS || Loaded Chunks +HTML - LOADED_ENTITIES || Loaded Entities +HTML - LOCAL_MACHINE || Local Machine +HTML - LONGEST || Longest +HTML - LOW_TPS_SPIKES || Low TPS Spikes +HTML - MOB_CAUSED_DEATHS || Mob caused Deaths +HTML - MOB_KDR || Mob KDR +HTML - MOB_KILLS || Mob Kills +HTML - MOST_RECENT_SESSIONS || Most Recent Sessions +HTML - NAME || Name +HTML - NAV_COMMAND_USAGE || Command Usage +HTML - NAV_GEOLOCATIONS || Geolocations +HTML - NAV_INFORMATION || Information +HTML - NAV_NETWORK_PLAYERS || Network Players +HTML - NAV_ONLINE_ACTIVITY || Online Activity +HTML - NAV_OVERVIEW || Overview +HTML - NAV_PERFORMANCE || Performance +HTML - NAV_PLAYERS || Players +HTML - NAV_PLUGINS || Plugins +HTML - NAV_SESSIONS || Sessions +HTML - NAV_SEVER_HEALTH || Server Health +HTML - NETWORK || Network +HTML - NETWORK_INFORMATION || NETWORK INFORMATION +HTML - NEW || NEW +HTML - NEW_CALENDAR || New: +HTML - NEW_PLAYERS_TEXT || New Players +HTML - NEW_RETENTION || New Player Retention +HTML - NEW_TEXT || New +HTML - NICKNAME || Nickname +HTML - NO_KILLS || No Kills +HTML - NO_PLAYER_CAUSED_DEATHS || No Player caused Deaths +HTML - OFFLINE || Offline +HTML - ONLINE || Online +HTML - ONLINE_ACTIVITY || ONLINE ACTIVITY +HTML - OPERATOR || Operator +HTML - OVERVIEW || OVERVIEW +HTML - PER_DAY || / Day +HTML - PLAYER_CAUSED_DEATHS || Player caused Deaths +HTML - PLAYER_KILLS || Player Kills +HTML - PLAYER_LIST || Player List +HTML - PLAYERBASE_DEVELOPMENT || Playerbase Development +HTML - PLAYERS || PLAYERS +HTML - PLAYERS_ONLINE || PLAYERS ONLINE +HTML - PLAYERS_ONLINE_TEXT || Players Online +HTML - PLAYERS_TEXT || Players +HTML - PLAYTIME || Playtime +HTML - PLEASE_WAIT || Please wait... +HTML - PREDICETED_RETENTION || Predicted Retention +HTML - PUNCH_CARD || Punchcard +HTML - PUNCHCARD || PUNCHCARD +HTML - RECENT_LOGINS || RECENT LOGINS +HTML - REGISTERED || REGISTERED +HTML - REGISTERED_TEXT || Registered +HTML - REGULAR || REGULAR +HTML - SEEN_NICKNAMES || Seen Nicknames +HTML - SERVER || Server +HTML - SERVER_ANALYSIS || Server Analysis +HTML - SERVER_HEALTH_ESTIMATE || Server Health Estimate +HTML - SERVER_INFORMATION || SERVER INFORMATION +HTML - SERVER_PREFERENCE || Server Preference +HTML - SERVERS || Servers +HTML - SESSION || Session +HTML - SESSION_ENDED || Session Ended +HTML - SESSION_LENGTH || Session Lenght +HTML - SESSION_MEDIAN || Session Median +HTML - SESSIONS || Sessions +HTML - TIME || Time +HTML - TIMES_KICKED || Times Kicked +HTML - TIMES_USED || Times Used +HTML - TOTAL_ACTIVE_TEXT || Total Active +HTML - TOTAL_AFK || Total AFK +HTML - TOTAL_PLAYERS || Total Players +HTML - TOTAL_PLAYTIME || Total Playtime +HTML - UNIQUE || UNIQUE +HTML - UNIQUE_CALENDAR || Unique: +HTML - UNIQUE_PLAYERS || UNIQUE PLAYERS +HTML - UNIQUE_PLAYERS_TEXT || Unique Players +HTML - UNIQUE_TEXT || Unique +HTML - USAGE || Usage +HTML - USED_COMMANDS || Used Commands +HTML - USER_AND_PASS_NOT_SPECIFIED || User and Password not specified +HTML - USER_DOES_NOT_EXIST || User does not exist +HTML - USER_INFORMATION || USER INFORMATION +HTML - USER_PASS_MISMATCH || User and Password did not match +HTML - WITH || With +HTML - WORLD || World +HTML - WORLD_LOAD || WORLD LOAD +HTML - WORLD_PLAYTIME || World Playtime +HTML - WORST_PING || Worst Ping +HTML ERRORS - ACCESS_DENIED_403 || Access Denied +HTML ERRORS - ANALYSIS_REFRESH || Analysis is being refreshed.. +HTML ERRORS - ANALYSIS_REFRESH_LONG || Analysis is being run, refresh the page after a few seconds.. +HTML ERRORS - AUTH_FAIL_TIPS_401 || - Ensure you have registered a user with /plan register
    - Check that the username and password are correct
    - Username and password are case-sensitive

    If you have forgotten your password, ask a staff member to delete your old user and re-register. +HTML ERRORS - AUTHENTICATION_FAIlED_401 || Authentication Failed. +HTML ERRORS - FORBIDDEN_403 || Forbidden +HTML ERRORS - NO_SERVERS_404 || No Servers online to perform the request. +HTML ERRORS - NOT_FOUND_404 || Not Found +HTML ERRORS - NOT_PLAYED_404 || Player has not played on this server. +HTML ERRORS - PAGE_NOT_FOUND_404 || Page does not exist. +HTML ERRORS - UNAUTHORIZED_401 || Unauthorized +HTML ERRORS - UNKNOWN_PAGE_404 || Make sure you're accessing a link given by a command, Examples:

    /player/PlayerName
    /server/ServerName

    +HTML ERRORS - UUID_404 || Player UUID was not found in the database. +In Depth Help - /plan ? || > §2Main Command\ Access to subcommands and help\ §2/plan §fList subcommands\ §2/plan ? §fIn depth help +In Depth Help - /plan analyze ? || > §2Analysis Command\ Refreshes server page and displays link to the web page. +In Depth Help - /plan inspect ? || > §2Inspect Command\ Refreshes player page and displays link to the web page. +In Depth Help - /plan manage ? || > §2Manage Command\ Manage MySQL and SQLite database of Plan.\ §2/plan m §fList subcommands\ §2/plan m ? §fIn depth help +In Depth Help - /plan manage backup ? || > §2Backup Subcommand\ Creates a new SQLite database (.db file) with contents of currently active database in the Plan plugin folder. +In Depth Help - /plan manage clear ? || > §2Clear Subcommand\ Removes everything in the active database. Use with caution. +In Depth Help - /plan manage con ? || > §2Connection Debug Subcommand\ Used to debug connections in the network.\ Sends a request to each server in the database. +In Depth Help - /plan manage disable ? || > §2Disable Subcommand\ Can disable parts of the plugin until next reload.\ Accepted arguments:\ §2kickcount §fDisables kick counts in case /kickall is used on shutdown macro. +In Depth Help - /plan manage import ? || > §2Import Subcommand\ Import data from other sources.\ Accepted Arguments:\ §2offline §fBukkit player data, only register date and name. +In Depth Help - /plan manage move ? || > §2Move Subcommand\ Move data from SQLite to MySQL or other way around.\ Target database is cleared before transfer. +In Depth Help - /plan manage remove ? || > §2Remove Subcommand\ Remove player's data from the active database. +In Depth Help - /plan manage restore ? || > §2Restore Subcommand\ Restore a previous backup SQLite database (.db file)\ You can also restore database.db from another server to MySQL.\ Target database is cleared before transfer. +In Depth Help - /plan manage setup ? || > §2Setup Subcommand\ Set-up a connection between Bungee and this server for network functionality.\ BungeeAddress can be found in the enable log on console when Plan enables on Bungee. +In Depth Help - /plan network ? || > §2Network Command\ Displays link to the network page.\ If not on a network, this page displays the server page. +In Depth Help - /plan players ? || > §2Players Command\ Displays link to the players page. +In Depth Help - /plan qinspect ? || > §2Quick Inspect Command\ Displays some information about the player in game. +In Depth Help - /plan reload ? || > §2Reload Command\ Restarts the plugin using onDisable and onEnable.\ §bDoes not support swapping jar on the fly +In Depth Help - /plan search ? || > §2Search Command\ Get a list of Player names that match the given argument.\§7 Example: /plan search 123 - Finds all users with 123 in their name. +In Depth Help - /plan servers ? || > §2Servers Command\ Displays list of Plan servers in the Database.\ Can be used to debug issues with database registration on a network. +In Depth Help - /plan update ? || > §2Update Command\ Used to update the plugin on the next shutdown\ /plan update - Changelog link\ /plan update -u - Schedule update to happen on all network servers that are online, next time they reboot.\ /plan update cancel - Cancel scheduled update on servers that haven't rebooted yet. +In Depth Help - /plan web ? || < §2Web User Manage Command.\ §2/plan web §fList subcommands\ §2/plan web ? §fIn Depth help +In Depth Help - /plan web register ? || > §2Register Subcommand\ Registers a new Web User.\ Registering a user for another player requires plan.webmanage permission.\ Passwords are hashed with PBKDF2 (64,000 iterations of SHA1) using a cryptographically-random salt. +In Depth Help - /planbungee disable ? || > §2Disable Command\ Runs onDisable on PlanBungee.\ Plugin can be enabled with /planbungee reload afterwards.\ §bDoes not support swapping jar on the fly +In Depth Help - /planbungee setup ? || > §2Set-up toggle Command\ Toggles set-up mode on Bungee.\ Safeguard against unauthorized MySQL snooping with another server. +Manage - Confirm Overwrite || Data in ${0} will be overwritten! +Manage - Confirm Removal || Data in ${0} will be removed! +Manage - Fail || > §cSomething went wrong: ${0} +Manage - Fail File not found || > §cNo File found at ${0} +Manage - Fail Incorrect Database || > §c'${0}' is not a supported database. +Manage - Fail No Importer || §eImporter '${0}' doesn't exist +Manage - Fail Same Database || > §cCan not operate on to and from the same database! +Manage - Fail, Confirmation || > §cAdd '-a' argument to confirm execution: ${0} +Manage - Fail, Connection Exception || §eFail reason: +Manage - Fail, No Servers || §cNo Servers found in the database. +Manage - Fail, Old version || §eFail reason: Older Plan version on receiving server +Manage - Fail, Unauthorized || §eFail reason: Unauthorized. Server might be using different database. +Manage - Fail, Unexpected Exception || §eOdd Exception: ${0} +Manage - List Importers || Importers: +Manage - Notify External Url || §eNon-local address, check that port is open +Manage - Remind HotSwap || §eRemember to swap to the new database (/plan m hotswap ${0}) & reload the plugin. +Manage - Start || > §2Processing data.. +Manage - Success || > §aSuccess! +Negative || No +Positive || Yes +Unknown || Unknown +Version - DEV || This is a DEV release. +Version - Latest || You're using the latest version. +Version - New || New Release (${0}) is available ${1} +Version - New (old) || New Version is available at ${0} +Version FAIL - Read info (old) || Failed to check newest version number +Version FAIL - Read versions.txt || Version information could not be loaded from Github/versions.txt +Web User Listing || §2${0} §7: §f${1} +WebServer - Notify HTTP || WebServer: No Certificate -> Using HTTP-server for Visualization. +WebServer - Notify HTTP User Auth || WebServer: User Authorization Disabled! (Not secure over HTTP) +WebServer - Notify no Cert file || WebServer: Certificate KeyStore File not Found: ${0} +WebServer FAIL - Port Bind || WebServer was not initialized successfully. Is the port (${0}) in use? +WebServer FAIL - SSL Context || WebServer: SSL Context Initialization Failed. +WebServer FAIL - Store Load || WebServer: SSL Certificate loading Failed. diff --git a/Plan/src/main/resources/locale/locale_IT_old.txt b/Plan/src/main/resources/locale/locale_IT_old.txt new file mode 100644 index 000000000..ed11648d9 --- /dev/null +++ b/Plan/src/main/resources/locale/locale_IT_old.txt @@ -0,0 +1,118 @@ +Analysis - Third Party || Analisi | Sto analizzando ulteriori dati (terze parti) +Analysis FAIL - Fetch Exception || Analisi | Errore durante la raccolta dati per l'analisi. +Analysis FAIL - No Data || Analisi | Analisi fallita, nessun dato nel database. +Analysis FAIL - No Players || Analisi | Analisi fallita, nessun player presente. +Analysis - Fetch Phase || Analisi | Raccolta dati.. +Analysis - Fetch Phase Start || Analisi | Verifica players disponibili.. +Analysis - Complete || Analisi | Analisi completa. (ho impiegato ${0}ms) ${1} +Analysis - Begin Analysis || Analisi | Dati raccolti (${0} utenti, ho impiegato ${1}ms), Inizio l'analisi dei dati.. +Analysis - Start || Analisi | Inizio analisi dei dati utente.. +>Constant - CMD Footer || §f» +>Constant - List Ball || §7 •§2 +Cmd FAIL - No Data View || §e[Plan] Nessun modo per visualizzare i dati disponibili. +Cmd FAIL - No Permission || §c[Plan] Non hai il permesso richiesto. +Cmd FAIL - Requires Arguments || §c[Plan] Il comando richiede argomenti. ${0} +Cmd FAIL - Require only one Argument || §c[Plan] Il comando richiede un argomento. +Cmd FAIL - Timeout || §c[Plan] ${0} Time out del comando! Esegui '/plan status' & console. +Cmd FAIL - Unknown Username || §c[Plan] Player non trovato nel database. +Cmd FAIL - Unseen Username || §c[Plan] Questo player non ha mai giocato nel server. +Cmd FAIL - Invalid Username || §c[Plan] Questo player non esiste. +Cmd Header - Analysis || §f»§2 Player Analytics - Analisi risultati +Cmd Header - Info || §f»§2 Player Analytics - Informazioni +Cmd Header - Inspect || §f»§2 Player Analytics - Risultato ispezione +Cmd Header - Search || §f»§2 Player Analytics - Risultati ricerca: +In Depth Help - /plan analyze ? || §2Comando Analyze\§f Usato per aggiornare la cache di analisi & Accedere alla pagina dei risultati\§7 /plan status pue' essere usato per verificare lo stato dell'analisi in corso.\§7 Alias: analyze, analyse, analysis, a +In Depth Help - /plan inspect ? || §2Comando Inspect\§f Usato per ottenere un link alla Pagina Ispezione Utente.\§7 E' possibile accedere alla propria pagina con /plan inspect\§7 Alias: /plan +In Depth Help - /plan list ? || §2Comando List\§f Usato per ottenere un link alla pagina che elenca i players.\§7 La pagina dei players contiene i links a tutte le pagine di ispezione generate.\§7 Alias: /plan pl +In Depth Help - /plan manage ? || §2Comando Manage\§f USato per gestire il database del plugin.\§7 Alias: /plan m\§7 /plan m - Lista sottocomandi\§7 /plan m ? - Help avanzato +In Depth Help - /plan manage clear ? || §2Comando Manage Clear\§f Usato per cancellare TUTTI i dati del database attivo.\§7 Il plugin deve essere reloadato dopo questo comando.\§7 Alias: /plan pl +In Depth Help - /plan manage dump ? || §2Comando Manage Dump\§f Usato per raccogliere dati e caricarli su hastebin per riportare bug. +In Depth Help - /plan manage hotswap ? || §2Comando Manage Hotswap\§f Usato per cambiare database in uso al volo.\§7 L'operazione non viene effettuata se la connessione al database non viene stabilita correttamente. +In Depth Help - /plan manage import ? || §2Comando Manage Import\§f Usato per importare i dati da altre sorgenti\§7 Durante l'importazione non sara' possibile effettuare analisi. +In Depth Help - /plan manage remove ? || §2Comando Manage Remove\§f Usato per rimuovere dati utente dal database in uso. +In Depth Help - /plan ? || §2/plan - Comando Principale\§f Usato per accedere a tutti i sottocomandi & help\§7 /plan - elenca i sottocomandi\§7 /plan ? - Help avanzato +In Depth Help - /plan qanalyze ? || §2Comando Quick Analysis\§f Usato per avere informazioni sull'analisi in game.\§7 Contiene meno informazioni dell'analisi su pagina web.\§7 Alias: qanalyze, ganalyse, qanalysis, qa +In Depth Help - /plan qinspect ? || §2Comando Quick Inspect\§f Usato per avere alcune informazioni in game.\§7 ontiene meno informazioni dell'inspect su pagina web.\§7 Alias: /plan qi +In Depth Help - /plan search ? || §2Comando Search\§f Visualizza una lista dei nami che includono la stringa cercata.\§7 Esempio: /plan search 123 - Trova tutti gli utenti con "123" nel loro nome. +In Depth Help - /plan webuser ? || §2Comando Web User Manage\§f Usato per gestire gli utenti web del plugin\§7 Livello dei permessi:\§f 0 - Accesso a tutte le pagine\§f 1 - Accesso a /players e tutte le pagine inspect\§f 2 - Accesso alla propria pagina inspect\§7 Alias: /plan web +In Depth Help - /plan webuser register ? || §2Comando Web Register\§f Usato per registrare un nuovo utente nel webserver.\§7 La registrazione di un altro utente richiede il permesso plan.webmanage.\§7 Password criptate con PBKDF2 (64,000 iterazioni di SHA1). +Analysis NOTIFY - Temporary Disable || §eAnalisi temporaneamente disabilitata per sovraccarico, usa /plan status per informazioni. +Cmd - Click Me || Cliccami +Cmd - Fetch Data || §f»§2 Raccolta dati nella cache.. +Cmd - Link || §7 • §2Link: §f +Cmd - No Results || §7 • §2Nessun risultato per §7${0}§2. +Cmd - Reload Success || §a[Plan] Reload completo. +Cmd - Results || §7 Matching players: §f +Cmd - Searching || §f»§2Ricerca.. +Cmd - Usage /plan analyze || Visualizza Analisi Server +Cmd - Usage /plan help || Visualizza elenco comandi. +Cmd - Usage /plan info || Controlla la versione di Plan +Cmd - Usage /plan inspect || Ispeziona i dati dei players +Cmd - Usage /plan list || Lista a tutti i players +Cmd - Usage /plan manage || Comando gestione database +Cmd - Usage /plan manage backup || Backup del database in un file .db +Cmd - Usage /plan manage clean || Cancella i vecchi dati dal database +Cmd - Usage /plan manage clear || Cancella TUTTI i dati dal database +Cmd - Usage /plan manage dump || Crea un log su Hastebin log utile per il Developer per la segnalazione bug. +Cmd - Usage /plan manage hotswap || Cambio rapido del database & restart plugin +Cmd - Usage /plan manage import || Importa data da plugin supportati nel database attivo. +Cmd - Usage /plan manage move || Copia dati da un database all'altro e sovrascrive i valori +Cmd - Usage /plan manage remove || Rimuove i dati dei player dal database attivo. +Cmd - Usage /plan manage restore || Ripristina il database da un file di backup +Cmd - Usage /plan qanalyze || Mostra l'analisi del server come testo in game +Cmd - Usage /plan qinspect || Mostra l'inspect di un player come testo in game +Cmd - Usage /plan reload || Ricarica il plugin (Ricarica i config) +Cmd - Usage /plan search || Ricerca player +Cmd - Usage /plan webuser || Gestisci utenti Web +Cmd - Usage /plan webuser check || Controlla un utente Web e il suo livello di permesso. +Cmd - Usage /plan webuser delete || Cancella un utente Web +Cmd - Usage /plan webuser level || Informazioni sui livelli di permesso degli utenti Web. +Cmd - Usage /plan webuser register || Reegistra un utente Web +Disable || Player Analytics Disabilitato. +Disable - Save || Salvo i dati dalla cache.. +Disable - WebServer || Spegnimento Webserver.. +Enable || Player Analytics Abilitato. +Enable - Boot Analysis 30s Notify || Analisi | Analisi all'avvio in 30 secondi.. +Enable - Boot Analysis Notify || Analisi | Inizio analisi all'avvio.. +Enable Db FAIL - Disable Info || Inizializzazione database fallita, disattivazione Plan. +Enable - Db Info || ${0}-connessione al database stabilita. +Enable - Db || Inizializzazione database.. +Enable FAIL-Db || ${0}-Connessione al database fallita: ${1} +Enable FAIL - Wrong Db Type || Questo tipo di database non esiste. +Enable Notify - ChatListener || §eChatListener disabilitato, informazioni sul nickname non accurate. +Enable Notify - Disabled CommandListener || §eCommandListener disabilitato. +Enable Notify - Disabled DeathListener || §eDeathListener disabilitato, morti e uccisioni mob non disponibili. +Enable Notify-Empty IP || §eL'IP nel server.properties e' vuoto & AlternativeServerIP non e' usato, riceverai link errati! +Enable Notify - No data view || §eWebserver disabilitato e Alternative IP non usato, non potrai vedere i dati! +Enable - WebServer || Inizializzazione Webserver.. +Enable - WebServer Info || Webserver attivo sulla PORTA ${0} +Html - Active || Player Attivo +Html - Banned || | Bannati +Html - Inactive || Player non attivo +Html - No Extra Plugins ||

    NEssun altro plugin registrato.

    +Html - Offline || | Offline +Html - Online || | Online +Html - OP || , Operatore (Op) +Html - Table No Kills || No Kills +Manage FAIL - Confirm Action || §c[Plan] Aggiungi "-a" per confermare esecuzione! ${0} +Manage FAIL - Faulty DB Connection || §c[Plan] Uno dei database non e' stato inizializzato correttamente. +Manage FAIL - Backup File Not Found || §c[Plan] BFile di backup inesistente! +Manage FAIL - Incorrect DB || §c[Plan] Database errato! (accettati sqlite o mysql): +Manage FAIL - Incorrect Plugin || §c[Plan] Plugin non supportato: +Manage FAIL - Empty DB || §c[Plan] Il database non ha dati sui player! +Manage FAIL - Unenabled Plugin || §c[Plan] Plugin non abilitato: +Manage FAIL - Same DB || §c[Plan] Non posso spostare i dati sullo stesso database! +Manage - Clear Success || §a[Plan] Tutti i dati cancellati correttamente! +Manage - Remind Config Change || §e[Plan] Ricardati di selezionare il nuovo database e ricaricare il plugin +Manage - Copy Success || §a[Plan] Tutti i dati copiati correttamente! +Manage - Process Fail || §c[Plan] Qualcosa e' andato storto processando i dati! +Manage - Import || §f» §2 Imporazione dei dati.. +Manage - Move Success || §a[Plan] Tutti i dati spostati correttamente! +Manage - Remove Success || §f» §2Dati di §f${0}§2 rimossi dal database §f${1}§2. +Manage - Start || »§7 Processo dei dati in corso.. +Manage - Success || §f» §2 Completato! +Manage NOTIFY - Overwrite || I dati del database ${0} verranno sovrascritti! +Manage NOTIFY - Partial Overwrite || Alcuni dati del database ${0} verranno sovrascritti! +Manage NOTIFY - Remove || I dati del database ${0} verranno rimossi! +Manage NOTIFY - Rewrite || I dati del database ${0} verranno riscritti! +WARN - Too Small Queue Size || Dimensione della coda troppo piccola! (${0}), cambia le impostazioni in un numero maggiore! (Attualmente ${1}) diff --git a/Plan/src/main/resources/locale/locale_NL.txt b/Plan/src/main/resources/locale/locale_NL.txt new file mode 100644 index 000000000..29f63a3f2 --- /dev/null +++ b/Plan/src/main/resources/locale/locale_NL.txt @@ -0,0 +1,314 @@ +Cmd - Click Me || Click me +Cmd - Link || §2Link: §f +Cmd Disable - Disabled || §aPlan systems are now disabled. You can still use /planbungee reload to restart the plugin. +Cmd FAIL - Invalid Username || §cUser does not have an UUID. +Cmd FAIL - No Feature || §eDefine a feature to disable! (currently supports ${0}) +Cmd FAIL - No Permission || §cYou do not have the required permission. +Cmd FAIL - Require only one Argument || §cSingle Argument required ${1} +Cmd FAIL - Requires Arguments || §cArguments required (${0}) ${1} +Cmd FAIL - Unknown Username || §cUser has not been seen on this server +Cmd FAIL - WebUser does not exists || §cUser does not exists! +Cmd FAIL - WebUser exists || §cUser already exists! +Cmd Header - Analysis || > §2Analysis Results +Cmd Header - Info || > §2Player Analytics +Cmd Header - Inspect || > §2Player: §f${0} +Cmd Header - Network || > §2Network Page +Cmd Header - Players || > §2Players +Cmd Header - Search || > §2${0} Results for §f${1}§2: +Cmd Header - Servers || > §2Servers +Cmd Header - Web Users || > §2${0} Web Users +Cmd Info - Bungee Connection || §2Connected to Bungee: §f${0} +Cmd Info - Database || §2Active Database: §f${0} +Cmd Info - Reload Complete || §aReload Complete +Cmd Info - Reload Failed || §cSomething went wrong during reload of the plugin, a restart is recommended. +Cmd Info - Update || §2Update Available: §f${0} +Cmd Info - Version || §2Version: §f${0} +Cmd Notify - No WebUser || You might not have a web user, use /plan register +Cmd Notify - WebUser register || Registered new user: '${0}' Perm level: ${1} +Cmd Qinspect - Activity Index || §2Activity Index: §f${0} | ${1} +Cmd Qinspect - Deaths || §2Deaths: §f${0} +Cmd Qinspect - Geolocation || §2Logged in from: §f${0} +Cmd Qinspect - Last Seen || §2Last Seen: §f${0} +Cmd Qinspect - Longest Session || §2Longest Session: §f${0} +Cmd Qinspect - Mob Kills || §2Mob Kills: §f${0} +Cmd Qinspect - Player Kills || §2Player Kills: §f${0} +Cmd Qinspect - Playtime || §2Playtime: §f${0} +Cmd Qinspect - Registered || §2Registered: §f${0} +Cmd Qinspect - Times Kicked || §2Times Kicked: §f${0} +Cmd Setup - Allowed || §aSet-up is now Allowed +Cmd Setup - Bad Request || §eConnection succeeded, but Receiving server was not a Bungee server. Use Bungee address instead. +Cmd Setup - Disallowed || §cSet-up is now Forbidden +Cmd Setup - Forbidden || §eConnection succeeded, but Bungee has set-up mode disabled - use '/planbungee setup' to enable it. +Cmd Setup - Gateway Error || §eConnection succeeded, but Bungee failed to connect to this server (Did current web server restart?). Use /plan m con & /planbungee con to debug. +Cmd Setup - Generic Fail || §eConnection failed: ${0} +Cmd Setup - Internal Error || §eConnection succeeded. ${0}, check possible ErrorLog on receiving server's debug page. +Cmd Setup - Success || §aConnection successful, Plan may restart in a few seconds.. +Cmd Setup - Unauthorized || §eConnection succeeded, but Receiving server didn't authorize this server. Contact Discord for support +Cmd Setup - Url mistake || §cMake sure you're using the full address (Starts with http:// or https://) - Check Bungee enable log for the full address. +Cmd Setup - WebServer not Enabled || §cWebServer is not enabled on this server! Make sure it enables on boot! +Cmd SUCCESS - Feature disabled || §aDisabled '${0}' temporarily until next plugin reload. +Cmd SUCCESS - WebUser register || §aAdded a new user (${0}) successfully! +Cmd Update - Cancel Success || §aCancel operation performed. +Cmd Update - Cancelled || §cUpdate cancelled. +Cmd Update - Change log || Change Log v${0}: +Cmd Update - Fail Cacnel || §cUpdate failed on a server, cancelling update on all servers.. +Cmd Update - Fail Force Notify || §e${0} failed to update, -force specified, continuing update. +Cmd Update - Fail Not Online || §cNot all servers were online or accessible, you can still update available servers using /plan update -u -force +Cmd Update - Notify Cancel || §aYou can cancel the update on servers that haven't rebooted yet with /plan update cancel. +Cmd Update - Online Check || Checking that all servers are online.. +Cmd Update - Scheduled || §a${0} scheduled for update. +Cmd Update - Url mismatch || §cVersion download url did not start with ${0} and might not be trusted. You can download this version manually here (Direct download): +Cmd Web - Permission Levels || >\§70: Access all pages\§71: Access '/players' and all player pages\§72: Access player page with the same username as the webuser\§73+: No permissions +Command Help - /plan analyze || View the Server Page +Command Help - /plan dev || Development mode command +Command Help - /plan help || Show command list +Command Help - /plan info || Check the version of Plan +Command Help - /plan inspect || View a Player Page +Command Help - /plan manage || Manage Plan Database +Command Help - /plan manage backup || Backup a Database +Command Help - /plan manage clear || Clear a Database +Command Help - /plan manage con || Debug Server-Bungee connections +Command Help - /plan manage disable || Disable a feature temporarily +Command Help - /plan manage hotswap || Change Database quickly +Command Help - /plan manage import || Import data from elsewhere +Command Help - /plan manage move || Move data between Databases +Command Help - /plan manage remove || Remove Player's data +Command Help - /plan manage restore || Restore a previous Backup +Command Help - /plan manage setup || Set-up Server-Bungee connection +Command Help - /plan network || View the Network Page +Command Help - /plan players || View the Players Page +Command Help - /plan qinspect || View Player info in game +Command Help - /plan register || Register a Web User +Command Help - /plan reload || Restart Plan +Command Help - /plan search || Search for a player name +Command Help - /plan servers || List servers in Database +Command Help - /plan update || Get change log link or update plugin +Command Help - /plan web check || Inspect a Web User +Command Help - /plan web delete || Delete a Web User +Command Help - /plan web level || Information about permission levels +Command Help - /plan web list || List Web Users +Command Help - /plan webuser || Manage Web Users +Command Help - /planbungee con || Debug Bungee-Server connections +Command Help - /planbungee disable || Disable the plugin temporarily +Command Help - /planbungee setup || Toggle set-up mode +Database - Apply Patch || Applying Patch: ${0}.. +Database - Patches Applied || All database patches applied successfully. +Database - Patches Applied Already || All database patches already applied. +Database MySQL - Launch Options Error || Launch Options were faulty, using default (${0}) +Database Notify - Clean || Removed data of ${0} players. +Database Notify - SQLite No WAL || SQLite WAL mode not supported on this server version, using default. This may or may not affect performance. +Disable || Player Analytics Disabled. +Disable - Processing || Processing critical unprocessed tasks. (${0}) +Disable - Processing Complete || Processing complete. +Disable - WebServer || Webserver has been disabled. +Enable || Player Analytics Enabled. +Enable - Database || ${0}-database connection established. +Enable - Notify Address Confirmation || Make sure that this address points to THIS Server: ${0} +Enable - Notify Empty IP || IP in server.properties is empty & AlternativeIP is not in use. Incorrect links will be given! +Enable - Notify Geolocations disabled || Geolocation gathering is not active. (Data.Geolocations: false) +Enable - Notify Geolocations Internet Required || Plan Requires internet access on first run to download GeoLite2 Geolocation database. +Enable - Notify Webserver disabled || WebServer was not initialized. (WebServer.DisableWebServer: true) +Enable - WebServer || Webserver running on PORT ${0} (${1}) +Enable FAIL - Database || ${0}-Database Connection failed: ${1} +Enable FAIL - Database Patch || Database Patching failed, plugin has to be disabled. Please report this issue +Enable FAIL - GeoDB Write || Something went wrong saving the downloaded GeoLite2 Geolocation database +Enable FAIL - WebServer (Bungee) || WebServer did not initialize! +Enable FAIL - Wrong Database Type || ${0} is not a supported Database +HTML - ACTIVITY_INDEX || Activity Index +HTML - ALL || ALL +HTML - ALL_TIME_PEAK || All Time Peak +HTML - AVERAGE_PING || Average Ping +HTML - AVG || AVG +HTML - BANNED || Banned +HTML - BEST_PING || Best Ping +HTML - CALENDAR || CALENDAR +HTML - CALENDAR_TEXT || Calendar +HTML - CHUNKS || Chunks +HTML - COMMAND || Command +HTML - COMMNAND_USAGE || Command Usage +HTML - CONNECTION_INFORMATION || Connection Information +HTML - COUNTRY || Country +HTML - CURRENT_PLAYERBASE || Current Playerbase +HTML - DEATHS || Deaths +HTML - ENTITIES || Entities +HTML - ERROR || Authentication failed due to error +HTML - FAVORITE_SERVER || Favorite Server +HTML - GEOLOCATION || Geolocation +HTML - GEOLOCATION_TEXT || Geolocation +HTML - HEALTH_ESTIMATE || Health Estimate +HTML - INDEX_ACTIVE || Active +HTML - INDEX_INACTIVE || Inactive +HTML - INDEX_IRREGULAR || Irregular +HTML - INDEX_REGULAR || Regular +HTML - INDEX_VERY_ACTIVE || Very Active +HTML - IP_ADDRESS || IP-address +HTML - KILLED || Killed +HTML - KILLED_BY || Killed by +HTML - LAST_24_HOURS || LAST 24 HOURS +HTML - LAST_30_DAYS || LAST 30 DAYS +HTML - LAST_30_DAYS_TEXT || Last 30 Days +HTML - LAST_7_DAYS || LAST 7 DAYS +HTML - LAST_CONNECTED || Last Connected +HTML - LAST_PEAK || Last Peak +HTML - LAST_SEEN || LAST SEEN +HTML - LAST_SEEN_TEXT || Last Seen +HTML - LOADED_CHUNKS || Loaded Chunks +HTML - LOADED_ENTITIES || Loaded Entities +HTML - LOCAL_MACHINE || Local Machine +HTML - LONGEST || Longest +HTML - LOW_TPS_SPIKES || Low TPS Spikes +HTML - MOB_CAUSED_DEATHS || Mob caused Deaths +HTML - MOB_KDR || Mob KDR +HTML - MOB_KILLS || Mob Kills +HTML - MOST_RECENT_SESSIONS || Most Recent Sessions +HTML - NAME || Name +HTML - NAV_COMMAND_USAGE || Command Usage +HTML - NAV_GEOLOCATIONS || Geolocations +HTML - NAV_INFORMATION || Information +HTML - NAV_NETWORK_PLAYERS || Network Players +HTML - NAV_ONLINE_ACTIVITY || Online Activity +HTML - NAV_OVERVIEW || Overview +HTML - NAV_PERFORMANCE || Performance +HTML - NAV_PLAYERS || Players +HTML - NAV_PLUGINS || Plugins +HTML - NAV_SESSIONS || Sessions +HTML - NAV_SEVER_HEALTH || Server Health +HTML - NETWORK || Network +HTML - NETWORK_INFORMATION || NETWORK INFORMATION +HTML - NEW || NEW +HTML - NEW_CALENDAR || New: +HTML - NEW_PLAYERS_TEXT || New Players +HTML - NEW_RETENTION || New Player Retention +HTML - NEW_TEXT || New +HTML - NICKNAME || Nickname +HTML - NO_KILLS || No Kills +HTML - NO_PLAYER_CAUSED_DEATHS || No Player caused Deaths +HTML - OFFLINE || Offline +HTML - ONLINE || Online +HTML - ONLINE_ACTIVITY || ONLINE ACTIVITY +HTML - OPERATOR || Operator +HTML - OVERVIEW || OVERVIEW +HTML - PER_DAY || / Day +HTML - PLAYER_CAUSED_DEATHS || Player caused Deaths +HTML - PLAYER_KILLS || Player Kills +HTML - PLAYER_LIST || Player List +HTML - PLAYERBASE_DEVELOPMENT || Playerbase Development +HTML - PLAYERS || PLAYERS +HTML - PLAYERS_ONLINE || PLAYERS ONLINE +HTML - PLAYERS_ONLINE_TEXT || Players Online +HTML - PLAYERS_TEXT || Players +HTML - PLAYTIME || Playtime +HTML - PLEASE_WAIT || Please wait... +HTML - PREDICETED_RETENTION || Predicted Retention +HTML - PUNCH_CARD || Punchcard +HTML - PUNCHCARD || PUNCHCARD +HTML - RECENT_LOGINS || RECENT LOGINS +HTML - REGISTERED || REGISTERED +HTML - REGISTERED_TEXT || Registered +HTML - REGULAR || REGULAR +HTML - SEEN_NICKNAMES || Seen Nicknames +HTML - SERVER || Server +HTML - SERVER_ANALYSIS || Server Analysis +HTML - SERVER_HEALTH_ESTIMATE || Server Health Estimate +HTML - SERVER_INFORMATION || SERVER INFORMATION +HTML - SERVER_PREFERENCE || Server Preference +HTML - SERVERS || Servers +HTML - SESSION || Session +HTML - SESSION_ENDED || Session Ended +HTML - SESSION_LENGTH || Session Lenght +HTML - SESSION_MEDIAN || Session Median +HTML - SESSIONS || Sessions +HTML - TIME || Time +HTML - TIMES_KICKED || Times Kicked +HTML - TIMES_USED || Times Used +HTML - TOTAL_ACTIVE_TEXT || Total Active +HTML - TOTAL_AFK || Total AFK +HTML - TOTAL_PLAYERS || Total Players +HTML - TOTAL_PLAYTIME || Total Playtime +HTML - UNIQUE || UNIQUE +HTML - UNIQUE_CALENDAR || Unique: +HTML - UNIQUE_PLAYERS || UNIQUE PLAYERS +HTML - UNIQUE_PLAYERS_TEXT || Unique Players +HTML - UNIQUE_TEXT || Unique +HTML - USAGE || Usage +HTML - USED_COMMANDS || Used Commands +HTML - USER_AND_PASS_NOT_SPECIFIED || User and Password not specified +HTML - USER_DOES_NOT_EXIST || User does not exist +HTML - USER_INFORMATION || USER INFORMATION +HTML - USER_PASS_MISMATCH || User and Password did not match +HTML - WITH || With +HTML - WORLD || World +HTML - WORLD_LOAD || WORLD LOAD +HTML - WORLD_PLAYTIME || World Playtime +HTML - WORST_PING || Worst Ping +HTML ERRORS - ACCESS_DENIED_403 || Access Denied +HTML ERRORS - ANALYSIS_REFRESH || Analysis is being refreshed.. +HTML ERRORS - ANALYSIS_REFRESH_LONG || Analysis is being run, refresh the page after a few seconds.. +HTML ERRORS - AUTH_FAIL_TIPS_401 || - Ensure you have registered a user with /plan register
    - Check that the username and password are correct
    - Username and password are case-sensitive

    If you have forgotten your password, ask a staff member to delete your old user and re-register. +HTML ERRORS - AUTHENTICATION_FAIlED_401 || Authentication Failed. +HTML ERRORS - FORBIDDEN_403 || Forbidden +HTML ERRORS - NO_SERVERS_404 || No Servers online to perform the request. +HTML ERRORS - NOT_FOUND_404 || Not Found +HTML ERRORS - NOT_PLAYED_404 || Player has not played on this server. +HTML ERRORS - PAGE_NOT_FOUND_404 || Page does not exist. +HTML ERRORS - UNAUTHORIZED_401 || Unauthorized +HTML ERRORS - UNKNOWN_PAGE_404 || Make sure you're accessing a link given by a command, Examples:

    /player/PlayerName
    /server/ServerName

    +HTML ERRORS - UUID_404 || Player UUID was not found in the database. +In Depth Help - /plan ? || > §2Main Command\ Access to subcommands and help\ §2/plan §fList subcommands\ §2/plan ? §fIn depth help +In Depth Help - /plan analyze ? || > §2Analysis Command\ Refreshes server page and displays link to the web page. +In Depth Help - /plan inspect ? || > §2Inspect Command\ Refreshes player page and displays link to the web page. +In Depth Help - /plan manage ? || > §2Manage Command\ Manage MySQL and SQLite database of Plan.\ §2/plan m §fList subcommands\ §2/plan m ? §fIn depth help +In Depth Help - /plan manage backup ? || > §2Backup Subcommand\ Creates a new SQLite database (.db file) with contents of currently active database in the Plan plugin folder. +In Depth Help - /plan manage clear ? || > §2Clear Subcommand\ Removes everything in the active database. Use with caution. +In Depth Help - /plan manage con ? || > §2Connection Debug Subcommand\ Used to debug connections in the network.\ Sends a request to each server in the database. +In Depth Help - /plan manage disable ? || > §2Disable Subcommand\ Can disable parts of the plugin until next reload.\ Accepted arguments:\ §2kickcount §fDisables kick counts in case /kickall is used on shutdown macro. +In Depth Help - /plan manage import ? || > §2Import Subcommand\ Import data from other sources.\ Accepted Arguments:\ §2offline §fBukkit player data, only register date and name. +In Depth Help - /plan manage move ? || > §2Move Subcommand\ Move data from SQLite to MySQL or other way around.\ Target database is cleared before transfer. +In Depth Help - /plan manage remove ? || > §2Remove Subcommand\ Remove player's data from the active database. +In Depth Help - /plan manage restore ? || > §2Restore Subcommand\ Restore a previous backup SQLite database (.db file)\ You can also restore database.db from another server to MySQL.\ Target database is cleared before transfer. +In Depth Help - /plan manage setup ? || > §2Setup Subcommand\ Set-up a connection between Bungee and this server for network functionality.\ BungeeAddress can be found in the enable log on console when Plan enables on Bungee. +In Depth Help - /plan network ? || > §2Network Command\ Displays link to the network page.\ If not on a network, this page displays the server page. +In Depth Help - /plan players ? || > §2Players Command\ Displays link to the players page. +In Depth Help - /plan qinspect ? || > §2Quick Inspect Command\ Displays some information about the player in game. +In Depth Help - /plan reload ? || > §2Reload Command\ Restarts the plugin using onDisable and onEnable.\ §bDoes not support swapping jar on the fly +In Depth Help - /plan search ? || > §2Search Command\ Get a list of Player names that match the given argument.\§7 Example: /plan search 123 - Finds all users with 123 in their name. +In Depth Help - /plan servers ? || > §2Servers Command\ Displays list of Plan servers in the Database.\ Can be used to debug issues with database registration on a network. +In Depth Help - /plan update ? || > §2Update Command\ Used to update the plugin on the next shutdown\ /plan update - Changelog link\ /plan update -u - Schedule update to happen on all network servers that are online, next time they reboot.\ /plan update cancel - Cancel scheduled update on servers that haven't rebooted yet. +In Depth Help - /plan web ? || < §2Web User Manage Command.\ §2/plan web §fList subcommands\ §2/plan web ? §fIn Depth help +In Depth Help - /plan web register ? || > §2Register Subcommand\ Registers a new Web User.\ Registering a user for another player requires plan.webmanage permission.\ Passwords are hashed with PBKDF2 (64,000 iterations of SHA1) using a cryptographically-random salt. +In Depth Help - /planbungee disable ? || > §2Disable Command\ Runs onDisable on PlanBungee.\ Plugin can be enabled with /planbungee reload afterwards.\ §bDoes not support swapping jar on the fly +In Depth Help - /planbungee setup ? || > §2Set-up toggle Command\ Toggles set-up mode on Bungee.\ Safeguard against unauthorized MySQL snooping with another server. +Manage - Confirm Overwrite || Data in ${0} will be overwritten! +Manage - Confirm Removal || Data in ${0} will be removed! +Manage - Fail || > §cSomething went wrong: ${0} +Manage - Fail File not found || > §cNo File found at ${0} +Manage - Fail Incorrect Database || > §c'${0}' is not a supported database. +Manage - Fail No Importer || §eImporter '${0}' doesn't exist +Manage - Fail Same Database || > §cCan not operate on to and from the same database! +Manage - Fail, Confirmation || > §cAdd '-a' argument to confirm execution: ${0} +Manage - Fail, Connection Exception || §eFail reason: +Manage - Fail, No Servers || §cNo Servers found in the database. +Manage - Fail, Old version || §eFail reason: Older Plan version on receiving server +Manage - Fail, Unauthorized || §eFail reason: Unauthorized. Server might be using different database. +Manage - Fail, Unexpected Exception || §eOdd Exception: ${0} +Manage - List Importers || Importers: +Manage - Notify External Url || §eNon-local address, check that port is open +Manage - Remind HotSwap || §eRemember to swap to the new database (/plan m hotswap ${0}) & reload the plugin. +Manage - Start || > §2Processing data.. +Manage - Success || > §aSuccess! +Negative || No +Positive || Yes +Unknown || Unknown +Version - DEV || This is a DEV release. +Version - Latest || You're using the latest version. +Version - New || New Release (${0}) is available ${1} +Version - New (old) || New Version is available at ${0} +Version FAIL - Read info (old) || Failed to check newest version number +Version FAIL - Read versions.txt || Version information could not be loaded from Github/versions.txt +Web User Listing || §2${0} §7: §f${1} +WebServer - Notify HTTP || WebServer: No Certificate -> Using HTTP-server for Visualization. +WebServer - Notify HTTP User Auth || WebServer: User Authorization Disabled! (Not secure over HTTP) +WebServer - Notify no Cert file || WebServer: Certificate KeyStore File not Found: ${0} +WebServer FAIL - Port Bind || WebServer was not initialized successfully. Is the port (${0}) in use? +WebServer FAIL - SSL Context || WebServer: SSL Context Initialization Failed. +WebServer FAIL - Store Load || WebServer: SSL Certificate loading Failed. diff --git a/Plan/src/main/resources/locale/locale_NO.txt b/Plan/src/main/resources/locale/locale_NO.txt new file mode 100644 index 000000000..29f63a3f2 --- /dev/null +++ b/Plan/src/main/resources/locale/locale_NO.txt @@ -0,0 +1,314 @@ +Cmd - Click Me || Click me +Cmd - Link || §2Link: §f +Cmd Disable - Disabled || §aPlan systems are now disabled. You can still use /planbungee reload to restart the plugin. +Cmd FAIL - Invalid Username || §cUser does not have an UUID. +Cmd FAIL - No Feature || §eDefine a feature to disable! (currently supports ${0}) +Cmd FAIL - No Permission || §cYou do not have the required permission. +Cmd FAIL - Require only one Argument || §cSingle Argument required ${1} +Cmd FAIL - Requires Arguments || §cArguments required (${0}) ${1} +Cmd FAIL - Unknown Username || §cUser has not been seen on this server +Cmd FAIL - WebUser does not exists || §cUser does not exists! +Cmd FAIL - WebUser exists || §cUser already exists! +Cmd Header - Analysis || > §2Analysis Results +Cmd Header - Info || > §2Player Analytics +Cmd Header - Inspect || > §2Player: §f${0} +Cmd Header - Network || > §2Network Page +Cmd Header - Players || > §2Players +Cmd Header - Search || > §2${0} Results for §f${1}§2: +Cmd Header - Servers || > §2Servers +Cmd Header - Web Users || > §2${0} Web Users +Cmd Info - Bungee Connection || §2Connected to Bungee: §f${0} +Cmd Info - Database || §2Active Database: §f${0} +Cmd Info - Reload Complete || §aReload Complete +Cmd Info - Reload Failed || §cSomething went wrong during reload of the plugin, a restart is recommended. +Cmd Info - Update || §2Update Available: §f${0} +Cmd Info - Version || §2Version: §f${0} +Cmd Notify - No WebUser || You might not have a web user, use /plan register +Cmd Notify - WebUser register || Registered new user: '${0}' Perm level: ${1} +Cmd Qinspect - Activity Index || §2Activity Index: §f${0} | ${1} +Cmd Qinspect - Deaths || §2Deaths: §f${0} +Cmd Qinspect - Geolocation || §2Logged in from: §f${0} +Cmd Qinspect - Last Seen || §2Last Seen: §f${0} +Cmd Qinspect - Longest Session || §2Longest Session: §f${0} +Cmd Qinspect - Mob Kills || §2Mob Kills: §f${0} +Cmd Qinspect - Player Kills || §2Player Kills: §f${0} +Cmd Qinspect - Playtime || §2Playtime: §f${0} +Cmd Qinspect - Registered || §2Registered: §f${0} +Cmd Qinspect - Times Kicked || §2Times Kicked: §f${0} +Cmd Setup - Allowed || §aSet-up is now Allowed +Cmd Setup - Bad Request || §eConnection succeeded, but Receiving server was not a Bungee server. Use Bungee address instead. +Cmd Setup - Disallowed || §cSet-up is now Forbidden +Cmd Setup - Forbidden || §eConnection succeeded, but Bungee has set-up mode disabled - use '/planbungee setup' to enable it. +Cmd Setup - Gateway Error || §eConnection succeeded, but Bungee failed to connect to this server (Did current web server restart?). Use /plan m con & /planbungee con to debug. +Cmd Setup - Generic Fail || §eConnection failed: ${0} +Cmd Setup - Internal Error || §eConnection succeeded. ${0}, check possible ErrorLog on receiving server's debug page. +Cmd Setup - Success || §aConnection successful, Plan may restart in a few seconds.. +Cmd Setup - Unauthorized || §eConnection succeeded, but Receiving server didn't authorize this server. Contact Discord for support +Cmd Setup - Url mistake || §cMake sure you're using the full address (Starts with http:// or https://) - Check Bungee enable log for the full address. +Cmd Setup - WebServer not Enabled || §cWebServer is not enabled on this server! Make sure it enables on boot! +Cmd SUCCESS - Feature disabled || §aDisabled '${0}' temporarily until next plugin reload. +Cmd SUCCESS - WebUser register || §aAdded a new user (${0}) successfully! +Cmd Update - Cancel Success || §aCancel operation performed. +Cmd Update - Cancelled || §cUpdate cancelled. +Cmd Update - Change log || Change Log v${0}: +Cmd Update - Fail Cacnel || §cUpdate failed on a server, cancelling update on all servers.. +Cmd Update - Fail Force Notify || §e${0} failed to update, -force specified, continuing update. +Cmd Update - Fail Not Online || §cNot all servers were online or accessible, you can still update available servers using /plan update -u -force +Cmd Update - Notify Cancel || §aYou can cancel the update on servers that haven't rebooted yet with /plan update cancel. +Cmd Update - Online Check || Checking that all servers are online.. +Cmd Update - Scheduled || §a${0} scheduled for update. +Cmd Update - Url mismatch || §cVersion download url did not start with ${0} and might not be trusted. You can download this version manually here (Direct download): +Cmd Web - Permission Levels || >\§70: Access all pages\§71: Access '/players' and all player pages\§72: Access player page with the same username as the webuser\§73+: No permissions +Command Help - /plan analyze || View the Server Page +Command Help - /plan dev || Development mode command +Command Help - /plan help || Show command list +Command Help - /plan info || Check the version of Plan +Command Help - /plan inspect || View a Player Page +Command Help - /plan manage || Manage Plan Database +Command Help - /plan manage backup || Backup a Database +Command Help - /plan manage clear || Clear a Database +Command Help - /plan manage con || Debug Server-Bungee connections +Command Help - /plan manage disable || Disable a feature temporarily +Command Help - /plan manage hotswap || Change Database quickly +Command Help - /plan manage import || Import data from elsewhere +Command Help - /plan manage move || Move data between Databases +Command Help - /plan manage remove || Remove Player's data +Command Help - /plan manage restore || Restore a previous Backup +Command Help - /plan manage setup || Set-up Server-Bungee connection +Command Help - /plan network || View the Network Page +Command Help - /plan players || View the Players Page +Command Help - /plan qinspect || View Player info in game +Command Help - /plan register || Register a Web User +Command Help - /plan reload || Restart Plan +Command Help - /plan search || Search for a player name +Command Help - /plan servers || List servers in Database +Command Help - /plan update || Get change log link or update plugin +Command Help - /plan web check || Inspect a Web User +Command Help - /plan web delete || Delete a Web User +Command Help - /plan web level || Information about permission levels +Command Help - /plan web list || List Web Users +Command Help - /plan webuser || Manage Web Users +Command Help - /planbungee con || Debug Bungee-Server connections +Command Help - /planbungee disable || Disable the plugin temporarily +Command Help - /planbungee setup || Toggle set-up mode +Database - Apply Patch || Applying Patch: ${0}.. +Database - Patches Applied || All database patches applied successfully. +Database - Patches Applied Already || All database patches already applied. +Database MySQL - Launch Options Error || Launch Options were faulty, using default (${0}) +Database Notify - Clean || Removed data of ${0} players. +Database Notify - SQLite No WAL || SQLite WAL mode not supported on this server version, using default. This may or may not affect performance. +Disable || Player Analytics Disabled. +Disable - Processing || Processing critical unprocessed tasks. (${0}) +Disable - Processing Complete || Processing complete. +Disable - WebServer || Webserver has been disabled. +Enable || Player Analytics Enabled. +Enable - Database || ${0}-database connection established. +Enable - Notify Address Confirmation || Make sure that this address points to THIS Server: ${0} +Enable - Notify Empty IP || IP in server.properties is empty & AlternativeIP is not in use. Incorrect links will be given! +Enable - Notify Geolocations disabled || Geolocation gathering is not active. (Data.Geolocations: false) +Enable - Notify Geolocations Internet Required || Plan Requires internet access on first run to download GeoLite2 Geolocation database. +Enable - Notify Webserver disabled || WebServer was not initialized. (WebServer.DisableWebServer: true) +Enable - WebServer || Webserver running on PORT ${0} (${1}) +Enable FAIL - Database || ${0}-Database Connection failed: ${1} +Enable FAIL - Database Patch || Database Patching failed, plugin has to be disabled. Please report this issue +Enable FAIL - GeoDB Write || Something went wrong saving the downloaded GeoLite2 Geolocation database +Enable FAIL - WebServer (Bungee) || WebServer did not initialize! +Enable FAIL - Wrong Database Type || ${0} is not a supported Database +HTML - ACTIVITY_INDEX || Activity Index +HTML - ALL || ALL +HTML - ALL_TIME_PEAK || All Time Peak +HTML - AVERAGE_PING || Average Ping +HTML - AVG || AVG +HTML - BANNED || Banned +HTML - BEST_PING || Best Ping +HTML - CALENDAR || CALENDAR +HTML - CALENDAR_TEXT || Calendar +HTML - CHUNKS || Chunks +HTML - COMMAND || Command +HTML - COMMNAND_USAGE || Command Usage +HTML - CONNECTION_INFORMATION || Connection Information +HTML - COUNTRY || Country +HTML - CURRENT_PLAYERBASE || Current Playerbase +HTML - DEATHS || Deaths +HTML - ENTITIES || Entities +HTML - ERROR || Authentication failed due to error +HTML - FAVORITE_SERVER || Favorite Server +HTML - GEOLOCATION || Geolocation +HTML - GEOLOCATION_TEXT || Geolocation +HTML - HEALTH_ESTIMATE || Health Estimate +HTML - INDEX_ACTIVE || Active +HTML - INDEX_INACTIVE || Inactive +HTML - INDEX_IRREGULAR || Irregular +HTML - INDEX_REGULAR || Regular +HTML - INDEX_VERY_ACTIVE || Very Active +HTML - IP_ADDRESS || IP-address +HTML - KILLED || Killed +HTML - KILLED_BY || Killed by +HTML - LAST_24_HOURS || LAST 24 HOURS +HTML - LAST_30_DAYS || LAST 30 DAYS +HTML - LAST_30_DAYS_TEXT || Last 30 Days +HTML - LAST_7_DAYS || LAST 7 DAYS +HTML - LAST_CONNECTED || Last Connected +HTML - LAST_PEAK || Last Peak +HTML - LAST_SEEN || LAST SEEN +HTML - LAST_SEEN_TEXT || Last Seen +HTML - LOADED_CHUNKS || Loaded Chunks +HTML - LOADED_ENTITIES || Loaded Entities +HTML - LOCAL_MACHINE || Local Machine +HTML - LONGEST || Longest +HTML - LOW_TPS_SPIKES || Low TPS Spikes +HTML - MOB_CAUSED_DEATHS || Mob caused Deaths +HTML - MOB_KDR || Mob KDR +HTML - MOB_KILLS || Mob Kills +HTML - MOST_RECENT_SESSIONS || Most Recent Sessions +HTML - NAME || Name +HTML - NAV_COMMAND_USAGE || Command Usage +HTML - NAV_GEOLOCATIONS || Geolocations +HTML - NAV_INFORMATION || Information +HTML - NAV_NETWORK_PLAYERS || Network Players +HTML - NAV_ONLINE_ACTIVITY || Online Activity +HTML - NAV_OVERVIEW || Overview +HTML - NAV_PERFORMANCE || Performance +HTML - NAV_PLAYERS || Players +HTML - NAV_PLUGINS || Plugins +HTML - NAV_SESSIONS || Sessions +HTML - NAV_SEVER_HEALTH || Server Health +HTML - NETWORK || Network +HTML - NETWORK_INFORMATION || NETWORK INFORMATION +HTML - NEW || NEW +HTML - NEW_CALENDAR || New: +HTML - NEW_PLAYERS_TEXT || New Players +HTML - NEW_RETENTION || New Player Retention +HTML - NEW_TEXT || New +HTML - NICKNAME || Nickname +HTML - NO_KILLS || No Kills +HTML - NO_PLAYER_CAUSED_DEATHS || No Player caused Deaths +HTML - OFFLINE || Offline +HTML - ONLINE || Online +HTML - ONLINE_ACTIVITY || ONLINE ACTIVITY +HTML - OPERATOR || Operator +HTML - OVERVIEW || OVERVIEW +HTML - PER_DAY || / Day +HTML - PLAYER_CAUSED_DEATHS || Player caused Deaths +HTML - PLAYER_KILLS || Player Kills +HTML - PLAYER_LIST || Player List +HTML - PLAYERBASE_DEVELOPMENT || Playerbase Development +HTML - PLAYERS || PLAYERS +HTML - PLAYERS_ONLINE || PLAYERS ONLINE +HTML - PLAYERS_ONLINE_TEXT || Players Online +HTML - PLAYERS_TEXT || Players +HTML - PLAYTIME || Playtime +HTML - PLEASE_WAIT || Please wait... +HTML - PREDICETED_RETENTION || Predicted Retention +HTML - PUNCH_CARD || Punchcard +HTML - PUNCHCARD || PUNCHCARD +HTML - RECENT_LOGINS || RECENT LOGINS +HTML - REGISTERED || REGISTERED +HTML - REGISTERED_TEXT || Registered +HTML - REGULAR || REGULAR +HTML - SEEN_NICKNAMES || Seen Nicknames +HTML - SERVER || Server +HTML - SERVER_ANALYSIS || Server Analysis +HTML - SERVER_HEALTH_ESTIMATE || Server Health Estimate +HTML - SERVER_INFORMATION || SERVER INFORMATION +HTML - SERVER_PREFERENCE || Server Preference +HTML - SERVERS || Servers +HTML - SESSION || Session +HTML - SESSION_ENDED || Session Ended +HTML - SESSION_LENGTH || Session Lenght +HTML - SESSION_MEDIAN || Session Median +HTML - SESSIONS || Sessions +HTML - TIME || Time +HTML - TIMES_KICKED || Times Kicked +HTML - TIMES_USED || Times Used +HTML - TOTAL_ACTIVE_TEXT || Total Active +HTML - TOTAL_AFK || Total AFK +HTML - TOTAL_PLAYERS || Total Players +HTML - TOTAL_PLAYTIME || Total Playtime +HTML - UNIQUE || UNIQUE +HTML - UNIQUE_CALENDAR || Unique: +HTML - UNIQUE_PLAYERS || UNIQUE PLAYERS +HTML - UNIQUE_PLAYERS_TEXT || Unique Players +HTML - UNIQUE_TEXT || Unique +HTML - USAGE || Usage +HTML - USED_COMMANDS || Used Commands +HTML - USER_AND_PASS_NOT_SPECIFIED || User and Password not specified +HTML - USER_DOES_NOT_EXIST || User does not exist +HTML - USER_INFORMATION || USER INFORMATION +HTML - USER_PASS_MISMATCH || User and Password did not match +HTML - WITH || With +HTML - WORLD || World +HTML - WORLD_LOAD || WORLD LOAD +HTML - WORLD_PLAYTIME || World Playtime +HTML - WORST_PING || Worst Ping +HTML ERRORS - ACCESS_DENIED_403 || Access Denied +HTML ERRORS - ANALYSIS_REFRESH || Analysis is being refreshed.. +HTML ERRORS - ANALYSIS_REFRESH_LONG || Analysis is being run, refresh the page after a few seconds.. +HTML ERRORS - AUTH_FAIL_TIPS_401 || - Ensure you have registered a user with /plan register
    - Check that the username and password are correct
    - Username and password are case-sensitive

    If you have forgotten your password, ask a staff member to delete your old user and re-register. +HTML ERRORS - AUTHENTICATION_FAIlED_401 || Authentication Failed. +HTML ERRORS - FORBIDDEN_403 || Forbidden +HTML ERRORS - NO_SERVERS_404 || No Servers online to perform the request. +HTML ERRORS - NOT_FOUND_404 || Not Found +HTML ERRORS - NOT_PLAYED_404 || Player has not played on this server. +HTML ERRORS - PAGE_NOT_FOUND_404 || Page does not exist. +HTML ERRORS - UNAUTHORIZED_401 || Unauthorized +HTML ERRORS - UNKNOWN_PAGE_404 || Make sure you're accessing a link given by a command, Examples:

    /player/PlayerName
    /server/ServerName

    +HTML ERRORS - UUID_404 || Player UUID was not found in the database. +In Depth Help - /plan ? || > §2Main Command\ Access to subcommands and help\ §2/plan §fList subcommands\ §2/plan ? §fIn depth help +In Depth Help - /plan analyze ? || > §2Analysis Command\ Refreshes server page and displays link to the web page. +In Depth Help - /plan inspect ? || > §2Inspect Command\ Refreshes player page and displays link to the web page. +In Depth Help - /plan manage ? || > §2Manage Command\ Manage MySQL and SQLite database of Plan.\ §2/plan m §fList subcommands\ §2/plan m ? §fIn depth help +In Depth Help - /plan manage backup ? || > §2Backup Subcommand\ Creates a new SQLite database (.db file) with contents of currently active database in the Plan plugin folder. +In Depth Help - /plan manage clear ? || > §2Clear Subcommand\ Removes everything in the active database. Use with caution. +In Depth Help - /plan manage con ? || > §2Connection Debug Subcommand\ Used to debug connections in the network.\ Sends a request to each server in the database. +In Depth Help - /plan manage disable ? || > §2Disable Subcommand\ Can disable parts of the plugin until next reload.\ Accepted arguments:\ §2kickcount §fDisables kick counts in case /kickall is used on shutdown macro. +In Depth Help - /plan manage import ? || > §2Import Subcommand\ Import data from other sources.\ Accepted Arguments:\ §2offline §fBukkit player data, only register date and name. +In Depth Help - /plan manage move ? || > §2Move Subcommand\ Move data from SQLite to MySQL or other way around.\ Target database is cleared before transfer. +In Depth Help - /plan manage remove ? || > §2Remove Subcommand\ Remove player's data from the active database. +In Depth Help - /plan manage restore ? || > §2Restore Subcommand\ Restore a previous backup SQLite database (.db file)\ You can also restore database.db from another server to MySQL.\ Target database is cleared before transfer. +In Depth Help - /plan manage setup ? || > §2Setup Subcommand\ Set-up a connection between Bungee and this server for network functionality.\ BungeeAddress can be found in the enable log on console when Plan enables on Bungee. +In Depth Help - /plan network ? || > §2Network Command\ Displays link to the network page.\ If not on a network, this page displays the server page. +In Depth Help - /plan players ? || > §2Players Command\ Displays link to the players page. +In Depth Help - /plan qinspect ? || > §2Quick Inspect Command\ Displays some information about the player in game. +In Depth Help - /plan reload ? || > §2Reload Command\ Restarts the plugin using onDisable and onEnable.\ §bDoes not support swapping jar on the fly +In Depth Help - /plan search ? || > §2Search Command\ Get a list of Player names that match the given argument.\§7 Example: /plan search 123 - Finds all users with 123 in their name. +In Depth Help - /plan servers ? || > §2Servers Command\ Displays list of Plan servers in the Database.\ Can be used to debug issues with database registration on a network. +In Depth Help - /plan update ? || > §2Update Command\ Used to update the plugin on the next shutdown\ /plan update - Changelog link\ /plan update -u - Schedule update to happen on all network servers that are online, next time they reboot.\ /plan update cancel - Cancel scheduled update on servers that haven't rebooted yet. +In Depth Help - /plan web ? || < §2Web User Manage Command.\ §2/plan web §fList subcommands\ §2/plan web ? §fIn Depth help +In Depth Help - /plan web register ? || > §2Register Subcommand\ Registers a new Web User.\ Registering a user for another player requires plan.webmanage permission.\ Passwords are hashed with PBKDF2 (64,000 iterations of SHA1) using a cryptographically-random salt. +In Depth Help - /planbungee disable ? || > §2Disable Command\ Runs onDisable on PlanBungee.\ Plugin can be enabled with /planbungee reload afterwards.\ §bDoes not support swapping jar on the fly +In Depth Help - /planbungee setup ? || > §2Set-up toggle Command\ Toggles set-up mode on Bungee.\ Safeguard against unauthorized MySQL snooping with another server. +Manage - Confirm Overwrite || Data in ${0} will be overwritten! +Manage - Confirm Removal || Data in ${0} will be removed! +Manage - Fail || > §cSomething went wrong: ${0} +Manage - Fail File not found || > §cNo File found at ${0} +Manage - Fail Incorrect Database || > §c'${0}' is not a supported database. +Manage - Fail No Importer || §eImporter '${0}' doesn't exist +Manage - Fail Same Database || > §cCan not operate on to and from the same database! +Manage - Fail, Confirmation || > §cAdd '-a' argument to confirm execution: ${0} +Manage - Fail, Connection Exception || §eFail reason: +Manage - Fail, No Servers || §cNo Servers found in the database. +Manage - Fail, Old version || §eFail reason: Older Plan version on receiving server +Manage - Fail, Unauthorized || §eFail reason: Unauthorized. Server might be using different database. +Manage - Fail, Unexpected Exception || §eOdd Exception: ${0} +Manage - List Importers || Importers: +Manage - Notify External Url || §eNon-local address, check that port is open +Manage - Remind HotSwap || §eRemember to swap to the new database (/plan m hotswap ${0}) & reload the plugin. +Manage - Start || > §2Processing data.. +Manage - Success || > §aSuccess! +Negative || No +Positive || Yes +Unknown || Unknown +Version - DEV || This is a DEV release. +Version - Latest || You're using the latest version. +Version - New || New Release (${0}) is available ${1} +Version - New (old) || New Version is available at ${0} +Version FAIL - Read info (old) || Failed to check newest version number +Version FAIL - Read versions.txt || Version information could not be loaded from Github/versions.txt +Web User Listing || §2${0} §7: §f${1} +WebServer - Notify HTTP || WebServer: No Certificate -> Using HTTP-server for Visualization. +WebServer - Notify HTTP User Auth || WebServer: User Authorization Disabled! (Not secure over HTTP) +WebServer - Notify no Cert file || WebServer: Certificate KeyStore File not Found: ${0} +WebServer FAIL - Port Bind || WebServer was not initialized successfully. Is the port (${0}) in use? +WebServer FAIL - SSL Context || WebServer: SSL Context Initialization Failed. +WebServer FAIL - Store Load || WebServer: SSL Certificate loading Failed. diff --git a/Plan/src/main/resources/locale/locale_PL.txt b/Plan/src/main/resources/locale/locale_PL.txt new file mode 100644 index 000000000..29f63a3f2 --- /dev/null +++ b/Plan/src/main/resources/locale/locale_PL.txt @@ -0,0 +1,314 @@ +Cmd - Click Me || Click me +Cmd - Link || §2Link: §f +Cmd Disable - Disabled || §aPlan systems are now disabled. You can still use /planbungee reload to restart the plugin. +Cmd FAIL - Invalid Username || §cUser does not have an UUID. +Cmd FAIL - No Feature || §eDefine a feature to disable! (currently supports ${0}) +Cmd FAIL - No Permission || §cYou do not have the required permission. +Cmd FAIL - Require only one Argument || §cSingle Argument required ${1} +Cmd FAIL - Requires Arguments || §cArguments required (${0}) ${1} +Cmd FAIL - Unknown Username || §cUser has not been seen on this server +Cmd FAIL - WebUser does not exists || §cUser does not exists! +Cmd FAIL - WebUser exists || §cUser already exists! +Cmd Header - Analysis || > §2Analysis Results +Cmd Header - Info || > §2Player Analytics +Cmd Header - Inspect || > §2Player: §f${0} +Cmd Header - Network || > §2Network Page +Cmd Header - Players || > §2Players +Cmd Header - Search || > §2${0} Results for §f${1}§2: +Cmd Header - Servers || > §2Servers +Cmd Header - Web Users || > §2${0} Web Users +Cmd Info - Bungee Connection || §2Connected to Bungee: §f${0} +Cmd Info - Database || §2Active Database: §f${0} +Cmd Info - Reload Complete || §aReload Complete +Cmd Info - Reload Failed || §cSomething went wrong during reload of the plugin, a restart is recommended. +Cmd Info - Update || §2Update Available: §f${0} +Cmd Info - Version || §2Version: §f${0} +Cmd Notify - No WebUser || You might not have a web user, use /plan register +Cmd Notify - WebUser register || Registered new user: '${0}' Perm level: ${1} +Cmd Qinspect - Activity Index || §2Activity Index: §f${0} | ${1} +Cmd Qinspect - Deaths || §2Deaths: §f${0} +Cmd Qinspect - Geolocation || §2Logged in from: §f${0} +Cmd Qinspect - Last Seen || §2Last Seen: §f${0} +Cmd Qinspect - Longest Session || §2Longest Session: §f${0} +Cmd Qinspect - Mob Kills || §2Mob Kills: §f${0} +Cmd Qinspect - Player Kills || §2Player Kills: §f${0} +Cmd Qinspect - Playtime || §2Playtime: §f${0} +Cmd Qinspect - Registered || §2Registered: §f${0} +Cmd Qinspect - Times Kicked || §2Times Kicked: §f${0} +Cmd Setup - Allowed || §aSet-up is now Allowed +Cmd Setup - Bad Request || §eConnection succeeded, but Receiving server was not a Bungee server. Use Bungee address instead. +Cmd Setup - Disallowed || §cSet-up is now Forbidden +Cmd Setup - Forbidden || §eConnection succeeded, but Bungee has set-up mode disabled - use '/planbungee setup' to enable it. +Cmd Setup - Gateway Error || §eConnection succeeded, but Bungee failed to connect to this server (Did current web server restart?). Use /plan m con & /planbungee con to debug. +Cmd Setup - Generic Fail || §eConnection failed: ${0} +Cmd Setup - Internal Error || §eConnection succeeded. ${0}, check possible ErrorLog on receiving server's debug page. +Cmd Setup - Success || §aConnection successful, Plan may restart in a few seconds.. +Cmd Setup - Unauthorized || §eConnection succeeded, but Receiving server didn't authorize this server. Contact Discord for support +Cmd Setup - Url mistake || §cMake sure you're using the full address (Starts with http:// or https://) - Check Bungee enable log for the full address. +Cmd Setup - WebServer not Enabled || §cWebServer is not enabled on this server! Make sure it enables on boot! +Cmd SUCCESS - Feature disabled || §aDisabled '${0}' temporarily until next plugin reload. +Cmd SUCCESS - WebUser register || §aAdded a new user (${0}) successfully! +Cmd Update - Cancel Success || §aCancel operation performed. +Cmd Update - Cancelled || §cUpdate cancelled. +Cmd Update - Change log || Change Log v${0}: +Cmd Update - Fail Cacnel || §cUpdate failed on a server, cancelling update on all servers.. +Cmd Update - Fail Force Notify || §e${0} failed to update, -force specified, continuing update. +Cmd Update - Fail Not Online || §cNot all servers were online or accessible, you can still update available servers using /plan update -u -force +Cmd Update - Notify Cancel || §aYou can cancel the update on servers that haven't rebooted yet with /plan update cancel. +Cmd Update - Online Check || Checking that all servers are online.. +Cmd Update - Scheduled || §a${0} scheduled for update. +Cmd Update - Url mismatch || §cVersion download url did not start with ${0} and might not be trusted. You can download this version manually here (Direct download): +Cmd Web - Permission Levels || >\§70: Access all pages\§71: Access '/players' and all player pages\§72: Access player page with the same username as the webuser\§73+: No permissions +Command Help - /plan analyze || View the Server Page +Command Help - /plan dev || Development mode command +Command Help - /plan help || Show command list +Command Help - /plan info || Check the version of Plan +Command Help - /plan inspect || View a Player Page +Command Help - /plan manage || Manage Plan Database +Command Help - /plan manage backup || Backup a Database +Command Help - /plan manage clear || Clear a Database +Command Help - /plan manage con || Debug Server-Bungee connections +Command Help - /plan manage disable || Disable a feature temporarily +Command Help - /plan manage hotswap || Change Database quickly +Command Help - /plan manage import || Import data from elsewhere +Command Help - /plan manage move || Move data between Databases +Command Help - /plan manage remove || Remove Player's data +Command Help - /plan manage restore || Restore a previous Backup +Command Help - /plan manage setup || Set-up Server-Bungee connection +Command Help - /plan network || View the Network Page +Command Help - /plan players || View the Players Page +Command Help - /plan qinspect || View Player info in game +Command Help - /plan register || Register a Web User +Command Help - /plan reload || Restart Plan +Command Help - /plan search || Search for a player name +Command Help - /plan servers || List servers in Database +Command Help - /plan update || Get change log link or update plugin +Command Help - /plan web check || Inspect a Web User +Command Help - /plan web delete || Delete a Web User +Command Help - /plan web level || Information about permission levels +Command Help - /plan web list || List Web Users +Command Help - /plan webuser || Manage Web Users +Command Help - /planbungee con || Debug Bungee-Server connections +Command Help - /planbungee disable || Disable the plugin temporarily +Command Help - /planbungee setup || Toggle set-up mode +Database - Apply Patch || Applying Patch: ${0}.. +Database - Patches Applied || All database patches applied successfully. +Database - Patches Applied Already || All database patches already applied. +Database MySQL - Launch Options Error || Launch Options were faulty, using default (${0}) +Database Notify - Clean || Removed data of ${0} players. +Database Notify - SQLite No WAL || SQLite WAL mode not supported on this server version, using default. This may or may not affect performance. +Disable || Player Analytics Disabled. +Disable - Processing || Processing critical unprocessed tasks. (${0}) +Disable - Processing Complete || Processing complete. +Disable - WebServer || Webserver has been disabled. +Enable || Player Analytics Enabled. +Enable - Database || ${0}-database connection established. +Enable - Notify Address Confirmation || Make sure that this address points to THIS Server: ${0} +Enable - Notify Empty IP || IP in server.properties is empty & AlternativeIP is not in use. Incorrect links will be given! +Enable - Notify Geolocations disabled || Geolocation gathering is not active. (Data.Geolocations: false) +Enable - Notify Geolocations Internet Required || Plan Requires internet access on first run to download GeoLite2 Geolocation database. +Enable - Notify Webserver disabled || WebServer was not initialized. (WebServer.DisableWebServer: true) +Enable - WebServer || Webserver running on PORT ${0} (${1}) +Enable FAIL - Database || ${0}-Database Connection failed: ${1} +Enable FAIL - Database Patch || Database Patching failed, plugin has to be disabled. Please report this issue +Enable FAIL - GeoDB Write || Something went wrong saving the downloaded GeoLite2 Geolocation database +Enable FAIL - WebServer (Bungee) || WebServer did not initialize! +Enable FAIL - Wrong Database Type || ${0} is not a supported Database +HTML - ACTIVITY_INDEX || Activity Index +HTML - ALL || ALL +HTML - ALL_TIME_PEAK || All Time Peak +HTML - AVERAGE_PING || Average Ping +HTML - AVG || AVG +HTML - BANNED || Banned +HTML - BEST_PING || Best Ping +HTML - CALENDAR || CALENDAR +HTML - CALENDAR_TEXT || Calendar +HTML - CHUNKS || Chunks +HTML - COMMAND || Command +HTML - COMMNAND_USAGE || Command Usage +HTML - CONNECTION_INFORMATION || Connection Information +HTML - COUNTRY || Country +HTML - CURRENT_PLAYERBASE || Current Playerbase +HTML - DEATHS || Deaths +HTML - ENTITIES || Entities +HTML - ERROR || Authentication failed due to error +HTML - FAVORITE_SERVER || Favorite Server +HTML - GEOLOCATION || Geolocation +HTML - GEOLOCATION_TEXT || Geolocation +HTML - HEALTH_ESTIMATE || Health Estimate +HTML - INDEX_ACTIVE || Active +HTML - INDEX_INACTIVE || Inactive +HTML - INDEX_IRREGULAR || Irregular +HTML - INDEX_REGULAR || Regular +HTML - INDEX_VERY_ACTIVE || Very Active +HTML - IP_ADDRESS || IP-address +HTML - KILLED || Killed +HTML - KILLED_BY || Killed by +HTML - LAST_24_HOURS || LAST 24 HOURS +HTML - LAST_30_DAYS || LAST 30 DAYS +HTML - LAST_30_DAYS_TEXT || Last 30 Days +HTML - LAST_7_DAYS || LAST 7 DAYS +HTML - LAST_CONNECTED || Last Connected +HTML - LAST_PEAK || Last Peak +HTML - LAST_SEEN || LAST SEEN +HTML - LAST_SEEN_TEXT || Last Seen +HTML - LOADED_CHUNKS || Loaded Chunks +HTML - LOADED_ENTITIES || Loaded Entities +HTML - LOCAL_MACHINE || Local Machine +HTML - LONGEST || Longest +HTML - LOW_TPS_SPIKES || Low TPS Spikes +HTML - MOB_CAUSED_DEATHS || Mob caused Deaths +HTML - MOB_KDR || Mob KDR +HTML - MOB_KILLS || Mob Kills +HTML - MOST_RECENT_SESSIONS || Most Recent Sessions +HTML - NAME || Name +HTML - NAV_COMMAND_USAGE || Command Usage +HTML - NAV_GEOLOCATIONS || Geolocations +HTML - NAV_INFORMATION || Information +HTML - NAV_NETWORK_PLAYERS || Network Players +HTML - NAV_ONLINE_ACTIVITY || Online Activity +HTML - NAV_OVERVIEW || Overview +HTML - NAV_PERFORMANCE || Performance +HTML - NAV_PLAYERS || Players +HTML - NAV_PLUGINS || Plugins +HTML - NAV_SESSIONS || Sessions +HTML - NAV_SEVER_HEALTH || Server Health +HTML - NETWORK || Network +HTML - NETWORK_INFORMATION || NETWORK INFORMATION +HTML - NEW || NEW +HTML - NEW_CALENDAR || New: +HTML - NEW_PLAYERS_TEXT || New Players +HTML - NEW_RETENTION || New Player Retention +HTML - NEW_TEXT || New +HTML - NICKNAME || Nickname +HTML - NO_KILLS || No Kills +HTML - NO_PLAYER_CAUSED_DEATHS || No Player caused Deaths +HTML - OFFLINE || Offline +HTML - ONLINE || Online +HTML - ONLINE_ACTIVITY || ONLINE ACTIVITY +HTML - OPERATOR || Operator +HTML - OVERVIEW || OVERVIEW +HTML - PER_DAY || / Day +HTML - PLAYER_CAUSED_DEATHS || Player caused Deaths +HTML - PLAYER_KILLS || Player Kills +HTML - PLAYER_LIST || Player List +HTML - PLAYERBASE_DEVELOPMENT || Playerbase Development +HTML - PLAYERS || PLAYERS +HTML - PLAYERS_ONLINE || PLAYERS ONLINE +HTML - PLAYERS_ONLINE_TEXT || Players Online +HTML - PLAYERS_TEXT || Players +HTML - PLAYTIME || Playtime +HTML - PLEASE_WAIT || Please wait... +HTML - PREDICETED_RETENTION || Predicted Retention +HTML - PUNCH_CARD || Punchcard +HTML - PUNCHCARD || PUNCHCARD +HTML - RECENT_LOGINS || RECENT LOGINS +HTML - REGISTERED || REGISTERED +HTML - REGISTERED_TEXT || Registered +HTML - REGULAR || REGULAR +HTML - SEEN_NICKNAMES || Seen Nicknames +HTML - SERVER || Server +HTML - SERVER_ANALYSIS || Server Analysis +HTML - SERVER_HEALTH_ESTIMATE || Server Health Estimate +HTML - SERVER_INFORMATION || SERVER INFORMATION +HTML - SERVER_PREFERENCE || Server Preference +HTML - SERVERS || Servers +HTML - SESSION || Session +HTML - SESSION_ENDED || Session Ended +HTML - SESSION_LENGTH || Session Lenght +HTML - SESSION_MEDIAN || Session Median +HTML - SESSIONS || Sessions +HTML - TIME || Time +HTML - TIMES_KICKED || Times Kicked +HTML - TIMES_USED || Times Used +HTML - TOTAL_ACTIVE_TEXT || Total Active +HTML - TOTAL_AFK || Total AFK +HTML - TOTAL_PLAYERS || Total Players +HTML - TOTAL_PLAYTIME || Total Playtime +HTML - UNIQUE || UNIQUE +HTML - UNIQUE_CALENDAR || Unique: +HTML - UNIQUE_PLAYERS || UNIQUE PLAYERS +HTML - UNIQUE_PLAYERS_TEXT || Unique Players +HTML - UNIQUE_TEXT || Unique +HTML - USAGE || Usage +HTML - USED_COMMANDS || Used Commands +HTML - USER_AND_PASS_NOT_SPECIFIED || User and Password not specified +HTML - USER_DOES_NOT_EXIST || User does not exist +HTML - USER_INFORMATION || USER INFORMATION +HTML - USER_PASS_MISMATCH || User and Password did not match +HTML - WITH || With +HTML - WORLD || World +HTML - WORLD_LOAD || WORLD LOAD +HTML - WORLD_PLAYTIME || World Playtime +HTML - WORST_PING || Worst Ping +HTML ERRORS - ACCESS_DENIED_403 || Access Denied +HTML ERRORS - ANALYSIS_REFRESH || Analysis is being refreshed.. +HTML ERRORS - ANALYSIS_REFRESH_LONG || Analysis is being run, refresh the page after a few seconds.. +HTML ERRORS - AUTH_FAIL_TIPS_401 || - Ensure you have registered a user with /plan register
    - Check that the username and password are correct
    - Username and password are case-sensitive

    If you have forgotten your password, ask a staff member to delete your old user and re-register. +HTML ERRORS - AUTHENTICATION_FAIlED_401 || Authentication Failed. +HTML ERRORS - FORBIDDEN_403 || Forbidden +HTML ERRORS - NO_SERVERS_404 || No Servers online to perform the request. +HTML ERRORS - NOT_FOUND_404 || Not Found +HTML ERRORS - NOT_PLAYED_404 || Player has not played on this server. +HTML ERRORS - PAGE_NOT_FOUND_404 || Page does not exist. +HTML ERRORS - UNAUTHORIZED_401 || Unauthorized +HTML ERRORS - UNKNOWN_PAGE_404 || Make sure you're accessing a link given by a command, Examples:

    /player/PlayerName
    /server/ServerName

    +HTML ERRORS - UUID_404 || Player UUID was not found in the database. +In Depth Help - /plan ? || > §2Main Command\ Access to subcommands and help\ §2/plan §fList subcommands\ §2/plan ? §fIn depth help +In Depth Help - /plan analyze ? || > §2Analysis Command\ Refreshes server page and displays link to the web page. +In Depth Help - /plan inspect ? || > §2Inspect Command\ Refreshes player page and displays link to the web page. +In Depth Help - /plan manage ? || > §2Manage Command\ Manage MySQL and SQLite database of Plan.\ §2/plan m §fList subcommands\ §2/plan m ? §fIn depth help +In Depth Help - /plan manage backup ? || > §2Backup Subcommand\ Creates a new SQLite database (.db file) with contents of currently active database in the Plan plugin folder. +In Depth Help - /plan manage clear ? || > §2Clear Subcommand\ Removes everything in the active database. Use with caution. +In Depth Help - /plan manage con ? || > §2Connection Debug Subcommand\ Used to debug connections in the network.\ Sends a request to each server in the database. +In Depth Help - /plan manage disable ? || > §2Disable Subcommand\ Can disable parts of the plugin until next reload.\ Accepted arguments:\ §2kickcount §fDisables kick counts in case /kickall is used on shutdown macro. +In Depth Help - /plan manage import ? || > §2Import Subcommand\ Import data from other sources.\ Accepted Arguments:\ §2offline §fBukkit player data, only register date and name. +In Depth Help - /plan manage move ? || > §2Move Subcommand\ Move data from SQLite to MySQL or other way around.\ Target database is cleared before transfer. +In Depth Help - /plan manage remove ? || > §2Remove Subcommand\ Remove player's data from the active database. +In Depth Help - /plan manage restore ? || > §2Restore Subcommand\ Restore a previous backup SQLite database (.db file)\ You can also restore database.db from another server to MySQL.\ Target database is cleared before transfer. +In Depth Help - /plan manage setup ? || > §2Setup Subcommand\ Set-up a connection between Bungee and this server for network functionality.\ BungeeAddress can be found in the enable log on console when Plan enables on Bungee. +In Depth Help - /plan network ? || > §2Network Command\ Displays link to the network page.\ If not on a network, this page displays the server page. +In Depth Help - /plan players ? || > §2Players Command\ Displays link to the players page. +In Depth Help - /plan qinspect ? || > §2Quick Inspect Command\ Displays some information about the player in game. +In Depth Help - /plan reload ? || > §2Reload Command\ Restarts the plugin using onDisable and onEnable.\ §bDoes not support swapping jar on the fly +In Depth Help - /plan search ? || > §2Search Command\ Get a list of Player names that match the given argument.\§7 Example: /plan search 123 - Finds all users with 123 in their name. +In Depth Help - /plan servers ? || > §2Servers Command\ Displays list of Plan servers in the Database.\ Can be used to debug issues with database registration on a network. +In Depth Help - /plan update ? || > §2Update Command\ Used to update the plugin on the next shutdown\ /plan update - Changelog link\ /plan update -u - Schedule update to happen on all network servers that are online, next time they reboot.\ /plan update cancel - Cancel scheduled update on servers that haven't rebooted yet. +In Depth Help - /plan web ? || < §2Web User Manage Command.\ §2/plan web §fList subcommands\ §2/plan web ? §fIn Depth help +In Depth Help - /plan web register ? || > §2Register Subcommand\ Registers a new Web User.\ Registering a user for another player requires plan.webmanage permission.\ Passwords are hashed with PBKDF2 (64,000 iterations of SHA1) using a cryptographically-random salt. +In Depth Help - /planbungee disable ? || > §2Disable Command\ Runs onDisable on PlanBungee.\ Plugin can be enabled with /planbungee reload afterwards.\ §bDoes not support swapping jar on the fly +In Depth Help - /planbungee setup ? || > §2Set-up toggle Command\ Toggles set-up mode on Bungee.\ Safeguard against unauthorized MySQL snooping with another server. +Manage - Confirm Overwrite || Data in ${0} will be overwritten! +Manage - Confirm Removal || Data in ${0} will be removed! +Manage - Fail || > §cSomething went wrong: ${0} +Manage - Fail File not found || > §cNo File found at ${0} +Manage - Fail Incorrect Database || > §c'${0}' is not a supported database. +Manage - Fail No Importer || §eImporter '${0}' doesn't exist +Manage - Fail Same Database || > §cCan not operate on to and from the same database! +Manage - Fail, Confirmation || > §cAdd '-a' argument to confirm execution: ${0} +Manage - Fail, Connection Exception || §eFail reason: +Manage - Fail, No Servers || §cNo Servers found in the database. +Manage - Fail, Old version || §eFail reason: Older Plan version on receiving server +Manage - Fail, Unauthorized || §eFail reason: Unauthorized. Server might be using different database. +Manage - Fail, Unexpected Exception || §eOdd Exception: ${0} +Manage - List Importers || Importers: +Manage - Notify External Url || §eNon-local address, check that port is open +Manage - Remind HotSwap || §eRemember to swap to the new database (/plan m hotswap ${0}) & reload the plugin. +Manage - Start || > §2Processing data.. +Manage - Success || > §aSuccess! +Negative || No +Positive || Yes +Unknown || Unknown +Version - DEV || This is a DEV release. +Version - Latest || You're using the latest version. +Version - New || New Release (${0}) is available ${1} +Version - New (old) || New Version is available at ${0} +Version FAIL - Read info (old) || Failed to check newest version number +Version FAIL - Read versions.txt || Version information could not be loaded from Github/versions.txt +Web User Listing || §2${0} §7: §f${1} +WebServer - Notify HTTP || WebServer: No Certificate -> Using HTTP-server for Visualization. +WebServer - Notify HTTP User Auth || WebServer: User Authorization Disabled! (Not secure over HTTP) +WebServer - Notify no Cert file || WebServer: Certificate KeyStore File not Found: ${0} +WebServer FAIL - Port Bind || WebServer was not initialized successfully. Is the port (${0}) in use? +WebServer FAIL - SSL Context || WebServer: SSL Context Initialization Failed. +WebServer FAIL - Store Load || WebServer: SSL Certificate loading Failed. diff --git a/Plan/src/main/resources/locale/locale_PT.txt b/Plan/src/main/resources/locale/locale_PT.txt new file mode 100644 index 000000000..29f63a3f2 --- /dev/null +++ b/Plan/src/main/resources/locale/locale_PT.txt @@ -0,0 +1,314 @@ +Cmd - Click Me || Click me +Cmd - Link || §2Link: §f +Cmd Disable - Disabled || §aPlan systems are now disabled. You can still use /planbungee reload to restart the plugin. +Cmd FAIL - Invalid Username || §cUser does not have an UUID. +Cmd FAIL - No Feature || §eDefine a feature to disable! (currently supports ${0}) +Cmd FAIL - No Permission || §cYou do not have the required permission. +Cmd FAIL - Require only one Argument || §cSingle Argument required ${1} +Cmd FAIL - Requires Arguments || §cArguments required (${0}) ${1} +Cmd FAIL - Unknown Username || §cUser has not been seen on this server +Cmd FAIL - WebUser does not exists || §cUser does not exists! +Cmd FAIL - WebUser exists || §cUser already exists! +Cmd Header - Analysis || > §2Analysis Results +Cmd Header - Info || > §2Player Analytics +Cmd Header - Inspect || > §2Player: §f${0} +Cmd Header - Network || > §2Network Page +Cmd Header - Players || > §2Players +Cmd Header - Search || > §2${0} Results for §f${1}§2: +Cmd Header - Servers || > §2Servers +Cmd Header - Web Users || > §2${0} Web Users +Cmd Info - Bungee Connection || §2Connected to Bungee: §f${0} +Cmd Info - Database || §2Active Database: §f${0} +Cmd Info - Reload Complete || §aReload Complete +Cmd Info - Reload Failed || §cSomething went wrong during reload of the plugin, a restart is recommended. +Cmd Info - Update || §2Update Available: §f${0} +Cmd Info - Version || §2Version: §f${0} +Cmd Notify - No WebUser || You might not have a web user, use /plan register +Cmd Notify - WebUser register || Registered new user: '${0}' Perm level: ${1} +Cmd Qinspect - Activity Index || §2Activity Index: §f${0} | ${1} +Cmd Qinspect - Deaths || §2Deaths: §f${0} +Cmd Qinspect - Geolocation || §2Logged in from: §f${0} +Cmd Qinspect - Last Seen || §2Last Seen: §f${0} +Cmd Qinspect - Longest Session || §2Longest Session: §f${0} +Cmd Qinspect - Mob Kills || §2Mob Kills: §f${0} +Cmd Qinspect - Player Kills || §2Player Kills: §f${0} +Cmd Qinspect - Playtime || §2Playtime: §f${0} +Cmd Qinspect - Registered || §2Registered: §f${0} +Cmd Qinspect - Times Kicked || §2Times Kicked: §f${0} +Cmd Setup - Allowed || §aSet-up is now Allowed +Cmd Setup - Bad Request || §eConnection succeeded, but Receiving server was not a Bungee server. Use Bungee address instead. +Cmd Setup - Disallowed || §cSet-up is now Forbidden +Cmd Setup - Forbidden || §eConnection succeeded, but Bungee has set-up mode disabled - use '/planbungee setup' to enable it. +Cmd Setup - Gateway Error || §eConnection succeeded, but Bungee failed to connect to this server (Did current web server restart?). Use /plan m con & /planbungee con to debug. +Cmd Setup - Generic Fail || §eConnection failed: ${0} +Cmd Setup - Internal Error || §eConnection succeeded. ${0}, check possible ErrorLog on receiving server's debug page. +Cmd Setup - Success || §aConnection successful, Plan may restart in a few seconds.. +Cmd Setup - Unauthorized || §eConnection succeeded, but Receiving server didn't authorize this server. Contact Discord for support +Cmd Setup - Url mistake || §cMake sure you're using the full address (Starts with http:// or https://) - Check Bungee enable log for the full address. +Cmd Setup - WebServer not Enabled || §cWebServer is not enabled on this server! Make sure it enables on boot! +Cmd SUCCESS - Feature disabled || §aDisabled '${0}' temporarily until next plugin reload. +Cmd SUCCESS - WebUser register || §aAdded a new user (${0}) successfully! +Cmd Update - Cancel Success || §aCancel operation performed. +Cmd Update - Cancelled || §cUpdate cancelled. +Cmd Update - Change log || Change Log v${0}: +Cmd Update - Fail Cacnel || §cUpdate failed on a server, cancelling update on all servers.. +Cmd Update - Fail Force Notify || §e${0} failed to update, -force specified, continuing update. +Cmd Update - Fail Not Online || §cNot all servers were online or accessible, you can still update available servers using /plan update -u -force +Cmd Update - Notify Cancel || §aYou can cancel the update on servers that haven't rebooted yet with /plan update cancel. +Cmd Update - Online Check || Checking that all servers are online.. +Cmd Update - Scheduled || §a${0} scheduled for update. +Cmd Update - Url mismatch || §cVersion download url did not start with ${0} and might not be trusted. You can download this version manually here (Direct download): +Cmd Web - Permission Levels || >\§70: Access all pages\§71: Access '/players' and all player pages\§72: Access player page with the same username as the webuser\§73+: No permissions +Command Help - /plan analyze || View the Server Page +Command Help - /plan dev || Development mode command +Command Help - /plan help || Show command list +Command Help - /plan info || Check the version of Plan +Command Help - /plan inspect || View a Player Page +Command Help - /plan manage || Manage Plan Database +Command Help - /plan manage backup || Backup a Database +Command Help - /plan manage clear || Clear a Database +Command Help - /plan manage con || Debug Server-Bungee connections +Command Help - /plan manage disable || Disable a feature temporarily +Command Help - /plan manage hotswap || Change Database quickly +Command Help - /plan manage import || Import data from elsewhere +Command Help - /plan manage move || Move data between Databases +Command Help - /plan manage remove || Remove Player's data +Command Help - /plan manage restore || Restore a previous Backup +Command Help - /plan manage setup || Set-up Server-Bungee connection +Command Help - /plan network || View the Network Page +Command Help - /plan players || View the Players Page +Command Help - /plan qinspect || View Player info in game +Command Help - /plan register || Register a Web User +Command Help - /plan reload || Restart Plan +Command Help - /plan search || Search for a player name +Command Help - /plan servers || List servers in Database +Command Help - /plan update || Get change log link or update plugin +Command Help - /plan web check || Inspect a Web User +Command Help - /plan web delete || Delete a Web User +Command Help - /plan web level || Information about permission levels +Command Help - /plan web list || List Web Users +Command Help - /plan webuser || Manage Web Users +Command Help - /planbungee con || Debug Bungee-Server connections +Command Help - /planbungee disable || Disable the plugin temporarily +Command Help - /planbungee setup || Toggle set-up mode +Database - Apply Patch || Applying Patch: ${0}.. +Database - Patches Applied || All database patches applied successfully. +Database - Patches Applied Already || All database patches already applied. +Database MySQL - Launch Options Error || Launch Options were faulty, using default (${0}) +Database Notify - Clean || Removed data of ${0} players. +Database Notify - SQLite No WAL || SQLite WAL mode not supported on this server version, using default. This may or may not affect performance. +Disable || Player Analytics Disabled. +Disable - Processing || Processing critical unprocessed tasks. (${0}) +Disable - Processing Complete || Processing complete. +Disable - WebServer || Webserver has been disabled. +Enable || Player Analytics Enabled. +Enable - Database || ${0}-database connection established. +Enable - Notify Address Confirmation || Make sure that this address points to THIS Server: ${0} +Enable - Notify Empty IP || IP in server.properties is empty & AlternativeIP is not in use. Incorrect links will be given! +Enable - Notify Geolocations disabled || Geolocation gathering is not active. (Data.Geolocations: false) +Enable - Notify Geolocations Internet Required || Plan Requires internet access on first run to download GeoLite2 Geolocation database. +Enable - Notify Webserver disabled || WebServer was not initialized. (WebServer.DisableWebServer: true) +Enable - WebServer || Webserver running on PORT ${0} (${1}) +Enable FAIL - Database || ${0}-Database Connection failed: ${1} +Enable FAIL - Database Patch || Database Patching failed, plugin has to be disabled. Please report this issue +Enable FAIL - GeoDB Write || Something went wrong saving the downloaded GeoLite2 Geolocation database +Enable FAIL - WebServer (Bungee) || WebServer did not initialize! +Enable FAIL - Wrong Database Type || ${0} is not a supported Database +HTML - ACTIVITY_INDEX || Activity Index +HTML - ALL || ALL +HTML - ALL_TIME_PEAK || All Time Peak +HTML - AVERAGE_PING || Average Ping +HTML - AVG || AVG +HTML - BANNED || Banned +HTML - BEST_PING || Best Ping +HTML - CALENDAR || CALENDAR +HTML - CALENDAR_TEXT || Calendar +HTML - CHUNKS || Chunks +HTML - COMMAND || Command +HTML - COMMNAND_USAGE || Command Usage +HTML - CONNECTION_INFORMATION || Connection Information +HTML - COUNTRY || Country +HTML - CURRENT_PLAYERBASE || Current Playerbase +HTML - DEATHS || Deaths +HTML - ENTITIES || Entities +HTML - ERROR || Authentication failed due to error +HTML - FAVORITE_SERVER || Favorite Server +HTML - GEOLOCATION || Geolocation +HTML - GEOLOCATION_TEXT || Geolocation +HTML - HEALTH_ESTIMATE || Health Estimate +HTML - INDEX_ACTIVE || Active +HTML - INDEX_INACTIVE || Inactive +HTML - INDEX_IRREGULAR || Irregular +HTML - INDEX_REGULAR || Regular +HTML - INDEX_VERY_ACTIVE || Very Active +HTML - IP_ADDRESS || IP-address +HTML - KILLED || Killed +HTML - KILLED_BY || Killed by +HTML - LAST_24_HOURS || LAST 24 HOURS +HTML - LAST_30_DAYS || LAST 30 DAYS +HTML - LAST_30_DAYS_TEXT || Last 30 Days +HTML - LAST_7_DAYS || LAST 7 DAYS +HTML - LAST_CONNECTED || Last Connected +HTML - LAST_PEAK || Last Peak +HTML - LAST_SEEN || LAST SEEN +HTML - LAST_SEEN_TEXT || Last Seen +HTML - LOADED_CHUNKS || Loaded Chunks +HTML - LOADED_ENTITIES || Loaded Entities +HTML - LOCAL_MACHINE || Local Machine +HTML - LONGEST || Longest +HTML - LOW_TPS_SPIKES || Low TPS Spikes +HTML - MOB_CAUSED_DEATHS || Mob caused Deaths +HTML - MOB_KDR || Mob KDR +HTML - MOB_KILLS || Mob Kills +HTML - MOST_RECENT_SESSIONS || Most Recent Sessions +HTML - NAME || Name +HTML - NAV_COMMAND_USAGE || Command Usage +HTML - NAV_GEOLOCATIONS || Geolocations +HTML - NAV_INFORMATION || Information +HTML - NAV_NETWORK_PLAYERS || Network Players +HTML - NAV_ONLINE_ACTIVITY || Online Activity +HTML - NAV_OVERVIEW || Overview +HTML - NAV_PERFORMANCE || Performance +HTML - NAV_PLAYERS || Players +HTML - NAV_PLUGINS || Plugins +HTML - NAV_SESSIONS || Sessions +HTML - NAV_SEVER_HEALTH || Server Health +HTML - NETWORK || Network +HTML - NETWORK_INFORMATION || NETWORK INFORMATION +HTML - NEW || NEW +HTML - NEW_CALENDAR || New: +HTML - NEW_PLAYERS_TEXT || New Players +HTML - NEW_RETENTION || New Player Retention +HTML - NEW_TEXT || New +HTML - NICKNAME || Nickname +HTML - NO_KILLS || No Kills +HTML - NO_PLAYER_CAUSED_DEATHS || No Player caused Deaths +HTML - OFFLINE || Offline +HTML - ONLINE || Online +HTML - ONLINE_ACTIVITY || ONLINE ACTIVITY +HTML - OPERATOR || Operator +HTML - OVERVIEW || OVERVIEW +HTML - PER_DAY || / Day +HTML - PLAYER_CAUSED_DEATHS || Player caused Deaths +HTML - PLAYER_KILLS || Player Kills +HTML - PLAYER_LIST || Player List +HTML - PLAYERBASE_DEVELOPMENT || Playerbase Development +HTML - PLAYERS || PLAYERS +HTML - PLAYERS_ONLINE || PLAYERS ONLINE +HTML - PLAYERS_ONLINE_TEXT || Players Online +HTML - PLAYERS_TEXT || Players +HTML - PLAYTIME || Playtime +HTML - PLEASE_WAIT || Please wait... +HTML - PREDICETED_RETENTION || Predicted Retention +HTML - PUNCH_CARD || Punchcard +HTML - PUNCHCARD || PUNCHCARD +HTML - RECENT_LOGINS || RECENT LOGINS +HTML - REGISTERED || REGISTERED +HTML - REGISTERED_TEXT || Registered +HTML - REGULAR || REGULAR +HTML - SEEN_NICKNAMES || Seen Nicknames +HTML - SERVER || Server +HTML - SERVER_ANALYSIS || Server Analysis +HTML - SERVER_HEALTH_ESTIMATE || Server Health Estimate +HTML - SERVER_INFORMATION || SERVER INFORMATION +HTML - SERVER_PREFERENCE || Server Preference +HTML - SERVERS || Servers +HTML - SESSION || Session +HTML - SESSION_ENDED || Session Ended +HTML - SESSION_LENGTH || Session Lenght +HTML - SESSION_MEDIAN || Session Median +HTML - SESSIONS || Sessions +HTML - TIME || Time +HTML - TIMES_KICKED || Times Kicked +HTML - TIMES_USED || Times Used +HTML - TOTAL_ACTIVE_TEXT || Total Active +HTML - TOTAL_AFK || Total AFK +HTML - TOTAL_PLAYERS || Total Players +HTML - TOTAL_PLAYTIME || Total Playtime +HTML - UNIQUE || UNIQUE +HTML - UNIQUE_CALENDAR || Unique: +HTML - UNIQUE_PLAYERS || UNIQUE PLAYERS +HTML - UNIQUE_PLAYERS_TEXT || Unique Players +HTML - UNIQUE_TEXT || Unique +HTML - USAGE || Usage +HTML - USED_COMMANDS || Used Commands +HTML - USER_AND_PASS_NOT_SPECIFIED || User and Password not specified +HTML - USER_DOES_NOT_EXIST || User does not exist +HTML - USER_INFORMATION || USER INFORMATION +HTML - USER_PASS_MISMATCH || User and Password did not match +HTML - WITH || With +HTML - WORLD || World +HTML - WORLD_LOAD || WORLD LOAD +HTML - WORLD_PLAYTIME || World Playtime +HTML - WORST_PING || Worst Ping +HTML ERRORS - ACCESS_DENIED_403 || Access Denied +HTML ERRORS - ANALYSIS_REFRESH || Analysis is being refreshed.. +HTML ERRORS - ANALYSIS_REFRESH_LONG || Analysis is being run, refresh the page after a few seconds.. +HTML ERRORS - AUTH_FAIL_TIPS_401 || - Ensure you have registered a user with /plan register
    - Check that the username and password are correct
    - Username and password are case-sensitive

    If you have forgotten your password, ask a staff member to delete your old user and re-register. +HTML ERRORS - AUTHENTICATION_FAIlED_401 || Authentication Failed. +HTML ERRORS - FORBIDDEN_403 || Forbidden +HTML ERRORS - NO_SERVERS_404 || No Servers online to perform the request. +HTML ERRORS - NOT_FOUND_404 || Not Found +HTML ERRORS - NOT_PLAYED_404 || Player has not played on this server. +HTML ERRORS - PAGE_NOT_FOUND_404 || Page does not exist. +HTML ERRORS - UNAUTHORIZED_401 || Unauthorized +HTML ERRORS - UNKNOWN_PAGE_404 || Make sure you're accessing a link given by a command, Examples:

    /player/PlayerName
    /server/ServerName

    +HTML ERRORS - UUID_404 || Player UUID was not found in the database. +In Depth Help - /plan ? || > §2Main Command\ Access to subcommands and help\ §2/plan §fList subcommands\ §2/plan ? §fIn depth help +In Depth Help - /plan analyze ? || > §2Analysis Command\ Refreshes server page and displays link to the web page. +In Depth Help - /plan inspect ? || > §2Inspect Command\ Refreshes player page and displays link to the web page. +In Depth Help - /plan manage ? || > §2Manage Command\ Manage MySQL and SQLite database of Plan.\ §2/plan m §fList subcommands\ §2/plan m ? §fIn depth help +In Depth Help - /plan manage backup ? || > §2Backup Subcommand\ Creates a new SQLite database (.db file) with contents of currently active database in the Plan plugin folder. +In Depth Help - /plan manage clear ? || > §2Clear Subcommand\ Removes everything in the active database. Use with caution. +In Depth Help - /plan manage con ? || > §2Connection Debug Subcommand\ Used to debug connections in the network.\ Sends a request to each server in the database. +In Depth Help - /plan manage disable ? || > §2Disable Subcommand\ Can disable parts of the plugin until next reload.\ Accepted arguments:\ §2kickcount §fDisables kick counts in case /kickall is used on shutdown macro. +In Depth Help - /plan manage import ? || > §2Import Subcommand\ Import data from other sources.\ Accepted Arguments:\ §2offline §fBukkit player data, only register date and name. +In Depth Help - /plan manage move ? || > §2Move Subcommand\ Move data from SQLite to MySQL or other way around.\ Target database is cleared before transfer. +In Depth Help - /plan manage remove ? || > §2Remove Subcommand\ Remove player's data from the active database. +In Depth Help - /plan manage restore ? || > §2Restore Subcommand\ Restore a previous backup SQLite database (.db file)\ You can also restore database.db from another server to MySQL.\ Target database is cleared before transfer. +In Depth Help - /plan manage setup ? || > §2Setup Subcommand\ Set-up a connection between Bungee and this server for network functionality.\ BungeeAddress can be found in the enable log on console when Plan enables on Bungee. +In Depth Help - /plan network ? || > §2Network Command\ Displays link to the network page.\ If not on a network, this page displays the server page. +In Depth Help - /plan players ? || > §2Players Command\ Displays link to the players page. +In Depth Help - /plan qinspect ? || > §2Quick Inspect Command\ Displays some information about the player in game. +In Depth Help - /plan reload ? || > §2Reload Command\ Restarts the plugin using onDisable and onEnable.\ §bDoes not support swapping jar on the fly +In Depth Help - /plan search ? || > §2Search Command\ Get a list of Player names that match the given argument.\§7 Example: /plan search 123 - Finds all users with 123 in their name. +In Depth Help - /plan servers ? || > §2Servers Command\ Displays list of Plan servers in the Database.\ Can be used to debug issues with database registration on a network. +In Depth Help - /plan update ? || > §2Update Command\ Used to update the plugin on the next shutdown\ /plan update - Changelog link\ /plan update -u - Schedule update to happen on all network servers that are online, next time they reboot.\ /plan update cancel - Cancel scheduled update on servers that haven't rebooted yet. +In Depth Help - /plan web ? || < §2Web User Manage Command.\ §2/plan web §fList subcommands\ §2/plan web ? §fIn Depth help +In Depth Help - /plan web register ? || > §2Register Subcommand\ Registers a new Web User.\ Registering a user for another player requires plan.webmanage permission.\ Passwords are hashed with PBKDF2 (64,000 iterations of SHA1) using a cryptographically-random salt. +In Depth Help - /planbungee disable ? || > §2Disable Command\ Runs onDisable on PlanBungee.\ Plugin can be enabled with /planbungee reload afterwards.\ §bDoes not support swapping jar on the fly +In Depth Help - /planbungee setup ? || > §2Set-up toggle Command\ Toggles set-up mode on Bungee.\ Safeguard against unauthorized MySQL snooping with another server. +Manage - Confirm Overwrite || Data in ${0} will be overwritten! +Manage - Confirm Removal || Data in ${0} will be removed! +Manage - Fail || > §cSomething went wrong: ${0} +Manage - Fail File not found || > §cNo File found at ${0} +Manage - Fail Incorrect Database || > §c'${0}' is not a supported database. +Manage - Fail No Importer || §eImporter '${0}' doesn't exist +Manage - Fail Same Database || > §cCan not operate on to and from the same database! +Manage - Fail, Confirmation || > §cAdd '-a' argument to confirm execution: ${0} +Manage - Fail, Connection Exception || §eFail reason: +Manage - Fail, No Servers || §cNo Servers found in the database. +Manage - Fail, Old version || §eFail reason: Older Plan version on receiving server +Manage - Fail, Unauthorized || §eFail reason: Unauthorized. Server might be using different database. +Manage - Fail, Unexpected Exception || §eOdd Exception: ${0} +Manage - List Importers || Importers: +Manage - Notify External Url || §eNon-local address, check that port is open +Manage - Remind HotSwap || §eRemember to swap to the new database (/plan m hotswap ${0}) & reload the plugin. +Manage - Start || > §2Processing data.. +Manage - Success || > §aSuccess! +Negative || No +Positive || Yes +Unknown || Unknown +Version - DEV || This is a DEV release. +Version - Latest || You're using the latest version. +Version - New || New Release (${0}) is available ${1} +Version - New (old) || New Version is available at ${0} +Version FAIL - Read info (old) || Failed to check newest version number +Version FAIL - Read versions.txt || Version information could not be loaded from Github/versions.txt +Web User Listing || §2${0} §7: §f${1} +WebServer - Notify HTTP || WebServer: No Certificate -> Using HTTP-server for Visualization. +WebServer - Notify HTTP User Auth || WebServer: User Authorization Disabled! (Not secure over HTTP) +WebServer - Notify no Cert file || WebServer: Certificate KeyStore File not Found: ${0} +WebServer FAIL - Port Bind || WebServer was not initialized successfully. Is the port (${0}) in use? +WebServer FAIL - SSL Context || WebServer: SSL Context Initialization Failed. +WebServer FAIL - Store Load || WebServer: SSL Certificate loading Failed. diff --git a/Plan/src/main/resources/plugin.yml b/Plan/src/main/resources/plugin.yml index 7fed3f98b..7a58e121e 100644 --- a/Plan/src/main/resources/plugin.yml +++ b/Plan/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: Plan author: Rsl1122 main: com.djrapitops.plan.Plan -version: 4.4.1 +version: 4.4.2 softdepend: - EssentialsX - Towny diff --git a/Plan/src/main/resources/web/error.html b/Plan/src/main/resources/web/error.html index 722d932b9..332d19e45 100644 --- a/Plan/src/main/resources/web/error.html +++ b/Plan/src/main/resources/web/error.html @@ -34,8 +34,7 @@ - + diff --git a/Plan/src/main/resources/web/network.html b/Plan/src/main/resources/web/network.html index 397cf3e51..77dfe6b25 100644 --- a/Plan/src/main/resources/web/network.html +++ b/Plan/src/main/resources/web/network.html @@ -37,8 +37,7 @@ - + diff --git a/Plan/src/main/resources/web/player.html b/Plan/src/main/resources/web/player.html index 02ba42296..1240ac371 100644 --- a/Plan/src/main/resources/web/player.html +++ b/Plan/src/main/resources/web/player.html @@ -34,8 +34,7 @@ - + diff --git a/Plan/src/main/resources/web/players.html b/Plan/src/main/resources/web/players.html index 397e3e2a5..f6fc6abc8 100644 --- a/Plan/src/main/resources/web/players.html +++ b/Plan/src/main/resources/web/players.html @@ -34,8 +34,7 @@ - + diff --git a/Plan/src/main/resources/web/server.html b/Plan/src/main/resources/web/server.html index cfbeb8cd5..17a79e9e8 100644 --- a/Plan/src/main/resources/web/server.html +++ b/Plan/src/main/resources/web/server.html @@ -37,8 +37,7 @@ - + @@ -59,7 +58,7 @@ -

    Loading Data...

    +

    Please wait...

    diff --git a/Plan/src/test/java/com/djrapitops/plan/data/calculation/ActivityIndexTest.java b/Plan/src/test/java/com/djrapitops/plan/data/calculation/ActivityIndexTest.java index c5ec42b58..59fa7f226 100644 --- a/Plan/src/test/java/com/djrapitops/plan/data/calculation/ActivityIndexTest.java +++ b/Plan/src/test/java/com/djrapitops/plan/data/calculation/ActivityIndexTest.java @@ -114,7 +114,6 @@ public class ActivityIndexTest { public void testTimeout() { PlayerContainer container = new PlayerContainer(); List sessions = new ArrayList<>(); - long date = 0; for (int i = 0; i < 5000; i++) { sessions.add(new Session(0, UUID, SERVER_UUID, 0, 0, 0, 0, 0)); diff --git a/Plan/src/test/java/com/djrapitops/plan/data/container/GeoInfoTest.java b/Plan/src/test/java/com/djrapitops/plan/data/container/GeoInfoTest.java index d1cda25dd..6e382eacf 100644 --- a/Plan/src/test/java/com/djrapitops/plan/data/container/GeoInfoTest.java +++ b/Plan/src/test/java/com/djrapitops/plan/data/container/GeoInfoTest.java @@ -2,7 +2,6 @@ package com.djrapitops.plan.data.container; import org.junit.Test; -import java.io.UnsupportedEncodingException; import java.net.InetAddress; import java.net.UnknownHostException; import java.security.NoSuchAlgorithmException; @@ -17,7 +16,7 @@ import static org.junit.Assert.assertEquals; public class GeoInfoTest { @Test - public void automaticallyHidesLast16Bits() throws UnsupportedEncodingException, NoSuchAlgorithmException, UnknownHostException { + public void automaticallyHidesLast16Bits() throws NoSuchAlgorithmException, UnknownHostException { InetAddress test = InetAddress.getByName("1.2.3.4"); String expected = "1.2.xx.xx"; String result = new GeoInfo(test, "Irrelevant", 3).getIp(); diff --git a/Plan/src/test/java/com/djrapitops/plan/data/container/SessionTest.java b/Plan/src/test/java/com/djrapitops/plan/data/container/SessionTest.java new file mode 100644 index 000000000..d58898680 --- /dev/null +++ b/Plan/src/test/java/com/djrapitops/plan/data/container/SessionTest.java @@ -0,0 +1,85 @@ +package com.djrapitops.plan.data.container; + +import com.djrapitops.plan.data.store.keys.SessionKeys; +import com.djrapitops.plan.data.time.WorldTimes; +import org.junit.Test; +import utilities.TestConstants; + +import java.util.List; +import java.util.Optional; + +import static org.junit.Assert.*; + +/** + * Test for {@link Session} {@link com.djrapitops.plan.data.store.containers.DataContainer}. + * + * @author Rsl1122 + */ +public class SessionTest { + + @Test + public void safeStartKeyConstructor() { + for (int i = 0; i < 10000; i++) { + Session session = new Session(null, System.currentTimeMillis(), null, null); + + // Should not throw + session.getUnsafe(SessionKeys.START); + } + } + + @Test + public void safeStartKeyDBConstructor() { + for (int i = 0; i < 10000; i++) { + long time = System.currentTimeMillis(); + Session session = new Session(-1, null, null, time, time + 1, 0, 0, 0); + + // Should not throw + session.getUnsafe(SessionKeys.START); + } + } + + @Test + public void killsAreAdded() { + Session session = new Session(null, System.currentTimeMillis(), "", ""); + + Optional> beforeOptional = session.getValue(SessionKeys.PLAYER_KILLS); + assertTrue(beforeOptional.isPresent()); + List before = beforeOptional.get(); + assertTrue(before.isEmpty()); + + session.playerKilled(new PlayerKill(TestConstants.PLAYER_TWO_UUID, "Weapon", System.currentTimeMillis())); + + Optional> afterOptional = session.getValue(SessionKeys.PLAYER_KILLS); + assertTrue(afterOptional.isPresent()); + List after = afterOptional.get(); + + assertFalse(after.isEmpty()); + assertEquals(before, after); + } + + @Test + public void killsAreAdded2() { + Session session = new Session(null, System.currentTimeMillis(), "", ""); + + session.playerKilled(new PlayerKill(TestConstants.PLAYER_TWO_UUID, "Weapon", System.currentTimeMillis())); + + Optional> afterOptional = session.getValue(SessionKeys.PLAYER_KILLS); + assertTrue(afterOptional.isPresent()); + List after = afterOptional.get(); + + assertFalse(after.isEmpty()); + } + + @Test + public void worldTimesWorks() { + long time = System.currentTimeMillis(); + Session session = new Session(null, time, "One", "Survival"); + session.changeState("Two", "Three", time + 5L); + + Optional optional = session.getValue(SessionKeys.WORLD_TIMES); + assertTrue(optional.isPresent()); + WorldTimes worldTimes = optional.get(); + + assertEquals(5L, worldTimes.getGMTimes("One").getTotal()); + } +} \ No newline at end of file diff --git a/Plan/src/test/java/com/djrapitops/plan/data/store/containers/DataContainerTest.java b/Plan/src/test/java/com/djrapitops/plan/data/store/containers/DataContainerTest.java new file mode 100644 index 000000000..3f0a8c1b4 --- /dev/null +++ b/Plan/src/test/java/com/djrapitops/plan/data/store/containers/DataContainerTest.java @@ -0,0 +1,88 @@ +package com.djrapitops.plan.data.store.containers; + +import com.djrapitops.plan.data.store.Key; +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Test for {@link DataContainer} programming errors. + * + * @author Rsl1122 + */ +public class DataContainerTest { + + private static final Key TEST_KEY = new Key<>(String.class, "TEST_KEY"); + private static final Key TEST_KEY_COPY = new Key<>(String.class, "TEST_KEY"); + + @Test + public void safeUnsafeKeySupplierSameObject() { + DataContainer container = new DataContainer(); + container.putSupplier(TEST_KEY, () -> "Success"); + + // Test twice for CachingSupplier + assertEquals("Success", container.getUnsafe(TEST_KEY)); + assertEquals("Success", container.getUnsafe(TEST_KEY)); + } + + @Test + public void safeUnsafeKeySupplierDifferentObject() { + DataContainer container = new DataContainer(); + container.putSupplier(TEST_KEY, () -> "Success"); + + // Test twice for CachingSupplier + assertEquals("Success", container.getUnsafe(TEST_KEY_COPY)); + assertEquals("Success", container.getUnsafe(TEST_KEY_COPY)); + } + + @Test + public void safeUnsafeKeyRawSameObject() { + DataContainer container = new DataContainer(); + container.putRawData(TEST_KEY, "Success"); + + // Test twice for CachingSupplier + assertEquals("Success", container.getUnsafe(TEST_KEY)); + assertEquals("Success", container.getUnsafe(TEST_KEY)); + } + + @Test + public void safeUnsafeKeyRawDifferentObject() { + DataContainer container = new DataContainer(); + container.putRawData(TEST_KEY, "Success"); + + // Test twice for CachingSupplier + assertEquals("Success", container.getUnsafe(TEST_KEY_COPY)); + assertEquals("Success", container.getUnsafe(TEST_KEY_COPY)); + } + + @Test + public void safeUnsafeKeyRawNull() { + DataContainer container = new DataContainer(); + container.putRawData(TEST_KEY, null); + + // Test twice for CachingSupplier + assertTrue(container.supports(TEST_KEY)); + assertNull(container.getUnsafe(TEST_KEY)); + assertNull(container.getUnsafe(TEST_KEY)); + } + + @Test + public void safeUnsafeKeyNullSupplier() { + DataContainer container = new DataContainer(); + container.putSupplier(TEST_KEY, null); + + assertFalse(container.supports(TEST_KEY)); + } + + @Test + public void safeUnsafeKeySupplierNull() { + DataContainer container = new DataContainer(); + container.putSupplier(TEST_KEY, () -> null); + + // Test twice for CachingSupplier + assertTrue(container.supports(TEST_KEY)); + assertNull(container.getUnsafe(TEST_KEY)); + assertNull(container.getUnsafe(TEST_KEY)); + } + +} \ No newline at end of file diff --git a/Plan/src/test/java/com/djrapitops/plan/data/store/mutators/TPSMutatorTest.java b/Plan/src/test/java/com/djrapitops/plan/data/store/mutators/TPSMutatorTest.java new file mode 100644 index 000000000..33d93c5e8 --- /dev/null +++ b/Plan/src/test/java/com/djrapitops/plan/data/store/mutators/TPSMutatorTest.java @@ -0,0 +1,138 @@ +package com.djrapitops.plan.data.store.mutators; + +import com.djrapitops.plan.data.container.TPS; +import com.djrapitops.plan.data.container.builders.TPSBuilder; +import com.djrapitops.plugin.api.TimeAmount; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +import static org.junit.Assert.*; + +/** + * Tests for {@link TPSMutator} + * + * @author Rsl1122 + */ +public class TPSMutatorTest { + + private List testData; + private long time; + + @Before + public void setUp() { + testData = new ArrayList<>(); + + time = System.currentTimeMillis(); + long twoMonthsAgo = time - TimeAmount.MONTH.ms() * 2L; + + for (long date = twoMonthsAgo; date < time; date += TimeAmount.MINUTE.ms()) { + testData.add( + TPSBuilder.get().date(date) + .tps(0.0) + .playersOnline(0) + .usedCPU(0.0) + .usedMemory(0) + .entities(0) + .chunksLoaded(0) + .toTPS() + ); + } + } + + @Test + public void noDownTimeIsCorrect() { + long expected = 0; + long result = new TPSMutator(testData).serverDownTime(); + assertEquals(expected, result); + } + + @Test + public void noDownTimeOnSingleEntry() { + long expected = 0; + long result = new TPSMutator(Collections.singletonList( + TPSBuilder.get().date(time - TimeAmount.DAY.ms()) + .tps(0.0) + .playersOnline(0) + .usedCPU(0.0) + .usedMemory(0) + .entities(0) + .chunksLoaded(0) + .toTPS() + )).serverDownTime(); + assertEquals(expected, result); + } + + @Test + public void fullDownTime() { + long periodLength = TimeAmount.MINUTE.ms() * 5L; + long expected = TimeAmount.MONTH.ms() * 2L - periodLength; + + TPSMutator tpsMutator = new TPSMutator(testData.stream() + .filter(tps -> (tps.getDate() - time) % (periodLength) == 0) + .collect(Collectors.toList())); + assertFalse(tpsMutator.all().isEmpty()); + assertNotEquals(testData, tpsMutator.all()); + + long result = tpsMutator.serverDownTime(); + assertEquals(expected, result); + } + + @Test + public void filteredFullMonthDownTime() { + long periodLength = TimeAmount.MINUTE.ms() * 5L; + long expected = TimeAmount.MONTH.ms() - periodLength; + + long monthAgo = time - TimeAmount.MONTH.ms(); + TPSMutator tpsMutator = new TPSMutator(testData.stream() + .filter(tps -> (tps.getDate() - time) % (periodLength) == 0) + .collect(Collectors.toList())) + .filterDataBetween(monthAgo, time); + + assertFalse(tpsMutator.all().isEmpty()); + assertNotEquals(testData, tpsMutator.filterDataBetween(monthAgo, time).all()); + + long result = tpsMutator.serverDownTime(); + assertEquals(expected, result); + } + + @Test + public void filteredFullMonthDownTimeWhenRandomOrder() { + long periodLength = TimeAmount.MINUTE.ms() * 5L; + long expected = TimeAmount.MONTH.ms() - periodLength; + + List randomOrder = testData; + Collections.shuffle(randomOrder); + long monthAgo = time - TimeAmount.MONTH.ms(); + TPSMutator tpsMutator = new TPSMutator(randomOrder.stream() + .filter(tps -> (tps.getDate() - time) % (periodLength) == 0) + .collect(Collectors.toList())) + .filterDataBetween(monthAgo, time); + + assertFalse(tpsMutator.all().isEmpty()); + assertNotEquals(randomOrder, tpsMutator.filterDataBetween(monthAgo, time).all()); + + long result = tpsMutator.serverDownTime(); + assertEquals(expected, result); + } + + @Test + public void filterWorksCorrectly() { + long monthAgo = time - TimeAmount.MONTH.ms(); + List filtered = new TPSMutator(testData).filterDataBetween(monthAgo, time).all(); + + for (TPS tps : filtered) { + long date = tps.getDate(); + if (date < monthAgo) { + fail("Data from over month ago was present"); + } + if (date > time) { + fail("Data from after 'time' was present"); + } + } + } +} \ No newline at end of file diff --git a/Plan/src/test/java/com/djrapitops/plan/data/time/WorldTimesTest.java b/Plan/src/test/java/com/djrapitops/plan/data/time/WorldTimesTest.java index 72c0dad0e..d85dca4c4 100644 --- a/Plan/src/test/java/com/djrapitops/plan/data/time/WorldTimesTest.java +++ b/Plan/src/test/java/com/djrapitops/plan/data/time/WorldTimesTest.java @@ -18,8 +18,8 @@ public class WorldTimesTest { private final String worldOne = "ONE"; private final String worldTwo = "TWO"; private final String[] gms = GMTimes.getGMKeyArray(); - private WorldTimes worldTimes = new WorldTimes(worldOne, gms[0]); - private long time = worldTimes.getGMTimes(worldOne).getLastStateChange(); + private long time = System.currentTimeMillis(); + private WorldTimes worldTimes = new WorldTimes(worldOne, gms[0], time); @Test public void testWorldChange() { diff --git a/Plan/src/test/java/com/djrapitops/plan/system/BungeeBukkitConnectionTest.java b/Plan/src/test/java/com/djrapitops/plan/system/BungeeBukkitConnectionTest.java index 0e4c328d1..c0c2d06a4 100644 --- a/Plan/src/test/java/com/djrapitops/plan/system/BungeeBukkitConnectionTest.java +++ b/Plan/src/test/java/com/djrapitops/plan/system/BungeeBukkitConnectionTest.java @@ -11,6 +11,7 @@ import com.djrapitops.plan.api.exceptions.connection.WebException; import com.djrapitops.plan.system.database.ServerDBSystem; import com.djrapitops.plan.system.info.request.GenerateInspectPluginsTabRequest; import com.djrapitops.plan.system.info.server.ServerInfo; +import com.djrapitops.plan.system.locale.Locale; import com.djrapitops.plan.system.settings.Settings; import org.junit.*; import org.junit.rules.ExpectedException; @@ -97,7 +98,7 @@ public class BungeeBukkitConnectionTest { Settings.WEBSERVER_PORT.setTemporaryValue(9250); Settings.BUNGEE_IP.setTemporaryValue("localhost"); Settings.DB_TYPE.setTemporaryValue("sqlite"); - bungeeSystem.setDatabaseSystem(new ServerDBSystem()); + bungeeSystem.setDatabaseSystem(new ServerDBSystem(Locale::new)); bungeeSystem.enable(); diff --git a/Plan/src/test/java/com/djrapitops/plan/system/BungeeSystemTest.java b/Plan/src/test/java/com/djrapitops/plan/system/BungeeSystemTest.java index 590252d09..7b8bb705f 100644 --- a/Plan/src/test/java/com/djrapitops/plan/system/BungeeSystemTest.java +++ b/Plan/src/test/java/com/djrapitops/plan/system/BungeeSystemTest.java @@ -7,6 +7,7 @@ package com.djrapitops.plan.system; import com.djrapitops.plan.PlanBungee; import com.djrapitops.plan.api.exceptions.EnableException; import com.djrapitops.plan.system.database.ServerDBSystem; +import com.djrapitops.plan.system.locale.Locale; import com.djrapitops.plan.system.settings.Settings; import org.junit.*; import org.junit.rules.ExpectedException; @@ -63,7 +64,7 @@ public class BungeeSystemTest { Settings.WEBSERVER_PORT.setTemporaryValue(9005); Settings.BUNGEE_IP.setTemporaryValue("8.8.8.8"); Settings.DB_TYPE.setTemporaryValue("sqlite"); - bungeeSystem.setDatabaseSystem(new ServerDBSystem()); + bungeeSystem.setDatabaseSystem(new ServerDBSystem(Locale::new)); bungeeSystem.enable(); } @@ -77,7 +78,7 @@ public class BungeeSystemTest { Settings.WEBSERVER_PORT.setTemporaryValue(9005); Settings.DB_TYPE.setTemporaryValue("sqlite"); - bungeeSystem.setDatabaseSystem(new ServerDBSystem()); + bungeeSystem.setDatabaseSystem(new ServerDBSystem(Locale::new)); bungeeSystem.enable(); } diff --git a/Plan/src/test/java/com/djrapitops/plan/system/database/databases/MySQLTest.java b/Plan/src/test/java/com/djrapitops/plan/system/database/databases/MySQLTest.java index 1a3a8942f..855d869aa 100644 --- a/Plan/src/test/java/com/djrapitops/plan/system/database/databases/MySQLTest.java +++ b/Plan/src/test/java/com/djrapitops/plan/system/database/databases/MySQLTest.java @@ -5,6 +5,7 @@ package com.djrapitops.plan.system.database.databases; import com.djrapitops.plan.system.database.databases.sql.MySQLDB; +import com.djrapitops.plan.system.locale.Locale; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -18,12 +19,12 @@ public class MySQLTest { @Test public void testMySQLGetConfigName() { - assertEquals("mysql", new MySQLDB().getConfigName()); + assertEquals("mysql", new MySQLDB(Locale::new).getConfigName()); } @Test public void testMySQLGetName() { - assertEquals("MySQL", new MySQLDB().getName()); + assertEquals("MySQL", new MySQLDB(Locale::new).getName()); } } diff --git a/Plan/src/test/java/com/djrapitops/plan/system/database/databases/SQLiteTest.java b/Plan/src/test/java/com/djrapitops/plan/system/database/databases/SQLiteTest.java index c1e359254..7026f96be 100644 --- a/Plan/src/test/java/com/djrapitops/plan/system/database/databases/SQLiteTest.java +++ b/Plan/src/test/java/com/djrapitops/plan/system/database/databases/SQLiteTest.java @@ -24,6 +24,7 @@ import com.djrapitops.plan.system.database.databases.sql.SQLiteDB; import com.djrapitops.plan.system.database.databases.sql.tables.*; import com.djrapitops.plan.system.info.server.Server; import com.djrapitops.plan.system.info.server.ServerInfo; +import com.djrapitops.plan.system.locale.Locale; import com.djrapitops.plan.system.processing.processors.player.RegisterProcessor; import com.djrapitops.plan.utilities.Base64Util; import com.djrapitops.plan.utilities.SHA256Hash; @@ -68,7 +69,7 @@ public class SQLiteTest { System.out.println("--- Test Class Setup ---"); SystemMockUtil mockUtil = SystemMockUtil.setUp(temporaryFolder.getRoot()) .enableConfigSystem(); - db = new SQLiteDB(); + db = new SQLiteDB(Locale::new); mockUtil.enableDatabaseSystem(db) .enableServerInfoSystem(); StaticHolder.saveInstance(SQLDB.class, Plan.class); @@ -593,7 +594,7 @@ public class SQLiteTest { assertTrue(securityTable.getUsers().isEmpty()); } - private void saveAllData(SQLDB database) throws UnsupportedEncodingException, NoSuchAlgorithmException { + private void saveAllData(SQLDB database) throws NoSuchAlgorithmException { System.out.println("Saving all possible data to the Database.."); UserInfoTable userInfoTable = database.getUserInfoTable(); UsersTable usersTable = database.getUsersTable(); @@ -748,7 +749,7 @@ public class SQLiteTest { @Test public void testBackupAndRestore() throws DBException, UnsupportedEncodingException, NoSuchAlgorithmException { System.out.println("- Creating Backup Database -"); - SQLiteDB backup = new SQLiteDB("debug-backup" + System.currentTimeMillis()); + SQLiteDB backup = new SQLiteDB("debug-backup" + System.currentTimeMillis(), Locale::new); backup.init(); System.out.println("- Backup Database Created -"); @@ -863,7 +864,7 @@ public class SQLiteTest { System.out.println("\n- Running RegisterProcessors -"); List processors = new ArrayList<>(); for (int i = 0; i < 200; i++) { - processors.add(new RegisterProcessor(playerUUID, 500L, "name")); + processors.add(new RegisterProcessor(playerUUID, () -> 500L, "name")); } for (RegisterProcessor processor : processors) { processor.run(); @@ -929,94 +930,6 @@ public class SQLiteTest { assertTrue(geolocations.contains(secondInfo.getGeolocation())); } - @Test - public void testWorldTableAlterV16() { - saveUserOne(); - new Table("test", db) { - @Override - public void createTable() { - execute( - "INSERT INTO " + WorldTable.TABLE_NAME + " (" + - WorldTable.Col.NAME + ", " + - WorldTable.Col.SERVER_ID + - ") VALUES ('Test', '0')" - ); - execute( - "INSERT INTO " + SessionsTable.TABLE_NAME + " (" + - SessionsTable.Col.SESSION_START + ", " + - SessionsTable.Col.SESSION_END + ", " + - SessionsTable.Col.AFK_TIME + ", " + - SessionsTable.Col.DEATHS + ", " + - SessionsTable.Col.MOB_KILLS + ", " + - SessionsTable.Col.SERVER_ID + ", " + - SessionsTable.Col.USER_ID + - ") VALUES ('0', '0', '0', '0', '0', '1', '1')" - ); - execute( - "INSERT INTO " + WorldTimesTable.TABLE_NAME + " (" + - WorldTimesTable.Col.SERVER_ID + ", " + - WorldTimesTable.Col.SESSION_ID + ", " + - WorldTimesTable.Col.USER_ID + ", " + - WorldTimesTable.Col.WORLD_ID + ", " + - WorldTimesTable.Col.SURVIVAL + ", " + - WorldTimesTable.Col.CREATIVE + ", " + - WorldTimesTable.Col.SPECTATOR + ", " + - WorldTimesTable.Col.ADVENTURE + - ") VALUES ('1', '1', '1', '1', '0','0','0','0')" - ); - execute( - "INSERT INTO " + ServerTable.TABLE_NAME + " (" + - ServerTable.Col.SERVER_UUID + ", " + - ServerTable.Col.SERVER_ID + ", " + - ServerTable.Col.MAX_PLAYERS + ", " + - ServerTable.Col.WEBSERVER_ADDRESS + ", " + - ServerTable.Col.INSTALLED + ", " + - ServerTable.Col.NAME + - ") VALUES ('" + UUID.randomUUID() + "', '2', '0', '0', '1', '2')" - ); - execute( - "INSERT INTO " + SessionsTable.TABLE_NAME + " (" + - SessionsTable.Col.SESSION_START + ", " + - SessionsTable.Col.SESSION_END + ", " + - SessionsTable.Col.AFK_TIME + ", " + - SessionsTable.Col.DEATHS + ", " + - SessionsTable.Col.MOB_KILLS + ", " + - SessionsTable.Col.SERVER_ID + ", " + - SessionsTable.Col.USER_ID + - ") VALUES ('0', '0', '0', '0', '0', '2', '1')" - ); - execute( - "INSERT INTO " + WorldTimesTable.TABLE_NAME + " (" + - WorldTimesTable.Col.SERVER_ID + ", " + - WorldTimesTable.Col.SESSION_ID + ", " + - WorldTimesTable.Col.USER_ID + ", " + - WorldTimesTable.Col.WORLD_ID + ", " + - WorldTimesTable.Col.SURVIVAL + ", " + - WorldTimesTable.Col.CREATIVE + ", " + - WorldTimesTable.Col.SPECTATOR + ", " + - WorldTimesTable.Col.ADVENTURE + - ") VALUES ('2', '2', '1', '1', '0','0','0','0')" - ); - } - }.createTable(); - - WorldTable worldTable = db.getWorldTable(); - Map> before = worldTable.getWorldIDsByServerIDs(); - System.out.println("\nBefore: " + before); - System.out.println("Before: " + worldTable.getWorldObjects() + "\n"); - - worldTable.alterTableV16(); - - Map> after = worldTable.getWorldIDsByServerIDs(); - System.out.println("\nAfter: " + after); - System.out.println("After: " + worldTable.getWorldObjects() + "\n"); - assertNull(after.get(0)); - assertNotNull(after.get(1)); - assertEquals(1, after.get(1).size()); - assertNotNull(after.get(2)); - assertEquals(1, after.get(2).size()); - } - @Test public void testNewContainerForPlayer() throws UnsupportedEncodingException, NoSuchAlgorithmException { saveAllData(db); diff --git a/Plan/src/test/java/com/djrapitops/plan/system/locale/LocaleFileWriterTest.java b/Plan/src/test/java/com/djrapitops/plan/system/locale/LocaleFileWriterTest.java new file mode 100644 index 000000000..8ce7cf4c6 --- /dev/null +++ b/Plan/src/test/java/com/djrapitops/plan/system/locale/LocaleFileWriterTest.java @@ -0,0 +1,34 @@ +package com.djrapitops.plan.system.locale; + +import com.djrapitops.plan.utilities.file.FileUtil; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.Charset; + +import static org.junit.Assert.assertEquals; + +/** + * Test class for {@link LocaleFileWriter}. + * + * @author Rsl1122 + */ +public class LocaleFileWriterTest { + + @Rule + public TemporaryFolder temporaryFolder = new TemporaryFolder(); + + @Test + public void writesAllIdentifiers() throws IOException { + File file = temporaryFolder.newFile(); + new LocaleFileWriter(new Locale()).writeToFile(file); + + long expected = LocaleSystem.getIdentifiers().size(); + int result = FileUtil.lines(file, Charset.forName("UTF-8")).size(); + assertEquals(expected, result); + } + +} \ No newline at end of file diff --git a/Plan/src/test/java/com/djrapitops/plan/system/locale/LocaleSystemTest.java b/Plan/src/test/java/com/djrapitops/plan/system/locale/LocaleSystemTest.java new file mode 100644 index 000000000..ec762052c --- /dev/null +++ b/Plan/src/test/java/com/djrapitops/plan/system/locale/LocaleSystemTest.java @@ -0,0 +1,12 @@ +package com.djrapitops.plan.system.locale; + +import org.junit.Test; + +public class LocaleSystemTest { + + @Test + public void noIdentifierCollisions() { + // No Exception wanted + LocaleSystem.getIdentifiers(); + } +} \ No newline at end of file diff --git a/Plan/src/test/java/com/djrapitops/plan/system/settings/network/NetworkSettingsTest.java b/Plan/src/test/java/com/djrapitops/plan/system/settings/network/NetworkSettingsTest.java index 4b52c362e..6504005b5 100644 --- a/Plan/src/test/java/com/djrapitops/plan/system/settings/network/NetworkSettingsTest.java +++ b/Plan/src/test/java/com/djrapitops/plan/system/settings/network/NetworkSettingsTest.java @@ -8,6 +8,7 @@ import com.djrapitops.plan.system.database.databases.sql.SQLiteDB; import com.djrapitops.plan.system.database.databases.sql.tables.ServerTable; import com.djrapitops.plan.system.info.server.Server; import com.djrapitops.plan.system.info.server.ServerInfo; +import com.djrapitops.plan.system.locale.Locale; import com.djrapitops.plan.system.settings.Settings; import com.djrapitops.plugin.StaticHolder; import com.djrapitops.plugin.api.utility.log.Log; @@ -33,7 +34,7 @@ public class NetworkSettingsTest { SystemMockUtil mockUtil = SystemMockUtil.setUp(temporaryFolder.getRoot()) .enableConfigSystem(); - db = new SQLiteDB(); + db = new SQLiteDB(Locale::new); mockUtil.enableDatabaseSystem(db) .enableServerInfoSystem(); diff --git a/Plan/src/test/java/com/djrapitops/plan/utilities/MiscUtilsTest.java b/Plan/src/test/java/com/djrapitops/plan/utilities/MiscUtilsTest.java index 899d74007..a841b6f89 100644 --- a/Plan/src/test/java/com/djrapitops/plan/utilities/MiscUtilsTest.java +++ b/Plan/src/test/java/com/djrapitops/plan/utilities/MiscUtilsTest.java @@ -29,8 +29,7 @@ import utilities.mocks.objects.MockUtils; import java.util.List; import java.util.UUID; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.*; /** * @author Rsl1122 @@ -75,10 +74,9 @@ public class MiscUtilsTest { String[] args = new String[]{"Rsl1122", "Test"}; ISender sender = new BukkitCMDSender(MockUtils.mockPlayer2()); - String expResult = ""; String result = MiscUtils.getPlayerName(args, sender); - assertEquals(expResult, result); + assertNull(result); } @Test diff --git a/Plan/src/test/java/com/djrapitops/plan/utilities/comparators/ComparatorTest.java b/Plan/src/test/java/com/djrapitops/plan/utilities/comparators/ComparatorTest.java index 6c117c94b..d2fa9bc05 100644 --- a/Plan/src/test/java/com/djrapitops/plan/utilities/comparators/ComparatorTest.java +++ b/Plan/src/test/java/com/djrapitops/plan/utilities/comparators/ComparatorTest.java @@ -6,8 +6,9 @@ import com.djrapitops.plan.data.container.Session; import com.djrapitops.plan.data.container.TPS; import com.djrapitops.plan.data.container.UserInfo; import com.djrapitops.plan.data.store.keys.SessionKeys; -import com.djrapitops.plan.system.settings.locale.Message; -import com.djrapitops.plan.system.settings.locale.Msg; +import com.djrapitops.plan.system.locale.Message; +import com.djrapitops.plan.system.locale.lang.CmdHelpLang; +import com.djrapitops.plan.system.locale.lang.Lang; import com.djrapitops.plan.utilities.PassEncryptUtil; import com.djrapitops.plan.utilities.html.graphs.line.Point; import org.junit.Test; @@ -123,20 +124,20 @@ public class ComparatorTest { @Test public void localeEntryComparator() { - Map messageMap = new HashMap<>(); - messageMap.put(Msg.CMD_CONSTANT_FOOTER, new Message(RandomData.randomString(10))); - messageMap.put(Msg.ANALYSIS_3RD_PARTY, new Message(RandomData.randomString(10))); - messageMap.put(Msg.MANAGE_FAIL_NO_PLAYERS, new Message(RandomData.randomString(10))); + Map messageMap = new HashMap<>(); + messageMap.put(CmdHelpLang.SERVERS, new Message(RandomData.randomString(10))); + messageMap.put(CmdHelpLang.ANALYZE, new Message(RandomData.randomString(10))); + messageMap.put(CmdHelpLang.MANAGE_RESTORE, new Message(RandomData.randomString(10))); - List result = messageMap.entrySet().stream() + List result = messageMap.entrySet().stream() .sorted(new LocaleEntryComparator()) .map(Map.Entry::getKey) .collect(Collectors.toList()); - List expected = Arrays.asList( - Msg.ANALYSIS_3RD_PARTY, - Msg.CMD_CONSTANT_FOOTER, - Msg.MANAGE_FAIL_NO_PLAYERS + List expected = Arrays.asList( + CmdHelpLang.ANALYZE, + CmdHelpLang.MANAGE_RESTORE, + CmdHelpLang.SERVERS ); assertEquals(expected, result); } diff --git a/Plan/src/test/java/com/djrapitops/plan/utilities/java/SerializerTest.java b/Plan/src/test/java/com/djrapitops/plan/utilities/java/SerializerTest.java new file mode 100644 index 000000000..f55b98d4b --- /dev/null +++ b/Plan/src/test/java/com/djrapitops/plan/utilities/java/SerializerTest.java @@ -0,0 +1,41 @@ +package com.djrapitops.plan.utilities.java; + +import com.djrapitops.plan.data.store.Type; +import com.djrapitops.plan.utilities.Base64Util; +import com.djrapitops.plugin.utilities.Format; +import org.junit.Before; +import org.junit.Test; + +import java.io.IOException; +import java.io.Serializable; +import java.util.function.Function; + +import static org.junit.Assert.assertEquals; + +/** + * Test for {@link Serializer}. + * + * @author Rsl1122 + */ +public class SerializerTest { + + private String store; + + @Before + public void setUp() throws Exception { + Function function = (Function & Serializable) + string -> new Format(string).removeSymbols().toString(); + + Serializer> serializer = new Serializer<>(Type.of(function)); + byte[] output = serializer.serialize(function); + store = Base64Util.encodeBytes(output); + } + + @Test + public void test() throws IOException, ClassNotFoundException { + Function function = new Serializer<>(new Type>() {}) + .deserialize(Base64Util.decodeBytes(store)); + String result = function.apply("no-,.-.,-.,-.,-"); + assertEquals("no", result); + } +} \ No newline at end of file diff --git a/Plan/src/test/java/utilities/TestDatabaseCreator.java b/Plan/src/test/java/utilities/TestDatabaseCreator.java index 471f860fa..5f4bbcc4e 100644 --- a/Plan/src/test/java/utilities/TestDatabaseCreator.java +++ b/Plan/src/test/java/utilities/TestDatabaseCreator.java @@ -7,6 +7,7 @@ import com.djrapitops.plan.data.time.WorldTimes; import com.djrapitops.plan.system.database.databases.sql.SQLDB; import com.djrapitops.plan.system.database.databases.sql.SQLiteDB; import com.djrapitops.plan.system.info.server.Server; +import com.djrapitops.plan.system.locale.Locale; import com.djrapitops.plugin.api.TimeAmount; import java.io.File; @@ -37,7 +38,7 @@ public class TestDatabaseCreator { boolean oldDB = testDB.exists(); - db = new SQLiteDB(testDB); + db = new SQLiteDB(testDB, Locale::new); db.init(); r = new Random(); diff --git a/Plan/src/test/java/utilities/mocks/objects/MockUtils.java b/Plan/src/test/java/utilities/mocks/objects/MockUtils.java index 43bb31d2d..8b209a141 100644 --- a/Plan/src/test/java/utilities/mocks/objects/MockUtils.java +++ b/Plan/src/test/java/utilities/mocks/objects/MockUtils.java @@ -1,6 +1,5 @@ package utilities.mocks.objects; -import com.sun.net.httpserver.*; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.World; @@ -8,13 +7,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.mockito.Mockito; -import java.io.*; -import java.net.InetSocketAddress; -import java.net.URI; -import java.net.URISyntaxException; -import java.nio.charset.Charset; -import java.util.*; -import java.util.zip.GZIPInputStream; +import java.util.UUID; import static org.mockito.Mockito.when; @@ -61,142 +54,8 @@ public class MockUtils { return p; } - public static Player mockBrokenPlayer() { - Player p = Mockito.mock(Player.class); - when(p.getGameMode()).thenReturn(GameMode.SURVIVAL); - when(p.getUniqueId()).thenReturn(UUID.fromString("45b0dfdb-f71d-4cf3-8c21-27c9d4c651db")); - when(p.getFirstPlayed()).thenReturn(1234567L); - World mockWorld = mockWorld(); - when(p.getLocation()).thenReturn(new Location(mockWorld, 0, 0, 0)); - when(p.isOp()).thenReturn(true); - when(p.isBanned()).thenThrow(Exception.class); - when(p.isOnline()).thenReturn(true); - when(p.getName()).thenReturn("TestName"); - return p; - } - public static CommandSender mockConsoleSender() { return Mockito.mock(CommandSender.class); } - public static HttpServer mockHTTPServer() { - HttpServer httpServer = Mockito.mock(HttpServer.class); - when(httpServer.getAddress()).thenReturn(new InetSocketAddress(80)); - when(httpServer.getExecutor()).thenReturn(command -> System.out.println("HTTP Server command received")); - return httpServer; - } - - public static HttpExchange getHttpExchange(String requestMethod, String requestURI, String body, Map> responseHeaders) { - return new HttpExchange() { - private ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - - @Override - public Headers getRequestHeaders() { - Headers headers = new Headers(); - headers.put("Authorization", new ArrayList<>()); - return headers; - } - - @Override - public Headers getResponseHeaders() { - Headers headers = new Headers(); - headers.putAll(responseHeaders); - return headers; - } - - @Override - public URI getRequestURI() { - try { - return new URI(requestURI); - } catch (URISyntaxException e) { - return null; - } - } - - @Override - public String getRequestMethod() { - return requestMethod; - } - - @Override - public HttpContext getHttpContext() { - return null; - } - - @Override - public void close() { - - } - - @Override - public InputStream getRequestBody() { - return new ByteArrayInputStream(body.getBytes(Charset.forName("UTF-8"))); - } - - @Override - public OutputStream getResponseBody() { - return outputStream; - } - - @Override - public InetSocketAddress getRemoteAddress() { - return null; - } - - @Override - public InetSocketAddress getLocalAddress() { - return null; - } - - @Override - public String getProtocol() { - return null; - } - - @Override - public Object getAttribute(String name) { - return null; - } - - @Override - public void sendResponseHeaders(int i, long l) { - - } - - @Override - public int getResponseCode() { - return 0; - } - - @Override - public void setAttribute(String s, Object o) { - - } - - @Override - public void setStreams(InputStream inputStream, OutputStream outputStream) { - - } - - @Override - public HttpPrincipal getPrincipal() { - return null; - } - }; - } - - public static String getResponseStream(HttpExchange requestExchange) throws IOException { - InputStream in = new GZIPInputStream( - new ByteArrayInputStream(( - (ByteArrayOutputStream) requestExchange.getResponseBody() - ).toByteArray()) - ); - try (Scanner scanner = new Scanner(in)) { - StringBuilder s = new StringBuilder(); - while (scanner.hasNextLine()) { - s.append(scanner.nextLine()).append("\n"); - } - return s.toString(); - } - } } diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansDBObj.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansDBObj.java index 25a377ff9..2693c1ef1 100644 --- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansDBObj.java +++ b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansDBObj.java @@ -13,13 +13,15 @@ public class LiteBansDBObj { private final String bannedBy; private final long expiry; private final boolean active; + private final long time; - public LiteBansDBObj(UUID uuid, String reason, String bannedBy, long expiry, boolean active) { + public LiteBansDBObj(UUID uuid, String reason, String bannedBy, long expiry, boolean active, long time) { this.uuid = uuid; this.reason = reason; this.bannedBy = bannedBy; this.expiry = expiry; this.active = active; + this.time = time; } public UUID getUuid() { @@ -41,4 +43,8 @@ public class LiteBansDBObj { public boolean isActive() { return active; } + + public long getTime() { + return time; + } } diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansData.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansData.java index 01dd71d96..48cde675c 100644 --- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansData.java +++ b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansData.java @@ -18,6 +18,7 @@ import com.djrapitops.plan.utilities.html.Html; import com.djrapitops.plan.utilities.html.icon.Color; import com.djrapitops.plan.utilities.html.icon.Family; import com.djrapitops.plan.utilities.html.icon.Icon; +import com.djrapitops.plan.utilities.html.icon.Icons; import com.djrapitops.plan.utilities.html.structure.TabsElement; import com.djrapitops.plugin.api.utility.log.Log; @@ -99,39 +100,40 @@ public class LiteBansData extends PluginData implements BanData { } catch (DBOpException ex) { Log.toLog(this.getClass().getName(), ex); table.addRow("Error: " + ex); + } catch (IllegalStateException e) { + inspectContainer.addValue(getWithIcon("Error", Icons.RED_WARN), "Database connection is not available"); + return inspectContainer; } inspectContainer.addTable("table", table); - return inspectContainer; } @Override public AnalysisContainer getServerData(Collection collection, AnalysisContainer analysisContainer) { - TableContainer banTable = getBanTable(); - TableContainer muteTable = getMuteTable(); - TableContainer warningTable = getWarningTable(); - TableContainer kickTable = getKickTable(); - - Html spacing = Html.PANEL_BODY; - String[] navAndHtml = new TabsElement( - new TabsElement.Tab(getWithIcon("Bans", Icon.called("ban")), spacing.parse(banTable.parseHtml())), - new TabsElement.Tab(getWithIcon("Mutes", Icon.called("bell-slash").of(Family.REGULAR)), spacing.parse(muteTable.parseHtml())), - new TabsElement.Tab(getWithIcon("Warnings", Icon.called("exclamation-triangle")), spacing.parse(warningTable.parseHtml())), - new TabsElement.Tab(getWithIcon("Kicks", Icon.called("user-times")), spacing.parse(kickTable.parseHtml())) - ).toHtml(); - analysisContainer.addHtml("Tables", navAndHtml[0] + navAndHtml[1]); + try { + TableContainer banTable = getBanTable(); + TableContainer muteTable = getMuteTable(); + TableContainer warningTable = getWarningTable(); + TableContainer kickTable = getKickTable(); + Html spacing = Html.PANEL_BODY; + String[] navAndHtml = new TabsElement( + new TabsElement.Tab(getWithIcon("Bans", Icon.called("ban")), spacing.parse(banTable.parseHtml())), + new TabsElement.Tab(getWithIcon("Mutes", Icon.called("bell-slash").of(Family.REGULAR)), spacing.parse(muteTable.parseHtml())), + new TabsElement.Tab(getWithIcon("Warnings", Icon.called("exclamation-triangle")), spacing.parse(warningTable.parseHtml())), + new TabsElement.Tab(getWithIcon("Kicks", Icon.called("user-times")), spacing.parse(kickTable.parseHtml())) + ).toHtml(); + analysisContainer.addHtml("Tables", navAndHtml[0] + navAndHtml[1]); + } catch (IllegalStateException e) { + analysisContainer.addValue(getWithIcon("Error", Icons.RED_WARN), "Database connection is not available"); + } return analysisContainer; } private TableContainer getBanTable() { String banned = getWithIcon("Banned", Icon.called("ban")); String by = getWithIcon("Banned By", Icon.called("gavel")); - String reason = getWithIcon("Reason", Icon.called("balance-scale")); - String date = getWithIcon("Expires", Icon.called("calendar-times").of(Family.REGULAR)); - String active = getWithIcon("Active", Icon.called("hourglass")); - - TableContainer banTable = new TableContainer(banned, by, reason, date, active); + TableContainer banTable = createTableContainer(banned, by); banTable.useJqueryDataTables(); addRows(banTable, db.getBans()); return banTable; @@ -140,11 +142,7 @@ public class LiteBansData extends PluginData implements BanData { private TableContainer getMuteTable() { String muted = getWithIcon("Muted", Icon.called("bell-slash").of(Family.REGULAR)); String by = getWithIcon("Muted By", Icon.called("gavel")); - String reason = getWithIcon("Reason", Icon.called("balance-scale")); - String date = getWithIcon("Expires", Icon.called("calendar-times").of(Family.REGULAR)); - String active = getWithIcon("Active", Icon.called("hourglass")); - - TableContainer muteTable = new TableContainer(muted, by, reason, date, active); + TableContainer muteTable = createTableContainer(muted, by); muteTable.useJqueryDataTables(); addRows(muteTable, db.getMutes()); return muteTable; @@ -153,11 +151,7 @@ public class LiteBansData extends PluginData implements BanData { private TableContainer getWarningTable() { String warned = getWithIcon("Warned", Icon.called("exclamation-triangle")); String by = getWithIcon("Warned By", Icon.called("gavel")); - String reason = getWithIcon("Reason", Icon.called("balance-scale")); - String date = getWithIcon("Expires", Icon.called("calendar-times").of(Family.REGULAR)); - String active = getWithIcon("Active", Icon.called("hourglass")); - - TableContainer warnTable = new TableContainer(warned, by, reason, date, active); + TableContainer warnTable = createTableContainer(warned, by); warnTable.useJqueryDataTables(); addRows(warnTable, db.getWarnings()); return warnTable; @@ -166,16 +160,21 @@ public class LiteBansData extends PluginData implements BanData { private TableContainer getKickTable() { String kicked = getWithIcon("Kicked", Icon.called("user-times")); String by = getWithIcon("Kicked By", Icon.called("gavel")); - String reason = getWithIcon("Reason", Icon.called("balance-scale")); - String date = getWithIcon("Expires", Icon.called("calendar-times").of(Family.REGULAR)); - String active = getWithIcon("Active", Icon.called("hourglass")); - - TableContainer kickTable = new TableContainer(kicked, by, reason, date, active); + TableContainer kickTable = createTableContainer(kicked, by); kickTable.useJqueryDataTables(); addRows(kickTable, db.getKicks()); return kickTable; } + private TableContainer createTableContainer(String who, String by) { + String reason = getWithIcon("Reason", Icon.called("balance-scale")); + String given = getWithIcon("Given", Icon.called("clock").of(Family.REGULAR)); + String expiry = getWithIcon("Expires", Icon.called("calendar-times").of(Family.REGULAR)); + String active = getWithIcon("Active", Icon.called("hourglass")); + + return new TableContainer(who, by, reason, given, expiry, active); + } + private void addRows(TableContainer table, List objects) { if (objects.isEmpty()) { table.addRow("No Data"); @@ -183,14 +182,17 @@ public class LiteBansData extends PluginData implements BanData { Map playerNames = analysisData.getValue(AnalysisKeys.PLAYER_NAMES).orElse(new HashMap<>()); for (LiteBansDBObj object : objects) { UUID uuid = object.getUuid(); - String name = playerNames.getOrDefault(uuid, "Unknown to Plan"); + String name = playerNames.getOrDefault(uuid, uuid.toString()); long expiry = object.getExpiry(); String expires = expiry <= 0 ? "Never" : FormatUtils.formatTimeStampSecond(expiry); + long time = object.getTime(); + String given = time <= 0 ? "Unknown" : FormatUtils.formatTimeStampSecond(time); table.addRow( Html.LINK.parse(PlanAPI.getInstance().getPlayerInspectPageLink(name), name), Html.LINK.parse(PlanAPI.getInstance().getPlayerInspectPageLink(object.getBannedBy()), object.getBannedBy()), object.getReason(), + given, expires, object.isActive() ? "Yes" : "No" ); diff --git a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansDatabaseQueries.java b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansDatabaseQueries.java index ef1fb183a..3c9f90332 100644 --- a/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansDatabaseQueries.java +++ b/PlanPluginBridge/src/main/java/com/djrapitops/pluginbridge/plan/litebans/LiteBansDatabaseQueries.java @@ -38,7 +38,7 @@ public class LiteBansDatabaseQueries extends Table { mutesTable = tablePrefix + "mutes"; warningsTable = tablePrefix + "warnings"; kicksTable = tablePrefix + "kicks"; - selectSQL = "SELECT uuid, reason, banned_by_name, until, active FROM "; + selectSQL = "SELECT uuid, reason, banned_by_name, until, active, time FROM "; } @Override @@ -81,6 +81,9 @@ public class LiteBansDatabaseQueries extends Table { List objs = new ArrayList<>(); while (set.next()) { String uuidS = set.getString("uuid"); + if (uuidS == null) { + continue; + } UUID uuid; try { uuid = UUID.fromString(uuidS); @@ -89,9 +92,10 @@ public class LiteBansDatabaseQueries extends Table { } String reason = set.getString("reason"); String bannedBy = set.getString("banned_by_name"); - long time = set.getLong("until"); + long until = set.getLong("until"); + long time = set.getLong("time"); boolean active = set.getBoolean("active"); - objs.add(new LiteBansDBObj(uuid, reason, bannedBy, time, active)); + objs.add(new LiteBansDBObj(uuid, reason, bannedBy, until, active, time)); } return objs; }