The server does not recognize the plugin I am trying to make

Discussion in 'Spigot Plugin Development' started by Perry1900, Jul 22, 2018.

  1. I am new to java and I am trying to make my first plugin and it should be a warzone ore vein plugin like in the youtuber smp h4m.
    when it was a blank plugin it did what it should have did: print to the console that it was enabled/disabled but after I added a command for giving yourself an ore vein block - the command worked when it was blank and just printed something to the chat but when I made it give the player who runs the command the ore vein block, the plugin completely stopped working and the server doesn't even recognize it.

    main class for now:
    Code (Java):
    package warzoneOreVeins;

    import org.bukkit.plugin.java.JavaPlugin;
    import warzoneOreVeins.commands.GiveOreVeinBlock;

    public class Plugin extends JavaPlugin{

        public Plugin mainInstance;
        @Override
        public void onEnable() {
            mainInstance = this;
            getLogger().info("[Warzone Ore Veins] The plugin has been enabled");
            getServer().broadcastMessage("[Warzone Ore Veins] The plugin has been enabled");
            loadMethod();
            registerConfig();
        }
     
        @Override
        public void onDisable() {
            getLogger().info("[Warzone Ore Veins] The plugin has been disabled");
            getServer().broadcastMessage("[Warzone Ore Veins] The plugin has been disabled");
        }
     
        public void loadMethod() {
            getCommand("GiveOreVeinBlock").setExecutor(new GiveOreVeinBlock());
         
        }
     
        public void registerConfig() {
            getConfig().options().copyDefaults(true);
            saveConfig();
         
        }
    }
     
    tell me if you want me to send any other part of the code because I am doing it to learn so idc if someone is gonna copy anything (and why would someone do that)

    edit: I forgot to say that I am using local host for the tests now (I used a free online host before) so its the same java version
     
  2. Do /pl on the server, is it red? If so, it’s not starting. Show the error if there is one too.

    Also: don’t call ur main class ‘Plugin’ since there’s a bukkit class called ‘Plugin’
     
  3. Does your plugin utilize 1.13 and have
    Code (Text):
    api-version: 1.13
    in its plugin.yml?

    Send your plugin.yml while you're at it.
     
  4. its not in /pl and I tried changing the name to Main because you said that maybe the class name is making problem but it didn't help
     
    #4 Perry1900, Jul 22, 2018
    Last edited: Jul 22, 2018
  5. its a plugin for minecraft 1.8.8 and here is my plugin.yml:
    Code (Java):
    name: WarzoneOreVeins
    version: 1.0.0
    main: me.Perry1900.WarzoneOreVeins.warzoneOreVeins
    author: Perry1900
    description: Allows the server owner to create ore veins like in the warzone in the private SMP server some youtuber played H4M (how to minecraft season 4)
    commands:
        GiveOreVeinBlock:
            description: Give yourself an ore vein block
            aliases: [GetOreVeinBlock, OreVeinBlockGive, OreVeinBlockGet]
     
  6. Are there any errors in the console on loading/reloading?
     
  7. in your code the package is called warzoneOreVeins but in thr plugin yml it is not
     
    • Agree Agree x 1
  8. nope
    so should I change me.Perry1900.WarzoneOreVeins.warzoneOreVeins to me.Perry1900.WarzoneOreVeins.warzoneOreVeins.Main?
     
  9. ^^ exactly that. Good find. From your main class it seems the package is only warzoneOreVein, and since you changed your class name from Plugin to Main, you should change your plugin.yml to:
    Code (Text):
    main: warzoneOreVein.Main
    For your plugin.yml to be:
    Code (Text):
    main: me.perry1900.warzoneoreveins.main
    you'd have to create a package named me.perry1900.warzoneoreveins (you can think of packages as folders).
     
  10. still doesn't work rip
     
  11. Plugin.yml is case sensitive, make sure you wrote everything correctly. The standard is to write packages in all lowercase and start classes with a capital letter.
     
  12. oh and btw I use the Spigot\Spigot-API\target\spigot-api-1.8.8-R0.1-SNAPSHOT-shaded.jar
     
  13. so should I change it?
     
  14. Using a stable release is usually better than using a snapshot one but I don't believe that is the cause of your problem here. You could always try and change it to see if you get a different result.
     
  15. how do I install a stable release of the API?
     
  16. You can learn more about the buildtools here.
     
  17. about the main in the plugin.yml, how can I check that I did the right path?
     
  18. Here's what my project looks like.
    [​IMG]
    As you can see, I have my Main.java class inside a com.pam.playerwarps package. And inside my plugin.yml file, I have this line:
    Code (Text):
    main: com.pam.playerwarps.Main
    Notice how all the caps match and that I omitted to put .java at the end since it's not needed.
     
  19. this is a package name:
    Code (Text):
    package org.bukkit.entity;
    this is not a package name (or, at least, not one that follows proper naming conventions) :
    Code (Text):
    package warzoneOreVeins;
    this is what a main class path would look like in the plugin.yml:
    Code (Text):
    main: vpd.bowandaero12.furnacelevels.FurnaceLevels
    That's my main class for my FurnaceLevels plugin, as an example. If the main class name is something like "Main," then someone who uses your plugin would have to really dig to figure out that it's your plugin causing issues if they don't know the main class. Also note that the main class at the end of the package is the only part with any capital letters. Easy class identification.

    Make the package in your IDE something like "me.perry1900.warzoneoreveins", and then "me.perry1900.warzoneoreveins.WarzoneOreVeins" (or whatever your main class's name is at the end) would work.
     
    • Informative Informative x 1
  20. Is there a difference bitween a package that looks like that and a package that looks like a folder?