Solved Solved it This is confusing... I believe its because its not an actual event that I am doing. Maybe I have to include on PlayerChatEvent or something like that. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Well, first of all, this is the onCommand() method, not an event method, so @EventHandler isnt needed there. Secondly, system.out.println() prints to console. To get the player sending the command, you would first check in sender is an instance of Player, then if it is, cast that to a Player Object.
XKnucklesX 1. You need to extend JavaPlugin. 2. No @EventHandler, onCommand is not an event. 3. System.out.printIn() is only for console. 4. Your error was caused because of the invalid @EventHandler. Your code should look like Code:java public class Main extends JavaPlugin { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player player = (Player) sender; if(cmd.getName().equalsIgnoreCase("getworld")) { player.sendMessage("You are in " + player.getWorld().getName()); } return false;}}
the event has just testing that I forgot to take out ._. System.out.println I must have got confused between bukkit and java The error was not the eventhandler because it was there already thanks though! i'm losing my bukkit sense EDIT by Moderator: merged posts, please use the edit button instead of double posting.