My command isn't working, I've registered them in the Main class and plugin.yml here's the code for the main class, the command class, and my plugin.yml. All the other commands are working just not the youtube one. Code: package me.verify.main; import me.verify.main.InventoryListener; import me.verify.main.PlayerListener; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; public class Main extends JavaPlugin { public void onEnable() { PluginManager pm = getServer().getPluginManager(); pm.registerEvents(new InventoryListener(), this); pm.registerEvents(new PlayerListener(), this); getCommand("help").setExecutor(new Help()); getCommand("economy").setExecutor(new EcoHelp()); getCommand("staff").setExecutor(new StaffList()); getCommand("cc").setExecutor(new ClearChat()); getCommand("rules").setExecutor(new Rules()); getCommand("pl a").setExecutor(new NoPluginShow()); getCommand("pl").setExecutor(new NoPluginShow()); getCommand("plugins").setExecutor(new NoPluginShow()); getCommand("?").setExecutor(new NoPluginShow()); getCommand("youtube").setExecutor(new Youtube()); System.out.println("cPVP Enabled!"); } public void onDisable() { System.out.println("cPVP Enabled!"); } } Code: package me.verify.main; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class Youtube implements CommandExecutor{ @Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] arg3) { if((sender instanceof Player)) { Player player = (Player)sender; if(commandLabel.equalsIgnoreCase("youtube")){ player.sendMessage("§c§m-------[-§r§fYou§4Tube§c§m-]-------"); player.sendMessage("§fAntique§4DZN§f -§c http://bit.ly/NHvvNb"); player.sendMessage("§fLeafyIs§4Sleepy§f -§c http://bit.ly/1jJaNI7"); player.sendMessage("§c§m-------[-§r§fYou§4Tube Info§c§m-]-------"); player.sendMessage("To receive You§4Tube§f rank you must create a video for the server. You §4§l§oNEED§r to have at a minimum of 100 subscribers and 1000 video views to make the cut. You§4Tube§f rank gets the same exact thing §aVIP§f rank gets."); } } return false; } } Code: name: cPVP main: me.verify.main.Main version: 0.1 author: Verify_x commands: help: economy: staff: cc: rules: pl: pl a: ?: plugins: youtube:
Verify_x I normally don't use commandLabel, I use cmd i.e Code:java if(cmd.getName().equalsIgnoreCase("youtube")) { //Send them the message}
In your onCommand change your Code:java if (sender instanceof Player) { } To Code:java if (!(sender instanceof Player)) { } Also your onEnable() change your System.out.println("Plugin Enabled!"); To Bukkit.getServer().getLogger().info("Plugin Enabled!")
No. That would block him from using the command as a player. Code:java if(commandLabel.equalsIgnoreCase("youtube")){{ Change to Code:java if(cmd.getName().equalsIgnoreCase("youtube")){
Oh I didn't see that that what he's command was under sorry my mistake. I know he can but it's easier when it comes to register events EDIT by Moderator: merged posts, please use the edit button instead of double posting.