Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advancements Wrapping error #48

Open
Breci opened this issue Dec 18, 2017 · 5 comments
Open

Advancements Wrapping error #48

Breci opened this issue Dec 18, 2017 · 5 comments

Comments

@Breci
Copy link

Breci commented Dec 18, 2017

Hello,
I tried to play with the Advancements wrapper to see what I can do with them.

I got errors concerning :

  • the AutoWrapper in WrapperPlayServerAdvancements.
  • getMinecraftKeys() in getTabId() in WrapperPlayClientAdvancements ,

Here are the trace :
Server Advancements : https://pastebin.com/35yFbXPA
Client Advancements : https://pastebin.com/YdzbNbQJ

My code :

public class AdvancementListener implements Listener {

    public AdvancementListener(Plugin plugin) {
        ProtocolLibrary.getProtocolManager().addPacketListener(
                new PacketAdapter(plugin, PacketType.Play.Server.ADVANCEMENTS) {
                    @Override
                    public void onPacketSending(PacketEvent event) {
                        System.out.println("===================SERVER=================");
                        PacketContainer packet = event.getPacket();
                        WrapperPlayServerAdvancements wrapper = new WrapperPlayServerAdvancements(packet);

                        System.out.println(wrapper.getAdvancements());
                        //System.out.println(message);
                        System.out.println("==========================================");

                    }
                });

        ProtocolLibrary.getProtocolManager().addPacketListener(
                new PacketAdapter(plugin, PacketType.Play.Client.ADVANCEMENTS) {
                    @Override
                    public void onPacketReceiving(PacketEvent event) {
                        System.out.println("===================CLIENT=================");
                        PacketContainer packet = event.getPacket();
                        WrapperPlayClientAdvancements wrapper = new WrapperPlayClientAdvancements(packet);

                        System.out.println(wrapper.getAction());
                        System.out.println(wrapper.getTabId().getFullKey());
                        System.out.println(wrapper.getTabId().getKey());
                        System.out.println(wrapper.getTabId().getPrefix());
                        //System.out.println(message);
                        System.out.println("==========================================");

                    }
                });
    }
}

Main class :

public class Main extends JavaPlugin {
    
    @Override
    public void onEnable() {
        System.out.println("------------------------------------");
        System.out.println("Plugin started");
        System.out.println("------------------------------------");
        Bukkit.getPluginManager().registerEvents(new AdvancementListener(this), this);
    }

    @Override
    public void onDisable() {
    }
}

PacketWrapper Build : #66
ProtocolLib Build : 4.3.0
Spigot Build : Generated from BuildTools #70

@JarvisCraft
Copy link

Also receiving java.lang.NoClassDefFoundError when performing

public class AdvancementsPacketListener extends PacketAdapter {
    public AdvancementsPacketListener(final JavaPlugin plugin) {
        super(plugin, PacketType.Play.Server.ADVANCEMENTS);
    }

    @Override
    public void onPacketSending(final PacketEvent event) {
        // Right here:
        final WrapperPlayServerAdvancements packet = new WrapperPlayServerAdvancements(event.getPacket());
        System.out.println(packet.getHandle().toString());
    }
}

@JarvisCraft
Copy link

After the research I've discovered that the problem is in com.comphenix.protocol.wrappers.AutoWrapper class being missing in latest published version of ProtocolLib on spigotmc. Fixed by using latest dev build from http://ci.dmulloy2.net/job/ProtocolLib/

@dmulloy2 this issue should be closed and ProtocolLib updated on spigotmc.org

@JarvisCraft
Copy link

Yet packet.getAdvancements() throws NullPointerException.

@JarvisCraft
Copy link

java.lang.StackOverflowError thrown when calling packet.getProgress(),

@riflowth
Copy link

Hello from 2019 @JarvisCraft Do you know about this problem? dmulloy2/ProtocolLib#593 😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants