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 485 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 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 2040 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 485 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 179 Share Posted July 5, 2019 Also please note you shouldn't be performing actions in the listener. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.