#2608,#2684: Add some missing translations to module commands

This commit is contained in:
MrIvanPlays 2019-08-16 18:19:36 +03:00 committed by md_5
parent 450c33db64
commit 9e76966e0f
8 changed files with 36 additions and 27 deletions

View File

@ -19,7 +19,7 @@ public class CommandAlert extends Command
{
if ( args.length == 0 )
{
sender.sendMessage( ChatColor.RED + "You must supply a message." );
sender.sendMessage( ProxyServer.getInstance().getTranslation( "message_needed" ) );
} else
{
StringBuilder builder = new StringBuilder();

View File

@ -23,7 +23,7 @@ public class CommandAlertRaw extends Command
{
if ( args.length == 0 )
{
sender.sendMessage( ChatColor.RED + "You must supply a message." );
sender.sendMessage( ProxyServer.getInstance().getTranslation( "message_needed" ) );
} else
{
String message = Joiner.on( ' ' ).join( args );
@ -40,15 +40,15 @@ public class CommandAlertRaw extends Command
}
if ( sender instanceof ProxiedPlayer )
{
sender.sendMessage( new ComponentBuilder( "An error occurred while parsing your message. (Hover for details)" )
sender.sendMessage( new ComponentBuilder( ProxyServer.getInstance().getTranslation( "error_occurred_player" ) )
.event( new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder( error.getMessage() )
.color( ChatColor.RED )
.underlined( true )
.event( new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder( error.getMessage() ).color( ChatColor.RED ).create() ) )
.create() ) )
.create()
);
} else
{
sender.sendMessage( new ComponentBuilder( "An error occurred while parsing your message: " ).color( ChatColor.RED ).append( error.getMessage() ).create() );
sender.sendMessage( ProxyServer.getInstance().getTranslation( "error_occurred_console", error.getMessage() ) );
}
}
}

View File

@ -1,9 +1,7 @@
package net.md_5.bungee.module.cmd.find;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.command.PlayerCommand;
@ -20,16 +18,16 @@ public class CommandFind extends PlayerCommand
{
if ( args.length != 1 )
{
sender.sendMessage( new ComponentBuilder( "Please follow this command by a user name" ).color( ChatColor.RED ).create() );
sender.sendMessage( ProxyServer.getInstance().getTranslation( "username_needed" ) );
} else
{
ProxiedPlayer player = ProxyServer.getInstance().getPlayer( args[0] );
if ( player == null || player.getServer() == null )
{
sender.sendMessage( new ComponentBuilder( "That user is not online" ).color( ChatColor.RED ).create() );
sender.sendMessage( ProxyServer.getInstance().getTranslation( "user_not_online" ) );
} else
{
sender.sendMessage( new ComponentBuilder( args[0] ).color( ChatColor.GREEN ).append( " is online at " ).append( player.getServer().getInfo().getName() ).create() );
sender.sendMessage( ProxyServer.getInstance().getTranslation( "user_online_at", player.getName(), player.getServer().getInfo().getName() ) );
}
}
}

View File

@ -4,7 +4,6 @@ import com.google.common.collect.ImmutableSet;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.config.ServerInfo;
@ -26,7 +25,7 @@ public class CommandSend extends Command implements TabExecutor
{
if ( args.length != 2 )
{
sender.sendMessage( ChatColor.RED + "Not enough arguments, usage: /send <server|player|all|current> <target>" );
sender.sendMessage( ProxyServer.getInstance().getTranslation( "send_cmd_usage" ) );
return;
}
ServerInfo target = ProxyServer.getInstance().getServerInfo( args[1] );
@ -46,7 +45,7 @@ public class CommandSend extends Command implements TabExecutor
{
if ( !( sender instanceof ProxiedPlayer ) )
{
sender.sendMessage( ChatColor.RED + "Only in game players can use this command" );
sender.sendMessage( ProxyServer.getInstance().getTranslation( "player_only" ) );
return;
}
ProxiedPlayer player = (ProxiedPlayer) sender;
@ -69,13 +68,13 @@ public class CommandSend extends Command implements TabExecutor
ProxiedPlayer player = ProxyServer.getInstance().getPlayer( args[0] );
if ( player == null )
{
sender.sendMessage( ChatColor.RED + "That player is not online" );
sender.sendMessage( ProxyServer.getInstance().getTranslation( "user_not_online" ) );
return;
}
summon( player, target, sender );
}
}
sender.sendMessage( ChatColor.GREEN + "Successfully summoned player(s)" );
sender.sendMessage( ProxyServer.getInstance().getTranslation( "successfully_summoned" ) );
}
private void summon(ProxiedPlayer player, ServerInfo target, CommandSender sender)
@ -83,7 +82,7 @@ public class CommandSend extends Command implements TabExecutor
if ( player.getServer() != null && !player.getServer().getInfo().equals( target ) )
{
player.connect( target, ServerConnectEvent.Reason.COMMAND );
player.sendMessage( ChatColor.GOLD + "Summoned to " + target.getName() + " by " + sender.getName() );
player.sendMessage( ProxyServer.getInstance().getTranslation( "you_got_summoned", target.getName(), sender.getName() ) );
}
}

View File

@ -40,7 +40,7 @@ public class CommandServer extends Command implements TabExecutor
sender.sendMessage( ProxyServer.getInstance().getTranslation( "current_server", ( (ProxiedPlayer) sender ).getServer().getInfo().getName() ) );
}
ComponentBuilder serverList = new ComponentBuilder( "" ).append( TextComponent.fromLegacyText( ProxyServer.getInstance().getTranslation( "server_list" ) ) );
ComponentBuilder serverList = new ComponentBuilder( "" ).appendLegacy( ProxyServer.getInstance().getTranslation( "server_list" ) );
boolean first = true;
for ( ServerInfo server : servers.values() )
{
@ -50,7 +50,7 @@ public class CommandServer extends Command implements TabExecutor
int count = server.getPlayers().size();
serverTextComponent.setHoverEvent( new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new ComponentBuilder( count + ( count == 1 ? " player" : " players" ) + "\n" ).append( "Click to connect to the server" ).italic( true ).create() )
new ComponentBuilder( count + ( count == 1 ? " player" : " players" ) + "\n" ).appendLegacy( ProxyServer.getInstance().getTranslation( "click_to_connect" ) ).create() )
);
serverTextComponent.setClickEvent( new ClickEvent( ClickEvent.Action.RUN_COMMAND, "/server " + server.getName() ) );
serverList.append( serverTextComponent );

View File

@ -1,6 +1,5 @@
package net.md_5.bungee.command;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -18,16 +17,16 @@ public class CommandIP extends PlayerCommand
{
if ( args.length < 1 )
{
sender.sendMessage( ChatColor.RED + "Please follow this command by a user name" );
sender.sendMessage( ProxyServer.getInstance().getTranslation( "username_needed" ) );
return;
}
ProxiedPlayer user = ProxyServer.getInstance().getPlayer( args[0] );
if ( user == null )
{
sender.sendMessage( ChatColor.RED + "That user is not online" );
sender.sendMessage( ProxyServer.getInstance().getTranslation( "user_not_online" ) );
} else
{
sender.sendMessage( ChatColor.BLUE + "IP of " + args[0] + " is " + user.getAddress() );
sender.sendMessage( ProxyServer.getInstance().getTranslation( "command_ip", args[0], user.getAddress() ) );
}
}
}

View File

@ -3,7 +3,6 @@ package net.md_5.bungee.command;
import java.util.HashSet;
import java.util.Set;
import net.md_5.bungee.Util;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.plugin.Command;
@ -24,11 +23,11 @@ public class CommandPerms extends Command
{
permissions.addAll( ProxyServer.getInstance().getConfigurationAdapter().getPermissions( group ) );
}
sender.sendMessage( ChatColor.GOLD + "You have the following groups: " + Util.csv( sender.getGroups() ) );
sender.sendMessage( ProxyServer.getInstance().getTranslation( "command_perms_groups", Util.csv( sender.getGroups() ) ) );
for ( String permission : permissions )
{
sender.sendMessage( ChatColor.BLUE + "- " + permission );
sender.sendMessage( ProxyServer.getInstance().getTranslation( "command_perms_permission", permission ) );
}
}
}

View File

@ -24,3 +24,17 @@ name_too_long=Cannot have username longer than 16 characters
name_invalid=Username contains invalid characters.
ping_cannot_connect=\u00a7c[Bungee] Can't connect to server.
offline_mode_player=Not authenticated with Minecraft.net
message_needed=\u00a7cYou must supply a message.
error_occurred_player=\u00a7cAn error occurred while parsing your message. (Hover for details)
error_occurred_console=\u00a7cAn error occurred while parsing your message: {0}
click_to_connect=Click to connect to the server
username_needed=\u00a7cPlease follow this command by a user name.
user_not_online=\u00a7cThat user is not online.
user_online_at=\u00a7a{0} \u00a7ris online at {1}
send_cmd_usage=\u00a7cNot enough arguments, usage: /send <server|player|all|current> <target>
player_only=\u00a7cOnly in game players can use this command
successfully_summoned=\u00a7aSuccessfully summoned player(s)
you_got_summoned=\u00a76Summoned to {0} by {1}
command_perms_groups=\u00a76You have the following groups: {0}
command_perms_permission=\u00a79- {0}
command_ip=\u00a79IP of {0} is {1}