I have several routines I either wrote or modified from the old JAVA game that I ran on a server several years ago and gone by. I am trying to pick it back up again and for the life of me cannot get a simple one to run even though it shows no errors and compiles just fine. What is confusing to me is it seems to look fine but will not run Do we still need to @Override
Most of this came from Red's example in the new API discussions
public class Angriffsignrework extends Plugin implements Listener {
@Override
public void onEnable(){
registerEventListener(this);
}
@EventMethod
public void onObjectInteraction(PlayerObjectInteractionEvent event){
// getID();
Objects.ObjectDefinition def = event.getObjectDefinition();
//Check if the object we're using is a sign
if(def.type == Objects.Type.Sign){
} else {
//The sign id is stored as "object info", so we can use it to get the sign object
Sign sign = World.getSign(event.getGlobalID());
//Always a good idea to check if sign isn't null...
if(sign != null){
if(sign.getText().contains("<test>")){
Server.broadcastTextMessage("Entered if");
//Get the player who triggered the event
Player player = event.getPlayer();
//Send the player a text message
player.sendTextMessage("Your Name is: " + player.getName());
//Cancel the event, so the player cannot edit the sign (optional)
event.setCancelled(true);
}
} }
}
@Override
public void onDisable() {
}
}