mirror of
https://github.com/FancyInnovations/FancyPlugins.git
synced 2025-12-06 07:43:36 +00:00
packets: Fix payload parsing for ServerboundCustomClickActionPacket
This commit is contained in:
@@ -7,6 +7,7 @@ import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.handler.codec.MessageToMessageDecoder;
|
||||
import io.papermc.paper.adventure.PaperAdventure;
|
||||
import net.minecraft.nbt.StringTag;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.common.ServerboundCustomClickActionPacket;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
@@ -80,7 +81,13 @@ public class PacketListenerImpl extends FS_PacketListener {
|
||||
Map<String, String> payload = new HashMap<>();
|
||||
if (customClickActionPacket.payload().isPresent() && customClickActionPacket.payload().get().asCompound().isPresent()) {
|
||||
customClickActionPacket.payload().get().asCompound().get().forEach((k, v) -> {
|
||||
payload.put(k, v.toString());
|
||||
if (v.getType().getName().equals(StringTag.TYPE.getName())) {
|
||||
if (v.asString().isPresent()) {
|
||||
payload.put(k, v.asString().get());
|
||||
}
|
||||
} else {
|
||||
payload.put(k, v.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -15,22 +15,27 @@ public class DialogRegistry implements com.fancyinnovations.fancydialogs.api.Dia
|
||||
this.dialogs = new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(@NotNull Dialog dialog) {
|
||||
dialogs.put(dialog.getId(), dialog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregister(@NotNull String id) {
|
||||
dialogs.remove(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog get(@NotNull String id) {
|
||||
return dialogs.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Dialog> getAll() {
|
||||
return dialogs.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
dialogs.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user