Fix formatting
This commit is contained in:
parent
1cd3e42182
commit
80b3135a93
@ -104,13 +104,13 @@ public class ServerPing
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public ServerPing(Protocol version, Players players, String description, String favicon)
|
public ServerPing(Protocol version, Players players, String description, String favicon)
|
||||||
{
|
{
|
||||||
this( version, players, new TextComponent( TextComponent.fromLegacyText(description) ), favicon == null ? null : Favicon.create( favicon ) );
|
this( version, players, new TextComponent( TextComponent.fromLegacyText( description ) ), favicon == null ? null : Favicon.create( favicon ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ServerPing(Protocol version, Players players, String description, Favicon favicon)
|
public ServerPing(Protocol version, Players players, String description, Favicon favicon)
|
||||||
{
|
{
|
||||||
this( version, players, new TextComponent( TextComponent.fromLegacyText(description) ), favicon );
|
this( version, players, new TextComponent( TextComponent.fromLegacyText( description ) ), favicon );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -136,20 +136,24 @@ public class ServerPing
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description)
|
||||||
|
{
|
||||||
this.description = new TextComponent( TextComponent.fromLegacyText( description ) );
|
this.description = new TextComponent( TextComponent.fromLegacyText( description ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public String getDescription() {
|
public String getDescription()
|
||||||
|
{
|
||||||
return BaseComponent.toLegacyText( description );
|
return BaseComponent.toLegacyText( description );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescriptionComponent(BaseComponent description) {
|
public void setDescriptionComponent(BaseComponent description)
|
||||||
|
{
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseComponent getDescriptionComponent() {
|
public BaseComponent getDescriptionComponent()
|
||||||
|
{
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,8 @@ public class AsyncEvent<T> extends Event
|
|||||||
{
|
{
|
||||||
done.done( (T) this, null );
|
done.done( (T) this, null );
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
latch.decrementAndGet();
|
latch.decrementAndGet();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,11 +250,13 @@ public class ComponentBuilder
|
|||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify that we do not want to retain anything from the previous component.
|
* Specify that we do not want to retain anything from the previous
|
||||||
|
* component.
|
||||||
*/
|
*/
|
||||||
NONE,
|
NONE,
|
||||||
/**
|
/**
|
||||||
* Specify that we want the formatting retained from the previous component.
|
* Specify that we want the formatting retained from the previous
|
||||||
|
* component.
|
||||||
*/
|
*/
|
||||||
FORMATTING,
|
FORMATTING,
|
||||||
/**
|
/**
|
||||||
@ -262,7 +264,8 @@ public class ComponentBuilder
|
|||||||
*/
|
*/
|
||||||
EVENTS,
|
EVENTS,
|
||||||
/**
|
/**
|
||||||
* Specify that we want to retain everything from the previous component.
|
* Specify that we want to retain everything from the previous
|
||||||
|
* component.
|
||||||
*/
|
*/
|
||||||
ALL
|
ALL
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,8 @@ public class TranslatableComponent extends BaseComponent
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
trans = locales.getString( translate );
|
trans = locales.getString( translate );
|
||||||
} catch ( MissingResourceException e ) {
|
} catch ( MissingResourceException ex )
|
||||||
|
{
|
||||||
trans = translate;
|
trans = translate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +185,8 @@ public class TranslatableComponent extends BaseComponent
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
trans = locales.getString( translate );
|
trans = locales.getString( translate );
|
||||||
} catch ( MissingResourceException e ) {
|
} catch ( MissingResourceException e )
|
||||||
|
{
|
||||||
trans = translate;
|
trans = translate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,9 @@ import org.junit.Test;
|
|||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
public class TranslatableComponentTest {
|
public class TranslatableComponentTest
|
||||||
|
{
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMissingPlaceholdersAdded()
|
public void testMissingPlaceholdersAdded()
|
||||||
{
|
{
|
||||||
|
@ -22,8 +22,8 @@ public abstract class ConfigurationProvider
|
|||||||
{
|
{
|
||||||
return providers.get( provider );
|
return providers.get( provider );
|
||||||
}
|
}
|
||||||
/*------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
public abstract void save(Configuration config, File file) throws IOException;
|
public abstract void save(Configuration config, File file) throws IOException;
|
||||||
|
|
||||||
public abstract void save(Configuration config, Writer writer);
|
public abstract void save(Configuration config, Writer writer);
|
||||||
|
4
pom.xml
4
pom.xml
@ -170,8 +170,8 @@
|
|||||||
<action>
|
<action>
|
||||||
<execute>
|
<execute>
|
||||||
<runOnIncremental>false</runOnIncremental>
|
<runOnIncremental>false</runOnIncremental>
|
||||||
</execute >
|
</execute>
|
||||||
</action>
|
</action>
|
||||||
</pluginExecution>
|
</pluginExecution>
|
||||||
</pluginExecutions>
|
</pluginExecutions>
|
||||||
</lifecycleMappingMetadata>
|
</lifecycleMappingMetadata>
|
||||||
|
@ -44,66 +44,66 @@ public enum Protocol
|
|||||||
|
|
||||||
// Undef
|
// Undef
|
||||||
HANDSHAKE
|
HANDSHAKE
|
||||||
{
|
{
|
||||||
|
|
||||||
{
|
{
|
||||||
TO_SERVER.registerPacket( 0x00, Handshake.class );
|
TO_SERVER.registerPacket( 0x00, Handshake.class );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 0
|
// 0
|
||||||
GAME
|
GAME
|
||||||
{
|
{
|
||||||
|
|
||||||
{
|
{
|
||||||
TO_CLIENT.registerPacket( 0x00, 0x1F, KeepAlive.class );
|
TO_CLIENT.registerPacket( 0x00, 0x1F, KeepAlive.class );
|
||||||
TO_CLIENT.registerPacket( 0x01, 0x23, Login.class );
|
TO_CLIENT.registerPacket( 0x01, 0x23, Login.class );
|
||||||
TO_CLIENT.registerPacket( 0x02, 0x0F, Chat.class );
|
TO_CLIENT.registerPacket( 0x02, 0x0F, Chat.class );
|
||||||
TO_CLIENT.registerPacket( 0x07, 0x33, Respawn.class );
|
TO_CLIENT.registerPacket( 0x07, 0x33, Respawn.class );
|
||||||
TO_CLIENT.registerPacket( 0x0C, 0x0C, BossBar.class, true );
|
TO_CLIENT.registerPacket( 0x0C, 0x0C, BossBar.class, true );
|
||||||
TO_CLIENT.registerPacket( 0x38, 0x2D, PlayerListItem.class ); // PlayerInfo
|
TO_CLIENT.registerPacket( 0x38, 0x2D, PlayerListItem.class ); // PlayerInfo
|
||||||
TO_CLIENT.registerPacket( 0x3A, 0x0E, TabCompleteResponse.class );
|
TO_CLIENT.registerPacket( 0x3A, 0x0E, TabCompleteResponse.class );
|
||||||
TO_CLIENT.registerPacket( 0x3B, 0x3F, ScoreboardObjective.class );
|
TO_CLIENT.registerPacket( 0x3B, 0x3F, ScoreboardObjective.class );
|
||||||
TO_CLIENT.registerPacket( 0x3C, 0x42, ScoreboardScore.class );
|
TO_CLIENT.registerPacket( 0x3C, 0x42, ScoreboardScore.class );
|
||||||
TO_CLIENT.registerPacket( 0x3D, 0x38, ScoreboardDisplay.class );
|
TO_CLIENT.registerPacket( 0x3D, 0x38, ScoreboardDisplay.class );
|
||||||
TO_CLIENT.registerPacket( 0x3E, 0x41, Team.class );
|
TO_CLIENT.registerPacket( 0x3E, 0x41, Team.class );
|
||||||
TO_CLIENT.registerPacket( 0x3F, 0x18, PluginMessage.class );
|
TO_CLIENT.registerPacket( 0x3F, 0x18, PluginMessage.class );
|
||||||
TO_CLIENT.registerPacket( 0x40, 0x1A, Kick.class );
|
TO_CLIENT.registerPacket( 0x40, 0x1A, Kick.class );
|
||||||
TO_CLIENT.registerPacket( 0x45, 0x45, Title.class );
|
TO_CLIENT.registerPacket( 0x45, 0x45, Title.class );
|
||||||
TO_CLIENT.registerPacket( 0x47, 0x48, PlayerListHeaderFooter.class );
|
TO_CLIENT.registerPacket( 0x47, 0x48, PlayerListHeaderFooter.class );
|
||||||
|
|
||||||
TO_SERVER.registerPacket( 0x00, 0x0B, KeepAlive.class );
|
TO_SERVER.registerPacket( 0x00, 0x0B, KeepAlive.class );
|
||||||
TO_SERVER.registerPacket( 0x01, 0x02, Chat.class );
|
TO_SERVER.registerPacket( 0x01, 0x02, Chat.class );
|
||||||
TO_SERVER.registerPacket( 0x14, 0x01, TabCompleteRequest.class );
|
TO_SERVER.registerPacket( 0x14, 0x01, TabCompleteRequest.class );
|
||||||
TO_SERVER.registerPacket( 0x15, 0x04, ClientSettings.class );
|
TO_SERVER.registerPacket( 0x15, 0x04, ClientSettings.class );
|
||||||
TO_SERVER.registerPacket( 0x17, 0x09, PluginMessage.class );
|
TO_SERVER.registerPacket( 0x17, 0x09, PluginMessage.class );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 1
|
// 1
|
||||||
STATUS
|
STATUS
|
||||||
{
|
{
|
||||||
|
|
||||||
{
|
{
|
||||||
TO_CLIENT.registerPacket( 0x00, StatusResponse.class );
|
TO_CLIENT.registerPacket( 0x00, StatusResponse.class );
|
||||||
TO_CLIENT.registerPacket( 0x01, PingPacket.class );
|
TO_CLIENT.registerPacket( 0x01, PingPacket.class );
|
||||||
|
|
||||||
TO_SERVER.registerPacket( 0x00, StatusRequest.class );
|
TO_SERVER.registerPacket( 0x00, StatusRequest.class );
|
||||||
TO_SERVER.registerPacket( 0x01, PingPacket.class );
|
TO_SERVER.registerPacket( 0x01, PingPacket.class );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//2
|
//2
|
||||||
LOGIN
|
LOGIN
|
||||||
{
|
{
|
||||||
|
|
||||||
{
|
{
|
||||||
TO_CLIENT.registerPacket( 0x00, Kick.class );
|
TO_CLIENT.registerPacket( 0x00, Kick.class );
|
||||||
TO_CLIENT.registerPacket( 0x01, EncryptionRequest.class );
|
TO_CLIENT.registerPacket( 0x01, EncryptionRequest.class );
|
||||||
TO_CLIENT.registerPacket( 0x02, LoginSuccess.class );
|
TO_CLIENT.registerPacket( 0x02, LoginSuccess.class );
|
||||||
TO_CLIENT.registerPacket( 0x03, SetCompression.class );
|
TO_CLIENT.registerPacket( 0x03, SetCompression.class );
|
||||||
|
|
||||||
TO_SERVER.registerPacket( 0x00, LoginRequest.class );
|
TO_SERVER.registerPacket( 0x00, LoginRequest.class );
|
||||||
TO_SERVER.registerPacket( 0x01, EncryptionResponse.class );
|
TO_SERVER.registerPacket( 0x01, EncryptionResponse.class );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
/*========================================================================*/
|
/*========================================================================*/
|
||||||
public static final int MAX_PACKET_ID = 0xFF;
|
public static final int MAX_PACKET_ID = 0xFF;
|
||||||
public static List<Integer> supportedVersions = Arrays.asList(
|
public static List<Integer> supportedVersions = Arrays.asList(
|
||||||
@ -129,7 +129,6 @@ public enum Protocol
|
|||||||
private final TIntObjectMap<TIntIntMap> packetRemap = new TIntObjectHashMap<>();
|
private final TIntObjectMap<TIntIntMap> packetRemap = new TIntObjectHashMap<>();
|
||||||
private final TIntObjectMap<TIntIntMap> packetRemapInv = new TIntObjectHashMap<>();
|
private final TIntObjectMap<TIntIntMap> packetRemapInv = new TIntObjectHashMap<>();
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
packetRemap.put( ProtocolConstants.MINECRAFT_1_8, new TIntIntHashMap() );
|
packetRemap.put( ProtocolConstants.MINECRAFT_1_8, new TIntIntHashMap() );
|
||||||
packetRemapInv.put( ProtocolConstants.MINECRAFT_1_8, new TIntIntHashMap() );
|
packetRemapInv.put( ProtocolConstants.MINECRAFT_1_8, new TIntIntHashMap() );
|
||||||
|
@ -54,7 +54,7 @@ public class ClientSettings extends DefinedPacket
|
|||||||
buf.writeByte( skinParts );
|
buf.writeByte( skinParts );
|
||||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
|
||||||
{
|
{
|
||||||
DefinedPacket.writeVarInt(mainHand, buf);
|
DefinedPacket.writeVarInt( mainHand, buf );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,11 +22,11 @@ public class PlayerListItem extends DefinedPacket
|
|||||||
@Override
|
@Override
|
||||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
{
|
{
|
||||||
action = Action.values()[ DefinedPacket.readVarInt( buf )];
|
action = Action.values()[DefinedPacket.readVarInt( buf )];
|
||||||
items = new Item[ DefinedPacket.readVarInt( buf ) ];
|
items = new Item[ DefinedPacket.readVarInt( buf ) ];
|
||||||
for ( int i = 0; i < items.length; i++ )
|
for ( int i = 0; i < items.length; i++ )
|
||||||
{
|
{
|
||||||
Item item = items[ i ] = new Item();
|
Item item = items[i] = new Item();
|
||||||
item.setUuid( DefinedPacket.readUUID( buf ) );
|
item.setUuid( DefinedPacket.readUUID( buf ) );
|
||||||
switch ( action )
|
switch ( action )
|
||||||
{
|
{
|
||||||
@ -39,13 +39,13 @@ public class PlayerListItem extends DefinedPacket
|
|||||||
String value = DefinedPacket.readString( buf );
|
String value = DefinedPacket.readString( buf );
|
||||||
if ( buf.readBoolean() )
|
if ( buf.readBoolean() )
|
||||||
{
|
{
|
||||||
item.properties[ j] = new String[]
|
item.properties[j] = new String[]
|
||||||
{
|
{
|
||||||
name, value, DefinedPacket.readString( buf )
|
name, value, DefinedPacket.readString( buf )
|
||||||
};
|
};
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
item.properties[ j ] = new String[]
|
item.properties[j] = new String[]
|
||||||
{
|
{
|
||||||
name, value
|
name, value
|
||||||
};
|
};
|
||||||
@ -88,12 +88,12 @@ public class PlayerListItem extends DefinedPacket
|
|||||||
DefinedPacket.writeVarInt( item.properties.length, buf );
|
DefinedPacket.writeVarInt( item.properties.length, buf );
|
||||||
for ( String[] prop : item.properties )
|
for ( String[] prop : item.properties )
|
||||||
{
|
{
|
||||||
DefinedPacket.writeString( prop[ 0], buf );
|
DefinedPacket.writeString( prop[0], buf );
|
||||||
DefinedPacket.writeString( prop[ 1], buf );
|
DefinedPacket.writeString( prop[1], buf );
|
||||||
if ( prop.length >= 3 )
|
if ( prop.length >= 3 )
|
||||||
{
|
{
|
||||||
buf.writeBoolean( true );
|
buf.writeBoolean( true );
|
||||||
DefinedPacket.writeString( prop[ 2], buf );
|
DefinedPacket.writeString( prop[2], buf );
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
buf.writeBoolean( false );
|
buf.writeBoolean( false );
|
||||||
|
@ -33,7 +33,7 @@ public class PluginMessage extends DefinedPacket
|
|||||||
{
|
{
|
||||||
tag = readString( buf );
|
tag = readString( buf );
|
||||||
int maxSize = direction == ProtocolConstants.Direction.TO_SERVER ? Short.MAX_VALUE : 0x100000;
|
int maxSize = direction == ProtocolConstants.Direction.TO_SERVER ? Short.MAX_VALUE : 0x100000;
|
||||||
Preconditions.checkArgument(buf.readableBytes() < maxSize);
|
Preconditions.checkArgument( buf.readableBytes() < maxSize );
|
||||||
data = new byte[ buf.readableBytes() ];
|
data = new byte[ buf.readableBytes() ];
|
||||||
buf.readBytes( data );
|
buf.readBytes( data );
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public class Team extends DefinedPacket
|
|||||||
nameTagVisibility = readString( buf );
|
nameTagVisibility = readString( buf );
|
||||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
|
||||||
{
|
{
|
||||||
collisionRule = readString(buf);
|
collisionRule = readString( buf );
|
||||||
}
|
}
|
||||||
color = buf.readByte();
|
color = buf.readByte();
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ public class Team extends DefinedPacket
|
|||||||
writeString( nameTagVisibility, buf );
|
writeString( nameTagVisibility, buf );
|
||||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
|
||||||
{
|
{
|
||||||
writeString( collisionRule, buf);
|
writeString( collisionRule, buf );
|
||||||
}
|
}
|
||||||
buf.writeByte( color );
|
buf.writeByte( color );
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public class PlayerInfoSerializer implements JsonSerializer<ServerPing.PlayerInfo>, JsonDeserializer<ServerPing.PlayerInfo>
|
public class PlayerInfoSerializer implements JsonSerializer<ServerPing.PlayerInfo>, JsonDeserializer<ServerPing.PlayerInfo>
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServerPing.PlayerInfo deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
|
public ServerPing.PlayerInfo deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
|
||||||
{
|
{
|
||||||
|
@ -41,20 +41,17 @@ public abstract class EntityMap
|
|||||||
{
|
{
|
||||||
if ( varint )
|
if ( varint )
|
||||||
{
|
{
|
||||||
clientboundVarInts[ id ] = true;
|
clientboundVarInts[id] = true;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
clientboundInts[ id ] = true;
|
clientboundInts[id] = true;
|
||||||
}
|
}
|
||||||
|
} else if ( varint )
|
||||||
|
{
|
||||||
|
serverboundVarInts[id] = true;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
if ( varint )
|
serverboundInts[id] = true;
|
||||||
{
|
|
||||||
serverboundVarInts[ id ] = true;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
serverboundInts[ id ] = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,10 +101,10 @@ public abstract class EntityMap
|
|||||||
int packetId = DefinedPacket.readVarInt( packet );
|
int packetId = DefinedPacket.readVarInt( packet );
|
||||||
int packetIdLength = packet.readerIndex() - readerIndex;
|
int packetIdLength = packet.readerIndex() - readerIndex;
|
||||||
|
|
||||||
if ( ints[ packetId ] )
|
if ( ints[packetId] )
|
||||||
{
|
{
|
||||||
rewriteInt( packet, oldId, newId, readerIndex + packetIdLength );
|
rewriteInt( packet, oldId, newId, readerIndex + packetIdLength );
|
||||||
} else if ( varints[ packetId ] )
|
} else if ( varints[packetId] )
|
||||||
{
|
{
|
||||||
rewriteVarInt( packet, oldId, newId, readerIndex + packetIdLength );
|
rewriteVarInt( packet, oldId, newId, readerIndex + packetIdLength );
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
class EntityMap_1_9 extends EntityMap
|
class EntityMap_1_9 extends EntityMap
|
||||||
{
|
{
|
||||||
|
|
||||||
static final EntityMap_1_9 INSTANCE = new EntityMap_1_9();
|
static final EntityMap_1_9 INSTANCE = new EntityMap_1_9();
|
||||||
|
|
||||||
EntityMap_1_9()
|
EntityMap_1_9()
|
||||||
|
@ -4,7 +4,6 @@ import java.util.Map;
|
|||||||
import net.md_5.bungee.ServerConnector;
|
import net.md_5.bungee.ServerConnector;
|
||||||
import net.md_5.bungee.UserConnection;
|
import net.md_5.bungee.UserConnection;
|
||||||
import net.md_5.bungee.forge.ForgeLogger.LogDirection;
|
import net.md_5.bungee.forge.ForgeLogger.LogDirection;
|
||||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
|
||||||
import net.md_5.bungee.protocol.packet.PluginMessage;
|
import net.md_5.bungee.protocol.packet.PluginMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,22 +24,22 @@ enum ForgeClientHandshakeState implements IForgeClientPacketHandler<ForgeClientH
|
|||||||
* Requires: {@link UserConnection}.
|
* Requires: {@link UserConnection}.
|
||||||
*/
|
*/
|
||||||
START
|
START
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
|
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
|
||||||
{
|
{
|
||||||
ForgeLogger.logClient( LogDirection.RECEIVED, this.name(), message );
|
ForgeLogger.logClient( LogDirection.RECEIVED, this.name(), message );
|
||||||
con.unsafe().sendPacket( message );
|
con.unsafe().sendPacket( message );
|
||||||
con.getForgeClientHandler().setState( HELLO );
|
con.getForgeClientHandler().setState( HELLO );
|
||||||
return HELLO;
|
return HELLO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
|
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
|
||||||
{
|
{
|
||||||
return HELLO;
|
return HELLO;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Waiting to receive a client HELLO and the mod list. Upon receiving the
|
* Waiting to receive a client HELLO and the mod list. Upon receiving the
|
||||||
* mod list, return the mod list of the server.
|
* mod list, return the mod list of the server.
|
||||||
@ -54,157 +53,157 @@ enum ForgeClientHandshakeState implements IForgeClientPacketHandler<ForgeClientH
|
|||||||
* {@link PluginMessage}, {@link UserConnection}, {@link ServerConnector}
|
* {@link PluginMessage}, {@link UserConnection}, {@link ServerConnector}
|
||||||
*/
|
*/
|
||||||
HELLO
|
HELLO
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
|
||||||
|
{
|
||||||
|
ForgeLogger.logClient( LogDirection.RECEIVED, this.name(), message );
|
||||||
|
// Server Hello.
|
||||||
|
if ( message.getData()[0] == 0 )
|
||||||
{
|
{
|
||||||
@Override
|
con.unsafe().sendPacket( message );
|
||||||
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
|
}
|
||||||
{
|
|
||||||
ForgeLogger.logClient( LogDirection.RECEIVED, this.name(), message );
|
|
||||||
// Server Hello.
|
|
||||||
if ( message.getData()[0] == 0 )
|
|
||||||
{
|
|
||||||
con.unsafe().sendPacket( message );
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
|
||||||
|
{
|
||||||
|
// Client Hello.
|
||||||
|
if ( message.getData()[0] == 1 )
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mod list.
|
||||||
|
if ( message.getData()[0] == 2 )
|
||||||
|
{
|
||||||
|
if ( con.getForgeClientHandler().getClientModList() == null )
|
||||||
|
{
|
||||||
|
// This is the first Forge connection - so get the mods now.
|
||||||
|
// Once we've done it, no point doing it again.
|
||||||
|
Map<String, String> clientModList = ForgeUtils.readModList( message );
|
||||||
|
con.getForgeClientHandler().setClientModList( clientModList );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
return WAITINGSERVERDATA;
|
||||||
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
|
}
|
||||||
{
|
|
||||||
// Client Hello.
|
|
||||||
if ( message.getData()[0] == 1 )
|
|
||||||
{
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mod list.
|
return this;
|
||||||
if ( message.getData()[0] == 2 )
|
}
|
||||||
{
|
|
||||||
if ( con.getForgeClientHandler().getClientModList() == null )
|
|
||||||
{
|
|
||||||
// This is the first Forge connection - so get the mods now.
|
|
||||||
// Once we've done it, no point doing it again.
|
|
||||||
Map<String, String> clientModList = ForgeUtils.readModList( message );
|
|
||||||
con.getForgeClientHandler().setClientModList( clientModList );
|
|
||||||
}
|
|
||||||
|
|
||||||
return WAITINGSERVERDATA;
|
},
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
WAITINGSERVERDATA
|
WAITINGSERVERDATA
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
|
||||||
|
{
|
||||||
|
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
|
||||||
|
// Mod list.
|
||||||
|
if ( message.getData()[0] == 2 )
|
||||||
{
|
{
|
||||||
|
con.unsafe().sendPacket( message );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
return this;
|
||||||
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
|
}
|
||||||
{
|
|
||||||
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
|
|
||||||
// Mod list.
|
|
||||||
if ( message.getData()[0] == 2 )
|
|
||||||
{
|
|
||||||
con.unsafe().sendPacket( message );
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
@Override
|
||||||
}
|
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
|
||||||
|
{
|
||||||
@Override
|
// ACK
|
||||||
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
|
return WAITINGSERVERCOMPLETE;
|
||||||
{
|
}
|
||||||
// ACK
|
},
|
||||||
return WAITINGSERVERCOMPLETE;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
WAITINGSERVERCOMPLETE
|
WAITINGSERVERCOMPLETE
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
|
||||||
|
{
|
||||||
|
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
|
||||||
|
// Mod ID's.
|
||||||
|
if ( message.getData()[0] == 3 )
|
||||||
{
|
{
|
||||||
|
con.unsafe().sendPacket( message );
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
con.unsafe().sendPacket( message ); // pass everything else
|
||||||
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
|
return this;
|
||||||
{
|
}
|
||||||
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
|
|
||||||
// Mod ID's.
|
|
||||||
if ( message.getData()[0] == 3 )
|
|
||||||
{
|
|
||||||
con.unsafe().sendPacket( message );
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
con.unsafe().sendPacket( message ); // pass everything else
|
@Override
|
||||||
return this;
|
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
|
||||||
}
|
{
|
||||||
|
// Send ACK.
|
||||||
@Override
|
return PENDINGCOMPLETE;
|
||||||
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
|
}
|
||||||
{
|
},
|
||||||
// Send ACK.
|
|
||||||
return PENDINGCOMPLETE;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
PENDINGCOMPLETE
|
PENDINGCOMPLETE
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
|
||||||
|
{
|
||||||
|
// Ack.
|
||||||
|
if ( message.getData()[0] == -1 )
|
||||||
{
|
{
|
||||||
|
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
|
||||||
|
con.unsafe().sendPacket( message );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
return this;
|
||||||
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
|
}
|
||||||
{
|
|
||||||
// Ack.
|
|
||||||
if ( message.getData()[0] == -1 )
|
|
||||||
{
|
|
||||||
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
|
|
||||||
con.unsafe().sendPacket( message );
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
@Override
|
||||||
}
|
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
|
||||||
|
{
|
||||||
@Override
|
// Send an ACK
|
||||||
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
|
return COMPLETE;
|
||||||
{
|
}
|
||||||
// Send an ACK
|
},
|
||||||
return COMPLETE;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
COMPLETE
|
COMPLETE
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
|
||||||
|
{
|
||||||
|
// Ack.
|
||||||
|
if ( message.getData()[0] == -1 )
|
||||||
{
|
{
|
||||||
|
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
|
||||||
|
con.unsafe().sendPacket( message );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
return this;
|
||||||
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
|
}
|
||||||
{
|
|
||||||
// Ack.
|
|
||||||
if ( message.getData()[0] == -1 )
|
|
||||||
{
|
|
||||||
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
|
|
||||||
con.unsafe().sendPacket( message );
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
@Override
|
||||||
}
|
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
|
||||||
|
{
|
||||||
@Override
|
return DONE;
|
||||||
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
|
}
|
||||||
{
|
},
|
||||||
return DONE;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/**
|
/**
|
||||||
* Handshake has been completed. Ignores any future handshake packets.
|
* Handshake has been completed. Ignores any future handshake packets.
|
||||||
*/
|
*/
|
||||||
DONE
|
DONE
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
|
public ForgeClientHandshakeState handle(PluginMessage message, UserConnection con)
|
||||||
{
|
{
|
||||||
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
|
ForgeLogger.logClient( ForgeLogger.LogDirection.RECEIVED, this.name(), message );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
|
public ForgeClientHandshakeState send(PluginMessage message, UserConnection con)
|
||||||
{
|
{
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,122 +17,122 @@ public enum ForgeServerHandshakeState implements IForgeServerPacketHandler<Forge
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
START
|
START
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public ForgeServerHandshakeState handle(PluginMessage message, ChannelWrapper ch)
|
public ForgeServerHandshakeState handle(PluginMessage message, ChannelWrapper ch)
|
||||||
{
|
{
|
||||||
ForgeLogger.logServer( LogDirection.RECEIVED, this.name(), message );
|
ForgeLogger.logServer( LogDirection.RECEIVED, this.name(), message );
|
||||||
ch.write( message );
|
ch.write( message );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ForgeServerHandshakeState send(PluginMessage message, UserConnection con)
|
public ForgeServerHandshakeState send(PluginMessage message, UserConnection con)
|
||||||
{
|
{
|
||||||
// Send custom channel registration. Send Hello.
|
// Send custom channel registration. Send Hello.
|
||||||
return HELLO;
|
return HELLO;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
HELLO
|
HELLO
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ForgeServerHandshakeState handle(PluginMessage message, ChannelWrapper ch)
|
||||||
|
{
|
||||||
|
ForgeLogger.logServer( LogDirection.RECEIVED, this.name(), message );
|
||||||
|
if ( message.getData()[0] == 1 ) // Client Hello
|
||||||
{
|
{
|
||||||
|
ch.write( message );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
if ( message.getData()[0] == 2 ) // Client ModList
|
||||||
public ForgeServerHandshakeState handle(PluginMessage message, ChannelWrapper ch)
|
{
|
||||||
{
|
ch.write( message );
|
||||||
ForgeLogger.logServer( LogDirection.RECEIVED, this.name(), message );
|
}
|
||||||
if ( message.getData()[0] == 1 ) // Client Hello
|
|
||||||
{
|
|
||||||
ch.write( message );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( message.getData()[0] == 2 ) // Client ModList
|
return this;
|
||||||
{
|
}
|
||||||
ch.write( message );
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
@Override
|
||||||
}
|
public ForgeServerHandshakeState send(PluginMessage message, UserConnection con)
|
||||||
|
{
|
||||||
@Override
|
// Send Server Mod List.
|
||||||
public ForgeServerHandshakeState send(PluginMessage message, UserConnection con)
|
return WAITINGCACK;
|
||||||
{
|
}
|
||||||
// Send Server Mod List.
|
},
|
||||||
return WAITINGCACK;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
WAITINGCACK
|
WAITINGCACK
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ForgeServerHandshakeState handle(PluginMessage message, ChannelWrapper ch)
|
||||||
|
{
|
||||||
|
ForgeLogger.logServer( LogDirection.RECEIVED, this.name(), message );
|
||||||
|
ch.write( message );
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ForgeServerHandshakeState send(PluginMessage message, UserConnection con)
|
||||||
|
{
|
||||||
|
if ( message.getData()[0] == 3 && message.getTag().equals( ForgeConstants.FML_HANDSHAKE_TAG ) )
|
||||||
{
|
{
|
||||||
|
con.getForgeClientHandler().setServerIdList( message );
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
if ( message.getData()[0] == -1 && message.getTag().equals( ForgeConstants.FML_HANDSHAKE_TAG ) ) // transition to COMPLETE after sending ACK
|
||||||
public ForgeServerHandshakeState handle(PluginMessage message, ChannelWrapper ch)
|
{
|
||||||
{
|
return this;
|
||||||
ForgeLogger.logServer( LogDirection.RECEIVED, this.name(), message );
|
}
|
||||||
ch.write( message );
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
if ( message.getTag().equals( ForgeConstants.FORGE_REGISTER ) ) // wait for Forge channel registration
|
||||||
public ForgeServerHandshakeState send(PluginMessage message, UserConnection con)
|
{
|
||||||
{
|
return COMPLETE;
|
||||||
if ( message.getData()[0] == 3 && message.getTag().equals( ForgeConstants.FML_HANDSHAKE_TAG ) )
|
}
|
||||||
{
|
|
||||||
con.getForgeClientHandler().setServerIdList( message );
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( message.getData()[0] == -1 && message.getTag().equals( ForgeConstants.FML_HANDSHAKE_TAG ) ) // transition to COMPLETE after sending ACK
|
return this;
|
||||||
{
|
}
|
||||||
return this;
|
},
|
||||||
}
|
|
||||||
|
|
||||||
if ( message.getTag().equals( ForgeConstants.FORGE_REGISTER ) ) // wait for Forge channel registration
|
|
||||||
{
|
|
||||||
return COMPLETE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
COMPLETE
|
COMPLETE
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ForgeServerHandshakeState handle(PluginMessage message, ChannelWrapper ch)
|
public ForgeServerHandshakeState handle(PluginMessage message, ChannelWrapper ch)
|
||||||
{
|
{
|
||||||
// Wait for ACK
|
// Wait for ACK
|
||||||
ForgeLogger.logServer( LogDirection.RECEIVED, this.name(), message );
|
ForgeLogger.logServer( LogDirection.RECEIVED, this.name(), message );
|
||||||
ch.write( message );
|
ch.write( message );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ForgeServerHandshakeState send(PluginMessage message, UserConnection con)
|
public ForgeServerHandshakeState send(PluginMessage message, UserConnection con)
|
||||||
{
|
{
|
||||||
// Send ACK
|
// Send ACK
|
||||||
return DONE;
|
return DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Handshake has been completed. Do not respond to any more handshake
|
* Handshake has been completed. Do not respond to any more handshake
|
||||||
* packets.
|
* packets.
|
||||||
*/
|
*/
|
||||||
DONE
|
DONE
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ForgeServerHandshakeState handle(PluginMessage message, ChannelWrapper ch)
|
public ForgeServerHandshakeState handle(PluginMessage message, ChannelWrapper ch)
|
||||||
{
|
{
|
||||||
// RECEIVE 2 ACKS
|
// RECEIVE 2 ACKS
|
||||||
ForgeLogger.logServer( LogDirection.RECEIVED, this.name(), message );
|
ForgeLogger.logServer( LogDirection.RECEIVED, this.name(), message );
|
||||||
ch.write( message );
|
ch.write( message );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ForgeServerHandshakeState send(PluginMessage message, UserConnection con)
|
public ForgeServerHandshakeState send(PluginMessage message, UserConnection con)
|
||||||
{
|
{
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ public class ForgeUtils
|
|||||||
{
|
{
|
||||||
if ( modList.containsKey( "FML" ) )
|
if ( modList.containsKey( "FML" ) )
|
||||||
{
|
{
|
||||||
String fmlVersion = modList.get( "FML" );
|
String fmlVersion = modList.get( "FML" );
|
||||||
|
|
||||||
// FML's version is hardcoded to this for builds beyond 1405 for 1.7.10 - if we see this, return Forge's build number.
|
// FML's version is hardcoded to this for builds beyond 1405 for 1.7.10 - if we see this, return Forge's build number.
|
||||||
if ( fmlVersion.equals( "7.10.99.99" ) )
|
if ( fmlVersion.equals( "7.10.99.99" ) )
|
||||||
@ -72,8 +72,7 @@ public class ForgeUtils
|
|||||||
// We know from the regex that we have an int.
|
// We know from the regex that we have an int.
|
||||||
return Integer.parseInt( matcher.group( 4 ) );
|
return Integer.parseInt( matcher.group( 4 ) );
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
{
|
{
|
||||||
Matcher matcher = ForgeConstants.FML_HANDSHAKE_VERSION_REGEX.matcher( fmlVersion );
|
Matcher matcher = ForgeConstants.FML_HANDSHAKE_VERSION_REGEX.matcher( fmlVersion );
|
||||||
if ( matcher.find() )
|
if ( matcher.find() )
|
||||||
|
@ -53,7 +53,7 @@ public class ColouredWriter extends Handler
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
console.print( Ansi.ansi().eraseLine(Erase.ALL).toString() + ConsoleReader.RESET_LINE + s + Ansi.ansi().reset().toString() );
|
console.print( Ansi.ansi().eraseLine( Erase.ALL ).toString() + ConsoleReader.RESET_LINE + s + Ansi.ansi().reset().toString() );
|
||||||
console.drawLine();
|
console.drawLine();
|
||||||
console.flush();
|
console.flush();
|
||||||
} catch ( IOException ex )
|
} catch ( IOException ex )
|
||||||
|
@ -75,11 +75,11 @@ public class Global extends TabList
|
|||||||
String[][] props = new String[ loginResult.getProperties().length ][];
|
String[][] props = new String[ loginResult.getProperties().length ][];
|
||||||
for ( int j = 0; j < props.length; j++ )
|
for ( int j = 0; j < props.length; j++ )
|
||||||
{
|
{
|
||||||
props[ j ] = new String[]
|
props[j] = new String[]
|
||||||
{
|
{
|
||||||
loginResult.getProperties()[ j ].getName(),
|
loginResult.getProperties()[j].getName(),
|
||||||
loginResult.getProperties()[ j ].getValue(),
|
loginResult.getProperties()[j].getValue(),
|
||||||
loginResult.getProperties()[ j ].getSignature()
|
loginResult.getProperties()[j].getSignature()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
item.setProperties( props );
|
item.setProperties( props );
|
||||||
@ -103,11 +103,11 @@ public class Global extends TabList
|
|||||||
String[][] props = new String[ loginResult.getProperties().length ][];
|
String[][] props = new String[ loginResult.getProperties().length ][];
|
||||||
for ( int j = 0; j < props.length; j++ )
|
for ( int j = 0; j < props.length; j++ )
|
||||||
{
|
{
|
||||||
props[ j ] = new String[]
|
props[j] = new String[]
|
||||||
{
|
{
|
||||||
loginResult.getProperties()[ j ].getName(),
|
loginResult.getProperties()[j].getName(),
|
||||||
loginResult.getProperties()[ j ].getValue(),
|
loginResult.getProperties()[j].getValue(),
|
||||||
loginResult.getProperties()[ j ].getSignature()
|
loginResult.getProperties()[j].getSignature()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
item.setProperties( props );
|
item.setProperties( props );
|
||||||
|
@ -41,11 +41,11 @@ public abstract class TabList
|
|||||||
String[][] props = new String[ loginResult.getProperties().length ][];
|
String[][] props = new String[ loginResult.getProperties().length ][];
|
||||||
for ( int i = 0; i < props.length; i++ )
|
for ( int i = 0; i < props.length; i++ )
|
||||||
{
|
{
|
||||||
props[ i ] = new String[]
|
props[i] = new String[]
|
||||||
{
|
{
|
||||||
loginResult.getProperties()[ i ].getName(),
|
loginResult.getProperties()[i].getName(),
|
||||||
loginResult.getProperties()[ i ].getValue(),
|
loginResult.getProperties()[i].getValue(),
|
||||||
loginResult.getProperties()[ i ].getSignature()
|
loginResult.getProperties()[i].getSignature()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
item.setProperties( props );
|
item.setProperties( props );
|
||||||
|
@ -84,8 +84,8 @@ public class ComponentsTest
|
|||||||
@Test
|
@Test
|
||||||
public void testBuilderReset()
|
public void testBuilderReset()
|
||||||
{
|
{
|
||||||
BaseComponent[] components = new ComponentBuilder( "Hello " ).color(ChatColor.RED)
|
BaseComponent[] components = new ComponentBuilder( "Hello " ).color( ChatColor.RED )
|
||||||
.append("World").reset().create();
|
.append( "World" ).reset().create();
|
||||||
|
|
||||||
Assert.assertEquals( components[0].getColor(), ChatColor.RED );
|
Assert.assertEquals( components[0].getColor(), ChatColor.RED );
|
||||||
Assert.assertEquals( components[1].getColor(), ChatColor.WHITE );
|
Assert.assertEquals( components[1].getColor(), ChatColor.WHITE );
|
||||||
@ -113,7 +113,7 @@ public class ComponentsTest
|
|||||||
ClickEvent testClickEvent = new ClickEvent( ClickEvent.Action.OPEN_URL, "http://www.example.com" );
|
ClickEvent testClickEvent = new ClickEvent( ClickEvent.Action.OPEN_URL, "http://www.example.com" );
|
||||||
|
|
||||||
BaseComponent[] eventRetention = new ComponentBuilder( "Hello " ).color( ChatColor.RED )
|
BaseComponent[] eventRetention = new ComponentBuilder( "Hello " ).color( ChatColor.RED )
|
||||||
.event( testEvent ).event(testClickEvent).append("World", ComponentBuilder.FormatRetention.EVENTS).create();
|
.event( testEvent ).event( testClickEvent ).append( "World", ComponentBuilder.FormatRetention.EVENTS ).create();
|
||||||
|
|
||||||
Assert.assertEquals( eventRetention[0].getColor(), ChatColor.RED );
|
Assert.assertEquals( eventRetention[0].getColor(), ChatColor.RED );
|
||||||
Assert.assertEquals( eventRetention[0].getHoverEvent(), testEvent );
|
Assert.assertEquals( eventRetention[0].getHoverEvent(), testEvent );
|
||||||
|
@ -5,7 +5,8 @@ import org.junit.Test;
|
|||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
public class BoundedArrayListTest {
|
public class BoundedArrayListTest
|
||||||
|
{
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGoodAdd() throws Exception
|
public void testGoodAdd() throws Exception
|
||||||
@ -63,7 +64,7 @@ public class BoundedArrayListTest {
|
|||||||
@Test(expected = IllegalStateException.class)
|
@Test(expected = IllegalStateException.class)
|
||||||
public void testBadAddAll() throws Exception
|
public void testBadAddAll() throws Exception
|
||||||
{
|
{
|
||||||
BoundedArrayList<Object> list = new BoundedArrayList<>(0);
|
BoundedArrayList<Object> list = new BoundedArrayList<>( 0 );
|
||||||
list.addAll( ImmutableList.of( new Object() ) );
|
list.addAll( ImmutableList.of( new Object() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user