Plugin returning plugin.yml info.

Discussion in 'Plugin Development' started by MetalGearDaner, Dec 20, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    MetalGearDaner

    Hi, i've created my first plugin and when typing the command, it returns the plugin.yml info. I tried to remove plugin.yml but it returns nothing. There isnt any console error or something related.

    This is the code:
    Code:java
    1. package main;
    2.  
    3. import org.bukkit.Bukkit;
    4. import org.bukkit.ChatColor;
    5. import org.bukkit.command.Command;
    6. import org.bukkit.command.CommandSender;
    7. import org.bukkit.entity.Player;
    8. import org.bukkit.plugin.java.JavaPlugin;
    9.  
    10. public class Rocket extends JavaPlugin {
    11.  
    12. public void onEnable(){
    13. Bukkit.getServer().getLogger().info("Rocket enabled.");
    14. }
    15.  
    16. public static boolean command(final CommandSender sender, final Command cmd, final String CommandLabel, final String args[] ){
    17. Player player = (Player) sender;
    18.  
    19. if(CommandLabel.equalsIgnoreCase("rocket") && sender.isOp()){
    20. if(args.length == 0){
    21. sender.sendMessage(ChatColor.RED + "Introduce el nombre del usuario a rocketear.");
    22. }
    23. Player target = Bukkit.getServer().getPlayer(args[0]);
    24. if(target == null){
    25. sender.sendMessage(ChatColor.RED+"No se ha podido encontrar al usuario "+ ChatColor.DARK_RED+args[0]+ChatColor.RED+".");
    26. }else{
    27. target.setVelocity(player.getVelocity().setY(player.getVelocity().getY() + 30));
    28. Bukkit.getServer().broadcastMessage(sender+""+ChatColor.YELLOW +"ha rocketeado a "+ target);
    29. }
    30. }
    31. return true;
    32. }
    33. }

    This is the plugin.yml:
    Code:
    name: Rocket
    main: main.Rocket
    version: Beta
    commands:
      rocket:
     
  2. Offline

    Goblom

    Here is your problem
    Code:java
    1. public static boolean command(final CommandSender sender, final Command cmd, final String CommandLabel, final String args[] ){

    Its supposed to be this...
    Code:java
    1. public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
     
    MetalGearDaner likes this.
  3. Offline

    MetalGearDaner

    Thank a lot ;)
     
Thread Status:
Not open for further replies.

Share This Page