From 1ea53f01aa3fdeaf75caa007a85a7ed775834a65 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 12 May 2013 13:39:02 +1000 Subject: [PATCH] Add a series of new translations --- .../net/md_5/bungee/api/plugin/PluginManager.java | 2 +- .../src/main/java/net/md_5/bungee/BungeeCord.java | 4 ++-- .../java/net/md_5/bungee/ServerConnector.java | 2 +- .../main/java/net/md_5/bungee/UserConnection.java | 6 +++--- .../net/md_5/bungee/command/CommandAlert.java | 3 +-- .../java/net/md_5/bungee/command/CommandList.java | 2 +- .../java/net/md_5/bungee/command/CommandSend.java | 2 +- .../net/md_5/bungee/command/CommandServer.java | 6 +++--- .../md_5/bungee/connection/DownstreamBridge.java | 4 ++-- .../md_5/bungee/connection/InitialHandler.java | 4 ++-- proxy/src/main/resources/messages_en.properties | 15 +++++++++++++-- 11 files changed, 30 insertions(+), 20 deletions(-) diff --git a/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java b/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java index 99d8758c..de5a1b81 100644 --- a/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java +++ b/api/src/main/java/net/md_5/bungee/api/plugin/PluginManager.java @@ -85,7 +85,7 @@ public class PluginManager String permission = command.getPermission(); if ( permission != null && !permission.isEmpty() && !sender.hasPermission( permission ) ) { - sender.sendMessage( ChatColor.RED + "You do not have permission to execute this command!" ); + sender.sendMessage( proxy.getTranslation( "no_permission" ) ); return true; } diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java index 48bb259b..80c5647b 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java @@ -155,7 +155,7 @@ public class BungeeCord extends ProxyServer public static void main(String[] args) throws Exception { Calendar deadline = Calendar.getInstance(); - deadline.set( 2013, 5, 26 ); // year, month, date + deadline.set( 2013, 6, 14 ); // year, month, date if ( Calendar.getInstance().after( deadline ) ) { System.err.println( "*** Warning, this build is outdated ***" ); @@ -295,7 +295,7 @@ public class BungeeCord extends ProxyServer getScheduler().cancel( plugin ); } - getLogger().info( getTranslation( "end" ) ); + getLogger().info( "Thankyou and goodbye" ); System.exit( 0 ); } diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java index c58e0196..95308b37 100644 --- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java +++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java @@ -252,7 +252,7 @@ public class ServerConnector extends PacketHandler return; } - String message = ChatColor.RED + "Kicked whilst connecting to " + target.getName() + ": " + kick.message; + String message = bungee.getTranslation( "connect_kick") + target.getName() + ": " + kick.message; if ( user.getServer() == null ) { user.disconnect( message ); diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java index 16b8fe5d..98d00eca 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -188,16 +188,16 @@ public final class UserConnection implements ProxiedPlayer ServerInfo def = ProxyServer.getInstance().getServers().get( getPendingConnection().getListener().getFallbackServer() ); if ( retry & target != def && ( getServer() == null || def != getServer().getInfo() ) ) { - sendMessage( ChatColor.RED + "Could not connect to target server, you have been moved to the lobby server" ); + sendMessage( bungee.getTranslation( "fallback_lobby" ) ); connect( def, false ); } else { if ( server == null ) { - disconnect( "Could not connect to default server, please try again later: " + future.cause().getClass().getName() ); + disconnect( bungee.getTranslation( "fallback_kick" ) + future.cause().getClass().getName() ); } else { - sendMessage( ChatColor.RED + "Could not connect to selected server, please try again later: " + future.cause().getClass().getName() ); + sendMessage( bungee.getTranslation( "fallback_kick" ) + future.cause().getClass().getName() ); } } } diff --git a/proxy/src/main/java/net/md_5/bungee/command/CommandAlert.java b/proxy/src/main/java/net/md_5/bungee/command/CommandAlert.java index 2b7ae973..391045fa 100644 --- a/proxy/src/main/java/net/md_5/bungee/command/CommandAlert.java +++ b/proxy/src/main/java/net/md_5/bungee/command/CommandAlert.java @@ -29,8 +29,7 @@ public class CommandAlert extends Command args[0] = args[0].substring( 2, args[0].length() ); } else { - builder.append( ChatColor.DARK_PURPLE ); - builder.append( "[Alert] " ); + builder.append( ProxyServer.getInstance().getTranslation( "alert" ) ); } for ( String s : args ) diff --git a/proxy/src/main/java/net/md_5/bungee/command/CommandList.java b/proxy/src/main/java/net/md_5/bungee/command/CommandList.java index 511a7ecc..4344d9c5 100644 --- a/proxy/src/main/java/net/md_5/bungee/command/CommandList.java +++ b/proxy/src/main/java/net/md_5/bungee/command/CommandList.java @@ -58,6 +58,6 @@ public class CommandList extends Command sender.sendMessage( message.toString() ); } - sender.sendMessage( "Total players online: " + ProxyServer.getInstance().getPlayers().size() ); + sender.sendMessage( ProxyServer.getInstance().getTranslation( "total_players" ) + ProxyServer.getInstance().getPlayers().size() ); } } diff --git a/proxy/src/main/java/net/md_5/bungee/command/CommandSend.java b/proxy/src/main/java/net/md_5/bungee/command/CommandSend.java index 6f308390..a409125f 100644 --- a/proxy/src/main/java/net/md_5/bungee/command/CommandSend.java +++ b/proxy/src/main/java/net/md_5/bungee/command/CommandSend.java @@ -26,7 +26,7 @@ public class CommandSend extends Command ServerInfo target = ProxyServer.getInstance().getServerInfo( args[1] ); if ( target == null ) { - sender.sendMessage( ChatColor.RED + "Target server does not exist" ); + sender.sendMessage( ProxyServer.getInstance().getTranslation( "no_server") ); return; } diff --git a/proxy/src/main/java/net/md_5/bungee/command/CommandServer.java b/proxy/src/main/java/net/md_5/bungee/command/CommandServer.java index aa871be3..5b6882d8 100644 --- a/proxy/src/main/java/net/md_5/bungee/command/CommandServer.java +++ b/proxy/src/main/java/net/md_5/bungee/command/CommandServer.java @@ -43,16 +43,16 @@ public class CommandServer extends Command { serverList.setLength( serverList.length() - 2 ); } - player.sendMessage( ChatColor.GOLD + "You may connect to the following servers at this time: " + serverList.toString() ); + player.sendMessage( ProxyServer.getInstance().getTranslation( "server_list") + serverList.toString() ); } else { ServerInfo server = servers.get( args[0] ); if ( server == null ) { - player.sendMessage( ChatColor.RED + "The specified server does not exist" ); + player.sendMessage( ProxyServer.getInstance().getTranslation( "no_server") ); } else if ( !server.canAccess( player ) ) { - player.sendMessage( ChatColor.RED + "You don't have permission to access this server" ); + player.sendMessage( ProxyServer.getInstance().getTranslation( "no_server_permission") ); } else { player.connect( server ); diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java index efb2e0a6..19b9b960 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java @@ -64,7 +64,7 @@ public class DownstreamBridge extends PacketHandler if ( !server.isObsolete() ) { - con.disconnect( bungee.getTranslation( "lost_connection ") ); + con.disconnect( bungee.getTranslation( "lost_connection " ) ); } } @@ -334,7 +334,7 @@ public class DownstreamBridge extends PacketHandler con.connectNow( event.getCancelServer() ); } else { - con.disconnect( "[Kicked] " + event.getKickReason() ); + con.disconnect( bungee.getTranslation( "server_kick" ) + event.getKickReason() ); } server.setObsolete( true ); throw new CancelSendSignal(); diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java index 273f4d77..b8b687f4 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java @@ -132,7 +132,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection int limit = BungeeCord.getInstance().config.getPlayerLimit(); if ( limit > 0 && bungee.getPlayers().size() > limit ) { - disconnect( "Server is full!" ); + disconnect( bungee.getTranslation( "proxy_full" ) ); return; } @@ -199,7 +199,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection ProxiedPlayer old = bungee.getPlayer( handshake.username ); if ( old != null ) { - old.disconnect( "You are already connected to the server" ); + old.disconnect( "already_connected" ); } Callback complete = new Callback() diff --git a/proxy/src/main/resources/messages_en.properties b/proxy/src/main/resources/messages_en.properties index abdbad12..e16f0af7 100644 --- a/proxy/src/main/resources/messages_en.properties +++ b/proxy/src/main/resources/messages_en.properties @@ -1,3 +1,14 @@ -restart: [Proxy] Proxy restarting. +alert: \u00a75[Alert] +already_connected: You are already connected to the server +connect_kick: \u00a7cKicked whilst connecting to +fallback_kick: \u00a7cCould not connect to default server, please try again later: +fallback_move: \u00a7cCould not connect to target server, you have been moved to the lobby server lost_connection: [Proxy] Lost connection to server. -end: Thank you, and goodbye. +no_permission: \u00a7cYou do not have permission to execute this command! +no_server: \u00a7cThe specified server does not exist +no_server_permission: \u00a7cYou don't have permission to access this server +proxy_full: Server is full +restart: [Proxy] Proxy restarting. +server_kick: [Kicked] +server_list: \u00a76You may connect to the following servers at this time: +total_players: Total players online: