BlockBBEvent in scripts?
-
This is what I came up with without seeing @commandblock2's solution.
I had to reverse engineer a bunch of stuff and then put all together and it worked.I was wondering what the hell was annotation in Nashorn and it turns out that
print(annotation.class)literally returns

I'll try to simplify it and automize it via Core.
///api_version=2 (script = registerScript({ name: "Test", authors: ["CzechHek"], version: "1.0" })).import("Core.lib"); module = { onClickGuiLoaded: function () { listener = new (Java.extend(Listenable, Consumer, { handleEvents: function() { return TestModule.state }, accept: function(e) { print(e) } })); method = getMethod(listener, "accept"); annotation = getMethod(TestModule, "onUpdate").getDeclaredAnnotations()[0]; AeventManager = new Reflector(LiquidBounce.eventManager) invocableEventTargets = AeventManager.registry.getOrDefault(BlockBBEvent.class, new ArrayList()); invocableEventTargets.add(new EventHook(listener, method, annotation)); AeventManager.registry[BlockBBEvent.class] = invocableEventTargets; } } Listenable = Java.type("net.ccbluex.liquidbounce.event.Listenable"); Consumer = Java.type("java.util.function.Consumer"); BlockBBEvent = Java.type("net.ccbluex.liquidbounce.event.BlockBBEvent"); EventHook = Java.type("net.ccbluex.liquidbounce.event.EventHook"); ArrayList = Java.type("java.util.ArrayList")@czechhek my problem was too stupid: i forgot to create new instance of my listener (and i had some shitcode in listener prob)
-
@czechhek my problem was too stupid: i forgot to create new instance of my listener (and i had some shitcode in listener prob)
@idk-my-name you forgor

-
@idk-my-name you forgor

@fartcheese i forgor

-
@fartcheese i forgor

@idk-my-name we forgor

-
@idk-my-name we forgor

@fartcheese Wait... I rember

-
@fartcheese Wait... I rember

@idk-my-name same
i rember



-
@czechhek my problem was too stupid: i forgot to create new instance of my listener (and i had some shitcode in listener prob)
@czechhek said in BlockBBEvent in scripts?:
I'll try to simplify it and automize it via Core.
@idk-my-name https://forums.ccbluex.net/topic/94/script-base-core-3-28-simple-yet-powerful-scriptapi-base/30 and here it is
You can use all events if you import Core base, no need to do any of this stuff.
For more info, look at my comment on Core post.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login