diff --git a/core/src/main/java/dev/naturecodevoid/voicechatdiscord/SubCommands.java b/core/src/main/java/dev/naturecodevoid/voicechatdiscord/SubCommands.java index d123111..ce474ba 100644 --- a/core/src/main/java/dev/naturecodevoid/voicechatdiscord/SubCommands.java +++ b/core/src/main/java/dev/naturecodevoid/voicechatdiscord/SubCommands.java @@ -26,7 +26,7 @@ import static dev.naturecodevoid.voicechatdiscord.util.Util.getArgumentOr; /** - * Subcommands for /dvc + * Subcomandos para /dvc */ public final class SubCommands { @SuppressWarnings("unchecked") @@ -40,8 +40,8 @@ public static LiteralArgumentBuilder build(LiteralArgumentBuilder buil .then(literal("group").executes(GroupCommands::help) .then(literal("list").executes(wrapInTry(GroupCommands::list))) .then(literal("create") - // Yeah, this is kind of a mess, all because we would have to use a mixin to add a custom ArgumentType - // so instead we just use literals for the group type + // Sí, esto es un poco complicado, todo porque tendríamos que usar una mezcla para agregar un ArgumentType personalizado + // así que en lugar de eso simplemente usamos literales para el tipo de grupo .then(argument("name", string()).executes(wrapInTry(GroupCommands.create(Group.Type.NORMAL))) .then(argument("password", string()).executes(wrapInTry(GroupCommands.create(Group.Type.NORMAL))) .then(literal("normal").executes(wrapInTry(GroupCommands.create(Group.Type.NORMAL))) @@ -77,14 +77,14 @@ private static Command wrapInTry(Consumer> function) { return 1; } catch (Throwable e) { e.printStackTrace(); - throw new RuntimeException(e); // This way the user will see "An error occurred when running this command" + throw new RuntimeException(e); // De esta manera, el usuario verá "Ocurrió un error al ejecutar este comando" } }; } private static void start(CommandContext sender) { if (!platform.isValidPlayer(sender)) { - platform.sendMessage(sender, "You must be a player to use this command!"); + platform.sendMessage(sender, "¡Debes ser un jugador para usar este comando!"); return; } @@ -94,14 +94,14 @@ private static void start(CommandContext sender) { DiscordBot botForPlayer = getBotForPlayer(player.getUuid()); if (botForPlayer != null) { - platform.sendMessage(player, "You have already started a voice chat! Restarting your session..."); + platform.sendMessage(player, "¡Ya has iniciado un chat de voz! Reiniciando tu sesión..."); botForPlayer.stop(); } if (bot == null) { platform.sendMessage( player, - "There are currently no bots available. You might want to contact your server owner to add more." + "Actualmente no hay bots disponibles. Espere a que algun usuario se salga de la llamada con uno de los bots." ); return; } @@ -109,7 +109,7 @@ private static void start(CommandContext sender) { if (botForPlayer == null) platform.sendMessage( player, - "Starting a voice chat..." + (!bot.hasLoggedIn ? " this might take a moment since we have to login to the bot." : "") + "Iniciando un chat de voz..." + (!bot.hasLoggedIn ? " esto podría llevar un momento ya que tenemos que iniciar sesión en el bot." : "") ); bot.player = player; @@ -121,7 +121,7 @@ private static void start(CommandContext sender) { private static void stop(CommandContext sender) { if (!platform.isValidPlayer(sender)) { - platform.sendMessage(sender, "You must be a player to use this command!"); + platform.sendMessage(sender, "¡Debes ser un jugador para usar este comando!"); return; } @@ -129,16 +129,16 @@ private static void stop(CommandContext sender) { DiscordBot bot = getBotForPlayer(player.getUuid()); if (bot == null) { - platform.sendMessage(player, "You must start a voice chat before you can use this command!"); + platform.sendMessage(player, "¡Debes iniciar un chat de voz antes de poder usar este comando!"); return; } - platform.sendMessage(player, "Stopping the bot..."); + platform.sendMessage(player, "Deteniendo el bot..."); new Thread(() -> { bot.stop(); - platform.sendMessage(sender, "Successfully stopped the bot!"); + platform.sendMessage(sender, "¡Se ha detenido el bot correctamente!"); }).start(); } @@ -149,29 +149,29 @@ private static void reloadConfig(CommandContext sender) { )) { platform.sendMessage( sender, - "You must be an operator or have the `" + RELOAD_CONFIG_PERMISSION + "` permission to use this command!" + "¡Debes ser un operador o tener el permiso `" + RELOAD_CONFIG_PERMISSION + "` para usar este comando!" ); return; } - platform.sendMessage(sender, "Stopping bots..."); + platform.sendMessage(sender, "Deteniendo bots..."); new Thread(() -> { for (DiscordBot bot : bots) if (bot.player != null) platform.sendMessage( bot.player, - "The config is being reloaded which stops all bots. Please use /dvc start to restart your session." + "La configuración se está recargando lo que detiene todos los bots. Usa /dvc start para reiniciar tu sesión." ); stopBots(); - platform.sendMessage(sender, "Successfully stopped bots! Reloading config..."); + platform.sendMessage(sender, "¡Se han detenido los bots correctamente! Recargando configuración..."); loadConfig(); platform.sendMessage( sender, - "Successfully reloaded config! Using " + bots.size() + " bot" + (bots.size() != 1 ? "s" : "") + "." + "¡Configuración recargada correctamente! Usando " + bots.size() + " bot" + (bots.size() != 1 ? "s" : "") + "." ); }).start(); } @@ -180,24 +180,24 @@ private static void checkForUpdate(CommandContext sender) { if (!platform.isOperator(sender)) { platform.sendMessage( sender, - "You must be an operator to use this command!" + "¡Debes ser un operador para usar este comando!" ); return; } - platform.sendMessage(sender, "Checking for update..."); + platform.sendMessage(sender, "Buscando actualizaciones..."); new Thread(() -> { if (UpdateChecker.checkForUpdate()) - platform.sendMessage(sender, Objects.requireNonNullElse(UpdateChecker.updateMessage, "No update found.")); + platform.sendMessage(sender, Objects.requireNonNullElse(UpdateChecker.updateMessage, "No se encontró ninguna actualización.")); else - platform.sendMessage(sender, "An error occurred when checking for updates. Check the console for the error message."); + platform.sendMessage(sender, "Se produjo un error al buscar actualizaciones. Comprueba la consola para ver el mensaje de error."); }).start(); } private static void toggleWhisper(CommandContext sender) { if (!platform.isValidPlayer(sender)) { - platform.sendMessage(sender, "You must be a player to use this command!"); + platform.sendMessage(sender, "¡Debes ser un jugador para usar este comando!"); return; } @@ -205,20 +205,20 @@ private static void toggleWhisper(CommandContext sender) { DiscordBot bot = getBotForPlayer(player.getUuid()); if (bot == null) { - platform.sendMessage(player, "You must start a voice chat before you can use this command!"); + platform.sendMessage(player, "¡Debes iniciar un chat de voz antes de poder usar este comando!"); return; } boolean whispering = !bot.sender.isWhispering(); bot.sender.whispering(whispering); - platform.sendMessage(sender, whispering ? "Started whispering!" : "Stopped whispering!"); + platform.sendMessage(sender, whispering ? "¡Comenzaste a susurrar!" : "¡Dejaste de susurrar!"); } private static final class GroupCommands { private static boolean checkIfGroupsEnabled(CommandContext sender) { if (!api.getServerConfig().getBoolean("enable_groups", true)) { - platform.sendMessage(sender, "Groups are currently disabled."); + platform.sendMessage(sender, "Los grupos están deshabilitados actualmente."); return true; } return false; @@ -229,14 +229,14 @@ private static int help(CommandContext sender) { platform.sendMessage( sender, """ - Available subcommands: - - `/dvc group list`: List groups - - `/dvc group create [password] [type] [persistent]`: Create a group - - `/dvc group join `: Join a group - - `/dvc group info`: Get info about your current group - - `/dvc group leave`: Leave your current group - - `/dvc group remove `: Removes a persistent group if there is no one in it - See https://github.com/naturecodevoid/voicechat-discord#dvc-group for more info on how to use these commands.""" + Subcomandos disponibles: + - `/dvc group list`: Lista de grupos + - `/dvc group create [contraseña] [tipo] [persistente]`: Crea un grupo + - `/dvc group join `: Unirse a un grupo + - `/dvc group info`: Obtener información sobre tu grupo actual + - `/dvc group leave`: Abandonar tu grupo actual + - `/dvc group remove `: Elimina un grupo persistente si no hay nadie en él + Consulta https://github.com/naturecodevoid/voicechat-discord#dvc-group para obtener más información sobre cómo utilizar estos comandos.""" ); return 1; } @@ -247,34 +247,34 @@ private static void list(CommandContext sender) { Collection apiGroups = api.getGroups(); if (apiGroups.isEmpty()) - platform.sendMessage(sender, "There are currently no groups."); + platform.sendMessage(sender, "No hay grupos actualmente."); else { - StringBuilder groupsMessage = new StringBuilder("Groups:\n"); + StringBuilder groupsMessage = new StringBuilder("Grupos:\n"); for (Group group : apiGroups) { int friendlyId = groupFriendlyIds.get(group.getId()); - platform.debugVerbose("Friendly ID for " + group.getId() + " (" + group.getName() + ") is " + friendlyId); + platform.debugVerbose("ID amigable para " + group.getId() + " (" + group.getName() + ") es " + friendlyId); - String playersMessage = "No players"; + String playersMessage = "No hay jugadores"; List players = groupPlayers.get(group.getId()); if (!players.isEmpty()) playersMessage = players.stream().map(player -> platform.getName(player)).collect(Collectors.joining(", ")); groupsMessage.append(" - ") .append(group.getName()) - .append(" (ID is ") + .append(" (ID es ") .append(friendlyId) .append("): ") - .append(group.hasPassword() ? "Has password" : "No password") - .append(group.isPersistent() ? ", persistent" : "") - .append(". Group type is ") + .append(group.hasPassword() ? "Tiene contraseña" : "No tiene contraseña") + .append(group.isPersistent() ? ", persistente" : "") + .append(". El tipo de grupo es ") .append( group.getType() == Group.Type.NORMAL ? "normal" : - group.getType() == Group.Type.OPEN ? "open" : - group.getType() == Group.Type.ISOLATED ? "isolated" : - "unknown" + group.getType() == Group.Type.OPEN ? "abierto" : + group.getType() == Group.Type.ISOLATED ? "aislado" : + "desconocido" ) - .append(". Players: ") + .append(". Jugadores: ") .append(playersMessage) .append("\n"); } @@ -286,23 +286,23 @@ private static void list(CommandContext sender) { private static Consumer> create(Group.Type type) { return (sender) -> { if (!platform.isValidPlayer(sender)) { - platform.sendMessage(sender, "You must be a player to use this command!"); + platform.sendMessage(sender, "¡Debes ser un jugador para usar este comando!"); return; } if (checkIfGroupsEnabled(sender)) return; - String name = sender.getArgument("name", String.class); - String password = getArgumentOr(sender, "password", String.class, null); + String name = sender.getArgument("nombre", String.class); + String password = getArgumentOr(sender, "contraseña", String.class, null); if (password != null) if (password.trim().isEmpty()) password = null; - Boolean persistent = getArgumentOr(sender, "persistent", Boolean.class, false); - assert persistent != null; + Boolean persistente = getArgumentOr(sender, "persistente", Boolean.class, false); + assert persistente != null; VoicechatConnection connection = Objects.requireNonNull(api.getConnectionOf(platform.commandContextToPlayer(sender))); if (connection.getGroup() != null) { - platform.sendMessage(sender, "You are already in a group!"); + platform.sendMessage(sender, "¡Ya estás en un grupo!"); return; } @@ -310,70 +310,70 @@ private static Consumer> create(Group.Type type) { .setName(name) .setPassword(password) .setType(type) - .setPersistent(persistent) + .setPersistent(persistente) .build(); connection.setGroup(group); - platform.sendMessage(sender, "Successfully created the group!"); + platform.sendMessage(sender, "¡Grupo creado correctamente!"); }; } private static void join(CommandContext sender) { if (!platform.isValidPlayer(sender)) { - platform.sendMessage(sender, "You must be a player to use this command!"); + platform.sendMessage(sender, "¡Debes ser un jugador para usar este comando!"); return; } if (checkIfGroupsEnabled(sender)) return; - Integer friendlyId = sender.getArgument("id", Integer.class); + Integer friendlyId = sender.getArgument("ID", Integer.class); UUID groupId = groupFriendlyIds.getKey(friendlyId); if (groupId == null) { - platform.sendMessage(sender, "Invalid group ID. Please use /dvc group list to see all groups."); + platform.sendMessage(sender, "ID de grupo no válido. Utiliza /dvc group list para ver todos los grupos."); return; } Group group = Objects.requireNonNull(api.getGroup(groupId)); if (group.hasPassword()) { - String inputPassword = getArgumentOr(sender, "password", String.class, null); + String inputPassword = getArgumentOr(sender, "contraseña", String.class, null); if (inputPassword != null) if (inputPassword.trim().isEmpty()) inputPassword = null; if (inputPassword == null) { - platform.sendMessage(sender, "The group has a password, and you have not provided one. Please rerun the command, including the password."); + platform.sendMessage(sender, "El grupo tiene una contraseña y no has proporcionado una. Vuelve a ejecutar el comando, incluyendo la contraseña."); return; } String groupPassword = getPassword(group); if (groupPassword == null) { - platform.sendMessage(sender, "Since the group has a password, we need to check if the password you supplied is correct. However, we failed to get the password for the group (the server owner can see the error in console). You may need to update Simple Voice Chat Discord Bridge."); + platform.sendMessage(sender, "Dado que el grupo tiene una contraseña, necesitamos verificar si la contraseña que proporcionaste es correcta. Sin embargo, no pudimos obtener la contraseña del grupo (el propietario del servidor puede ver el error en la consola). Es posible que necesites actualizar Simple Voice Chat Discord Bridge."); return; } if (!inputPassword.equals(groupPassword)) { - platform.sendMessage(sender, "The password you provided is incorrect. You may want to surround the password in quotes if the password has spaces in it."); + platform.sendMessage(sender, "La contraseña que proporcionaste es incorrecta. Puede que quieras rodear la contraseña con comillas si la contraseña contiene espacios."); return; } } VoicechatConnection connection = Objects.requireNonNull(api.getConnectionOf(platform.commandContextToPlayer(sender))); if (connection.getGroup() != null) { - platform.sendMessage(sender, "You are already in a group! Leave it using /dvc group leave, then join this group."); + platform.sendMessage(sender, "¡Ya estás en un grupo! Sal del grupo usando /dvc group leave, y luego únete a este grupo."); return; } if (!connection.isInstalled() && getBotForPlayer(platform.commandContextToPlayer(sender).getUuid()) == null) { - platform.sendMessage(sender, "You must have the mod installed or start a voice chat before you can use this command!"); + platform.sendMessage(sender, "¡Debes tener el mod instalado o iniciar un chat de voz antes de poder usar este comando!"); return; } connection.setGroup(group); - platform.sendMessage(sender, "Successfully joined group \"" + group.getName() + "\". Use /dvc group info to see info on the group, and /dvc group leave to leave the group."); + platform.sendMessage(sender, "¡Te has unido correctamente al grupo \"" + group.getName() + "\". Usa /dvc group info para ver información sobre el grupo, y /dvc group leave para abandonar el grupo."); } private static void info(CommandContext sender) { if (!platform.isValidPlayer(sender)) { - platform.sendMessage(sender, "You must be a player to use this command!"); + platform.sendMessage(sender, "¡Debes ser un jugador para usar este comando!"); return; } @@ -382,27 +382,27 @@ private static void info(CommandContext sender) { VoicechatConnection connection = Objects.requireNonNull(api.getConnectionOf(platform.commandContextToPlayer(sender))); Group group = connection.getGroup(); if (group == null) { - platform.sendMessage(sender, "You are not in a group!"); + platform.sendMessage(sender, "No estás en un grupo!"); return; } List players = groupPlayers.get(group.getId()); String playersMessage = players.stream().map(player -> platform.getName(player)).collect(Collectors.joining(", ")); - String message = "You are currently in \"" + group.getName() + "\". It " + - (group.hasPassword() ? "has a password" : "does not have a password") + (group.isPersistent() ? " and is persistent." : ".") + - " Group type is " + + String message = "Actualmente estás en \"" + group.getName() + "\". " + + (group.hasPassword() ? "tiene una contraseña" : "no tiene una contraseña") + (group.isPersistent() ? " y es persistente." : ".") + + " El tipo de grupo es " + (group.getType() == Group.Type.NORMAL ? "normal" : - group.getType() == Group.Type.OPEN ? "open" : - group.getType() == Group.Type.ISOLATED ? "isolated" : - "unknown") + - ". Players: " + playersMessage; + group.getType() == Group.Type.OPEN ? "abierto" : + group.getType() == Group.Type.ISOLATED ? "aislado" : + "desconocido") + + ". Jugadores: " + playersMessage; platform.sendMessage(sender, message); } private static void leave(CommandContext sender) { if (!platform.isValidPlayer(sender)) { - platform.sendMessage(sender, "You must be a player to use this command!"); + platform.sendMessage(sender, "¡Debes ser un jugador para usar este comando!"); return; } @@ -410,30 +410,30 @@ private static void leave(CommandContext sender) { VoicechatConnection connection = Objects.requireNonNull(api.getConnectionOf(platform.commandContextToPlayer(sender))); if (connection.getGroup() == null) { - platform.sendMessage(sender, "You are not in a group!"); + platform.sendMessage(sender, "No estás en un grupo!"); return; } connection.setGroup(null); - platform.sendMessage(sender, "Successfully left the group."); + platform.sendMessage(sender, "¡Has abandonado correctamente el grupo."); } private static void remove(CommandContext sender) { if (checkIfGroupsEnabled(sender)) return; - Integer friendlyId = sender.getArgument("id", Integer.class); + Integer friendlyId = sender.getArgument("ID", Integer.class); UUID groupId = groupFriendlyIds.getKey(friendlyId); if (groupId == null) { - platform.sendMessage(sender, "Invalid group ID. Please use /dvc group list to see all groups."); + platform.sendMessage(sender, "ID de grupo no válido. Utiliza /dvc group list para ver todos los grupos."); return; } if (!api.removeGroup(groupId)) { - platform.sendMessage(sender, "Couldn't remove the group. This means it either has players in it or it is not persistent."); + platform.sendMessage(sender, "No se pudo eliminar el grupo. Esto significa que o tiene jugadores o no es persistente."); return; } - platform.sendMessage(sender, "Successfully removed the group!"); + platform.sendMessage(sender, "¡Se eliminó correctamente el grupo!"); } } }