diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java index eaf2d3c6..128d3934 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java @@ -104,7 +104,7 @@ public enum Protocol public static List 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 ); diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/ProtocolConstants.java b/protocol/src/main/java/net/md_5/bungee/protocol/ProtocolConstants.java index 7cd6a7cd..59140383 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/ProtocolConstants.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/ProtocolConstants.java @@ -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 { diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Chat.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Chat.java index 504b563d..6144bd61 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Chat.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Chat.java @@ -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 ); } diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/EncryptionRequest.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/EncryptionRequest.java index bc1a649b..3d1a3f79 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/EncryptionRequest.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/EncryptionRequest.java @@ -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 ); diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/EncryptionResponse.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/EncryptionResponse.java index 2bda5116..52a4eec8 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/EncryptionResponse.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/EncryptionResponse.java @@ -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 ); diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/KeepAlive.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/KeepAlive.java index a15591db..e6b9e935 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/KeepAlive.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/KeepAlive.java @@ -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 diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/PlayerListItem.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/PlayerListItem.java index 71ca74bc..25c9bc61 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/PlayerListItem.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/PlayerListItem.java @@ -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! diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/PluginMessage.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/PluginMessage.java index e855b00c..c3c7cdbe 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/PluginMessage.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/PluginMessage.java @@ -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 diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/ScoreboardObjective.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ScoreboardObjective.java index f9fd5ddf..a650b482 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/ScoreboardObjective.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ScoreboardObjective.java @@ -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 ); diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/ScoreboardScore.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ScoreboardScore.java index 4d5cd5da..e8157005 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/ScoreboardScore.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ScoreboardScore.java @@ -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 ) diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/TabCompleteRequest.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/TabCompleteRequest.java index c685083a..9bd2d5d0 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/TabCompleteRequest.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/TabCompleteRequest.java @@ -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 ) diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Team.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Team.java index fab4a903..33740dd0 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/Team.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Team.java @@ -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 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 c22409b8..a4c2c746 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeTitle.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeTitle.java @@ -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 ); 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 b6e7dd28..5282033a 100644 --- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java +++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java @@ -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() + ")" ); 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 5e9075bf..fb437c57 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -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, diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java index afbc88c4..a553db3a 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java @@ -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 { diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java index 49fbd223..56067db8 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap.java @@ -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" ); } diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_14_21_b.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_8.java similarity index 99% rename from proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_14_21_b.java rename to proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_8.java index 29aa0974..d5df24cd 100644 --- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_14_21_b.java +++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_8.java @@ -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 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 ae652b4b..7ac15f92 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 @@ -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 diff --git a/proxy/src/main/java/net/md_5/bungee/tab/ServerUnique.java b/proxy/src/main/java/net/md_5/bungee/tab/ServerUnique.java index 60e59143..c6629a9d 100644 --- a/proxy/src/main/java/net/md_5/bungee/tab/ServerUnique.java +++ b/proxy/src/main/java/net/md_5/bungee/tab/ServerUnique.java @@ -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