Bredz 6 Share Posted July 4, 2019 Hey guys, I'm trying to grab messages from the chat-log but I cant seem to get it to work. currently I have this public class main extends AbstractScript implements AdvancedMessageListener { @Override public void onGameMessage(Message msg) { if (msg.getMessage().toLowerCase().contains("i can't reach that!")) { getCamera().rotateToEntity(getRock()); log("Cant reach move camera"); } } } However I'm getting this error everytime. "'main' must either be declared abstract or implement abstract method 'onAutoMessage(Message)' in 'AdvancedMessageListener'" Along with Illegal Character errors and ' ; ' expected. What am I doing wrong here. Link to comment Share on other sites More sharing options...
Neffarion 472 Share Posted July 4, 2019 You are implementing an interface on a class, so you have to add every function is requires You need to add all those functions. They can be empty if you don't need anything from them Bredz 1 Link to comment Share on other sites More sharing options...
Bredz 6 Author Share Posted July 4, 2019 10 minutes ago, Neffarion said: You are implementing an interface on a class, so you have to add every function is requires You need to add all those functions. They can be empty if you don't need anything from them @Override public void onMessage(Message arg0) { // TODO Auto-generated method stub } @Override public void onAutoMessage(Message arg0) { // TODO Auto-generated method stub } @Override public void onClanMessage(Message arg0) { // TODO Auto-generated method stub } @Override public void onPlayerMessage(Message arg0) { // TODO Auto-generated method stub } @Override public void onPrivateInMessage(Message arg0) { // TODO Auto-generated method stub } @Override public void onPrivateInfoMessage(Message arg0) { // TODO Auto-generated method stub } @Override public void onPrivateOutMessage(Message arg0) { // TODO Auto-generated method stub } @Override public void onTradeMessage(Message arg0) { // TODO Auto-generated method stub } @Override public void onGameMessage(Message msg) { if (msg.getMessage().toLowerCase().contains("i can't reach that!")) { getCamera().rotateToEntity(getRock()); log("Cant reach move camera"); } } This is still getting me the illegal character error. Link to comment Share on other sites More sharing options...
Nuclear Nezz 1969 Share Posted July 4, 2019 Are you not using an IDE? It should be flagging things as red if there are errors. Link to comment Share on other sites More sharing options...
Neffarion 472 Share Posted July 4, 2019 Illegal character must be from something else you didn't post. What is in getRock? Link to comment Share on other sites More sharing options...
Pseudo 178 Share Posted July 5, 2019 Also please note you shouldn't be performing actions in the listener. Nex 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now