From 61cee2d27ccd4751a19800a1ff5d0b98ce9829ed Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 14 Feb 2015 18:36:58 +1100 Subject: [PATCH] Fix formatting in a bunch of files. --- .../main/java/net/md_5/bungee/api/Title.java | 49 +++++++++---------- .../bungee/api/connection/ProxiedPlayer.java | 13 ++--- .../net/md_5/bungee/api/ChatMessageType.java | 1 + .../net/md_5/bungee/config/Configuration.java | 6 ++- .../bungee/config/ConfigurationProvider.java | 4 ++ .../bungee/protocol/packet/LegacyPing.java | 1 + .../packet/PlayerListHeaderFooter.java | 1 + .../md_5/bungee/protocol/packet/Title.java | 2 + .../java/net/md_5/bungee/BungeeTitle.java | 1 + .../java/net/md_5/bungee/ServerConnector.java | 2 +- .../java/net/md_5/bungee/UserConnection.java | 2 +- .../md_5/bungee/forge/ForgeClientHandler.java | 10 ++-- .../main/java/net/md_5/bungee/tab/Global.java | 17 ++++--- .../java/net/md_5/bungee/tab/TabList.java | 6 +-- 14 files changed, 63 insertions(+), 52 deletions(-) diff --git a/api/src/main/java/net/md_5/bungee/api/Title.java b/api/src/main/java/net/md_5/bungee/api/Title.java index ae426f02..601518ba 100644 --- a/api/src/main/java/net/md_5/bungee/api/Title.java +++ b/api/src/main/java/net/md_5/bungee/api/Title.java @@ -4,17 +4,18 @@ import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.connection.ProxiedPlayer; /** - * Represents a configuration of a title. - * A title in Minecraft consists of a main title and a sub title. - * It will {@link #fadeIn(int)}, {@link #stay(int)}, and {@link #fadeOut(int)} - * for a specified amount of time. - * In most cases you will want to {@link #reset()} the current title first so - * your title won't be affected by a previous one. + * Represents a configuration of a title. A title in Minecraft consists of a + * main title and a sub title. It will {@link #fadeIn(int)}, {@link #stay(int)}, + * and {@link #fadeOut(int)} for a specified amount of time. In most cases you + * will want to {@link #reset()} the current title first so your title won't be + * affected by a previous one. *

- * You can create a new configuration by calling {@link ProxyServer#createTitle()}. + * You can create a new configuration by calling + * {@link ProxyServer#createTitle()}. */ public interface Title { + /** * Set the title to send to the player. * @@ -31,7 +32,6 @@ public interface Title */ public Title title(BaseComponent... text); - /** * Set the subtitle to send to the player. * @@ -48,12 +48,11 @@ public interface Title */ public Title subTitle(BaseComponent... text); - /** - * Set the duration in ticks of the fade in effect of the title. - * Once this period of time is over the title will stay for the amount - * of time specified in {@link #stay(int)}. - * The default value for the official Minecraft version is 20 (1 second). + * Set the duration in ticks of the fade in effect of the title. Once this + * period of time is over the title will stay for the amount of time + * specified in {@link #stay(int)}. The default value for the official + * Minecraft version is 20 (1 second). * * @param ticks The amount of ticks (1/20 second) for the fade in effect. * @return This title configuration. @@ -62,9 +61,9 @@ public interface Title /** * Set the duration in ticks how long the title should stay on the screen. - * Once this period of time is over the title will fade out using the duration - * specified in {@link #fadeOut(int)}. - * The default value for the official Minecraft version is 60 (3 seconds). + * Once this period of time is over the title will fade out using the + * duration specified in {@link #fadeOut(int)}. The default value for the + * official Minecraft version is 60 (3 seconds). * * @param ticks The amount of ticks (1/20 second) for the fade in effect. * @return This title configuration. @@ -72,35 +71,33 @@ public interface Title public Title stay(int ticks); /** - * Set the duration in ticks of the fade out effect of the title. - * The default value for the official Minecraft version is 20 (1 second). + * Set the duration in ticks of the fade out effect of the title. The + * default value for the official Minecraft version is 20 (1 second). * * @param ticks The amount of ticks (1/20 second) for the fade out effect. * @return This title configuration. */ public Title fadeOut(int ticks); - /** - * Remove the currently displayed title from the player's screen. - * This will keep the currently used display times and will only remove the title. + * Remove the currently displayed title from the player's screen. This will + * keep the currently used display times and will only remove the title. * * @return This title configuration. */ public Title clear(); /** - * Remove the currently displayed title from the player's screen - * and set the configuration back to the default values. + * Remove the currently displayed title from the player's screen and set the + * configuration back to the default values. * * @return This title configuration. */ public Title reset(); - /** - * Send this title configuration to the specified player. - * This is the same as calling {@link ProxiedPlayer#sendTitle(Title)}. + * Send this title configuration to the specified player. This is the same + * as calling {@link ProxiedPlayer#sendTitle(Title)}. * * @param player The player to send the title to. * @return This title configuration. diff --git a/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java b/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java index d4438e51..375815c4 100644 --- a/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java +++ b/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java @@ -175,14 +175,15 @@ public interface ProxiedPlayer extends Connection, CommandSender /** * Gets whether this player is using a FML client. *

- * This method is only reliable if BungeeCord links Minecraft 1.8 servers - * together, as Bungee can pick up whether a user is a Forge user with the + * This method is only reliable if BungeeCord links Minecraft 1.8 servers + * together, as Bungee can pick up whether a user is a Forge user with the * initial handshake. If this is used for a 1.7 network, this might return * false even if the user is a FML user, as Bungee can only * determine this information if a handshake successfully completes. *

- * @return true if it is known that the user is using a FML - * client, false otherwise. + * + * @return true if it is known that the user is using a FML + * client, false otherwise. */ boolean isForgeUser(); @@ -195,7 +196,7 @@ public interface ProxiedPlayer extends Connection, CommandSender *

* Consumers of this API should be aware that an empty mod list does * not indicate that a user is not a Forge user, and so should not - * use this API to check for this. See the {@link #isForgeUser() + * use this API to check for this. See the {@link #isForgeUser() * isForgeUser} method instead. *

*

@@ -204,7 +205,7 @@ public interface ProxiedPlayer extends Connection, CommandSender * place to do so as this event occurs after a FML handshake has completed, * if any has occurred. *

- * + * * @return A {@link Map} of mods, where the key is the name of the mod, and * the value is the version. Returns an empty list if the FML handshake has * not occurred for this {@link ProxiedPlayer} yet. diff --git a/chat/src/main/java/net/md_5/bungee/api/ChatMessageType.java b/chat/src/main/java/net/md_5/bungee/api/ChatMessageType.java index 1d126a91..aa76e858 100644 --- a/chat/src/main/java/net/md_5/bungee/api/ChatMessageType.java +++ b/chat/src/main/java/net/md_5/bungee/api/ChatMessageType.java @@ -5,6 +5,7 @@ package net.md_5.bungee.api; */ public enum ChatMessageType { + CHAT, SYSTEM, ACTION_BAR diff --git a/config/src/main/java/net/md_5/bungee/config/Configuration.java b/config/src/main/java/net/md_5/bungee/config/Configuration.java index c51594ed..1366f449 100644 --- a/config/src/main/java/net/md_5/bungee/config/Configuration.java +++ b/config/src/main/java/net/md_5/bungee/config/Configuration.java @@ -18,11 +18,13 @@ public final class Configuration final Map self; private final Configuration defaults; - public Configuration() { + public Configuration() + { this( null ); } - public Configuration(Configuration defaults) { + public Configuration(Configuration defaults) + { this( new LinkedHashMap(), defaults ); } diff --git a/config/src/main/java/net/md_5/bungee/config/ConfigurationProvider.java b/config/src/main/java/net/md_5/bungee/config/ConfigurationProvider.java index 73ed9bc5..2cd28162 100644 --- a/config/src/main/java/net/md_5/bungee/config/ConfigurationProvider.java +++ b/config/src/main/java/net/md_5/bungee/config/ConfigurationProvider.java @@ -29,14 +29,18 @@ public abstract class ConfigurationProvider public abstract void save(Configuration config, Writer writer); public abstract Configuration load(File file) throws IOException; + public abstract Configuration load(File file, Configuration defaults) throws IOException; public abstract Configuration load(Reader reader); + public abstract Configuration load(Reader reader, Configuration defaults); public abstract Configuration load(InputStream is); + public abstract Configuration load(InputStream is, Configuration defaults); public abstract Configuration load(String string); + public abstract Configuration load(String string, Configuration defaults); } diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/LegacyPing.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/LegacyPing.java index 76137e36..b0f9be27 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/LegacyPing.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/LegacyPing.java @@ -13,6 +13,7 @@ import net.md_5.bungee.protocol.DefinedPacket; @EqualsAndHashCode(callSuper = false) public class LegacyPing extends DefinedPacket { + private final boolean v1_5; @Override diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/PlayerListHeaderFooter.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/PlayerListHeaderFooter.java index f71c6ba9..e76fcab2 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/PlayerListHeaderFooter.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/PlayerListHeaderFooter.java @@ -16,6 +16,7 @@ import net.md_5.bungee.protocol.ProtocolConstants; @EqualsAndHashCode(callSuper = false) public class PlayerListHeaderFooter extends DefinedPacket { + private String header; private String footer; diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Title.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Title.java index bf525b59..79a12578 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Title.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Title.java @@ -14,6 +14,7 @@ import net.md_5.bungee.protocol.ProtocolConstants; @EqualsAndHashCode(callSuper = false) public class Title extends DefinedPacket { + private Action action; // TITLE & SUBTITLE @@ -68,6 +69,7 @@ public class Title extends DefinedPacket public static enum Action { + TITLE, SUBTITLE, TIMES, diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeTitle.java b/proxy/src/main/java/net/md_5/bungee/BungeeTitle.java index 5fa6c3fb..c22409b8 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeTitle.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeTitle.java @@ -10,6 +10,7 @@ import net.md_5.bungee.protocol.packet.Title.Action; public class BungeeTitle implements Title { + private net.md_5.bungee.protocol.packet.Title title, subtitle, times, clear, reset; private static net.md_5.bungee.protocol.packet.Title createPacket(Action action) 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 6d4ea8a7..b6e7dd28 100644 --- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java +++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java @@ -92,7 +92,7 @@ public class ServerConnector extends PacketHandler } copiedHandshake.setHost( newHost ); } - else if ( !user.getExtraDataInHandshake().isEmpty() ) + else if ( !user.getExtraDataInHandshake().isEmpty() ) { // Only restore the extra data if IP forwarding is off. // TODO: Add support for this data with IP forwarding. 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 66791296..5e9075bf 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -520,7 +520,7 @@ public final class UserConnection implements ProxiedPlayer } @Override - public boolean isForgeUser() + public boolean isForgeUser() { return forgeClientHandler.isForgeUser(); } diff --git a/proxy/src/main/java/net/md_5/bungee/forge/ForgeClientHandler.java b/proxy/src/main/java/net/md_5/bungee/forge/ForgeClientHandler.java index ebde27ea..3281ee98 100644 --- a/proxy/src/main/java/net/md_5/bungee/forge/ForgeClientHandler.java +++ b/proxy/src/main/java/net/md_5/bungee/forge/ForgeClientHandler.java @@ -42,8 +42,8 @@ public class ForgeClientHandler private PluginMessage serverIdList = null; /** - * Gets or sets a value indicating whether the '\00FML\00' token was found in - * the handshake. + * Gets or sets a value indicating whether the '\00FML\00' token was found + * in the handshake. */ @Getter @Setter @@ -150,9 +150,9 @@ public class ForgeClientHandler } /** - * Returns whether we know if the user is a forge user. - * In FML 1.8, a "FML" token is included in the initial handshake. - * We can use that to determine if the user is a Forge 1.8 user. + * Returns whether we know if the user is a forge user. In FML 1.8, a "FML" + * token is included in the initial handshake. We can use that to determine + * if the user is a Forge 1.8 user. * * @return true if the user is a forge user. */ diff --git a/proxy/src/main/java/net/md_5/bungee/tab/Global.java b/proxy/src/main/java/net/md_5/bungee/tab/Global.java index ecd8ff04..ae652b4b 100644 --- a/proxy/src/main/java/net/md_5/bungee/tab/Global.java +++ b/proxy/src/main/java/net/md_5/bungee/tab/Global.java @@ -77,15 +77,15 @@ public class Global extends TabList { props[ j ] = new String[] { - loginResult.getProperties()[ j ].getName(), - loginResult.getProperties()[ j ].getValue(), - loginResult.getProperties()[ j ].getSignature() + loginResult.getProperties()[ j ].getName(), + loginResult.getProperties()[ j ].getValue(), + loginResult.getProperties()[ j ].getSignature() }; } item.setProperties( props ); } else { - item.setProperties( new String[0][0] ); + item.setProperties( new String[ 0 ][ 0 ] ); } item.setGamemode( ( (UserConnection) p ).getGamemode() ); item.setPing( p.getPing() ); @@ -115,15 +115,16 @@ public class Global extends TabList item.setUsername( player.getName() ); item.setDisplayName( ComponentSerializer.toString( TextComponent.fromLegacyText( player.getDisplayName() ) ) ); LoginResult loginResult = ( (UserConnection) player ).getPendingConnection().getLoginProfile(); - if ( loginResult != null ) { + if ( loginResult != null ) + { String[][] props = new String[ loginResult.getProperties().length ][]; for ( int j = 0; j < props.length; j++ ) { props[ j ] = new String[] { - loginResult.getProperties()[ j ].getName(), - loginResult.getProperties()[ j ].getValue(), - loginResult.getProperties()[ j ].getSignature() + loginResult.getProperties()[ j ].getName(), + loginResult.getProperties()[ j ].getValue(), + loginResult.getProperties()[ j ].getSignature() }; } item.setProperties( props ); diff --git a/proxy/src/main/java/net/md_5/bungee/tab/TabList.java b/proxy/src/main/java/net/md_5/bungee/tab/TabList.java index bab75b1c..4546a83a 100644 --- a/proxy/src/main/java/net/md_5/bungee/tab/TabList.java +++ b/proxy/src/main/java/net/md_5/bungee/tab/TabList.java @@ -43,9 +43,9 @@ public abstract class TabList { props[ i ] = new String[] { - loginResult.getProperties()[ i ].getName(), - loginResult.getProperties()[ i ].getValue(), - loginResult.getProperties()[ i ].getSignature() + loginResult.getProperties()[ i ].getName(), + loginResult.getProperties()[ i ].getValue(), + loginResult.getProperties()[ i ].getSignature() }; } item.setProperties( props );