Code format :(
This commit is contained in:
@@ -10,11 +10,11 @@ import net.md_5.bungee.protocol.PacketWrapper;
|
||||
public class EntityMap
|
||||
{
|
||||
|
||||
private final static boolean[] clientboundInts = new boolean[256];
|
||||
private final static boolean[] clientboundVarInts = new boolean[256];
|
||||
private final static boolean[] clientboundInts = new boolean[ 256 ];
|
||||
private final static boolean[] clientboundVarInts = new boolean[ 256 ];
|
||||
|
||||
private final static boolean[] serverboundInts = new boolean[256];
|
||||
private final static boolean[] serverboundVarInts = new boolean[256];
|
||||
private final static boolean[] serverboundInts = new boolean[ 256 ];
|
||||
private final static boolean[] serverboundVarInts = new boolean[ 256 ];
|
||||
|
||||
static
|
||||
{
|
||||
@@ -50,12 +50,12 @@ public class EntityMap
|
||||
|
||||
public static void rewriteServerbound(ByteBuf packet, int serverEntityId, int clientEntityId)
|
||||
{
|
||||
rewrite(packet, serverEntityId, clientEntityId, serverboundInts, serverboundVarInts);
|
||||
rewrite( packet, serverEntityId, clientEntityId, serverboundInts, serverboundVarInts );
|
||||
}
|
||||
|
||||
public static void rewriteClientbound(ByteBuf packet, int serverEntityId, int clientEntityId)
|
||||
{
|
||||
rewrite(packet, serverEntityId, clientEntityId, clientboundInts, clientboundVarInts);
|
||||
rewrite( packet, serverEntityId, clientEntityId, clientboundInts, clientboundVarInts );
|
||||
|
||||
//Special cases
|
||||
int readerIndex = packet.readerIndex();
|
||||
@@ -76,7 +76,7 @@ public class EntityMap
|
||||
int count = packet.getByte( packetIdLength );
|
||||
for ( int i = 0; i < count; i++ )
|
||||
{
|
||||
int readId = packet.getInt( packetIdLength + 1 + i * 4);
|
||||
int readId = packet.getInt( packetIdLength + 1 + i * 4 );
|
||||
if ( readId == serverEntityId )
|
||||
{
|
||||
packet.setInt( packetIdLength + 1 + i * 4, clientEntityId );
|
||||
|
@@ -68,7 +68,10 @@ public class ServerConnection implements Server
|
||||
@Override
|
||||
public void disconnect(BaseComponent reason)
|
||||
{
|
||||
disconnect( new BaseComponent[]{reason} );
|
||||
disconnect( new BaseComponent[]
|
||||
{
|
||||
reason
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -56,10 +56,15 @@ public class BaseComponentSerializer
|
||||
{
|
||||
JsonObject event = object.getAsJsonObject( "hoverEvent" );
|
||||
BaseComponent[] res;
|
||||
if (event.get("value").isJsonArray()) {
|
||||
if ( event.get( "value" ).isJsonArray() )
|
||||
{
|
||||
res = context.deserialize( event.get( "value" ), BaseComponent[].class );
|
||||
} else {
|
||||
res = new BaseComponent[]{context.<BaseComponent>deserialize( event.get( "value" ), BaseComponent.class )};
|
||||
} else
|
||||
{
|
||||
res = new BaseComponent[]
|
||||
{
|
||||
context.<BaseComponent>deserialize( event.get( "value" ), BaseComponent.class )
|
||||
};
|
||||
}
|
||||
component.setHoverEvent( new HoverEvent( HoverEvent.Action.valueOf( event.get( "action" ).getAsString().toUpperCase() ), res ) );
|
||||
}
|
||||
|
@@ -30,7 +30,10 @@ public class ComponentSerializer implements JsonSerializer<BaseComponent>, JsonD
|
||||
{ //Array
|
||||
return gson.fromJson( json, BaseComponent[].class );
|
||||
}
|
||||
return new BaseComponent[]{gson.fromJson( json, BaseComponent.class )};
|
||||
return new BaseComponent[]
|
||||
{
|
||||
gson.fromJson( json, BaseComponent.class )
|
||||
};
|
||||
}
|
||||
|
||||
public static String toString(BaseComponent component)
|
||||
|
@@ -14,6 +14,7 @@ import java.lang.reflect.Type;
|
||||
|
||||
public class TextComponentSerializer extends BaseComponentSerializer implements JsonSerializer<TextComponent>, JsonDeserializer<TextComponent>
|
||||
{
|
||||
|
||||
@Override
|
||||
public TextComponent deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
|
||||
{
|
||||
|
@@ -15,6 +15,7 @@ import java.util.Arrays;
|
||||
|
||||
public class TranslatableComponentSerializer extends BaseComponentSerializer implements JsonSerializer<TranslatableComponent>, JsonDeserializer<TranslatableComponent>
|
||||
{
|
||||
|
||||
@Override
|
||||
public TranslatableComponent deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
|
||||
{
|
||||
|
@@ -42,10 +42,10 @@ public class CommandAlertRaw extends Command
|
||||
{
|
||||
sender.sendMessage(
|
||||
new ComponentBuilder( "An error occurred while parsing your message. (Hover for details)" ).
|
||||
color( ChatColor.RED ).underlined( true ).
|
||||
event( new HoverEvent( HoverEvent.Action.SHOW_TEXT,
|
||||
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() );
|
||||
|
@@ -325,7 +325,7 @@ public class DownstreamBridge extends PacketHandler
|
||||
out.writeUTF( "UUID" );
|
||||
out.writeUTF( con.getUUID() );
|
||||
}
|
||||
if ( subChannel.equals("UUIDOther") )
|
||||
if ( subChannel.equals( "UUIDOther" ) )
|
||||
{
|
||||
ProxiedPlayer player = bungee.getPlayer( in.readUTF() );
|
||||
if ( player != null )
|
||||
@@ -356,7 +356,7 @@ public class DownstreamBridge extends PacketHandler
|
||||
{
|
||||
def = null;
|
||||
}
|
||||
ServerKickEvent event = bungee.getPluginManager().callEvent( new ServerKickEvent( con, ComponentSerializer.parse(kick.getMessage()), def, ServerKickEvent.State.CONNECTED ) );
|
||||
ServerKickEvent event = bungee.getPluginManager().callEvent( new ServerKickEvent( con, ComponentSerializer.parse( kick.getMessage() ), def, ServerKickEvent.State.CONNECTED ) );
|
||||
if ( event.isCancelled() && event.getCancelServer() != null )
|
||||
{
|
||||
con.connectNow( event.getCancelServer() );
|
||||
|
Reference in New Issue
Block a user