diff --git a/api/pom.xml b/api/pom.xml
index 0daf39da..d9363b60 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-parent
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
../pom.xml
net.md-5
bungeecord-api
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
jar
BungeeCord-API
diff --git a/api/src/main/java/net/md_5/bungee/api/score/Team.java b/api/src/main/java/net/md_5/bungee/api/score/Team.java
index dbb27aea..41660371 100644
--- a/api/src/main/java/net/md_5/bungee/api/score/Team.java
+++ b/api/src/main/java/net/md_5/bungee/api/score/Team.java
@@ -18,6 +18,7 @@ public class Team
private String suffix;
private byte friendlyFire;
private String nameTagVisibility;
+ private String collisionRule;
private byte color;
private Set players = new HashSet<>();
diff --git a/bootstrap/pom.xml b/bootstrap/pom.xml
index 48f56b3b..0c023491 100644
--- a/bootstrap/pom.xml
+++ b/bootstrap/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-parent
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
../pom.xml
net.md-5
bungeecord-bootstrap
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
jar
BungeeCord-Bootstrap
diff --git a/chat/pom.xml b/chat/pom.xml
index 3f2dd5b1..0b447c14 100644
--- a/chat/pom.xml
+++ b/chat/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-parent
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
../pom.xml
net.md-5
bungeecord-chat
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
jar
BungeeCord-Chat
diff --git a/config/pom.xml b/config/pom.xml
index c28a5983..5c99e14a 100644
--- a/config/pom.xml
+++ b/config/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-parent
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
../pom.xml
net.md-5
bungeecord-config
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
jar
BungeeCord-Config
diff --git a/event/pom.xml b/event/pom.xml
index 4315c49f..a5fee806 100644
--- a/event/pom.xml
+++ b/event/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-parent
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
../pom.xml
net.md-5
bungeecord-event
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
jar
BungeeCord-Event
diff --git a/module/cmd-alert/pom.xml b/module/cmd-alert/pom.xml
index 1118a737..1cc7fefa 100644
--- a/module/cmd-alert/pom.xml
+++ b/module/cmd-alert/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-module
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
../pom.xml
net.md-5
bungeecord-module-cmd-alert
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
jar
cmd_alert
diff --git a/module/cmd-find/pom.xml b/module/cmd-find/pom.xml
index 703a2cbd..10b6a4fa 100644
--- a/module/cmd-find/pom.xml
+++ b/module/cmd-find/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-module
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
../pom.xml
net.md-5
bungeecord-module-cmd-find
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
jar
cmd_find
diff --git a/module/cmd-list/pom.xml b/module/cmd-list/pom.xml
index d9ec0b68..774b694c 100644
--- a/module/cmd-list/pom.xml
+++ b/module/cmd-list/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-module
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
../pom.xml
net.md-5
bungeecord-module-cmd-list
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
jar
cmd_list
diff --git a/module/cmd-send/pom.xml b/module/cmd-send/pom.xml
index 1afa53b0..15d03fcb 100644
--- a/module/cmd-send/pom.xml
+++ b/module/cmd-send/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-module
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
../pom.xml
net.md-5
bungeecord-module-cmd-send
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
jar
cmd_send
diff --git a/module/cmd-server/pom.xml b/module/cmd-server/pom.xml
index 1e5221b1..a72db68f 100644
--- a/module/cmd-server/pom.xml
+++ b/module/cmd-server/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-module
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
../pom.xml
net.md-5
bungeecord-module-cmd-server
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
jar
cmd_server
diff --git a/module/pom.xml b/module/pom.xml
index 072c3835..3482d0df 100644
--- a/module/pom.xml
+++ b/module/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-parent
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
../pom.xml
net.md-5
bungeecord-module
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
pom
BungeeCord Modules
diff --git a/module/reconnect-yaml/pom.xml b/module/reconnect-yaml/pom.xml
index 513ce4fa..bf5ae48f 100644
--- a/module/reconnect-yaml/pom.xml
+++ b/module/reconnect-yaml/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-module
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
../pom.xml
net.md-5
bungeecord-module-reconnect-yaml
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
jar
reconnect_yaml
diff --git a/native/pom.xml b/native/pom.xml
index 1c3b6508..fb12cc45 100644
--- a/native/pom.xml
+++ b/native/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-parent
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
../pom.xml
net.md-5
bungeecord-native
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
jar
BungeeCord-Native
diff --git a/pom.xml b/pom.xml
index 7ebde38f..af523e1f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
net.md-5
bungeecord-parent
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
pom
BungeeCord-Parent
diff --git a/protocol/pom.xml b/protocol/pom.xml
index 32d4bf7b..9e816ab7 100644
--- a/protocol/pom.xml
+++ b/protocol/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-parent
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
../pom.xml
net.md-5
bungeecord-protocol
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
jar
BungeeCord-Protocol
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 85d1a2c4..26cf7c2b 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
@@ -54,27 +54,26 @@ public enum Protocol
{
{
- TO_CLIENT.registerPacket( 0x00, KeepAlive.class );
- TO_CLIENT.registerPacket( 0x01, Login.class );
- TO_CLIENT.registerPacket( 0x02, Chat.class );
- TO_CLIENT.registerPacket( 0x07, Respawn.class );
- TO_CLIENT.registerPacket( 0x38, PlayerListItem.class );
- TO_CLIENT.registerPacket( 0x3A, TabCompleteResponse.class );
- TO_CLIENT.registerPacket( 0x3B, ScoreboardObjective.class );
- TO_CLIENT.registerPacket( 0x3C, ScoreboardScore.class );
- TO_CLIENT.registerPacket( 0x3D, ScoreboardDisplay.class );
- TO_CLIENT.registerPacket( 0x3E, Team.class );
- TO_CLIENT.registerPacket( 0x3F, PluginMessage.class );
- TO_CLIENT.registerPacket( 0x40, Kick.class );
- TO_CLIENT.registerPacket( 0x45, Title.class );
- TO_CLIENT.registerPacket( 0x46, SetCompression.class );
- TO_CLIENT.registerPacket( 0x47, PlayerListHeaderFooter.class );
+ TO_CLIENT.registerPacket( 0x00, 0x1F, KeepAlive.class );
+ TO_CLIENT.registerPacket( 0x01, 0x23, Login.class );
+ TO_CLIENT.registerPacket( 0x02, 0x0F, Chat.class );
+ TO_CLIENT.registerPacket( 0x07, 0x33, Respawn.class );
+ TO_CLIENT.registerPacket( 0x38, 0x2D, PlayerListItem.class ); // PlayerInfo
+ TO_CLIENT.registerPacket( 0x3A, 0x0E, TabCompleteResponse.class );
+ TO_CLIENT.registerPacket( 0x3B, 0x3F, ScoreboardObjective.class );
+ TO_CLIENT.registerPacket( 0x3C, 0x42, ScoreboardScore.class );
+ TO_CLIENT.registerPacket( 0x3D, 0x38, ScoreboardDisplay.class );
+ TO_CLIENT.registerPacket( 0x3E, 0x41, Team.class );
+ TO_CLIENT.registerPacket( 0x3F, 0x18, PluginMessage.class );
+ TO_CLIENT.registerPacket( 0x40, 0x1A, Kick.class );
+ TO_CLIENT.registerPacket( 0x45, 0x45, Title.class );
+ TO_CLIENT.registerPacket( 0x47, 0x48, PlayerListHeaderFooter.class );
- TO_SERVER.registerPacket( 0x00, KeepAlive.class );
- TO_SERVER.registerPacket( 0x01, Chat.class );
- TO_SERVER.registerPacket( 0x14, 0x15, TabCompleteRequest.class );
- TO_SERVER.registerPacket( 0x15, 0x16, ClientSettings.class );
- TO_SERVER.registerPacket( 0x17, 0x18, PluginMessage.class );
+ TO_SERVER.registerPacket( 0x00, 0x0B, KeepAlive.class );
+ TO_SERVER.registerPacket( 0x01, 0x02, Chat.class );
+ TO_SERVER.registerPacket( 0x14, 0x01, TabCompleteRequest.class );
+ TO_SERVER.registerPacket( 0x15, 0x04, ClientSettings.class );
+ TO_SERVER.registerPacket( 0x17, 0x09, PluginMessage.class );
}
},
// 1
@@ -107,7 +106,7 @@ public enum Protocol
public static final int MAX_PACKET_ID = 0xFF;
public static List supportedVersions = Arrays.asList(
ProtocolConstants.MINECRAFT_1_8,
- ProtocolConstants.MINECRAFT_SNAPSHOT
+ ProtocolConstants.MINECRAFT_1_9
);
/*========================================================================*/
public final DirectionData TO_SERVER = new DirectionData( ProtocolConstants.Direction.TO_SERVER );
@@ -126,11 +125,12 @@ public enum Protocol
private final TIntObjectMap packetRemap = new TIntObjectHashMap<>();
private final TIntObjectMap packetRemapInv = new TIntObjectHashMap<>();
+
{
packetRemap.put( ProtocolConstants.MINECRAFT_1_8, new TIntIntHashMap() );
packetRemapInv.put( ProtocolConstants.MINECRAFT_1_8, new TIntIntHashMap() );
- packetRemap.put( ProtocolConstants.MINECRAFT_SNAPSHOT, new TIntIntHashMap() );
- packetRemapInv.put( ProtocolConstants.MINECRAFT_SNAPSHOT, new TIntIntHashMap() );
+ packetRemap.put(ProtocolConstants.MINECRAFT_1_9, new TIntIntHashMap() );
+ packetRemapInv.put(ProtocolConstants.MINECRAFT_1_9, new TIntIntHashMap() );
}
public final DefinedPacket createPacket(int id, int protocol)
@@ -140,7 +140,7 @@ public enum Protocol
{
if ( !remap.containsKey( id ) )
{
- throw new BadPacketException( "No packet with id " + id );
+ return null;
}
id = remap.get( id );
}
@@ -177,9 +177,9 @@ public enum Protocol
packetMap.put( packetClass, id );
packetRemap.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 );
- packetRemapInv.get( ProtocolConstants.MINECRAFT_SNAPSHOT ).put( id, newId );
+ packetRemapInv.get( ProtocolConstants.MINECRAFT_1_8 ).put( id, id );
+ packetRemap.get( ProtocolConstants.MINECRAFT_1_9 ).put( newId, id );
+ packetRemapInv.get( ProtocolConstants.MINECRAFT_1_9 ).put( id, newId );
}
protected final void unregisterPacket(int id)
@@ -191,7 +191,7 @@ public enum Protocol
final int getId(Class extends DefinedPacket> packet, int protocol)
{
- Preconditions.checkArgument(packetMap.containsKey(packet), "Cannot get ID for packet " + packet);
+ Preconditions.checkArgument( packetMap.containsKey( packet ), "Cannot get ID for packet " + packet );
int id = packetMap.get( packet );
TIntIntMap remap = packetRemapInv.get( protocol );
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 2507170e..5100d586 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
@@ -6,10 +6,10 @@ import java.util.List;
public class ProtocolConstants
{
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 SUPPORTED_VERSIONS = Arrays.asList(
- "1.8.X",
- "15w33c"
+ "1.8.x",
+ "1.9"
);
public enum Direction
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/Varint21FrameDecoder.java b/protocol/src/main/java/net/md_5/bungee/protocol/Varint21FrameDecoder.java
index 0edc63bc..29e54dba 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/Varint21FrameDecoder.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/Varint21FrameDecoder.java
@@ -51,7 +51,7 @@ public class Varint21FrameDecoder extends ByteToMessageDecoder
if ( !DIRECT_WARNING )
{
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
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/packet/ClientSettings.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ClientSettings.java
index e4d87970..0a54ac62 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/packet/ClientSettings.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ClientSettings.java
@@ -29,10 +29,10 @@ public class ClientSettings extends DefinedPacket
{
locale = readString( buf );
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();
skinParts = buf.readByte();
- if ( protocolVersion >= ProtocolConstants.MINECRAFT_SNAPSHOT )
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
{
mainHand = DefinedPacket.readVarInt( buf );
}
@@ -43,7 +43,7 @@ public class ClientSettings extends DefinedPacket
{
writeString( locale, buf );
buf.writeByte( viewDistance );
- if ( protocolVersion >= ProtocolConstants.MINECRAFT_SNAPSHOT )
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
{
DefinedPacket.writeVarInt( chatFlags, buf );
} else
@@ -52,7 +52,7 @@ public class ClientSettings extends DefinedPacket
}
buf.writeBoolean( chatColours );
buf.writeByte( skinParts );
- if ( protocolVersion >= ProtocolConstants.MINECRAFT_SNAPSHOT )
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
{
DefinedPacket.writeVarInt(mainHand, buf);
}
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 33c35036..0960b7d8 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
@@ -1,38 +1,38 @@
-package net.md_5.bungee.protocol.packet;
-
-import net.md_5.bungee.protocol.DefinedPacket;
-import io.netty.buffer.ByteBuf;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.NoArgsConstructor;
-import net.md_5.bungee.protocol.AbstractPacketHandler;
-import net.md_5.bungee.protocol.ProtocolConstants;
-
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@EqualsAndHashCode(callSuper = false)
-public class KeepAlive extends DefinedPacket
-{
-
- private int randomId;
-
- @Override
- public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
- {
- randomId = readVarInt( buf );
- }
-
- @Override
- public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
- {
- writeVarInt( randomId, buf );
- }
-
- @Override
- public void handle(AbstractPacketHandler handler) throws Exception
- {
- handler.handle( this );
- }
-}
+package net.md_5.bungee.protocol.packet;
+
+import net.md_5.bungee.protocol.DefinedPacket;
+import io.netty.buffer.ByteBuf;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import net.md_5.bungee.protocol.AbstractPacketHandler;
+import net.md_5.bungee.protocol.ProtocolConstants;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@EqualsAndHashCode(callSuper = false)
+public class KeepAlive extends DefinedPacket
+{
+
+ private int randomId;
+
+ @Override
+ public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
+ {
+ randomId = readVarInt( buf );
+ }
+
+ @Override
+ public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
+ {
+ writeVarInt( randomId, buf );
+ }
+
+ @Override
+ public void handle(AbstractPacketHandler handler) throws Exception
+ {
+ handler.handle( this );
+ }
+}
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 bd4763d7..e3bcbc33 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
@@ -17,6 +17,7 @@ public class TabCompleteRequest extends DefinedPacket
{
private String cursor;
+ private boolean assumeCommand;
private boolean hasPositon;
private long position;
@@ -24,6 +25,11 @@ public class TabCompleteRequest extends DefinedPacket
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
cursor = readString( buf );
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
+ {
+ assumeCommand = buf.readBoolean();
+ }
+
if ( hasPositon = buf.readBoolean() )
{
position = buf.readLong();
@@ -34,6 +40,11 @@ public class TabCompleteRequest extends DefinedPacket
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
writeString( cursor, buf );
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
+ {
+ buf.writeBoolean( assumeCommand );
+ }
+
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 dd238649..846881f5 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
@@ -25,6 +25,7 @@ public class Team extends DefinedPacket
private String prefix;
private String suffix;
private String nameTagVisibility;
+ private String collisionRule;
private byte color;
private byte friendlyFire;
private String[] players;
@@ -34,7 +35,6 @@ public class Team extends DefinedPacket
*/
public Team(String name)
{
- this();
this.name = name;
this.mode = 1;
}
@@ -51,6 +51,10 @@ public class Team extends DefinedPacket
suffix = readString( buf );
friendlyFire = buf.readByte();
nameTagVisibility = readString( buf );
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
+ {
+ collisionRule = readString(buf);
+ }
color = buf.readByte();
}
if ( mode == 0 || mode == 3 || mode == 4 )
@@ -76,6 +80,10 @@ public class Team extends DefinedPacket
writeString( suffix, buf );
buf.writeByte( friendlyFire );
writeString( nameTagVisibility, buf );
+ if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_9 )
+ {
+ writeString( collisionRule, buf);
+ }
buf.writeByte( color );
}
if ( mode == 0 || mode == 3 || mode == 4 )
diff --git a/proxy/pom.xml b/proxy/pom.xml
index f60ba371..44ff3ffe 100644
--- a/proxy/pom.xml
+++ b/proxy/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-parent
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
../pom.xml
net.md-5
bungeecord-proxy
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
jar
BungeeCord-Proxy
diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeSecurityManager.java b/proxy/src/main/java/net/md_5/bungee/BungeeSecurityManager.java
index de2b25ec..53c81923 100644
--- a/proxy/src/main/java/net/md_5/bungee/BungeeSecurityManager.java
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeSecurityManager.java
@@ -1,7 +1,11 @@
package net.md_5.bungee;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.security.AccessControlException;
import java.security.Permission;
+import java.util.HashSet;
+import java.util.Set;
import java.util.logging.Level;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.scheduler.GroupedThreadFactory;
@@ -10,6 +14,7 @@ public class BungeeSecurityManager extends SecurityManager
{
private static final boolean ENFORCE = false;
+ private final Set seen = new HashSet<>();
private void checkRestricted(String text)
{
@@ -18,33 +23,25 @@ public class BungeeSecurityManager extends SecurityManager
{
ClassLoader loader = context[i].getClassLoader();
- // Bungee can do everything
- if ( loader == ClassLoader.getSystemClassLoader() )
+ // Bungee / system can do everything
+ if ( loader == ClassLoader.getSystemClassLoader() || loader == null )
{
break;
}
- // Allow external packages from the system class loader to create threads.
- if ( loader == null )
+ AccessControlException ex = new AccessControlException( "Plugin violation: " + text );
+ if ( ENFORCE )
{
- if ( !context[i].getName().startsWith( "java" ) )
- {
- break;
- }
+ throw ex;
}
- // Everyone but system can't do anything
- if ( loader != null )
+ StringWriter stack = new StringWriter();
+ ex.printStackTrace( new PrintWriter( stack ) );
+ if ( seen.add( stack.toString() ) )
{
- AccessControlException ex = new AccessControlException( "Plugin violation: " + text );
- if ( ENFORCE )
- {
- throw ex;
- }
-
ProxyServer.getInstance().getLogger().log( Level.WARNING, "Plugin performed restricted action, please inform them to use proper API methods: " + text, ex );
- break;
}
+ break;
}
}
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 9dad21f3..4e6261a4 100644
--- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
+++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java
@@ -144,7 +144,6 @@ public class ServerConnector extends PacketHandler
@Override
public void handle(SetCompression setCompression) throws Exception
{
- user.setCompressionThreshold( setCompression.getThreshold() );
ch.setCompressionThreshold( setCompression.getThreshold() );
}
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 d7e4a276..e61b76ba 100644
--- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java
+++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java
@@ -154,15 +154,15 @@ public final class UserConnection implements ProxiedPlayer
switch ( getPendingConnection().getListener().getTabListType() )
{
- case "GLOBAL":
- tabListHandler = new Global( this );
- break;
- case "SERVER":
- tabListHandler = new ServerUnique( this );
- break;
- default:
- tabListHandler = new GlobalPing( this );
- break;
+ case "GLOBAL":
+ tabListHandler = new Global( this );
+ break;
+ case "SERVER":
+ tabListHandler = new ServerUnique( this );
+ break;
+ default:
+ tabListHandler = new GlobalPing( this );
+ break;
}
Collection g = bungee.getConfigurationAdapter().getGroups( name );
@@ -192,7 +192,7 @@ public final class UserConnection implements ProxiedPlayer
@Override
public void setDisplayName(String name)
{
- Preconditions.checkNotNull(name, "displayName");
+ Preconditions.checkNotNull( name, "displayName" );
Preconditions.checkArgument( name.length() <= 16, "Display name cannot be longer than 16 characters" );
displayName = name;
}
@@ -272,17 +272,18 @@ public final class UserConnection implements ProxiedPlayer
if ( !future.isSuccess() )
{
future.channel().close();
- pendingConnects.remove(target);
+ pendingConnects.remove( target );
lastServerJoined++;
String serverName = "";
List servers = getPendingConnection().getListener().getServerPriority();
- if ( lastServerJoined < servers.size() ) {
+ if ( lastServerJoined < servers.size() )
+ {
serverName = servers.get( lastServerJoined );
}
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" ) );
connect( def, null, false );
@@ -293,7 +294,8 @@ public final class UserConnection implements ProxiedPlayer
{
sendMessage( bungee.getTranslation( "fallback_kick", future.cause().getClass().getName() ) );
}
- } else {
+ } else
+ {
lastServerJoined = 0;
}
}
@@ -590,7 +592,7 @@ public final class UserConnection implements ProxiedPlayer
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;
unsafe.sendPacket( new SetCompression( compressionThreshold ) );
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 0428401f..974aeb25 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
@@ -198,6 +198,7 @@ public class DownstreamBridge extends PacketHandler
t.setSuffix( team.getSuffix() );
t.setFriendlyFire( team.getFriendlyFire() );
t.setNameTagVisibility( team.getNameTagVisibility() );
+ t.setCollisionRule( team.getCollisionRule() );
t.setColor( team.getColor() );
}
if ( team.getPlayers() != null )
@@ -467,7 +468,6 @@ public class DownstreamBridge extends PacketHandler
@Override
public void handle(SetCompression setCompression) throws Exception
{
- con.setCompressionThreshold( setCompression.getThreshold() );
server.getCh().setCompressionThreshold( setCompression.getThreshold() );
}
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 41952eb7..17f94546 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
@@ -27,8 +27,8 @@ public abstract class EntityMap
{
case ProtocolConstants.MINECRAFT_1_8:
return EntityMap_1_8.INSTANCE;
- case ProtocolConstants.MINECRAFT_SNAPSHOT:
- return EntityMap_1_SNAPSHOT.INSTANCE;
+ case ProtocolConstants.MINECRAFT_1_9:
+ return EntityMap_1_9.INSTANCE;
}
throw new RuntimeException( "Version " + version + " has no entity map" );
}
diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_7_2.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_7_2.java
deleted file mode 100644
index 05097bba..00000000
--- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_7_2.java
+++ /dev/null
@@ -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 );
- }
-}
diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_7_6.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_7_6.java
deleted file mode 100644
index 301da0e7..00000000
--- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_7_6.java
+++ /dev/null
@@ -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 );
- }
-}
diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java
new file mode 100644
index 00000000..1f15dcb3
--- /dev/null
+++ b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_1_9.java
@@ -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 );
+ }
+}
diff --git a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_SNAPSHOT.java b/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_SNAPSHOT.java
deleted file mode 100644
index 04ee1407..00000000
--- a/proxy/src/main/java/net/md_5/bungee/entitymap/EntityMap_SNAPSHOT.java
+++ /dev/null
@@ -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 );
- }
-}
diff --git a/query/pom.xml b/query/pom.xml
index 3dab7c51..81bd2c77 100644
--- a/query/pom.xml
+++ b/query/pom.xml
@@ -6,13 +6,13 @@
net.md-5
bungeecord-parent
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
../pom.xml
net.md-5
bungeecord-query
- 1.8-SNAPSHOT
+ 1.9-SNAPSHOT
jar
BungeeCord-Query