mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-28 12:07:35 +01:00
Lang implemented for RegistrationCommands
This commit is contained in:
parent
66b34b48a0
commit
077a150498
@ -188,7 +188,7 @@ public class DatabaseCommands {
|
||||
if (choice) {
|
||||
performRestore(sender, backupDBFile, toDB);
|
||||
} else {
|
||||
sender.send(colors.getMainColor() + locale.getString(CommandLang.CONFIRM_CANCELLED));
|
||||
sender.send(colors.getMainColor() + locale.getString(CommandLang.CONFIRM_CANCELLED_DATA));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -241,7 +241,7 @@ public class DatabaseCommands {
|
||||
if (choice) {
|
||||
performMove(sender, fromDB, toDB);
|
||||
} else {
|
||||
sender.send(colors.getMainColor() + locale.getString(CommandLang.CONFIRM_CANCELLED));
|
||||
sender.send(colors.getMainColor() + locale.getString(CommandLang.CONFIRM_CANCELLED_DATA));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -297,7 +297,7 @@ public class DatabaseCommands {
|
||||
if (choice) {
|
||||
performClear(sender, fromDB);
|
||||
} else {
|
||||
sender.send(colors.getMainColor() + locale.getString(CommandLang.CONFIRM_CANCELLED));
|
||||
sender.send(colors.getMainColor() + locale.getString(CommandLang.CONFIRM_CANCELLED_DATA));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -355,7 +355,7 @@ public class DatabaseCommands {
|
||||
if (choice) {
|
||||
performRemoval(sender, database, playerUUID);
|
||||
} else {
|
||||
sender.send(colors.getMainColor() + locale.getString(CommandLang.CONFIRM_CANCELLED));
|
||||
sender.send(colors.getMainColor() + locale.getString(CommandLang.CONFIRM_CANCELLED_DATA));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class RegistrationCommands {
|
||||
if (arguments.isEmpty()) {
|
||||
String address = linkCommands.getAddress(sender) + "/register";
|
||||
sender.buildMessage()
|
||||
.addPart(colors.getMainColor() + "Register page: ")
|
||||
.addPart(colors.getMainColor() + locale.getString(CommandLang.LINK_REGISTER))
|
||||
.apply(builder -> linkCommands.linkTo(builder, sender, address))
|
||||
.send();
|
||||
} else {
|
||||
@ -117,7 +117,7 @@ public class RegistrationCommands {
|
||||
.orElseThrow(() -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_REQ_ARGS, 1, "<password>")));
|
||||
String passwordHash = PassEncryptUtil.createHash(password);
|
||||
int permissionLevel = arguments.getInteger(2)
|
||||
.filter(arg -> sender.hasPermission("plan.register.other")) // argument only allowed with plan.webmanage
|
||||
.filter(arg -> sender.hasPermission(Permissions.REGISTER_OTHER)) // argument only allowed with register other permission
|
||||
.orElseGet(() -> getPermissionLevel(sender));
|
||||
|
||||
if (sender.getUUID().isPresent() && sender.getPlayerName().isPresent()) {
|
||||
@ -196,15 +196,16 @@ public class RegistrationCommands {
|
||||
|
||||
if (sender.supportsChatEvents()) {
|
||||
sender.buildMessage()
|
||||
.addPart(colors.getMainColor() + "You are about to unregister '" + presentUser.getUsername() + "' linked to " + presentUser.getLinkedTo()).newLine()
|
||||
.addPart(colors.getTertiaryColor() + "Confirm: ").addPart("§2§l[\u2714]").command("/" + mainCommand + " accept").hover("Accept")
|
||||
.addPart(colors.getMainColor() + locale.getString(CommandLang.CONFIRM_UNREGISTER, presentUser.getUsername(), presentUser.getLinkedTo())).newLine()
|
||||
.addPart(colors.getTertiaryColor() + locale.getString(CommandLang.CONFIRM))
|
||||
.addPart("§2§l[\u2714]").command("/" + mainCommand + " accept").hover(locale.getString(CommandLang.CONFIRM_ACCEPT))
|
||||
.addPart(" ")
|
||||
.addPart("§4§l[\u2718]").command("/" + mainCommand + " cancel").hover("Cancel")
|
||||
.addPart("§4§l[\u2718]").command("/" + mainCommand + " cancel").hover(locale.getString(CommandLang.CONFIRM_DENY))
|
||||
.send();
|
||||
} else {
|
||||
sender.buildMessage()
|
||||
.addPart(colors.getMainColor() + "You are about to unregister '" + presentUser.getUsername() + "' linked to " + presentUser.getLinkedTo()).newLine()
|
||||
.addPart(colors.getTertiaryColor() + "Confirm: ").addPart("§a/" + mainCommand + " accept")
|
||||
.addPart(colors.getMainColor() + locale.getString(CommandLang.CONFIRM_UNREGISTER, presentUser.getUsername(), presentUser.getLinkedTo())).newLine()
|
||||
.addPart(colors.getTertiaryColor() + locale.getString(CommandLang.CONFIRM)).addPart("§a/" + mainCommand + " accept")
|
||||
.addPart(" ")
|
||||
.addPart("§c/" + mainCommand + " cancel")
|
||||
.send();
|
||||
@ -213,7 +214,7 @@ public class RegistrationCommands {
|
||||
confirmation.confirm(sender, choice -> {
|
||||
if (choice) {
|
||||
try {
|
||||
sender.send(colors.getMainColor() + "Unregistering '" + presentUser.getUsername() + "'..");
|
||||
sender.send(colors.getMainColor() + locale.getString(CommandLang.UNREGISTER, presentUser.getUsername()));
|
||||
database.executeTransaction(new RemoveWebUserTransaction(username))
|
||||
.get(); // Wait for completion
|
||||
sender.send(locale.getString(CommandLang.PROGRESS_SUCCESS));
|
||||
@ -223,7 +224,7 @@ public class RegistrationCommands {
|
||||
errorLogger.log(L.WARN, e, ErrorContext.builder().related("unregister command", sender, sender.getPlayerName().orElse("console"), arguments).build());
|
||||
}
|
||||
} else {
|
||||
sender.send(colors.getMainColor() + "Cancelled. '" + presentUser.getUsername() + "' was not unregistered.");
|
||||
sender.send(colors.getMainColor() + locale.getString(CommandLang.CONFIRM_CANCELLED_UNREGISTER, presentUser.getUsername()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -31,7 +31,9 @@ public enum CommandLang implements Lang {
|
||||
CONFIRM_OVERWRITE_DB("Cmd Confirm - overwriting db", "You are about to overwrite data in Plan ${0} with data in ${1}"),
|
||||
CONFIRM_CLEAR_DB("Cmd Confirm - clearing db", "You are about to remove all Plan-data in ${0}"),
|
||||
CONFIRM_REMOVE_PLAYER_DB("Cmd Confirm - remove player db", "You are about to remove data of ${0} from ${1}"),
|
||||
CONFIRM_CANCELLED("Cmd Confirm - cancelled, no data change", "Cancelled. No data was changed."),
|
||||
CONFIRM_UNREGISTER("Cmd Confirm - unregister", "You are about to unregister '${0}' linked to ${1}"),
|
||||
CONFIRM_CANCELLED_DATA("Cmd Confirm - cancelled, no data change", "Cancelled. No data was changed."),
|
||||
CONFIRM_CANCELLED_UNREGISTER("Cmd Confirm - cancelled, unregister", "Cancelled. '${0}' was not unregistered"),
|
||||
|
||||
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."),
|
||||
@ -67,6 +69,7 @@ public enum CommandLang implements Lang {
|
||||
LINK_PLAYERS("Cmd - Link Players", "Players page: "),
|
||||
LINK_NETWORK("Cmd - Link Network", "Network page: "),
|
||||
LINK_JSON("Cmd - Link Player JSON", "Player json: "),
|
||||
LINK_REGISTER("Cmd - Link Register", "Register page: "),
|
||||
|
||||
HEADER_SEARCH("Cmd Header - Search", "> §2${0} Results for §f${1}§2:"),
|
||||
HEADER_ANALYSIS("Cmd Header - Analysis", "> §2Analysis Results"),
|
||||
@ -102,6 +105,7 @@ public enum CommandLang implements Lang {
|
||||
DB_REMOVAL("Cmd db - removal", "Removing Plan-data from ${0}.."),
|
||||
DB_REMOVAL_PLAYER("Cmd db - removal player", "Removing data of ${0} from ${1}.."),
|
||||
DB_UNINSTALLED("Cmd db - server uninstalled", "§aIf the server is still installed, it will automatically set itself as installed in the database."),
|
||||
UNREGISTER("Cmd unregister - unregistering", "Unregistering '${0}'.."),
|
||||
|
||||
DISABLE_DISABLED("Cmd Disable - Disabled", "§aPlan systems are now disabled. You can still use /planbungee reload to restart the plugin."),
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user