package Mail;
import net.risingworld.api.Plugin;
import net.risingworld.api.events.EventMethod;
import net.risingworld.api.events.Listener;
import net.risingworld.api.events.player.PlayerCommandEvent;
import net.risingworld.api.objects.Player;
public class Mail extends Plugin implements Listener{
@Override
public void onEnable(){
registerEventListener(this);
}
@Override
public void onDisable(){
//...
}
@EventMethod
public void onPlayerCommand(PlayerCommandEvent event){
Player player = event.getPlayer();
String command = event.getCommand();
//split the command
String[] cmd = command.split(" ");
//check the command
if(cmd[0].equals("/mail")){
//check if player Entered a Recipeant
if(cmd.length > 1){
String towhom = command.substring(5);
player.sendTextMessage("Sent Mail to:" + towhom);
}
}
else{
//inform player that he has to enter the recpiant
player.sendTextMessage("[#FF0000]You Need to Specify Who You are Mailing!");
player.sendTextMessage("[#FF0000]USAGE: /mail UncleBob");
}
}
}
It will say "Mail sent to: XXXX" but when I just type in "/mail" it won't see the Else Command, it doesn't say anything i the chat