Help with my Plugin

Discussion in 'Plugin Development' started by tooncool64, May 5, 2014.

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

    tooncool64

    When i launch my plugin, it says there is no main class, Even if my only class is my Main class!
    My code is in the next post!

    Code:java
    1. package name.testplugin;
    2.  
    3. import org.bukkit.plugin.java.JavaPlugin;
    4. import org.bukkit.ChatColor;
    5. import org.bukkit.entity.Player;
    6. import org.bukkit.command.Command;
    7. import org.bukkit.command.CommandSender;
    8.  
    9. public class Main extends JavaPlugin{
    10.  
    11. public void onEnable(){
    12. getLogger().info("Disabled!");
    13. }
    14.  
    15. public void onDisable(){
    16. getLogger().info("Enabled!");
    17. }
    18. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    19. Player player = (Player) sender;
    20. if(cmd.getName().equalsIgnoreCase("helloMC")){
    21. player.sendMessage(ChatColor.AQUA + "Hello Minecraft");
    22. }
    23. return false;
    24. }
    25. }


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  2. Offline

    Birdgeek3

  3. Offline

    tooncool64

    Birdgeek3
    Here is my plugin.yml
    Code:
    name: TestPlugin
    version: 1
    main: me.tooncool64.project.Main
    commands:
      test:
        description: This is a test Plugin.
     
  4. Offline

    kakaruso

    Code:
    name: TestPlugin
    main: name.testplugin.Main
    version: '1'
    authors: [you /others]
    commands:
        test:
            usage: /test
            description: description of test
    Be sure the way of your package is me.tooncool64.project

    and your main class better :
    Code:java
    1. package name.testplugin; // TAKE AN EYE HERE IS THE NAME OF YOU PACKAGE
    2.  
    3. import org.bukkit.plugin.java.JavaPlugin;
    4. import org.bukkit.ChatColor;
    5. import org.bukkit.entity.Player;
    6. import org.bukkit.command.Command;
    7. import org.bukkit.command.CommandSender;
    8.  
    9. public class Main extends JavaPlugin{
    10.  
    11. public void onEnable(){
    12. getLogger().info("Disabled!"); // this is when u start the plugin... Disabled???
    13. }
    14.  
    15. public void onDisable(){
    16. getLogger().info("Enabled!"); // this is when u stop the plugin.. Enabled???
    17. }
    18. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    19. Player player = (Player) sender;
    20. if(cmd.getName().equalsIgnoreCase("helloMC")){
    21. player.sendMessage(ChatColor.AQUA + "Hello Minecraft");
    22. }
    23. return false;
    24. }
    25. }
     
  5. Offline

    tooncool64

    Now it throws me a invalid description exception"Authors are of wrong type."
    Here is my .yml
    Code:java
    1. name: TestPlugin
    2. main: name.testplugin.Main
    3. version: '1'
    4. authors: tooncool64
    5. commands:
    6. test:
    7. usage: /test
    8. description: HelloMinecraft









    Here is my .class
    Code:java
    1. package name.testplugin;
    2.  
    3. import org.bukkit.plugin.java.JavaPlugin;
    4. import org.bukkit.ChatColor;
    5. import org.bukkit.entity.Player;
    6. import org.bukkit.command.Command;
    7. import org.bukkit.command.CommandSender;
    8. import org.bukkit.event.Listener;
    9.  
    10. public class Main extends JavaPlugin{
    11.  
    12. public void onEnable(){
    13. getLogger().info("Enabled!");
    14. }
    15.  
    16. public void onDisable(){
    17. getLogger().info("Disabled!");
    18. }
    19. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    20. Player player = (Player) sender;
    21. if(cmd.getName().equalsIgnoreCase("helloMC")){
    22. player.sendMessage(ChatColor.AQUA + "Hello Minecraft");
    23. }
    24. return false;
    25. }
    26. }
     
  6. Offline

    kakaruso

    looks like better ur pugin works now? changing the package in plugin.yml?
     
  7. Offline

    tooncool64

  8. Offline

    Birdgeek3

    in the plugin.yml you posted you have the word "authors:" with only one author. Delete the s.
     
  9. Offline

    kakaruso

    okey, authors Could be ignored but if u want to set your authorship, must be: [tooncool64] With the [ ]

    take an eye to this:

    Code:
    name: Ignora-2
    main: wakunia.ignore.principal.Principal
    version: '2.1'
    authors: [Kakaruso]
    commands:
        ignora2:
            usage: /ignora2
            description: Información básica acerca del plugin.
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  10. Offline

    AoH_Ruthless

  11. Offline

    kakaruso

    AoH_Ruthless has reason, but i always prefer write authors because sometimes i put other people there, like testers etc... As you want, both forms works fine.
     
Thread Status:
Not open for further replies.

Share This Page