#2834: Add support for long array NBT tag

This commit is contained in:
md_5 2020-05-09 15:41:38 +10:00
parent b85df4f2a1
commit 3373eb864d
2 changed files with 15 additions and 18 deletions

View File

@ -24,12 +24,6 @@
</properties> </properties>
<dependencies> <dependencies>
<dependency>
<groupId>com.flowpowered</groupId>
<artifactId>flow-nbt</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-codec-haproxy</artifactId> <artifactId>netty-codec-haproxy</artifactId>
@ -91,6 +85,12 @@
<version>5.0.4</version> <version>5.0.4</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>se.llbit</groupId>
<artifactId>jo-nbt</artifactId>
<version>1.3.0</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>

View File

@ -1,14 +1,15 @@
package net.md_5.bungee.entitymap; package net.md_5.bungee.entitymap;
import com.flowpowered.nbt.stream.NBTInputStream;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufInputStream; import io.netty.buffer.ByteBufInputStream;
import java.io.IOException; import java.io.DataInputStream;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import net.md_5.bungee.protocol.DefinedPacket; import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.ProtocolConstants;
import se.llbit.nbt.NamedTag;
import se.llbit.nbt.Tag;
/** /**
* Class to rewrite integers within packets. * Class to rewrite integers within packets.
@ -252,12 +253,10 @@ public abstract class EntityMap
DefinedPacket.readVarInt( packet ); DefinedPacket.readVarInt( packet );
break; break;
case 13: case 13:
try Tag tag = NamedTag.read( new DataInputStream( new ByteBufInputStream( packet ) ) );
if ( tag.isError() )
{ {
new NBTInputStream( new ByteBufInputStream( packet ), false ).readTag(); throw new RuntimeException( tag.error() );
} catch ( IOException ex )
{
throw new RuntimeException( ex );
} }
break; break;
case 15: case 15:
@ -300,12 +299,10 @@ public abstract class EntityMap
{ {
packet.readerIndex( position ); packet.readerIndex( position );
try Tag tag = NamedTag.read( new DataInputStream( new ByteBufInputStream( packet ) ) );
if ( tag.isError() )
{ {
new NBTInputStream( new ByteBufInputStream( packet ), false ).readTag(); throw new RuntimeException( tag.error() );
} catch ( IOException ex )
{
throw new RuntimeException( ex );
} }
} }
} }