Update to Minecraft 1.9
This commit is contained in:
parent
12a7b7afc3
commit
05de455a9c
@ -6,13 +6,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-api</artifactId>
|
<artifactId>bungeecord-api</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-API</name>
|
<name>BungeeCord-API</name>
|
||||||
|
@ -18,6 +18,7 @@ public class Team
|
|||||||
private String suffix;
|
private String suffix;
|
||||||
private byte friendlyFire;
|
private byte friendlyFire;
|
||||||
private String nameTagVisibility;
|
private String nameTagVisibility;
|
||||||
|
private String collisionRule;
|
||||||
private byte color;
|
private byte color;
|
||||||
private Set<String> players = new HashSet<>();
|
private Set<String> players = new HashSet<>();
|
||||||
|
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-bootstrap</artifactId>
|
<artifactId>bungeecord-bootstrap</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-Bootstrap</name>
|
<name>BungeeCord-Bootstrap</name>
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-chat</artifactId>
|
<artifactId>bungeecord-chat</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-Chat</name>
|
<name>BungeeCord-Chat</name>
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-config</artifactId>
|
<artifactId>bungeecord-config</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-Config</name>
|
<name>BungeeCord-Config</name>
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-event</artifactId>
|
<artifactId>bungeecord-event</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-Event</name>
|
<name>BungeeCord-Event</name>
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-module</artifactId>
|
<artifactId>bungeecord-module</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-module-cmd-alert</artifactId>
|
<artifactId>bungeecord-module-cmd-alert</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>cmd_alert</name>
|
<name>cmd_alert</name>
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-module</artifactId>
|
<artifactId>bungeecord-module</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-module-cmd-find</artifactId>
|
<artifactId>bungeecord-module-cmd-find</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>cmd_find</name>
|
<name>cmd_find</name>
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-module</artifactId>
|
<artifactId>bungeecord-module</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-module-cmd-list</artifactId>
|
<artifactId>bungeecord-module-cmd-list</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>cmd_list</name>
|
<name>cmd_list</name>
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-module</artifactId>
|
<artifactId>bungeecord-module</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-module-cmd-send</artifactId>
|
<artifactId>bungeecord-module-cmd-send</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>cmd_send</name>
|
<name>cmd_send</name>
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-module</artifactId>
|
<artifactId>bungeecord-module</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-module-cmd-server</artifactId>
|
<artifactId>bungeecord-module-cmd-server</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>cmd_server</name>
|
<name>cmd_server</name>
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-module</artifactId>
|
<artifactId>bungeecord-module</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<name>BungeeCord Modules</name>
|
<name>BungeeCord Modules</name>
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-module</artifactId>
|
<artifactId>bungeecord-module</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-module-reconnect-yaml</artifactId>
|
<artifactId>bungeecord-module-reconnect-yaml</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>reconnect_yaml</name>
|
<name>reconnect_yaml</name>
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-native</artifactId>
|
<artifactId>bungeecord-native</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-Native</name>
|
<name>BungeeCord-Native</name>
|
||||||
|
2
pom.xml
2
pom.xml
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-Parent</name>
|
<name>BungeeCord-Parent</name>
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-protocol</artifactId>
|
<artifactId>bungeecord-protocol</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-Protocol</name>
|
<name>BungeeCord-Protocol</name>
|
||||||
|
@ -54,27 +54,26 @@ public enum Protocol
|
|||||||
{
|
{
|
||||||
|
|
||||||
{
|
{
|
||||||
TO_CLIENT.registerPacket( 0x00, KeepAlive.class );
|
TO_CLIENT.registerPacket( 0x00, 0x1F, KeepAlive.class );
|
||||||
TO_CLIENT.registerPacket( 0x01, Login.class );
|
TO_CLIENT.registerPacket( 0x01, 0x23, Login.class );
|
||||||
TO_CLIENT.registerPacket( 0x02, Chat.class );
|
TO_CLIENT.registerPacket( 0x02, 0x0F, Chat.class );
|
||||||
TO_CLIENT.registerPacket( 0x07, Respawn.class );
|
TO_CLIENT.registerPacket( 0x07, 0x33, Respawn.class );
|
||||||
TO_CLIENT.registerPacket( 0x38, PlayerListItem.class );
|
TO_CLIENT.registerPacket( 0x38, 0x2D, PlayerListItem.class ); // PlayerInfo
|
||||||
TO_CLIENT.registerPacket( 0x3A, TabCompleteResponse.class );
|
TO_CLIENT.registerPacket( 0x3A, 0x0E, TabCompleteResponse.class );
|
||||||
TO_CLIENT.registerPacket( 0x3B, ScoreboardObjective.class );
|
TO_CLIENT.registerPacket( 0x3B, 0x3F, ScoreboardObjective.class );
|
||||||
TO_CLIENT.registerPacket( 0x3C, ScoreboardScore.class );
|
TO_CLIENT.registerPacket( 0x3C, 0x42, ScoreboardScore.class );
|
||||||
TO_CLIENT.registerPacket( 0x3D, ScoreboardDisplay.class );
|
TO_CLIENT.registerPacket( 0x3D, 0x38, ScoreboardDisplay.class );
|
||||||
TO_CLIENT.registerPacket( 0x3E, Team.class );
|
TO_CLIENT.registerPacket( 0x3E, 0x41, Team.class );
|
||||||
TO_CLIENT.registerPacket( 0x3F, PluginMessage.class );
|
TO_CLIENT.registerPacket( 0x3F, 0x18, PluginMessage.class );
|
||||||
TO_CLIENT.registerPacket( 0x40, Kick.class );
|
TO_CLIENT.registerPacket( 0x40, 0x1A, Kick.class );
|
||||||
TO_CLIENT.registerPacket( 0x45, Title.class );
|
TO_CLIENT.registerPacket( 0x45, 0x45, Title.class );
|
||||||
TO_CLIENT.registerPacket( 0x46, SetCompression.class );
|
TO_CLIENT.registerPacket( 0x47, 0x48, PlayerListHeaderFooter.class );
|
||||||
TO_CLIENT.registerPacket( 0x47, PlayerListHeaderFooter.class );
|
|
||||||
|
|
||||||
TO_SERVER.registerPacket( 0x00, KeepAlive.class );
|
TO_SERVER.registerPacket( 0x00, 0x0B, KeepAlive.class );
|
||||||
TO_SERVER.registerPacket( 0x01, Chat.class );
|
TO_SERVER.registerPacket( 0x01, 0x02, Chat.class );
|
||||||
TO_SERVER.registerPacket( 0x14, 0x15, TabCompleteRequest.class );
|
TO_SERVER.registerPacket( 0x14, 0x01, TabCompleteRequest.class );
|
||||||
TO_SERVER.registerPacket( 0x15, 0x16, ClientSettings.class );
|
TO_SERVER.registerPacket( 0x15, 0x04, ClientSettings.class );
|
||||||
TO_SERVER.registerPacket( 0x17, 0x18, PluginMessage.class );
|
TO_SERVER.registerPacket( 0x17, 0x09, PluginMessage.class );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 1
|
// 1
|
||||||
@ -107,7 +106,7 @@ public enum Protocol
|
|||||||
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(
|
||||||
ProtocolConstants.MINECRAFT_1_8,
|
ProtocolConstants.MINECRAFT_1_8,
|
||||||
ProtocolConstants.MINECRAFT_SNAPSHOT
|
ProtocolConstants.MINECRAFT_1_9
|
||||||
);
|
);
|
||||||
/*========================================================================*/
|
/*========================================================================*/
|
||||||
public final DirectionData TO_SERVER = new DirectionData( ProtocolConstants.Direction.TO_SERVER );
|
public final DirectionData TO_SERVER = new DirectionData( ProtocolConstants.Direction.TO_SERVER );
|
||||||
@ -126,11 +125,12 @@ 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() );
|
||||||
packetRemap.put( ProtocolConstants.MINECRAFT_SNAPSHOT, new TIntIntHashMap() );
|
packetRemap.put(ProtocolConstants.MINECRAFT_1_9, new TIntIntHashMap() );
|
||||||
packetRemapInv.put( ProtocolConstants.MINECRAFT_SNAPSHOT, new TIntIntHashMap() );
|
packetRemapInv.put(ProtocolConstants.MINECRAFT_1_9, new TIntIntHashMap() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public final DefinedPacket createPacket(int id, int protocol)
|
public final DefinedPacket createPacket(int id, int protocol)
|
||||||
@ -140,7 +140,7 @@ public enum Protocol
|
|||||||
{
|
{
|
||||||
if ( !remap.containsKey( id ) )
|
if ( !remap.containsKey( id ) )
|
||||||
{
|
{
|
||||||
throw new BadPacketException( "No packet with id " + id );
|
return null;
|
||||||
}
|
}
|
||||||
id = remap.get( id );
|
id = remap.get( id );
|
||||||
}
|
}
|
||||||
@ -178,8 +178,8 @@ public enum Protocol
|
|||||||
|
|
||||||
packetRemap.get( ProtocolConstants.MINECRAFT_1_8 ).put( id, id );
|
packetRemap.get( ProtocolConstants.MINECRAFT_1_8 ).put( id, id );
|
||||||
packetRemapInv.get( ProtocolConstants.MINECRAFT_1_8 ).put( id, id );
|
packetRemapInv.get( ProtocolConstants.MINECRAFT_1_8 ).put( id, id );
|
||||||
packetRemap.get( ProtocolConstants.MINECRAFT_SNAPSHOT ).put( newId, id );
|
packetRemap.get( ProtocolConstants.MINECRAFT_1_9 ).put( newId, id );
|
||||||
packetRemapInv.get( ProtocolConstants.MINECRAFT_SNAPSHOT ).put( id, newId );
|
packetRemapInv.get( ProtocolConstants.MINECRAFT_1_9 ).put( id, newId );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void unregisterPacket(int id)
|
protected final void unregisterPacket(int id)
|
||||||
|
@ -6,10 +6,10 @@ import java.util.List;
|
|||||||
public class ProtocolConstants
|
public class ProtocolConstants
|
||||||
{
|
{
|
||||||
public static final int MINECRAFT_1_8 = 47;
|
public static final int MINECRAFT_1_8 = 47;
|
||||||
public static final int MINECRAFT_SNAPSHOT = 57;
|
public static final int MINECRAFT_1_9 = 107;
|
||||||
public static final List<String> SUPPORTED_VERSIONS = Arrays.asList(
|
public static final List<String> SUPPORTED_VERSIONS = Arrays.asList(
|
||||||
"1.8.X",
|
"1.8.x",
|
||||||
"15w33c"
|
"1.9"
|
||||||
);
|
);
|
||||||
|
|
||||||
public enum Direction
|
public enum Direction
|
||||||
|
@ -51,7 +51,7 @@ public class Varint21FrameDecoder extends ByteToMessageDecoder
|
|||||||
if ( !DIRECT_WARNING )
|
if ( !DIRECT_WARNING )
|
||||||
{
|
{
|
||||||
DIRECT_WARNING = true;
|
DIRECT_WARNING = true;
|
||||||
System.err.println( "Netty is not using direct IO buffers." );
|
System.out.println( "Netty is not using direct IO buffers." );
|
||||||
}
|
}
|
||||||
|
|
||||||
// See https://github.com/SpigotMC/BungeeCord/issues/1717
|
// See https://github.com/SpigotMC/BungeeCord/issues/1717
|
||||||
|
@ -29,10 +29,10 @@ public class ClientSettings extends DefinedPacket
|
|||||||
{
|
{
|
||||||
locale = readString( buf );
|
locale = readString( buf );
|
||||||
viewDistance = buf.readByte();
|
viewDistance = buf.readByte();
|
||||||
chatFlags = protocolVersion >= ProtocolConstants.MINECRAFT_SNAPSHOT ? DefinedPacket.readVarInt( buf ) : buf.readUnsignedByte();
|
chatFlags = protocolVersion >= ProtocolConstants.MINECRAFT_1_9 ? DefinedPacket.readVarInt( buf ) : buf.readUnsignedByte();
|
||||||
chatColours = buf.readBoolean();
|
chatColours = buf.readBoolean();
|
||||||
skinParts = buf.readByte();
|
skinParts = buf.readByte();
|
||||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
|
||||||
{
|
{
|
||||||
mainHand = DefinedPacket.readVarInt( buf );
|
mainHand = DefinedPacket.readVarInt( buf );
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ public class ClientSettings extends DefinedPacket
|
|||||||
{
|
{
|
||||||
writeString( locale, buf );
|
writeString( locale, buf );
|
||||||
buf.writeByte( viewDistance );
|
buf.writeByte( viewDistance );
|
||||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
|
||||||
{
|
{
|
||||||
DefinedPacket.writeVarInt( chatFlags, buf );
|
DefinedPacket.writeVarInt( chatFlags, buf );
|
||||||
} else
|
} else
|
||||||
@ -52,7 +52,7 @@ public class ClientSettings extends DefinedPacket
|
|||||||
}
|
}
|
||||||
buf.writeBoolean( chatColours );
|
buf.writeBoolean( chatColours );
|
||||||
buf.writeByte( skinParts );
|
buf.writeByte( skinParts );
|
||||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_SNAPSHOT )
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
|
||||||
{
|
{
|
||||||
DefinedPacket.writeVarInt(mainHand, buf);
|
DefinedPacket.writeVarInt(mainHand, buf);
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ public class TabCompleteRequest extends DefinedPacket
|
|||||||
{
|
{
|
||||||
|
|
||||||
private String cursor;
|
private String cursor;
|
||||||
|
private boolean assumeCommand;
|
||||||
private boolean hasPositon;
|
private boolean hasPositon;
|
||||||
private long position;
|
private long position;
|
||||||
|
|
||||||
@ -24,6 +25,11 @@ public class TabCompleteRequest extends DefinedPacket
|
|||||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
{
|
{
|
||||||
cursor = readString( buf );
|
cursor = readString( buf );
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
|
||||||
|
{
|
||||||
|
assumeCommand = buf.readBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
if ( hasPositon = buf.readBoolean() )
|
if ( hasPositon = buf.readBoolean() )
|
||||||
{
|
{
|
||||||
position = buf.readLong();
|
position = buf.readLong();
|
||||||
@ -34,6 +40,11 @@ public class TabCompleteRequest extends DefinedPacket
|
|||||||
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
{
|
{
|
||||||
writeString( cursor, buf );
|
writeString( cursor, buf );
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
|
||||||
|
{
|
||||||
|
buf.writeBoolean( assumeCommand );
|
||||||
|
}
|
||||||
|
|
||||||
buf.writeBoolean( hasPositon );
|
buf.writeBoolean( hasPositon );
|
||||||
if ( hasPositon )
|
if ( hasPositon )
|
||||||
{
|
{
|
||||||
|
@ -25,6 +25,7 @@ public class Team extends DefinedPacket
|
|||||||
private String prefix;
|
private String prefix;
|
||||||
private String suffix;
|
private String suffix;
|
||||||
private String nameTagVisibility;
|
private String nameTagVisibility;
|
||||||
|
private String collisionRule;
|
||||||
private byte color;
|
private byte color;
|
||||||
private byte friendlyFire;
|
private byte friendlyFire;
|
||||||
private String[] players;
|
private String[] players;
|
||||||
@ -34,7 +35,6 @@ public class Team extends DefinedPacket
|
|||||||
*/
|
*/
|
||||||
public Team(String name)
|
public Team(String name)
|
||||||
{
|
{
|
||||||
this();
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.mode = 1;
|
this.mode = 1;
|
||||||
}
|
}
|
||||||
@ -51,6 +51,10 @@ public class Team extends DefinedPacket
|
|||||||
suffix = readString( buf );
|
suffix = readString( buf );
|
||||||
friendlyFire = buf.readByte();
|
friendlyFire = buf.readByte();
|
||||||
nameTagVisibility = readString( buf );
|
nameTagVisibility = readString( buf );
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
|
||||||
|
{
|
||||||
|
collisionRule = readString(buf);
|
||||||
|
}
|
||||||
color = buf.readByte();
|
color = buf.readByte();
|
||||||
}
|
}
|
||||||
if ( mode == 0 || mode == 3 || mode == 4 )
|
if ( mode == 0 || mode == 3 || mode == 4 )
|
||||||
@ -76,6 +80,10 @@ public class Team extends DefinedPacket
|
|||||||
writeString( suffix, buf );
|
writeString( suffix, buf );
|
||||||
buf.writeByte( friendlyFire );
|
buf.writeByte( friendlyFire );
|
||||||
writeString( nameTagVisibility, buf );
|
writeString( nameTagVisibility, buf );
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
|
||||||
|
{
|
||||||
|
writeString( collisionRule, buf);
|
||||||
|
}
|
||||||
buf.writeByte( color );
|
buf.writeByte( color );
|
||||||
}
|
}
|
||||||
if ( mode == 0 || mode == 3 || mode == 4 )
|
if ( mode == 0 || mode == 3 || mode == 4 )
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-proxy</artifactId>
|
<artifactId>bungeecord-proxy</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-Proxy</name>
|
<name>BungeeCord-Proxy</name>
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
package net.md_5.bungee;
|
package net.md_5.bungee;
|
||||||
|
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.io.StringWriter;
|
||||||
import java.security.AccessControlException;
|
import java.security.AccessControlException;
|
||||||
import java.security.Permission;
|
import java.security.Permission;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
import net.md_5.bungee.api.scheduler.GroupedThreadFactory;
|
import net.md_5.bungee.api.scheduler.GroupedThreadFactory;
|
||||||
@ -10,6 +14,7 @@ public class BungeeSecurityManager extends SecurityManager
|
|||||||
{
|
{
|
||||||
|
|
||||||
private static final boolean ENFORCE = false;
|
private static final boolean ENFORCE = false;
|
||||||
|
private final Set<String> seen = new HashSet<>();
|
||||||
|
|
||||||
private void checkRestricted(String text)
|
private void checkRestricted(String text)
|
||||||
{
|
{
|
||||||
@ -18,33 +23,25 @@ public class BungeeSecurityManager extends SecurityManager
|
|||||||
{
|
{
|
||||||
ClassLoader loader = context[i].getClassLoader();
|
ClassLoader loader = context[i].getClassLoader();
|
||||||
|
|
||||||
// Bungee can do everything
|
// Bungee / system can do everything
|
||||||
if ( loader == ClassLoader.getSystemClassLoader() )
|
if ( loader == ClassLoader.getSystemClassLoader() || loader == null )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow external packages from the system class loader to create threads.
|
|
||||||
if ( loader == null )
|
|
||||||
{
|
|
||||||
if ( !context[i].getName().startsWith( "java" ) )
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Everyone but system can't do anything
|
|
||||||
if ( loader != null )
|
|
||||||
{
|
|
||||||
AccessControlException ex = new AccessControlException( "Plugin violation: " + text );
|
AccessControlException ex = new AccessControlException( "Plugin violation: " + text );
|
||||||
if ( ENFORCE )
|
if ( ENFORCE )
|
||||||
{
|
{
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StringWriter stack = new StringWriter();
|
||||||
|
ex.printStackTrace( new PrintWriter( stack ) );
|
||||||
|
if ( seen.add( stack.toString() ) )
|
||||||
|
{
|
||||||
ProxyServer.getInstance().getLogger().log( Level.WARNING, "Plugin performed restricted action, please inform them to use proper API methods: " + text, ex );
|
ProxyServer.getInstance().getLogger().log( Level.WARNING, "Plugin performed restricted action, please inform them to use proper API methods: " + text, ex );
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,6 @@ public class ServerConnector extends PacketHandler
|
|||||||
@Override
|
@Override
|
||||||
public void handle(SetCompression setCompression) throws Exception
|
public void handle(SetCompression setCompression) throws Exception
|
||||||
{
|
{
|
||||||
user.setCompressionThreshold( setCompression.getThreshold() );
|
|
||||||
ch.setCompressionThreshold( setCompression.getThreshold() );
|
ch.setCompressionThreshold( setCompression.getThreshold() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,12 +277,13 @@ public final class UserConnection implements ProxiedPlayer
|
|||||||
lastServerJoined++;
|
lastServerJoined++;
|
||||||
String serverName = "";
|
String serverName = "";
|
||||||
List<String> servers = getPendingConnection().getListener().getServerPriority();
|
List<String> servers = getPendingConnection().getListener().getServerPriority();
|
||||||
if ( lastServerJoined < servers.size() ) {
|
if ( lastServerJoined < servers.size() )
|
||||||
|
{
|
||||||
serverName = servers.get( lastServerJoined );
|
serverName = servers.get( lastServerJoined );
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerInfo def = ProxyServer.getInstance().getServers().get( serverName );
|
ServerInfo def = ProxyServer.getInstance().getServers().get( serverName );
|
||||||
if ( retry && target != def && ( getServer() == null || def != getServer().getInfo() ) )
|
if ( retry && def != null && target != def && ( getServer() == null || def != getServer().getInfo() ) )
|
||||||
{
|
{
|
||||||
sendMessage( bungee.getTranslation( "fallback_lobby" ) );
|
sendMessage( bungee.getTranslation( "fallback_lobby" ) );
|
||||||
connect( def, null, false );
|
connect( def, null, false );
|
||||||
@ -293,7 +294,8 @@ public final class UserConnection implements ProxiedPlayer
|
|||||||
{
|
{
|
||||||
sendMessage( bungee.getTranslation( "fallback_kick", future.cause().getClass().getName() ) );
|
sendMessage( bungee.getTranslation( "fallback_kick", future.cause().getClass().getName() ) );
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
|
{
|
||||||
lastServerJoined = 0;
|
lastServerJoined = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -590,7 +592,7 @@ public final class UserConnection implements ProxiedPlayer
|
|||||||
|
|
||||||
public void setCompressionThreshold(int compressionThreshold)
|
public void setCompressionThreshold(int compressionThreshold)
|
||||||
{
|
{
|
||||||
if ( ch.getHandle().isActive() && this.compressionThreshold == -1 && getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_8 )
|
if ( ch.getHandle().isActive() && this.compressionThreshold == -1 )
|
||||||
{
|
{
|
||||||
this.compressionThreshold = compressionThreshold;
|
this.compressionThreshold = compressionThreshold;
|
||||||
unsafe.sendPacket( new SetCompression( compressionThreshold ) );
|
unsafe.sendPacket( new SetCompression( compressionThreshold ) );
|
||||||
|
@ -198,6 +198,7 @@ public class DownstreamBridge extends PacketHandler
|
|||||||
t.setSuffix( team.getSuffix() );
|
t.setSuffix( team.getSuffix() );
|
||||||
t.setFriendlyFire( team.getFriendlyFire() );
|
t.setFriendlyFire( team.getFriendlyFire() );
|
||||||
t.setNameTagVisibility( team.getNameTagVisibility() );
|
t.setNameTagVisibility( team.getNameTagVisibility() );
|
||||||
|
t.setCollisionRule( team.getCollisionRule() );
|
||||||
t.setColor( team.getColor() );
|
t.setColor( team.getColor() );
|
||||||
}
|
}
|
||||||
if ( team.getPlayers() != null )
|
if ( team.getPlayers() != null )
|
||||||
@ -467,7 +468,6 @@ public class DownstreamBridge extends PacketHandler
|
|||||||
@Override
|
@Override
|
||||||
public void handle(SetCompression setCompression) throws Exception
|
public void handle(SetCompression setCompression) throws Exception
|
||||||
{
|
{
|
||||||
con.setCompressionThreshold( setCompression.getThreshold() );
|
|
||||||
server.getCh().setCompressionThreshold( setCompression.getThreshold() );
|
server.getCh().setCompressionThreshold( setCompression.getThreshold() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,8 +27,8 @@ public abstract class EntityMap
|
|||||||
{
|
{
|
||||||
case ProtocolConstants.MINECRAFT_1_8:
|
case ProtocolConstants.MINECRAFT_1_8:
|
||||||
return EntityMap_1_8.INSTANCE;
|
return EntityMap_1_8.INSTANCE;
|
||||||
case ProtocolConstants.MINECRAFT_SNAPSHOT:
|
case ProtocolConstants.MINECRAFT_1_9:
|
||||||
return EntityMap_1_SNAPSHOT.INSTANCE;
|
return EntityMap_1_9.INSTANCE;
|
||||||
}
|
}
|
||||||
throw new RuntimeException( "Version " + version + " has no entity map" );
|
throw new RuntimeException( "Version " + version + " has no entity map" );
|
||||||
}
|
}
|
||||||
|
@ -1,100 +0,0 @@
|
|||||||
package net.md_5.bungee.entitymap;
|
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import net.md_5.bungee.protocol.DefinedPacket;
|
|
||||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
|
||||||
|
|
||||||
class EntityMap_1_7_2 extends EntityMap
|
|
||||||
{
|
|
||||||
|
|
||||||
static final EntityMap INSTANCE = new EntityMap_1_7_2();
|
|
||||||
|
|
||||||
EntityMap_1_7_2()
|
|
||||||
{
|
|
||||||
addRewrite( 0x04, ProtocolConstants.Direction.TO_CLIENT, false ); // Entity Equipment
|
|
||||||
addRewrite( 0x0A, ProtocolConstants.Direction.TO_CLIENT, false ); // Use bed
|
|
||||||
addRewrite( 0x0B, ProtocolConstants.Direction.TO_CLIENT, true ); // Animation
|
|
||||||
addRewrite( 0x0C, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Player
|
|
||||||
addRewrite( 0x0D, ProtocolConstants.Direction.TO_CLIENT, false ); // Collect Item
|
|
||||||
addRewrite( 0x0E, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Object
|
|
||||||
addRewrite( 0x0F, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Mob
|
|
||||||
addRewrite( 0x10, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Painting
|
|
||||||
addRewrite( 0x11, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Experience Orb
|
|
||||||
addRewrite( 0x12, ProtocolConstants.Direction.TO_CLIENT, false ); // Entity Velocity
|
|
||||||
addRewrite( 0x14, ProtocolConstants.Direction.TO_CLIENT, false ); // Entity
|
|
||||||
addRewrite( 0x15, ProtocolConstants.Direction.TO_CLIENT, false ); // Entity Relative Move
|
|
||||||
addRewrite( 0x16, ProtocolConstants.Direction.TO_CLIENT, false ); // Entity Look
|
|
||||||
addRewrite( 0x17, ProtocolConstants.Direction.TO_CLIENT, false ); // Entity Look and Relative Move
|
|
||||||
addRewrite( 0x18, ProtocolConstants.Direction.TO_CLIENT, false ); // Entity Teleport
|
|
||||||
addRewrite( 0x19, ProtocolConstants.Direction.TO_CLIENT, false ); // Entity Head Look
|
|
||||||
addRewrite( 0x1A, ProtocolConstants.Direction.TO_CLIENT, false ); // Entity Status
|
|
||||||
addRewrite( 0x1B, ProtocolConstants.Direction.TO_CLIENT, false ); // Attach Entity
|
|
||||||
addRewrite( 0x1C, ProtocolConstants.Direction.TO_CLIENT, false ); // Entity Metadata
|
|
||||||
addRewrite( 0x1D, ProtocolConstants.Direction.TO_CLIENT, false ); // Entity Effect
|
|
||||||
addRewrite( 0x1E, ProtocolConstants.Direction.TO_CLIENT, false ); // Remove Entity Effect
|
|
||||||
addRewrite( 0x20, ProtocolConstants.Direction.TO_CLIENT, false ); // Entity Properties
|
|
||||||
addRewrite( 0x25, ProtocolConstants.Direction.TO_CLIENT, true ); // Block Break Animation
|
|
||||||
addRewrite( 0x2C, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Global Entity
|
|
||||||
|
|
||||||
addRewrite( 0x02, ProtocolConstants.Direction.TO_SERVER, false ); // Use Entity
|
|
||||||
addRewrite( 0x0A, ProtocolConstants.Direction.TO_SERVER, false ); // Animation
|
|
||||||
addRewrite( 0x0B, ProtocolConstants.Direction.TO_SERVER, false ); // Entity Action
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void rewriteClientbound(ByteBuf packet, int oldId, int newId)
|
|
||||||
{
|
|
||||||
super.rewriteClientbound( packet, oldId, newId );
|
|
||||||
|
|
||||||
//Special cases
|
|
||||||
int readerIndex = packet.readerIndex();
|
|
||||||
int packetId = DefinedPacket.readVarInt( packet );
|
|
||||||
int packetIdLength = packet.readerIndex() - readerIndex;
|
|
||||||
if ( packetId == 0x0D /* Collect Item */ || packetId == 0x1B /* Attach Entity */ )
|
|
||||||
{
|
|
||||||
rewriteInt( packet, oldId, newId, readerIndex + packetIdLength + 4 );
|
|
||||||
} else if ( packetId == 0x13 /* Destroy Entities */ )
|
|
||||||
{
|
|
||||||
int count = packet.getByte( packetIdLength );
|
|
||||||
for ( int i = 0; i < count; i++ )
|
|
||||||
{
|
|
||||||
rewriteInt( packet, oldId, newId, packetIdLength + 1 + i * 4 );
|
|
||||||
}
|
|
||||||
} else if ( packetId == 0x0E /* Spawn Object */ )
|
|
||||||
{
|
|
||||||
DefinedPacket.readVarInt( packet );
|
|
||||||
int type = packet.readUnsignedByte();
|
|
||||||
|
|
||||||
if ( type == 60 || type == 90 )
|
|
||||||
{
|
|
||||||
packet.skipBytes( 14 );
|
|
||||||
int position = packet.readerIndex();
|
|
||||||
int readId = packet.readInt();
|
|
||||||
int changedId = -1;
|
|
||||||
if ( readId == oldId )
|
|
||||||
{
|
|
||||||
packet.setInt( position, newId );
|
|
||||||
changedId = newId;
|
|
||||||
} else if ( readId == newId )
|
|
||||||
{
|
|
||||||
packet.setInt( position, oldId );
|
|
||||||
changedId = oldId;
|
|
||||||
}
|
|
||||||
if ( changedId != -1 )
|
|
||||||
{
|
|
||||||
if ( changedId == 0 && readId != 0 )
|
|
||||||
{ // Trim off the extra data
|
|
||||||
packet.readerIndex( readerIndex );
|
|
||||||
packet.writerIndex( packet.readableBytes() - 6 );
|
|
||||||
} else if ( changedId != 0 && readId == 0 )
|
|
||||||
{ // Add on the extra data
|
|
||||||
packet.readerIndex( readerIndex );
|
|
||||||
packet.capacity( packet.readableBytes() + 6 );
|
|
||||||
packet.writerIndex( packet.readableBytes() + 6 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
packet.readerIndex( readerIndex );
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
package net.md_5.bungee.entitymap;
|
|
||||||
|
|
||||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import net.md_5.bungee.BungeeCord;
|
|
||||||
import net.md_5.bungee.UserConnection;
|
|
||||||
import net.md_5.bungee.connection.LoginResult;
|
|
||||||
import net.md_5.bungee.protocol.DefinedPacket;
|
|
||||||
|
|
||||||
class EntityMap_1_7_6 extends EntityMap_1_7_2
|
|
||||||
{
|
|
||||||
|
|
||||||
static final EntityMap_1_7_6 INSTANCE = new EntityMap_1_7_6();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressFBWarnings("DLS_DEAD_LOCAL_STORE")
|
|
||||||
public void rewriteClientbound(ByteBuf packet, int oldId, int newId)
|
|
||||||
{
|
|
||||||
super.rewriteClientbound( packet, oldId, newId );
|
|
||||||
|
|
||||||
int readerIndex = packet.readerIndex();
|
|
||||||
int packetId = DefinedPacket.readVarInt( packet );
|
|
||||||
int packetIdLength = packet.readerIndex() - readerIndex;
|
|
||||||
if ( packetId == 0x0C /* Spawn Player */ )
|
|
||||||
{
|
|
||||||
DefinedPacket.readVarInt( packet );
|
|
||||||
int idLength = packet.readerIndex() - readerIndex - packetIdLength;
|
|
||||||
String uuid = DefinedPacket.readString( packet );
|
|
||||||
String username = DefinedPacket.readString( packet );
|
|
||||||
int props = DefinedPacket.readVarInt( packet );
|
|
||||||
if ( props == 0 )
|
|
||||||
{
|
|
||||||
UserConnection player = (UserConnection) BungeeCord.getInstance().getPlayer( username );
|
|
||||||
if ( player != null )
|
|
||||||
{
|
|
||||||
LoginResult profile = player.getPendingConnection().getLoginProfile();
|
|
||||||
if ( profile != null && profile.getProperties() != null
|
|
||||||
&& profile.getProperties().length >= 1 )
|
|
||||||
{
|
|
||||||
ByteBuf rest = packet.copy();
|
|
||||||
packet.readerIndex( readerIndex );
|
|
||||||
packet.writerIndex( readerIndex + packetIdLength + idLength );
|
|
||||||
DefinedPacket.writeString( player.getUniqueId().toString(), packet );
|
|
||||||
DefinedPacket.writeString( username, packet );
|
|
||||||
DefinedPacket.writeVarInt( profile.getProperties().length, packet );
|
|
||||||
for ( LoginResult.Property property : profile.getProperties() )
|
|
||||||
{
|
|
||||||
DefinedPacket.writeString( property.getName(), packet );
|
|
||||||
DefinedPacket.writeString( property.getValue(), packet );
|
|
||||||
DefinedPacket.writeString( property.getSignature(), packet );
|
|
||||||
}
|
|
||||||
packet.writeBytes( rest );
|
|
||||||
rest.release();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
packet.readerIndex( readerIndex );
|
|
||||||
}
|
|
||||||
}
|
|
173
proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java
Normal file
173
proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
package net.md_5.bungee.entitymap;
|
||||||
|
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import net.md_5.bungee.BungeeCord;
|
||||||
|
import net.md_5.bungee.UserConnection;
|
||||||
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
|
import net.md_5.bungee.protocol.DefinedPacket;
|
||||||
|
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
class EntityMap_1_9 extends EntityMap
|
||||||
|
{
|
||||||
|
static final EntityMap_1_9 INSTANCE = new EntityMap_1_9();
|
||||||
|
|
||||||
|
EntityMap_1_9()
|
||||||
|
{
|
||||||
|
addRewrite( 0x00, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Object : PacketPlayOutSpawnEntity
|
||||||
|
addRewrite( 0x01, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Experience Orb : PacketPlayOutSpawnEntityExperienceOrb
|
||||||
|
addRewrite( 0x03, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Mob : PacketPlayOutSpawnEntityLiving
|
||||||
|
addRewrite( 0x04, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Painting : PacketPlayOutSpawnEntityPainting
|
||||||
|
addRewrite( 0x05, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Player : PacketPlayOutNamedEntitySpawn
|
||||||
|
addRewrite( 0x06, ProtocolConstants.Direction.TO_CLIENT, true ); // Animation : PacketPlayOutAnimation
|
||||||
|
addRewrite( 0x08, ProtocolConstants.Direction.TO_CLIENT, true ); // Block Break Animation : PacketPlayOutBlockBreakAnimation
|
||||||
|
addRewrite( 0x1B, ProtocolConstants.Direction.TO_CLIENT, false ); // Entity Status : PacketPlayOutEntityStatus
|
||||||
|
addRewrite( 0x25, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Relative Move : PacketPlayOutRelEntityMove
|
||||||
|
addRewrite( 0x26, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Look and Relative Move : PacketPlayOutRelEntityMoveLook
|
||||||
|
addRewrite( 0x27, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Look : PacketPlayOutEntityLook
|
||||||
|
addRewrite( 0x28, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity : PacketPlayOutEntity
|
||||||
|
addRewrite( 0x2F, ProtocolConstants.Direction.TO_CLIENT, true ); // Use bed : PacketPlayOutBed
|
||||||
|
addRewrite( 0x31, ProtocolConstants.Direction.TO_CLIENT, true ); // Remove Entity Effect : PacketPlayOutRemoveEntityEffect
|
||||||
|
addRewrite( 0x34, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Head Look : PacketPlayOutEntityHeadRotation
|
||||||
|
addRewrite( 0x36, ProtocolConstants.Direction.TO_CLIENT, true ); // Camera : PacketPlayOutCamera
|
||||||
|
addRewrite( 0x39, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Metadata : PacketPlayOutEntityMetadata
|
||||||
|
addRewrite( 0x3B, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Velocity : PacketPlayOutEntityVelocity
|
||||||
|
addRewrite( 0x3C, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Equipment : PacketPlayOutEntityEquipment
|
||||||
|
addRewrite( 0x40, ProtocolConstants.Direction.TO_CLIENT, true ); // Attach Entity : PacketPlayOutMount
|
||||||
|
addRewrite( 0x49, ProtocolConstants.Direction.TO_CLIENT, true ); // Collect Item : PacketPlayOutCollect
|
||||||
|
addRewrite( 0x4A, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Teleport : PacketPlayOutEntityTeleport
|
||||||
|
addRewrite( 0x4B, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Properties : PacketPlayOutUpdateAttributes
|
||||||
|
addRewrite( 0x4C, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Effect : PacketPlayOutEntityEffect
|
||||||
|
|
||||||
|
addRewrite( 0x0A, ProtocolConstants.Direction.TO_SERVER, true ); // Use Entity : PacketPlayInUseEntity
|
||||||
|
addRewrite( 0x14, ProtocolConstants.Direction.TO_SERVER, true ); // Entity Action : PacketPlayInEntityAction
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressFBWarnings("DLS_DEAD_LOCAL_STORE")
|
||||||
|
public void rewriteClientbound(ByteBuf packet, int oldId, int newId)
|
||||||
|
{
|
||||||
|
super.rewriteClientbound( packet, oldId, newId );
|
||||||
|
|
||||||
|
// Special cases
|
||||||
|
int readerIndex = packet.readerIndex();
|
||||||
|
int packetId = DefinedPacket.readVarInt( packet );
|
||||||
|
int packetIdLength = packet.readerIndex() - readerIndex;
|
||||||
|
int jumpIndex = packet.readerIndex();
|
||||||
|
switch ( packetId )
|
||||||
|
{
|
||||||
|
case 0x49 /* Collect Item : PacketPlayOutCollect */:
|
||||||
|
DefinedPacket.readVarInt( packet );
|
||||||
|
rewriteVarInt( packet, oldId, newId, packet.readerIndex() );
|
||||||
|
break;
|
||||||
|
case 0x40 /* Attach Entity : PacketPlayOutMount */:
|
||||||
|
DefinedPacket.readVarInt( packet );
|
||||||
|
jumpIndex = packet.readerIndex();
|
||||||
|
// Fall through on purpose to int array of IDs
|
||||||
|
case 0x30 /* Destroy Entities : PacketPlayOutEntityDestroy */:
|
||||||
|
int count = DefinedPacket.readVarInt( packet );
|
||||||
|
int[] ids = new int[ count ];
|
||||||
|
for ( int i = 0; i < count; i++ )
|
||||||
|
{
|
||||||
|
ids[i] = DefinedPacket.readVarInt( packet );
|
||||||
|
}
|
||||||
|
packet.readerIndex( jumpIndex );
|
||||||
|
packet.writerIndex( jumpIndex );
|
||||||
|
DefinedPacket.writeVarInt( count, packet );
|
||||||
|
for ( int id : ids )
|
||||||
|
{
|
||||||
|
if ( id == oldId )
|
||||||
|
{
|
||||||
|
id = newId;
|
||||||
|
} else if ( id == newId )
|
||||||
|
{
|
||||||
|
id = oldId;
|
||||||
|
}
|
||||||
|
DefinedPacket.writeVarInt( id, packet );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x00 /* Spawn Object : PacketPlayOutSpawnEntity */:
|
||||||
|
DefinedPacket.readVarInt( packet );
|
||||||
|
DefinedPacket.readUUID( packet );
|
||||||
|
int type = packet.readUnsignedByte();
|
||||||
|
|
||||||
|
if ( type == 60 || type == 90 || type == 91 )
|
||||||
|
{
|
||||||
|
if ( type == 60 || type == 91 )
|
||||||
|
{
|
||||||
|
oldId = oldId + 1;
|
||||||
|
newId = newId + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
packet.skipBytes( 26 ); // double, double, double, byte, byte
|
||||||
|
int position = packet.readerIndex();
|
||||||
|
int readId = packet.readInt();
|
||||||
|
if ( readId == oldId )
|
||||||
|
{
|
||||||
|
packet.setInt( position, newId );
|
||||||
|
} else if ( readId == newId )
|
||||||
|
{
|
||||||
|
packet.setInt( position, oldId );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x05 /* Spawn Player : PacketPlayOutNamedEntitySpawn */:
|
||||||
|
DefinedPacket.readVarInt( packet ); // Entity ID
|
||||||
|
int idLength = packet.readerIndex() - readerIndex - packetIdLength;
|
||||||
|
UUID uuid = DefinedPacket.readUUID( packet );
|
||||||
|
ProxiedPlayer player;
|
||||||
|
if ( ( player = BungeeCord.getInstance().getPlayerByOfflineUUID( uuid ) ) != null )
|
||||||
|
{
|
||||||
|
int previous = packet.writerIndex();
|
||||||
|
packet.readerIndex( readerIndex );
|
||||||
|
packet.writerIndex( readerIndex + packetIdLength + idLength );
|
||||||
|
DefinedPacket.writeUUID( player.getUniqueId(), packet );
|
||||||
|
packet.writerIndex( previous );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x2C /* Combat Event : PacketPlayOutCombatEvent */:
|
||||||
|
int event = packet.readUnsignedByte();
|
||||||
|
if ( event == 1 /* End Combat*/ )
|
||||||
|
{
|
||||||
|
DefinedPacket.readVarInt( packet );
|
||||||
|
rewriteInt( packet, oldId, newId, packet.readerIndex() );
|
||||||
|
} else if ( event == 2 /* Entity Dead */ )
|
||||||
|
{
|
||||||
|
int position = packet.readerIndex();
|
||||||
|
rewriteVarInt( packet, oldId, newId, packet.readerIndex() );
|
||||||
|
packet.readerIndex( position );
|
||||||
|
DefinedPacket.readVarInt( packet );
|
||||||
|
rewriteInt( packet, oldId, newId, packet.readerIndex() );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
packet.readerIndex( readerIndex );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rewriteServerbound(ByteBuf packet, int oldId, int newId)
|
||||||
|
{
|
||||||
|
super.rewriteServerbound( packet, oldId, newId );
|
||||||
|
// Special cases
|
||||||
|
int readerIndex = packet.readerIndex();
|
||||||
|
int packetId = DefinedPacket.readVarInt( packet );
|
||||||
|
int packetIdLength = packet.readerIndex() - readerIndex;
|
||||||
|
|
||||||
|
if ( packetId == 0x1B /* Spectate : PacketPlayInSpectate */ && !BungeeCord.getInstance().getConfig().isIpForward() )
|
||||||
|
{
|
||||||
|
UUID uuid = DefinedPacket.readUUID( packet );
|
||||||
|
ProxiedPlayer player;
|
||||||
|
if ( ( player = BungeeCord.getInstance().getPlayer( uuid ) ) != null )
|
||||||
|
{
|
||||||
|
int previous = packet.writerIndex();
|
||||||
|
packet.readerIndex( readerIndex );
|
||||||
|
packet.writerIndex( readerIndex + packetIdLength );
|
||||||
|
DefinedPacket.writeUUID( ( (UserConnection) player ).getPendingConnection().getOfflineId(), packet );
|
||||||
|
packet.writerIndex( previous );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
packet.readerIndex( readerIndex );
|
||||||
|
}
|
||||||
|
}
|
@ -1,181 +0,0 @@
|
|||||||
package net.md_5.bungee.entitymap;
|
|
||||||
|
|
||||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import net.md_5.bungee.BungeeCord;
|
|
||||||
import net.md_5.bungee.UserConnection;
|
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
|
||||||
import net.md_5.bungee.protocol.DefinedPacket;
|
|
||||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
class EntityMap_SNAPSHOT extends EntityMap
|
|
||||||
{
|
|
||||||
static final EntityMap_SNAPSHOT INSTANCE = new EntityMap_SNAPSHOT();
|
|
||||||
|
|
||||||
EntityMap_SNAPSHOT()
|
|
||||||
{
|
|
||||||
addRewrite( 0x04, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Equipment
|
|
||||||
addRewrite( 0x0A, ProtocolConstants.Direction.TO_CLIENT, true ); // Use bed
|
|
||||||
addRewrite( 0x0B, ProtocolConstants.Direction.TO_CLIENT, true ); // Animation
|
|
||||||
addRewrite( 0x0C, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Player
|
|
||||||
addRewrite( 0x0D, ProtocolConstants.Direction.TO_CLIENT, true ); // Collect Item
|
|
||||||
addRewrite( 0x0E, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Object
|
|
||||||
addRewrite( 0x0F, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Mob
|
|
||||||
addRewrite( 0x10, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Painting
|
|
||||||
addRewrite( 0x11, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Experience Orb
|
|
||||||
addRewrite( 0x12, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Velocity
|
|
||||||
addRewrite( 0x14, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity
|
|
||||||
addRewrite( 0x15, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Relative Move
|
|
||||||
addRewrite( 0x16, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Look
|
|
||||||
addRewrite( 0x17, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Look and Relative Move
|
|
||||||
addRewrite( 0x18, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Teleport
|
|
||||||
addRewrite( 0x19, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Head Look
|
|
||||||
addRewrite( 0x1A, ProtocolConstants.Direction.TO_CLIENT, false ); // Entity Status
|
|
||||||
addRewrite( 0x1B, ProtocolConstants.Direction.TO_CLIENT, false ); // Attach Entity
|
|
||||||
addRewrite( 0x1C, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Metadata
|
|
||||||
addRewrite( 0x1D, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Effect
|
|
||||||
addRewrite( 0x1E, ProtocolConstants.Direction.TO_CLIENT, true ); // Remove Entity Effect
|
|
||||||
addRewrite( 0x20, ProtocolConstants.Direction.TO_CLIENT, true ); // Entity Properties
|
|
||||||
addRewrite( 0x25, ProtocolConstants.Direction.TO_CLIENT, true ); // Block Break Animation
|
|
||||||
addRewrite( 0x2C, ProtocolConstants.Direction.TO_CLIENT, true ); // Spawn Global Entity
|
|
||||||
addRewrite( 0x43, ProtocolConstants.Direction.TO_CLIENT, true ); // Camera
|
|
||||||
addRewrite( 0x49, ProtocolConstants.Direction.TO_CLIENT, true ); // Update Entity NBT
|
|
||||||
|
|
||||||
addRewrite( 0x02, ProtocolConstants.Direction.TO_SERVER, true ); // Use Entity
|
|
||||||
addRewrite( 0x0C, ProtocolConstants.Direction.TO_SERVER, true ); // Entity Action
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressFBWarnings("DLS_DEAD_LOCAL_STORE")
|
|
||||||
public void rewriteClientbound(ByteBuf packet, int oldId, int newId)
|
|
||||||
{
|
|
||||||
super.rewriteClientbound( packet, oldId, newId );
|
|
||||||
|
|
||||||
//Special cases
|
|
||||||
int readerIndex = packet.readerIndex();
|
|
||||||
int packetId = DefinedPacket.readVarInt( packet );
|
|
||||||
int packetIdLength = packet.readerIndex() - readerIndex;
|
|
||||||
if ( packetId == 0x0D /* Collect Item */ )
|
|
||||||
{
|
|
||||||
DefinedPacket.readVarInt( packet );
|
|
||||||
rewriteVarInt( packet, oldId, newId, packet.readerIndex() );
|
|
||||||
} else if ( packetId == 0x1B /* Attach Entity */ )
|
|
||||||
{
|
|
||||||
rewriteInt( packet, oldId, newId, readerIndex + packetIdLength + 4 );
|
|
||||||
} else if ( packetId == 0x13 /* Destroy Entities */ )
|
|
||||||
{
|
|
||||||
int count = DefinedPacket.readVarInt( packet );
|
|
||||||
int[] ids = new int[ count ];
|
|
||||||
for ( int i = 0; i < count; i++ )
|
|
||||||
{
|
|
||||||
ids[ i ] = DefinedPacket.readVarInt( packet );
|
|
||||||
}
|
|
||||||
packet.readerIndex( readerIndex + packetIdLength );
|
|
||||||
packet.writerIndex( readerIndex + packetIdLength );
|
|
||||||
DefinedPacket.writeVarInt( count, packet );
|
|
||||||
for ( int id : ids )
|
|
||||||
{
|
|
||||||
if ( id == oldId )
|
|
||||||
{
|
|
||||||
id = newId;
|
|
||||||
} else if ( id == newId )
|
|
||||||
{
|
|
||||||
id = oldId;
|
|
||||||
}
|
|
||||||
DefinedPacket.writeVarInt( id, packet );
|
|
||||||
}
|
|
||||||
} else if ( packetId == 0x0E /* Spawn Object */ )
|
|
||||||
{
|
|
||||||
|
|
||||||
DefinedPacket.readVarInt( packet );
|
|
||||||
int type = packet.readUnsignedByte();
|
|
||||||
|
|
||||||
if ( type == 60 || type == 90 )
|
|
||||||
{
|
|
||||||
packet.skipBytes( 14 );
|
|
||||||
int position = packet.readerIndex();
|
|
||||||
int readId = packet.readInt();
|
|
||||||
int changedId = -1;
|
|
||||||
if ( readId == oldId )
|
|
||||||
{
|
|
||||||
packet.setInt( position, newId );
|
|
||||||
changedId = newId;
|
|
||||||
} else if ( readId == newId )
|
|
||||||
{
|
|
||||||
packet.setInt( position, oldId );
|
|
||||||
changedId = oldId;
|
|
||||||
}
|
|
||||||
if ( changedId != -1 )
|
|
||||||
{
|
|
||||||
if ( changedId == 0 && readId != 0 )
|
|
||||||
{ // Trim off the extra data
|
|
||||||
packet.readerIndex( readerIndex );
|
|
||||||
packet.writerIndex( packet.readableBytes() - 6 );
|
|
||||||
} else if ( changedId != 0 && readId == 0 )
|
|
||||||
{ // Add on the extra data
|
|
||||||
packet.readerIndex( readerIndex );
|
|
||||||
packet.capacity( packet.readableBytes() + 6 );
|
|
||||||
packet.writerIndex( packet.readableBytes() + 6 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if ( packetId == 0x0C /* Spawn Player */ )
|
|
||||||
{
|
|
||||||
DefinedPacket.readVarInt( packet ); // Entity ID
|
|
||||||
int idLength = packet.readerIndex() - readerIndex - packetIdLength;
|
|
||||||
UUID uuid = DefinedPacket.readUUID( packet );
|
|
||||||
ProxiedPlayer player;
|
|
||||||
if ( ( player = BungeeCord.getInstance().getPlayerByOfflineUUID( uuid ) ) != null )
|
|
||||||
{
|
|
||||||
int previous = packet.writerIndex();
|
|
||||||
packet.readerIndex( readerIndex );
|
|
||||||
packet.writerIndex( readerIndex + packetIdLength + idLength );
|
|
||||||
DefinedPacket.writeUUID( player.getUniqueId(), packet );
|
|
||||||
packet.writerIndex( previous );
|
|
||||||
}
|
|
||||||
} else if ( packetId == 0x42 /* Combat Event */ )
|
|
||||||
{
|
|
||||||
int event = packet.readUnsignedByte();
|
|
||||||
if ( event == 1 /* End Combat*/ )
|
|
||||||
{
|
|
||||||
DefinedPacket.readVarInt( packet );
|
|
||||||
rewriteInt( packet, oldId, newId, packet.readerIndex() );
|
|
||||||
} else if ( event == 2 /* Entity Dead */ )
|
|
||||||
{
|
|
||||||
int position = packet.readerIndex();
|
|
||||||
rewriteVarInt( packet, oldId, newId, packet.readerIndex() );
|
|
||||||
packet.readerIndex( position );
|
|
||||||
DefinedPacket.readVarInt( packet );
|
|
||||||
rewriteInt( packet, oldId, newId, packet.readerIndex() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
packet.readerIndex( readerIndex );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void rewriteServerbound(ByteBuf packet, int oldId, int newId)
|
|
||||||
{
|
|
||||||
super.rewriteServerbound( packet, oldId, newId );
|
|
||||||
//Special cases
|
|
||||||
int readerIndex = packet.readerIndex();
|
|
||||||
int packetId = DefinedPacket.readVarInt( packet );
|
|
||||||
int packetIdLength = packet.readerIndex() - readerIndex;
|
|
||||||
|
|
||||||
if ( packetId == 0x19 /* Spectate */ && !BungeeCord.getInstance().getConfig().isIpForward() )
|
|
||||||
{
|
|
||||||
UUID uuid = DefinedPacket.readUUID( packet );
|
|
||||||
ProxiedPlayer player;
|
|
||||||
if ( ( player = BungeeCord.getInstance().getPlayer( uuid ) ) != null )
|
|
||||||
{
|
|
||||||
int previous = packet.writerIndex();
|
|
||||||
packet.readerIndex( readerIndex );
|
|
||||||
packet.writerIndex( readerIndex + packetIdLength );
|
|
||||||
DefinedPacket.writeUUID( ( (UserConnection) player ).getPendingConnection().getOfflineId(), packet );
|
|
||||||
packet.writerIndex( previous );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
packet.readerIndex( readerIndex );
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,13 +6,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>bungeecord-query</artifactId>
|
<artifactId>bungeecord-query</artifactId>
|
||||||
<version>1.8-SNAPSHOT</version>
|
<version>1.9-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>BungeeCord-Query</name>
|
<name>BungeeCord-Query</name>
|
||||||
|
Loading…
Reference in New Issue
Block a user