mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-28 12:07:35 +01:00
Lang implemented for DataUtilityCommands
This commit is contained in:
parent
9b068f14a8
commit
72a2a50ecf
@ -34,13 +34,14 @@ import com.djrapitops.plan.gathering.importing.importers.Importer;
|
||||
import com.djrapitops.plan.identification.Identifiers;
|
||||
import com.djrapitops.plan.identification.ServerInfo;
|
||||
import com.djrapitops.plan.processing.Processing;
|
||||
import com.djrapitops.plan.settings.Permissions;
|
||||
import com.djrapitops.plan.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.settings.config.paths.ExportSettings;
|
||||
import com.djrapitops.plan.settings.config.paths.TimeSettings;
|
||||
import com.djrapitops.plan.settings.locale.Locale;
|
||||
import com.djrapitops.plan.settings.locale.lang.CommandLang;
|
||||
import com.djrapitops.plan.settings.locale.lang.GenericLang;
|
||||
import com.djrapitops.plan.settings.locale.lang.ManageLang;
|
||||
import com.djrapitops.plan.settings.locale.lang.HelpLang;
|
||||
import com.djrapitops.plan.storage.database.DBSystem;
|
||||
import com.djrapitops.plan.storage.database.Database;
|
||||
import com.djrapitops.plan.storage.database.queries.containers.ContainerFetchQueries;
|
||||
@ -96,7 +97,7 @@ public class DataUtilityCommands {
|
||||
|
||||
public void onExport(CMDSender sender, Arguments arguments) {
|
||||
String exportKind = arguments.get(0)
|
||||
.orElseThrow(() -> new IllegalArgumentException("Accepts following as export kind: players, server_json"));
|
||||
.orElseThrow(() -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_ACCEPTS_ARGUMENTS, locale.getString(HelpLang.ARG_EXPORT_KIND), "players, server_json")));
|
||||
|
||||
ensureDatabaseIsOpen();
|
||||
|
||||
@ -109,7 +110,7 @@ public class DataUtilityCommands {
|
||||
} else if ("server_json".endsWith(exportArg)) {
|
||||
return this::exportServerJSON;
|
||||
}
|
||||
throw new IllegalArgumentException(locale.getString(ManageLang.FAIL_EXPORTER_NOT_FOUND, exportArg));
|
||||
throw new IllegalArgumentException(locale.getString(CommandLang.FAIL_EXPORTER_NOT_FOUND, exportArg));
|
||||
}
|
||||
|
||||
private void exportServerJSON(CMDSender sender) {
|
||||
@ -118,14 +119,17 @@ public class DataUtilityCommands {
|
||||
}
|
||||
processing.submitNonCritical(() -> {
|
||||
try {
|
||||
sender.send(locale.getString(ManageLang.PROGRESS_START));
|
||||
sender.send(locale.getString(CommandLang.PROGRESS_START));
|
||||
if (exporter.exportServerJSON(serverInfo.getServer())) {
|
||||
sender.send(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
||||
sender.send(locale.getString(CommandLang.PROGRESS_SUCCESS));
|
||||
} else {
|
||||
sender.send(locale.get(ManageLang.PROGRESS_FAIL).toString("see '" + ExportSettings.SERVER_JSON.getPath() + "' in config.yml"));
|
||||
sender.send(locale.getString(
|
||||
CommandLang.PROGRESS_FAIL,
|
||||
locale.getString(CommandLang.FAIL_SEE_CONFIG_SETTING, ExportSettings.SERVER_JSON.getPath())
|
||||
));
|
||||
}
|
||||
} catch (ExportException e) {
|
||||
sender.send(locale.get(ManageLang.PROGRESS_FAIL).toString(e.getMessage()));
|
||||
sender.send(locale.get(CommandLang.PROGRESS_FAIL).toString(e.getMessage()));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -145,13 +149,13 @@ public class DataUtilityCommands {
|
||||
}
|
||||
|
||||
private void performExport(CMDSender sender, boolean exportPlayerJSON, boolean exportPlayerHTML) {
|
||||
sender.send(locale.getString(ManageLang.PROGRESS_START));
|
||||
sender.send(locale.getString(CommandLang.PROGRESS_START));
|
||||
|
||||
Map<UUID, String> players = dbSystem.getDatabase().query(UserIdentifierQueries.fetchAllPlayerNames());
|
||||
int size = players.size();
|
||||
int outOf = players.size();
|
||||
int failed = 0;
|
||||
|
||||
int i = 1;
|
||||
int current = 1;
|
||||
for (Map.Entry<UUID, String> entry : players.entrySet()) {
|
||||
try {
|
||||
if (exportPlayerJSON) exporter.exportPlayerJSON(entry.getKey(), entry.getValue());
|
||||
@ -159,22 +163,22 @@ public class DataUtilityCommands {
|
||||
} catch (ExportException e) {
|
||||
failed++;
|
||||
}
|
||||
i++;
|
||||
if (i % 1000 == 0) {
|
||||
sender.send(i + " / " + size + " processed..");
|
||||
current++;
|
||||
if (current % 1000 == 0) {
|
||||
sender.send(locale.getString(CommandLang.PROGRESS, current, outOf));
|
||||
}
|
||||
}
|
||||
sender.send(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
||||
sender.send(locale.getString(CommandLang.PROGRESS_SUCCESS));
|
||||
if (failed != 0) {
|
||||
sender.send(locale.getString(ManageLang.PROGRESS_FAIL));
|
||||
sender.send(" §2✔: §f" + (i - failed));
|
||||
sender.send(locale.getString(CommandLang.PROGRESS_FAIL));
|
||||
sender.send(" §2✔: §f" + (current - failed));
|
||||
sender.send(" §c✕: §f" + failed);
|
||||
}
|
||||
}
|
||||
|
||||
public void onImport(CMDSender sender, Arguments arguments) {
|
||||
String importKind = arguments.get(0)
|
||||
.orElseThrow(() -> new IllegalArgumentException("Accepts following as import kind: " + importSystem.getImporterNames()));
|
||||
.orElseThrow(() -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_ACCEPTS_ARGUMENTS, locale.getString(HelpLang.ARG_IMPORT_KIND), importSystem.getImporterNames().toString())));
|
||||
|
||||
ensureDatabaseIsOpen();
|
||||
|
||||
@ -186,19 +190,19 @@ public class DataUtilityCommands {
|
||||
if (foundImporter.isPresent()) {
|
||||
Importer importer = foundImporter.get();
|
||||
processing.submitNonCritical(() -> {
|
||||
sender.send(locale.getString(ManageLang.PROGRESS_START));
|
||||
sender.send(locale.getString(CommandLang.PROGRESS_START));
|
||||
importer.processImport();
|
||||
sender.send(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
||||
sender.send(locale.getString(CommandLang.PROGRESS_SUCCESS));
|
||||
});
|
||||
} else {
|
||||
sender.send(locale.getString(ManageLang.FAIL_IMPORTER_NOT_FOUND, importKind));
|
||||
sender.send(locale.getString(CommandLang.FAIL_IMPORTER_NOT_FOUND, importKind));
|
||||
}
|
||||
}
|
||||
|
||||
public void onSearch(CMDSender sender, Arguments arguments) {
|
||||
String searchingFor = arguments.concatenate(" ");
|
||||
if (searchingFor.trim().isEmpty()) {
|
||||
throw new IllegalArgumentException("The search string can not be empty" /* TODO */);
|
||||
throw new IllegalArgumentException(locale.getString(CommandLang.FAIL_EMPTY_SEARCH_STRING));
|
||||
}
|
||||
|
||||
ensureDatabaseIsOpen();
|
||||
@ -223,18 +227,18 @@ public class DataUtilityCommands {
|
||||
UUID senderUUID = sender.getUUID().orElse(null);
|
||||
if (playerUUID == null) playerUUID = senderUUID;
|
||||
if (playerUUID == null) {
|
||||
throw new IllegalArgumentException("Player '" + identifier + "' was not found, they have no UUID.");
|
||||
throw new IllegalArgumentException(locale.getString(CommandLang.FAIL_PLAYER_NOT_FOUND, identifier));
|
||||
}
|
||||
|
||||
PlayerContainer player = dbSystem.getDatabase().query(ContainerFetchQueries.fetchPlayerContainer(playerUUID));
|
||||
if (!player.getValue(PlayerKeys.REGISTERED).isPresent()) {
|
||||
throw new IllegalArgumentException("Player '" + identifier + "' was not found in the database.");
|
||||
throw new IllegalArgumentException(locale.getString(CommandLang.FAIL_PLAYER_NOT_FOUND_REGISTER, identifier));
|
||||
}
|
||||
|
||||
if (sender.hasPermission("plan.ingame.other") || playerUUID.equals(senderUUID)) {
|
||||
if (sender.hasPermission(Permissions.INGAME_OTHER) || playerUUID.equals(senderUUID)) {
|
||||
sendInGameMessages(sender, player);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Insufficient permissions: You can not view other player's information.");
|
||||
throw new IllegalArgumentException(locale.getString(CommandLang.FAIL_NO_PERMISSION) + " (" + Permissions.INGAME_OTHER.get() + ')');
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,20 +259,20 @@ public class DataUtilityCommands {
|
||||
SessionsMutator sessionsMutator = SessionsMutator.forContainer(player);
|
||||
|
||||
String table = locale.getString(CommandLang.HEADER_INSPECT, playerName) + '\n' +
|
||||
locale.getString(CommandLang.QINSPECT_ACTIVITY_INDEX, activityIndex.getFormattedValue(formatters.decimals()), activityIndex.getGroup()) + '\n' +
|
||||
locale.getString(CommandLang.QINSPECT_REGISTERED, timestamp.apply(() -> registered)) + '\n' +
|
||||
locale.getString(CommandLang.QINSPECT_LAST_SEEN, timestamp.apply(() -> lastSeen)) + '\n' +
|
||||
locale.getString(CommandLang.QINSPECT_GEOLOCATION, geolocation) + '\n' +
|
||||
locale.getString(CommandLang.QINSPECT_TIMES_KICKED, player.getValue(PlayerKeys.KICK_COUNT).orElse(0)) + '\n' +
|
||||
locale.getString(CommandLang.INGAME_ACTIVITY_INDEX, activityIndex.getFormattedValue(formatters.decimals()), activityIndex.getGroup()) + '\n' +
|
||||
locale.getString(CommandLang.INGAME_REGISTERED, timestamp.apply(() -> registered)) + '\n' +
|
||||
locale.getString(CommandLang.INGAME_LAST_SEEN, timestamp.apply(() -> lastSeen)) + '\n' +
|
||||
locale.getString(CommandLang.INGAME_GEOLOCATION, geolocation) + '\n' +
|
||||
locale.getString(CommandLang.INGAME_TIMES_KICKED, player.getValue(PlayerKeys.KICK_COUNT).orElse(0)) + '\n' +
|
||||
'\n' +
|
||||
locale.getString(CommandLang.QINSPECT_PLAYTIME, length.apply(sessionsMutator.toPlaytime())) + '\n' +
|
||||
locale.getString(CommandLang.QINSPECT_ACTIVE_PLAYTIME, length.apply(sessionsMutator.toActivePlaytime())) + '\n' +
|
||||
locale.getString(CommandLang.QINSPECT_AFK_PLAYTIME, length.apply(sessionsMutator.toAfkTime())) + '\n' +
|
||||
locale.getString(CommandLang.QINSPECT_LONGEST_SESSION, length.apply(sessionsMutator.toLongestSessionLength())) + '\n' +
|
||||
locale.getString(CommandLang.INGAME_PLAYTIME, length.apply(sessionsMutator.toPlaytime())) + '\n' +
|
||||
locale.getString(CommandLang.INGAME_ACTIVE_PLAYTIME, length.apply(sessionsMutator.toActivePlaytime())) + '\n' +
|
||||
locale.getString(CommandLang.INGAME_AFK_PLAYTIME, length.apply(sessionsMutator.toAfkTime())) + '\n' +
|
||||
locale.getString(CommandLang.INGAME_LONGEST_SESSION, length.apply(sessionsMutator.toLongestSessionLength())) + '\n' +
|
||||
'\n' +
|
||||
locale.getString(CommandLang.QINSPECT_PLAYER_KILLS, sessionsMutator.toPlayerKillCount()) + '\n' +
|
||||
locale.getString(CommandLang.QINSPECT_MOB_KILLS, sessionsMutator.toMobKillCount()) + '\n' +
|
||||
locale.getString(CommandLang.QINSPECT_DEATHS, sessionsMutator.toDeathCount());
|
||||
locale.getString(CommandLang.INGAME_PLAYER_KILLS, sessionsMutator.toPlayerKillCount()) + '\n' +
|
||||
locale.getString(CommandLang.INGAME_MOB_KILLS, sessionsMutator.toMobKillCount()) + '\n' +
|
||||
locale.getString(CommandLang.INGAME_DEATHS, sessionsMutator.toDeathCount());
|
||||
sender.send(sender.getFormatter().table(table, ":"));
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,6 @@ import com.djrapitops.plan.settings.config.paths.DatabaseSettings;
|
||||
import com.djrapitops.plan.settings.locale.Locale;
|
||||
import com.djrapitops.plan.settings.locale.lang.CommandLang;
|
||||
import com.djrapitops.plan.settings.locale.lang.HelpLang;
|
||||
import com.djrapitops.plan.settings.locale.lang.ManageLang;
|
||||
import com.djrapitops.plan.storage.database.DBSystem;
|
||||
import com.djrapitops.plan.storage.database.DBType;
|
||||
import com.djrapitops.plan.storage.database.Database;
|
||||
@ -110,14 +109,14 @@ public class DatabaseCommands {
|
||||
.toLowerCase();
|
||||
|
||||
if (!DBType.exists(dbName)) {
|
||||
throw new IllegalArgumentException(locale.getString(ManageLang.FAIL_INCORRECT_DB, dbName));
|
||||
throw new IllegalArgumentException(locale.getString(CommandLang.FAIL_INCORRECT_DB, dbName));
|
||||
}
|
||||
|
||||
Database fromDB = dbSystem.getActiveDatabaseByName(dbName);
|
||||
if (fromDB.getState() != Database.State.OPEN) fromDB.init();
|
||||
|
||||
performBackup(sender, arguments, dbName, fromDB);
|
||||
sender.send(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
||||
sender.send(locale.getString(CommandLang.PROGRESS_SUCCESS));
|
||||
}
|
||||
|
||||
public void performBackup(CMDSender sender, Arguments arguments, String dbName, Database fromDB) {
|
||||
@ -149,21 +148,21 @@ public class DatabaseCommands {
|
||||
File backupDBFile = files.getFileFromPluginFolder(backupDbName + (containsDBFileExtension ? "" : ".db"));
|
||||
|
||||
if (!backupDBFile.exists()) {
|
||||
throw new IllegalArgumentException(locale.getString(ManageLang.FAIL_FILE_NOT_FOUND, backupDBFile.getAbsolutePath()));
|
||||
throw new IllegalArgumentException(locale.getString(CommandLang.FAIL_FILE_NOT_FOUND, backupDBFile.getAbsolutePath()));
|
||||
}
|
||||
|
||||
String dbName = arguments.get(1)
|
||||
.orElse(dbSystem.getDatabase().getType().getName())
|
||||
.toLowerCase();
|
||||
if (!DBType.exists(dbName)) {
|
||||
throw new IllegalArgumentException(locale.getString(ManageLang.FAIL_INCORRECT_DB, dbName));
|
||||
throw new IllegalArgumentException(locale.getString(CommandLang.FAIL_INCORRECT_DB, dbName));
|
||||
}
|
||||
|
||||
Database toDB = dbSystem.getActiveDatabaseByName(dbName);
|
||||
|
||||
// Check against restoring from database.db as it is active database
|
||||
if (backupDbName.contains("database") && toDB instanceof SQLiteDB) {
|
||||
throw new IllegalArgumentException(locale.getString(ManageLang.FAIL_SAME_DB));
|
||||
throw new IllegalArgumentException(locale.getString(CommandLang.FAIL_SAME_DB));
|
||||
}
|
||||
|
||||
if (toDB.getState() != Database.State.OPEN) toDB.init();
|
||||
@ -201,24 +200,24 @@ public class DatabaseCommands {
|
||||
|
||||
sender.send(locale.getString(CommandLang.DB_WRITE, toDB.getType().getName()));
|
||||
toDB.executeTransaction(new BackupCopyTransaction(fromDB, toDB)).get();
|
||||
sender.send(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
||||
sender.send(locale.getString(CommandLang.PROGRESS_SUCCESS));
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
} catch (DBOpException | ExecutionException e) {
|
||||
errorLogger.log(L.ERROR, e, ErrorContext.builder().related(backupDBFile, toDB.getType(), toDB.getState()).build());
|
||||
sender.send(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage()));
|
||||
sender.send(locale.getString(CommandLang.PROGRESS_FAIL, e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
public void onMove(String mainCommand, CMDSender sender, Arguments arguments) {
|
||||
DBType fromDB = arguments.get(0).flatMap(DBType::getForName)
|
||||
.orElseThrow(() -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_INCORRECT_DB, arguments.get(0).orElse("<MySQL/SQLite/H2>"))));
|
||||
.orElseThrow(() -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_INCORRECT_DB, arguments.get(0).orElse("<MySQL/SQLite/H2>"))));
|
||||
|
||||
DBType toDB = arguments.get(1).flatMap(DBType::getForName)
|
||||
.orElseThrow(() -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_INCORRECT_DB, arguments.get(0).orElse("<MySQL/SQLite/H2>"))));
|
||||
.orElseThrow(() -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_INCORRECT_DB, arguments.get(0).orElse("<MySQL/SQLite/H2>"))));
|
||||
|
||||
if (fromDB == toDB) {
|
||||
throw new IllegalArgumentException(locale.getString(ManageLang.FAIL_SAME_DB));
|
||||
throw new IllegalArgumentException(locale.getString(CommandLang.FAIL_SAME_DB));
|
||||
}
|
||||
|
||||
if (sender.supportsChatEvents()) {
|
||||
@ -258,24 +257,24 @@ public class DatabaseCommands {
|
||||
|
||||
fromDatabase.executeTransaction(new BackupCopyTransaction(fromDatabase, toDatabase)).get();
|
||||
|
||||
sender.send(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
||||
sender.send(locale.getString(CommandLang.PROGRESS_SUCCESS));
|
||||
|
||||
boolean movingToCurrentDB = toDatabase.getType() == dbSystem.getDatabase().getType();
|
||||
if (movingToCurrentDB) {
|
||||
sender.send(locale.getString(ManageLang.HOTSWAP_REMINDER, toDatabase.getType().getConfigName()));
|
||||
sender.send(locale.getString(CommandLang.HOTSWAP_REMINDER, toDatabase.getType().getConfigName()));
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
} catch (Exception e) {
|
||||
errorLogger.log(L.ERROR, e, ErrorContext.builder().related(sender, fromDB.getName() + "->" + toDB.getName()).build());
|
||||
sender.send(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage()));
|
||||
sender.send(locale.getString(CommandLang.PROGRESS_FAIL, e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onClear(String mainCommand, CMDSender sender, Arguments arguments) {
|
||||
DBType fromDB = arguments.get(0).flatMap(DBType::getForName)
|
||||
.orElseThrow(() -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_INCORRECT_DB, arguments.get(0).orElse("<MySQL/SQLite/H2>"))));
|
||||
.orElseThrow(() -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_INCORRECT_DB, arguments.get(0).orElse("<MySQL/SQLite/H2>"))));
|
||||
|
||||
if (sender.supportsChatEvents()) {
|
||||
sender.buildMessage()
|
||||
@ -313,7 +312,7 @@ public class DatabaseCommands {
|
||||
fromDatabase.executeTransaction(new RemoveEverythingTransaction())
|
||||
.get(); // Wait for completion
|
||||
queryService.dataCleared();
|
||||
sender.send(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
||||
sender.send(locale.getString(CommandLang.PROGRESS_SUCCESS));
|
||||
|
||||
// Reload plugin to register the server into the database
|
||||
// Otherwise errors will start.
|
||||
@ -321,7 +320,7 @@ public class DatabaseCommands {
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
} catch (DBOpException | ExecutionException e) {
|
||||
sender.send(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage()));
|
||||
sender.send(locale.getString(CommandLang.PROGRESS_FAIL, e.getMessage()));
|
||||
errorLogger.log(L.ERROR, e, ErrorContext.builder().related(sender, fromDB.getName()).build());
|
||||
}
|
||||
}
|
||||
@ -369,11 +368,11 @@ public class DatabaseCommands {
|
||||
database.executeTransaction(new RemovePlayerTransaction(playerToRemove))
|
||||
.get(); // Wait for completion
|
||||
|
||||
sender.send(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
||||
sender.send(locale.getString(CommandLang.PROGRESS_SUCCESS));
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
} catch (DBOpException | ExecutionException e) {
|
||||
sender.send(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage()));
|
||||
sender.send(locale.getString(CommandLang.PROGRESS_FAIL, e.getMessage()));
|
||||
errorLogger.log(L.ERROR, e, ErrorContext.builder().related(sender, database.getType().getName(), playerToRemove).build());
|
||||
}
|
||||
}
|
||||
@ -394,17 +393,17 @@ public class DatabaseCommands {
|
||||
.orElseThrow(() -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_SERVER_NOT_FOUND, identifier)));
|
||||
|
||||
if (server.getUuid().equals(serverInfo.getServerUUID())) {
|
||||
throw new IllegalArgumentException(locale.getString(ManageLang.UNINSTALLING_SAME_SERVER));
|
||||
throw new IllegalArgumentException(locale.getString(CommandLang.UNINSTALLING_SAME_SERVER));
|
||||
}
|
||||
|
||||
dbSystem.getDatabase().executeTransaction(new SetServerAsUninstalledTransaction(server.getUuid()));
|
||||
sender.send(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
||||
sender.send(locale.getString(CommandLang.PROGRESS_SUCCESS));
|
||||
sender.send(locale.getString(CommandLang.DB_UNINSTALLED));
|
||||
}
|
||||
|
||||
public void onHotswap(CMDSender sender, Arguments arguments) {
|
||||
DBType toDB = arguments.get(0).flatMap(DBType::getForName)
|
||||
.orElseThrow(() -> new IllegalArgumentException(locale.getString(ManageLang.FAIL_INCORRECT_DB, arguments.get(0).orElse("<MySQL/SQLite/H2>"))));
|
||||
.orElseThrow(() -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_INCORRECT_DB, arguments.get(0).orElse("<MySQL/SQLite/H2>"))));
|
||||
|
||||
try {
|
||||
Database database = dbSystem.getActiveDatabaseByType(toDB);
|
||||
@ -418,7 +417,7 @@ public class DatabaseCommands {
|
||||
config.save();
|
||||
} catch (DBOpException | IOException e) {
|
||||
errorLogger.log(L.WARN, e, ErrorContext.builder().related(toDB).build());
|
||||
sender.send(locale.getString(ManageLang.PROGRESS_FAIL, e.getMessage()));
|
||||
sender.send(locale.getString(CommandLang.PROGRESS_FAIL, e.getMessage()));
|
||||
return;
|
||||
}
|
||||
statusCommands.onReload(sender, new Arguments(Collections.emptyList()));
|
||||
|
@ -26,7 +26,6 @@ import com.djrapitops.plan.settings.Permissions;
|
||||
import com.djrapitops.plan.settings.locale.Locale;
|
||||
import com.djrapitops.plan.settings.locale.lang.CommandLang;
|
||||
import com.djrapitops.plan.settings.locale.lang.HelpLang;
|
||||
import com.djrapitops.plan.settings.locale.lang.ManageLang;
|
||||
import com.djrapitops.plan.storage.database.DBSystem;
|
||||
import com.djrapitops.plan.storage.database.Database;
|
||||
import com.djrapitops.plan.storage.database.queries.objects.WebUserQueries;
|
||||
@ -217,7 +216,7 @@ public class RegistrationCommands {
|
||||
sender.send(colors.getMainColor() + "Unregistering '" + presentUser.getUsername() + "'..");
|
||||
database.executeTransaction(new RemoveWebUserTransaction(username))
|
||||
.get(); // Wait for completion
|
||||
sender.send(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
||||
sender.send(locale.getString(CommandLang.PROGRESS_SUCCESS));
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
} catch (ExecutionException e) {
|
||||
|
@ -72,7 +72,6 @@ public class LocaleSystem implements SubSystem {
|
||||
HelpLang.values(),
|
||||
DeepHelpLang.values(),
|
||||
PluginLang.values(),
|
||||
ManageLang.values(),
|
||||
GenericLang.values(),
|
||||
HtmlLang.values(),
|
||||
ErrorPageLang.values(),
|
||||
|
@ -34,7 +34,10 @@ public enum CommandLang implements Lang {
|
||||
CONFIRM_CANCELLED("Cmd Confirm - cancelled, no data change", "Cancelled. No data was changed."),
|
||||
|
||||
FAIL_PLAYER_NOT_FOUND("Cmd FAIL - No player", "Player '${0}' was not found, they have no UUID."),
|
||||
FAIL_PLAYER_NOT_FOUND_REGISTER("Cmd FAIL - No player register", "Player '${0}' was not found in the database."),
|
||||
FAIL_SERVER_NOT_FOUND("Cmd FAIL - No server", "Server '${0}' was not found from the database."),
|
||||
FAIL_EMPTY_SEARCH_STRING("Cmd FAIL - Empty search string", "The search string can not be empty"),
|
||||
FAIL_ACCEPTS_ARGUMENTS("Cmd FAIL - Accepts only these arguments", "Accepts following as ${0}: ${1}"),
|
||||
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."),
|
||||
@ -47,6 +50,7 @@ public enum CommandLang implements Lang {
|
||||
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})"),
|
||||
FAIL_SEE_CONFIG_SETTING("Cmd FAIL - see config", "see '${0}' in config.yml"),
|
||||
|
||||
FEATURE_DISABLED("Cmd SUCCESS - Feature disabled", "§aDisabled '${0}' temporarily until next plugin reload."),
|
||||
|
||||
@ -73,18 +77,18 @@ public enum CommandLang implements Lang {
|
||||
INFO_DATABASE("Cmd Info - Database", " §2Current Database: §f${0}"),
|
||||
INFO_PROXY_CONNECTION("Cmd Info - Bungee Connection", " §2Connected to Proxy: §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_ACTIVE_PLAYTIME("Cmd Qinspect - Active Playtime", " §2Active Playtime: §f${0}"),
|
||||
QINSPECT_AFK_PLAYTIME("Cmd Qinspect - AFK Playtime", " §2AFK Time: §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}"),
|
||||
INGAME_ACTIVITY_INDEX("Cmd Qinspect - Activity Index", " §2Activity Index: §f${0} | ${1}"),
|
||||
INGAME_REGISTERED("Cmd Qinspect - Registered", " §2Registered: §f${0}"),
|
||||
INGAME_LAST_SEEN("Cmd Qinspect - Last Seen", " §2Last Seen: §f${0}"),
|
||||
INGAME_GEOLOCATION("Cmd Qinspect - Geolocation", " §2Logged in from: §f${0}"),
|
||||
INGAME_PLAYTIME("Cmd Qinspect - Playtime", " §2Playtime: §f${0}"),
|
||||
INGAME_ACTIVE_PLAYTIME("Cmd Qinspect - Active Playtime", " §2Active Playtime: §f${0}"),
|
||||
INGAME_AFK_PLAYTIME("Cmd Qinspect - AFK Playtime", " §2AFK Time: §f${0}"),
|
||||
INGAME_LONGEST_SESSION("Cmd Qinspect - Longest Session", " §2Longest Session: §f${0}"),
|
||||
INGAME_TIMES_KICKED("Cmd Qinspect - Times Kicked", " §2Times Kicked: §f${0}"),
|
||||
INGAME_PLAYER_KILLS("Cmd Qinspect - Player Kills", " §2Player Kills: §f${0}"),
|
||||
INGAME_MOB_KILLS("Cmd Qinspect - Mob Kills", " §2Mob Kills: §f${0}"),
|
||||
INGAME_DEATHS("Cmd Qinspect - Deaths", " §2Deaths: §f${0}"),
|
||||
|
||||
DB_BACKUP_CREATE("Cmd db - creating backup", "Creating a backup file '${0}.db' with contents of ${1}"),
|
||||
DB_WRITE("Cmd db - write", "Writing to ${0}.."),
|
||||
@ -96,7 +100,23 @@ public enum CommandLang implements Lang {
|
||||
|
||||
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."),
|
||||
NO_ADDRESS_NOTIFY("Cmd Notify - No Address", "§eNo address was available - using localhost as fallback. Set up 'Alternative_IP' settings.");
|
||||
NO_ADDRESS_NOTIFY("Cmd Notify - No Address", "§eNo address was available - using localhost as fallback. Set up 'Alternative_IP' settings."),
|
||||
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("Manage - Progress", "${0} / ${1} processed.."),
|
||||
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: "),
|
||||
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"),
|
||||
FAIL_EXPORTER_NOT_FOUND("Manage - Fail No Exporter", "§eExporter '${0}' doesn't exist"),
|
||||
NO_SERVER("Manage - Fail No Server", "No server found with given parameters."),
|
||||
UNINSTALLING_SAME_SERVER("Manage - Fail Same server", "Can not mark this server as uninstalled (You are on it)");
|
||||
|
||||
private final String identifier;
|
||||
private final String defaultValue;
|
||||
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* This file is part of Player Analytics (Plan).
|
||||
*
|
||||
* Plan is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License v3 as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Plan is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.djrapitops.plan.settings.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: "),
|
||||
|
||||
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"),
|
||||
FAIL_EXPORTER_NOT_FOUND("Manage - Fail No Exporter", "§eExporter '${0}' doesn't exist"),
|
||||
NO_SERVER("Manage - Fail No Server", "No server found with given parameters."),
|
||||
UNINSTALLING_SAME_SERVER("Manage - Fail Same server", "Can not mark this server as uninstalled (You are on it)"),
|
||||
;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user