#3803: Add NBT module
This commit is contained in:
@@ -47,7 +47,6 @@ import net.md_5.bungee.protocol.packet.TabCompleteRequest;
|
||||
import net.md_5.bungee.protocol.packet.TabCompleteResponse;
|
||||
import net.md_5.bungee.protocol.packet.UnsignedClientCommand;
|
||||
import net.md_5.bungee.util.AllowedCharacters;
|
||||
import se.llbit.nbt.SpecificTag;
|
||||
|
||||
public class UpstreamBridge extends PacketHandler
|
||||
{
|
||||
@@ -385,7 +384,7 @@ public class UpstreamBridge extends PacketHandler
|
||||
@Override
|
||||
public void handle(CustomClickAction customClickAction) throws Exception
|
||||
{
|
||||
CustomClickEvent event = new CustomClickEvent( con, customClickAction.getId(), TagUtil.toJson( (SpecificTag) customClickAction.getData() ) );
|
||||
CustomClickEvent event = new CustomClickEvent( con, customClickAction.getId(), TagUtil.toJson( customClickAction.getData() ) );
|
||||
if ( bungee.getPluginManager().callEvent( event ).isCancelled() )
|
||||
{
|
||||
throw CancelSendSignal.INSTANCE;
|
||||
|
@@ -4,12 +4,13 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.ByteBufInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
import net.md_5.bungee.nbt.NamedTag;
|
||||
import net.md_5.bungee.nbt.limit.NBTLimiter;
|
||||
import net.md_5.bungee.protocol.DefinedPacket;
|
||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||
import se.llbit.nbt.NamedTag;
|
||||
import se.llbit.nbt.Tag;
|
||||
|
||||
/**
|
||||
* Class to rewrite integers within packets.
|
||||
@@ -275,10 +276,13 @@ public abstract class EntityMap
|
||||
DefinedPacket.readVarInt( packet );
|
||||
break;
|
||||
case 13:
|
||||
Tag tag = NamedTag.read( new DataInputStream( new ByteBufInputStream( packet ) ) );
|
||||
if ( tag.isError() )
|
||||
NamedTag tag = new NamedTag();
|
||||
try
|
||||
{
|
||||
throw new RuntimeException( tag.error() );
|
||||
tag.read( new DataInputStream( new ByteBufInputStream( packet ) ), NBTLimiter.unlimitedSize() );
|
||||
} catch ( IOException ioException )
|
||||
{
|
||||
throw new RuntimeException( ioException );
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
@@ -321,10 +325,13 @@ public abstract class EntityMap
|
||||
{
|
||||
packet.readerIndex( position );
|
||||
|
||||
Tag tag = NamedTag.read( new DataInputStream( new ByteBufInputStream( packet ) ) );
|
||||
if ( tag.isError() )
|
||||
NamedTag tag = new NamedTag();
|
||||
try
|
||||
{
|
||||
throw new RuntimeException( tag.error() );
|
||||
tag.read( new DataInputStream( new ByteBufInputStream( packet ) ), NBTLimiter.unlimitedSize() );
|
||||
} catch ( IOException ioException )
|
||||
{
|
||||
throw new RuntimeException( ioException );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user