#how can i register class this way

24 messages · Page 1 of 1 (latest)

mortal lion
#
private static void AddPacketListener(ProtocolManager manager, Class classes, ListenerPriority priority, PacketType[] type) {
        manager.addPacketListener(new PacketAdapter(plugin, priority, type) {
            @Override
            public void onPacketReceiving(PacketEvent event) {
                new BowBomb();
            }
        });
    }
vast orbitBOT
#

This post has been reserved for your question.

Hey @mortal lion! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

mortal lion
#

check the picture first

bleak narwhal
#

you'd have to use reflection, are you sure you're supposed to have this pattern

#

don't you usually accept an instance of the listener and then just call a method on the listener?

mortal lion
#

my brain..

#

i've been trying this for some time sorry

mortal lion
#

how can i register the class using reflection

bleak narwhal
#

not like that

#

reflection is a concept, not just a class named "reflection"

#

Class itself is already reflection

mortal lion
bleak narwhal
#

no

mortal lion
#

i never used reflection thats the issue

#

anyway im going to search how reflection works than

bleak narwhal
mortal lion
bleak narwhal
#

no

#

accept an instance of the class rather than Class, and instead of passing SomeListener.getClass(), just pass new SomeListener()

#

that way the caller can also provide all appropriate constructor arguments themselves

#

is that not how it's usually done?