Cant find the problem

Discussion in 'Plugin Development' started by killerbigmacs, Apr 2, 2014.

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

    killerbigmacs

    Hello, So I new to coding and I'm still watching some videos to help me along and I can't seem to find the problem with this plugin I am making.

    Code:java
    1. package me.rdock.EnchantAll;
    2.  
    3. import java.util.logging.Logger;
    4.  
    5. import org.bukkit.ChatColor;
    6. import org.bukkit.command.Command;
    7. import org.bukkit.command.CommandSender;
    8. import org.bukkit.enchantments.Enchantment;
    9. import org.bukkit.entity.Player;
    10. import org.bukkit.plugin.PluginDescriptionFile;
    11. import org.bukkit.plugin.java.JavaPlugin;
    12.  
    13. public class EnchantAll extends JavaPlugin {
    14. public final Logger logger = Logger.getLogger("Minecraft");
    15. public static EnchantAll plugin;
    16.  
    17. public void onEnable() {
    18. PluginDescriptionFile pdfFile = this.getDescription();
    19. this.logger.info("[" + pdfFile.getName() + "] v" + pdfFile.getVersion() + " is enabled!");
    20. }
    21.  
    22. public void onDisable() {
    23. PluginDescriptionFile pdfFile = this.getDescription();
    24. this.logger.info("[" + pdfFile.getName() + "] is disabled!");
    25. }
    26.  
    27. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
    28. if (commandLabel.equalsIgnoreCase("enchantme")) {
    29. if (sender instanceof Player) {
    30. if (sender.hasPermission("echantme.use")) {
    31. if (args.length == 2) {
    32. if (Enchantment.getByName(args[0]) != null) {
    33. Player player = (Player)sender;
    34. int level = Integer.parseInt(args[1].replaceAll("[\\D]", ""));
    35. player.getItemInHand().addUnsafeEnchantment(Enchantment.getByName(args[0]), level);
    36. sender.sendMessage(ChatColor.GREEN + "This item has successfully been enchanted.");
    37. } else {
    38. sender.sendMessage(ChatColor.RED + "This enchantment is not available.");
    39. }
    40. } else {
    41. sender.sendMessage(ChatColor.RED + "Wrong number of command parameters.");
    42. }
    43. } else {
    44. sender.sendMessage(ChatColor.RED + "You don't have the permissions.");
    45. }
    46. } else {
    47. logger.info("You must be a player to use this command.");
    48. }
    49. return true;
    50. }
    51. return false;
    52. }
    53. }


    plugin.yml

    Code:
    name: EnchantAll
    main: me.rdock.EnchantAll
    version: 1.0
    descirption: 1st Plugin I made (Ryan|killerbigmacs)!
    commands:
      enchantme:
        description: Enchants an item.
    permissions:
      enchantme.use:
        description: Give access to the /enchantme command.
    The error I get
    http://pastebin.com/bGjKhfqa
     
  2. Offline

    Maurdekye

  3. Offline

    Abs0rbed

    Whether or not he did, you're specifying the main package in your plugin.yml, when you should be specifying a your main class, that being me.rdock.EnchantAll.EnchantAll
     
  4. Offline

    CraftBang

    killerbigmacs
    1. org.bukkit.plugin.InvalidPluginException: Cannot find main class `me.rdock.EnchantAll'
    It cant find class me.rdock.EnchantAll < Just your package (that's not class)
    I guess your class is me.rdock.EnchantAll.EnchantAll <Package + Main Class Change this in the plugin.yml!
     
  5. Offline

    The Fancy Whale

    As Maurdekye please don't steal others work. Also, learn java before you begin trying to code bukkit plugins.
     
Thread Status:
Not open for further replies.

Share This Page