GamersBot.java : https://pastebin.com/7HbGrzCd
Cefh.java : https://pastebin.com/MZeVDqkx
Screenshot: http://prnt.sc/ewm2dn
The output generated:
Code xjoeyv.cefh.MessageTransporterEvent@4208289f
xjoeyv.cefh.MessageTransporterEvent@5e8d667f
Is a part of the 'library' and comes from the function:
Code public void onMessageTransport(MessageTransporterEvent event) {
System.out.println(event);
}
And my function on the left side does not override it, why not? The function in the Cefh.java file will get called as you can see.
Apr 14, 2017 06:08 PM
(This post was last modified: Apr 15, 2017 08:34 AM by Weco.)
You need to call GamersBot.onMessageTransport if you want to use the overridden function.
Where's the rest of the code ? How do you know that onMessageTransport() is not being overridden in GamersBot class, you used "@override" annotation so you imply to the compiler that you actually want to override a method in the code that follows, and if it doesn't give you an error than it means it actually is being overridden, the mistake may be in the part of code where you call these methods.
(Apr 14, 2017 06:08 PM)Weco Wrote: You need to call xjoeyv.gamersbot.Cefh.onMessageTransport if you want to use the overridden function.
You mean what happends here?
Code package xjoeyv.cefh;
import org.cef.browser.CefBrowser;
import org.cef.callback.CefQueryCallback;
import org.cef.handler.CefMessageRouterHandlerAdapter;
public class MessageTransporter extends CefMessageRouterHandlerAdapter {
@Override
public boolean onQuery(CefBrowser browser,
long query_id,
String request,
boolean persistent,
CefQueryCallback callback) {
Cefh.getInstance().onMessageTransport(new MessageTransporterEvent(callback, request));
return false;
}
}
(Apr 14, 2017 06:47 PM)SIM-429621 Wrote: Where's the rest of the code ? How do you know that onMessageTransport() is not being overridden in GamersBot class, you used "@override" annotation so you imply to the compiler that you actually want to override a method in the code that follows, and if it doesn't give you an error than it means it actually is being overridden, the mistake may be in the part of code where you call these methods.
See above ^^
"How do you know that onMessageTransport() is not being overridden in GamersBot class" and how do you mean that? GamersBot class should override it right? Or that is what I want
Apr 15, 2017 06:28 AM
(This post was last modified: Apr 15, 2017 08:32 AM by Weco.)
(Apr 15, 2017 02:05 AM)Zippy™ Wrote: You mean what happends here?
Code package xjoeyv.cefh;
import org.cef.browser.CefBrowser;
import org.cef.callback.CefQueryCallback;
import org.cef.handler.CefMessageRouterHandlerAdapter;
public class MessageTransporter extends CefMessageRouterHandlerAdapter {
@Override
public boolean onQuery(CefBrowser browser,
long query_id,
String request,
boolean persistent,
CefQueryCallback callback) {
Cefh.getInstance().onMessageTransport(new MessageTransporterEvent(callback, request));
return false;
}
}
public boolean onQuery gets Overriden, so whenever MessageTransporter.onQuery is called, the overriden function will be used instead of the original.
(Apr 15, 2017 06:28 AM)Weco Wrote: public boolean onQuery gets Overriden, so whenever MessageTransporter.onQuery is called, the overriden function will be sued instead of the original.
So how can I resolve this issue? What should be the best way to go? Cause I do want the function to be overriden in the Cefh class.
(Apr 15, 2017 07:02 AM)Zippy™ Wrote: So how can I resolve this issue? What should be the best way to go? Cause I do want the function to be overriden in the Cefh class.
You simply call GamersBot.onMessageTransport instead of Cefh.onMessageTransport :)
You can read more here: http://docs.oracle.com/javase/tutorial/j...rride.html
(Apr 15, 2017 08:35 AM)Weco Wrote: You simply call GamersBot.onMessageTransport instead of Cefh.onMessageTransport :)
You can read more here: http://docs.oracle.com/javase/tutorial/j...rride.html
Yea but I said the Cefh is a library so people can use it them selfs, this can end up that someone else its class is CefBrowser that wants to override the onMessageTransport.
|