1.8 isn't a snapshot anymore
This commit is contained in:
parent
62981e4c70
commit
988490ba87
@ -104,7 +104,7 @@ public enum Protocol
|
||||
public static List<Integer> supportedVersions = Arrays.asList(
|
||||
ProtocolConstants.MINECRAFT_1_7_2,
|
||||
ProtocolConstants.MINECRAFT_1_7_6,
|
||||
ProtocolConstants.MINECRAFT_SNAPSHOT
|
||||
ProtocolConstants.MINECRAFT_1_8
|
||||
);
|
||||
/*========================================================================*/
|
||||
public final DirectionData TO_SERVER = new DirectionData( ProtocolConstants.Direction.TO_SERVER );
|
||||
|
@ -5,7 +5,7 @@ public class ProtocolConstants
|
||||
|
||||
public static final int MINECRAFT_1_7_2 = 4;
|
||||
public static final int MINECRAFT_1_7_6 = 5;
|
||||
public static final int MINECRAFT_SNAPSHOT = 47;
|
||||
public static final int MINECRAFT_1_8 = 47;
|
||||
|
||||
public enum Direction
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ public class Chat extends DefinedPacket
|
||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
message = readString( buf );
|
||||
if ( direction == ProtocolConstants.Direction.TO_CLIENT && protocolVersion >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( direction == ProtocolConstants.Direction.TO_CLIENT && protocolVersion >= ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
position = buf.readByte();
|
||||
}
|
||||
@ -38,7 +38,7 @@ public class Chat extends DefinedPacket
|
||||
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
writeString( message, buf );
|
||||
if ( direction == ProtocolConstants.Direction.TO_CLIENT && protocolVersion >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( direction == ProtocolConstants.Direction.TO_CLIENT && protocolVersion >= ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
buf.writeByte( position );
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public class EncryptionRequest extends DefinedPacket
|
||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
serverId = readString( buf );
|
||||
if ( protocolVersion < ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
publicKey = readArrayLegacy( buf );
|
||||
verifyToken = readArrayLegacy( buf );
|
||||
@ -39,7 +39,7 @@ public class EncryptionRequest extends DefinedPacket
|
||||
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
writeString( serverId, buf );
|
||||
if ( protocolVersion < ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
writeArrayLegacy( publicKey, buf, false );
|
||||
writeArrayLegacy( verifyToken, buf, false );
|
||||
|
@ -22,7 +22,7 @@ public class EncryptionResponse extends DefinedPacket
|
||||
@Override
|
||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
if ( protocolVersion < ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
sharedSecret = readArrayLegacy( buf );
|
||||
verifyToken = readArrayLegacy( buf );
|
||||
@ -36,7 +36,7 @@ public class EncryptionResponse extends DefinedPacket
|
||||
@Override
|
||||
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
if ( protocolVersion < ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
writeArrayLegacy( sharedSecret, buf, false );
|
||||
writeArrayLegacy( verifyToken, buf, false );
|
||||
|
@ -21,7 +21,7 @@ public class KeepAlive extends DefinedPacket
|
||||
@Override
|
||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
randomId = readVarInt( buf );
|
||||
} else
|
||||
@ -33,7 +33,7 @@ public class KeepAlive extends DefinedPacket
|
||||
@Override
|
||||
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
writeVarInt( randomId, buf );
|
||||
} else
|
||||
|
@ -9,8 +9,6 @@ import net.md_5.bungee.protocol.AbstractPacketHandler;
|
||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||
|
||||
import java.util.UUID;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.chat.ComponentSerializer;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@ -24,7 +22,7 @@ public class PlayerListItem extends DefinedPacket
|
||||
@Override
|
||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
if ( protocolVersion < ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
items = new Item[ 1 ];
|
||||
Item item = items[ 0 ] = new Item();
|
||||
@ -88,7 +86,7 @@ public class PlayerListItem extends DefinedPacket
|
||||
@Override
|
||||
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
if ( protocolVersion < ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
Item item = items[0]; // Only one at a time
|
||||
writeString( item.displayName, buf ); // TODO: Server unique only!
|
||||
|
@ -33,7 +33,7 @@ public class PluginMessage extends DefinedPacket
|
||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
tag = readString( buf );
|
||||
if ( protocolVersion < ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
data = readArrayLegacy( buf );
|
||||
} else
|
||||
@ -47,7 +47,7 @@ public class PluginMessage extends DefinedPacket
|
||||
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
writeString( tag, buf );
|
||||
if ( protocolVersion < ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
writeArrayLegacy( data, buf, allowExtendedPacket );
|
||||
} else
|
||||
|
@ -33,7 +33,7 @@ public class ScoreboardObjective extends DefinedPacket
|
||||
value = readString( buf );
|
||||
}
|
||||
action = buf.readByte();
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_SNAPSHOT && ( action == 0 || action == 2 ) )
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_8 && ( action == 0 || action == 2 ) )
|
||||
{
|
||||
value = readString( buf );
|
||||
type = readString( buf );
|
||||
@ -49,7 +49,7 @@ public class ScoreboardObjective extends DefinedPacket
|
||||
writeString( value, buf );
|
||||
}
|
||||
buf.writeByte( action );
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_SNAPSHOT && ( action == 0 || action == 2 ) )
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_8 && ( action == 0 || action == 2 ) )
|
||||
{
|
||||
writeString( value, buf );
|
||||
writeString( type, buf );
|
||||
|
@ -29,7 +29,7 @@ public class ScoreboardScore extends DefinedPacket
|
||||
{
|
||||
itemName = readString( buf );
|
||||
action = buf.readByte();
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
scoreName = readString( buf );
|
||||
if ( action != 1 )
|
||||
@ -51,7 +51,7 @@ public class ScoreboardScore extends DefinedPacket
|
||||
{
|
||||
writeString( itemName, buf );
|
||||
buf.writeByte( action );
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
writeString( scoreName, buf );
|
||||
if ( action != 1 )
|
||||
|
@ -24,7 +24,7 @@ public class TabCompleteRequest extends DefinedPacket
|
||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
cursor = readString( buf );
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
if ( hasPositon = buf.readBoolean() )
|
||||
{
|
||||
@ -37,7 +37,7 @@ public class TabCompleteRequest extends DefinedPacket
|
||||
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||
{
|
||||
writeString( cursor, buf );
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
buf.writeBoolean( hasPositon );
|
||||
if ( hasPositon )
|
||||
|
@ -50,7 +50,7 @@ public class Team extends DefinedPacket
|
||||
prefix = readString( buf );
|
||||
suffix = readString( buf );
|
||||
friendlyFire = buf.readByte();
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
nameTagVisibility = readString( buf );
|
||||
color = buf.readByte();
|
||||
@ -58,7 +58,7 @@ public class Team extends DefinedPacket
|
||||
}
|
||||
if ( mode == 0 || mode == 3 || mode == 4 )
|
||||
{
|
||||
int len = ( protocolVersion >= ProtocolConstants.MINECRAFT_SNAPSHOT ) ? readVarInt( buf ) : buf.readShort();
|
||||
int len = ( protocolVersion >= ProtocolConstants.MINECRAFT_1_8 ) ? readVarInt( buf ) : buf.readShort();
|
||||
players = new String[ len ];
|
||||
for ( int i = 0; i < len; i++ )
|
||||
{
|
||||
@ -78,7 +78,7 @@ public class Team extends DefinedPacket
|
||||
writeString( prefix, buf );
|
||||
writeString( suffix, buf );
|
||||
buf.writeByte( friendlyFire );
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
writeString( nameTagVisibility, buf );
|
||||
buf.writeByte( color );
|
||||
@ -86,7 +86,7 @@ public class Team extends DefinedPacket
|
||||
}
|
||||
if ( mode == 0 || mode == 3 || mode == 4 )
|
||||
{
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
writeVarInt( players.length, buf );
|
||||
} else
|
||||
|
@ -152,7 +152,7 @@ public class BungeeTitle implements Title
|
||||
@Override
|
||||
public Title send(ProxiedPlayer player)
|
||||
{
|
||||
if ( player.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( player.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
// Send the packets in the correct order
|
||||
sendPacket( player, clear );
|
||||
|
@ -193,7 +193,7 @@ public class ServerConnector extends PacketHandler
|
||||
|
||||
user.unsafe().sendPacket( modLogin );
|
||||
|
||||
if ( user.getPendingConnection().getVersion() < ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( user.getPendingConnection().getVersion() < ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
MinecraftOutput out = new MinecraftOutput();
|
||||
out.writeStringUTF8WithoutLengthHeaderBecauseDinnerboneStuffedUpTheMCBrandPacket( ProxyServer.getInstance().getName() + " (" + ProxyServer.getInstance().getVersion() + ")" );
|
||||
|
@ -393,7 +393,7 @@ public final class UserConnection implements ProxiedPlayer
|
||||
public void sendMessage(ChatMessageType position, BaseComponent... message)
|
||||
{
|
||||
// Action bar doesn't display the new JSON formattings, legacy works - send it using this for now
|
||||
if ( position == ChatMessageType.ACTION_BAR && pendingConnection.getVersion() >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( position == ChatMessageType.ACTION_BAR && pendingConnection.getVersion() >= ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
sendMessage( position, ComponentSerializer.toString( new TextComponent( TextComponent.toLegacyText( message ) ) ) );
|
||||
} else
|
||||
@ -406,7 +406,7 @@ public final class UserConnection implements ProxiedPlayer
|
||||
public void sendMessage(ChatMessageType position, BaseComponent message)
|
||||
{
|
||||
// Action bar doesn't display the new JSON formattings, legacy works - send it using this for now
|
||||
if ( position == ChatMessageType.ACTION_BAR && pendingConnection.getVersion() >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( position == ChatMessageType.ACTION_BAR && pendingConnection.getVersion() >= ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
sendMessage( position, ComponentSerializer.toString( new TextComponent( TextComponent.toLegacyText( message ) ) ) );
|
||||
} else
|
||||
@ -543,7 +543,7 @@ public final class UserConnection implements ProxiedPlayer
|
||||
@Override
|
||||
public void setTabHeader(BaseComponent header, BaseComponent footer)
|
||||
{
|
||||
if ( pendingConnection.getVersion() >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( pendingConnection.getVersion() >= ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
unsafe().sendPacket( new PlayerListHeaderFooter(
|
||||
( header != null ) ? ComponentSerializer.toString( header ) : EMPTY_TEXT,
|
||||
@ -555,7 +555,7 @@ public final class UserConnection implements ProxiedPlayer
|
||||
@Override
|
||||
public void setTabHeader(BaseComponent[] header, BaseComponent[] footer)
|
||||
{
|
||||
if ( pendingConnection.getVersion() >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( pendingConnection.getVersion() >= ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
unsafe().sendPacket( new PlayerListHeaderFooter(
|
||||
( header != null ) ? ComponentSerializer.toString( header ) : EMPTY_TEXT,
|
||||
|
@ -226,7 +226,7 @@ public class DownstreamBridge extends PacketHandler
|
||||
|
||||
if ( pluginMessage.getTag().equals( "MC|Brand" ) )
|
||||
{
|
||||
if ( con.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( con.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -30,8 +30,8 @@ public abstract class EntityMap
|
||||
return new EntityMap_1_7_2();
|
||||
case ProtocolConstants.MINECRAFT_1_7_6:
|
||||
return new EntityMap_1_7_6();
|
||||
case ProtocolConstants.MINECRAFT_SNAPSHOT:
|
||||
return new EntityMap_14_21_b();
|
||||
case ProtocolConstants.MINECRAFT_1_8:
|
||||
return new EntityMap_1_8();
|
||||
}
|
||||
throw new RuntimeException( "Version " + version + " has no entity map" );
|
||||
}
|
||||
|
@ -9,10 +9,10 @@ import net.md_5.bungee.protocol.DefinedPacket;
|
||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||
import java.util.UUID;
|
||||
|
||||
class EntityMap_14_21_b extends EntityMap
|
||||
class EntityMap_1_8 extends EntityMap
|
||||
{
|
||||
|
||||
EntityMap_14_21_b()
|
||||
EntityMap_1_8()
|
||||
{
|
||||
addRewrite( 0x04, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Equipment
|
||||
addRewrite( 0x0A, ProtocolConstants.Direction.TO_CLIENT, true ); // Use bed
|
@ -90,7 +90,7 @@ public class Global extends TabList
|
||||
item.setGamemode( ( (UserConnection) p ).getGamemode() );
|
||||
item.setPing( p.getPing() );
|
||||
}
|
||||
if ( player.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( player.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
player.unsafe().sendPacket( playerListItem );
|
||||
} else
|
||||
|
@ -72,7 +72,7 @@ public class ServerUnique extends TabList
|
||||
item.setDisplayName( username );
|
||||
}
|
||||
packet.setItems( items );
|
||||
if ( player.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
||||
if ( player.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_8 )
|
||||
{
|
||||
player.unsafe().sendPacket( packet );
|
||||
} else
|
||||
|
Loading…
Reference in New Issue
Block a user