Fix some source code formatting

This commit is contained in:
md_5 2018-01-28 10:23:52 +11:00
parent 6b88b63941
commit 9b2bb07d89
4 changed files with 18 additions and 12 deletions

View File

@ -79,7 +79,7 @@ public abstract class BaseComponent
copyFormatting( old ); copyFormatting( old );
} }
public void copyFormatting( BaseComponent component ) public void copyFormatting(BaseComponent component)
{ {
setColor( component.getColorRaw() ); setColor( component.getColorRaw() );
setBold( component.isBoldRaw() ); setBold( component.isBoldRaw() );

View File

@ -5,6 +5,7 @@ import org.junit.Test;
public class DefaultConfigurationTest public class DefaultConfigurationTest
{ {
@Test @Test
public void testDefaultValues() public void testDefaultValues()
{ {

View File

@ -251,8 +251,8 @@ public enum Protocol
/*========================================================================*/ /*========================================================================*/
public static final int MAX_PACKET_ID = 0xFF; public static final int MAX_PACKET_ID = 0xFF;
/*========================================================================*/ /*========================================================================*/
public final DirectionData TO_SERVER = new DirectionData(this, ProtocolConstants.Direction.TO_SERVER ); public final DirectionData TO_SERVER = new DirectionData( this, ProtocolConstants.Direction.TO_SERVER );
public final DirectionData TO_CLIENT = new DirectionData(this, ProtocolConstants.Direction.TO_CLIENT ); public final DirectionData TO_CLIENT = new DirectionData( this, ProtocolConstants.Direction.TO_CLIENT );
public static void main(String[] args) public static void main(String[] args)
{ {
@ -289,7 +289,8 @@ public enum Protocol
} }
@RequiredArgsConstructor @RequiredArgsConstructor
private static class ProtocolData { private static class ProtocolData
{
private final int protocolVersion; private final int protocolVersion;
private final TObjectIntMap<Class<? extends DefinedPacket>> packetMap = new TObjectIntHashMap<>( MAX_PACKET_ID ); private final TObjectIntMap<Class<? extends DefinedPacket>> packetMap = new TObjectIntHashMap<>( MAX_PACKET_ID );
@ -297,13 +298,17 @@ public enum Protocol
} }
@RequiredArgsConstructor @RequiredArgsConstructor
private static class ProtocolMapping { private static class ProtocolMapping
{
private final int protocolVersion; private final int protocolVersion;
private final int packetID; private final int packetID;
} }
// Helper method // Helper method
private static ProtocolMapping map(int protocol, int id) { private static ProtocolMapping map(int protocol, int id)
return new ProtocolMapping(protocol, id); {
return new ProtocolMapping( protocol, id );
} }
@RequiredArgsConstructor @RequiredArgsConstructor
@ -337,7 +342,7 @@ public enum Protocol
linkedProtocols.put( ProtocolConstants.MINECRAFT_1_12, Arrays.asList( linkedProtocols.put( ProtocolConstants.MINECRAFT_1_12, Arrays.asList(
ProtocolConstants.MINECRAFT_1_12_1 ProtocolConstants.MINECRAFT_1_12_1
) ); ) );
linkedProtocols.put( ProtocolConstants.MINECRAFT_1_12_1, Arrays.asList( linkedProtocols.put( ProtocolConstants.MINECRAFT_1_12_1, Arrays.asList(
ProtocolConstants.MINECRAFT_1_12_2 ProtocolConstants.MINECRAFT_1_12_2
) ); ) );
} }
@ -358,7 +363,7 @@ public enum Protocol
public final DefinedPacket createPacket(int id, int version) public final DefinedPacket createPacket(int id, int version)
{ {
ProtocolData protocolData = getProtocolData( version ); ProtocolData protocolData = getProtocolData( version );
if (protocolData == null) if ( protocolData == null )
{ {
throw new BadPacketException( "Unsupported protocol version" ); throw new BadPacketException( "Unsupported protocol version" );
} }
@ -377,7 +382,7 @@ public enum Protocol
} }
} }
protected final void registerPacket(Class<? extends DefinedPacket> packetClass, ProtocolMapping ...mappings) protected final void registerPacket(Class<? extends DefinedPacket> packetClass, ProtocolMapping... mappings)
{ {
try try
{ {
@ -415,7 +420,7 @@ public enum Protocol
{ {
ProtocolData protocolData = getProtocolData( version ); ProtocolData protocolData = getProtocolData( version );
if (protocolData == null) if ( protocolData == null )
{ {
throw new BadPacketException( "Unsupported protocol version" ); throw new BadPacketException( "Unsupported protocol version" );
} }

View File

@ -16,7 +16,7 @@ public class ComponentsTest
@Test @Test
public void testBuilderClone() public void testBuilderClone()
{ {
ComponentBuilder builder = new ComponentBuilder("Hel").color(ChatColor.RED).append("lo").color(ChatColor.DARK_RED); ComponentBuilder builder = new ComponentBuilder( "Hel" ).color( ChatColor.RED ).append( "lo" ).color( ChatColor.DARK_RED );
ComponentBuilder cloned = new ComponentBuilder( builder ); ComponentBuilder cloned = new ComponentBuilder( builder );
Assert.assertEquals( TextComponent.toLegacyText( builder.create() ), TextComponent.toLegacyText( cloned.create() ) ); Assert.assertEquals( TextComponent.toLegacyText( builder.create() ), TextComponent.toLegacyText( cloned.create() ) );