Plugin Not Registering as a Plugin on my Server?

Discussion in 'Plugin Development' started by Zeinaty, Jul 7, 2015.

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

    Zeinaty

    Hi, a few minutes ago I finished making a small "test" plugin and on the server, when I did /pl to check if it registered as a plugin, the plugin didn't even show up on the list.

    I don't understand why though.. I finished my plugin.yml and everything! Maybe you guys can help.

    This is my MainClass:
    Code:
    package me.zeinaty;
    import org.bukkit.Bukkit;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerRespawnEvent;
    import org.bukkit.permissions.Permission;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.potion.PotionEffect;
    import org.bukkit.potion.PotionEffectType;
    
    public class MainClass extends JavaPlugin implements Listener {
      
        public Permission playerPermission = new Permission("playerAbilities.speed");
      
        @Override
        public void onEnable() {
            new ListenerClass(this);
            Bukkit.getServer().getPluginManager().registerEvents(this, this);
            PluginManager pm = getServer().getPluginManager();
            pm.addPermission(playerPermission);
            }
      
        @EventHandler
        public void onPlayerRespawn(final PlayerRespawnEvent e) {
          
            Player player = e.getPlayer();
          
            if(player.hasPermission("playerAbilities.speed")) {
                player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 100, 1));
            }
        }
    }
    This is my ListenerClass:
    Code:
    package me.zeinaty;
    
    import org.bukkit.event.Listener;
    
    public class ListenerClass implements Listener {
      
        public ListenerClass(MainClass plugin) {
            plugin.getServer().getPluginManager().registerEvents(this, plugin);
        }
    }
    
    and this is my plugin.yml:
    Code:
    name: MyFirstPlugin
    main: me.zeinaty.MainClass
    version: 1.0
    If anybody could help out and find what the problem could be, that'd be awesome!
     
  2. Offline

    Konato_K

    @Zeinaty If it's not under /pl you should have a stacktrace in the logs.
     
  3. Offline

    Zeinaty

    Thanks, I'll try that in a few minutes (busy atm). I will let you know if it works or not!

    EDIT: @Konato_K I did that, but nothing showed up in the logs!
     
    Last edited: Jul 7, 2015
  4. @Zeinaty
    Might be a weird question, but is it really in your plugins folder? Because if a jar is in the plugins folder it automaticly checks if it's a plugin, and if it's not it throws an error, and you said no errors occured, so this seems like the best reason why.
     
  5. Offline

    Zeinaty

    You know what? I actually checked that earlier to make sure that I wasn't stupid... But no, that's not the problem lol

    This might help: I made another plugin and the same thing is happening, maybe it has to do with the plugin.yml?

    I'm going to sleep, so if somebody could figure this out overnight that would be awesome! I will check the thread again just before I fall asleep and then I will again tomorrow (for me, anyway).
     
  6. Do you use "Eclipse"? If so did you tick "plugin.yml" in the compile settings? Is the plugin.yml at the right place? And why do you use this ListenerClass?
     
  7. Offline

    Creeper674

    This looks like a weird main class path (from plugin.yml)
    main: me.zeinaty.MainClass

    Shouldn't it be structured more like
    main: x.x.x.MainClass ?
     
  8. Offline

    Zeinaty

    @Mr01Luki
    1. Yes, I use Eclipse.
    2. Yes, I ticked plugin.yml
    3. Yes, it's in the source folder.
    4. The Listener Class is for fixing a bug in the MainClass. (I know this isn't the problem because this exact same problem is happening with a different plugin I tried to compile)
    @Creeper674
    It's not a big plugin, it's only got two classes. Therefore I only need 1 package, that is me.zeinaty.
     
  9. Offline

    Zombie_Striker

    @Zeinaty
    Is the package name of this plugin different then the package name of any other plugin?
     
  10. Offline

    Zeinaty

    I'm pretty sure.. but I'm going to change it just to make sure! I'll let you know if that works or not :)

    EDIT: @Zombie_Striker Wow! I had know clue that this could be the problem! It worked! Thanks so much!

    EDIT EDIT: I'm so ticked right now.... I make another plugin, do the same thing, but nothing again! I changed it from me.zeinaty.boundless to me.zeinaty.joinfirework on a plugin I watched a tutorial on (to make sure that I'm not entirely stupid and miss anything) and it didn't work...... any suggestions now?
     
    Last edited: Jul 8, 2015
  11. Offline

    Zombie_Striker

    @Zeinaty
    Are you sure the plugin.yml is correct (no tabs, two to three spaces)? Did you put in the right path (it is CaSe-SenSiTiVe)? Can you post everything related to this other plugin (the plugin.yml, package path-name .ect)
     
  12. Offline

    Zeinaty

    Alrighty, here is the MainClass:
    Code:
    package me.zeinaty.joinfirework;
    import org.bukkit.Bukkit;
    import org.bukkit.Color;
    import org.bukkit.FireworkEffect;
    import org.bukkit.FireworkEffect.Type;
    import org.bukkit.entity.Firework;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerLoginEvent;
    import org.bukkit.inventory.meta.FireworkMeta;
    import org.bukkit.plugin.java.JavaPlugin;
    public class JoinFirework extends JavaPlugin implements Listener {
            public void onEnable() {
                    Bukkit.getServer().getPluginManager().registerEvents(this, this);
            }
          
            @EventHandler
            public void onPlayerLogin(final PlayerLoginEvent e) {
                    Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
                            public void run() {
                                    if (e.getPlayer().hasPlayedBefore()) return;
                                  
                                    Firework f = (Firework) e.getPlayer().getWorld().spawn(e.getPlayer().getLocation(), Firework.class);
                                  
                                    FireworkMeta fm = f.getFireworkMeta();
                                    fm.addEffect(FireworkEffect.builder()
                                                    .flicker(false)
                                                    .trail(true)
                                                    .with(Type.CREEPER)
                                                    .withColor(Color.GREEN)
                                                    .withFade(Color.BLUE)
                                                    .build());
                                    fm.setPower(3);
                                    f.setFireworkMeta(fm);
                            }
                    }, 20);
            }
    }
    And this is the plugin.yml:
    Code:
    name: JoinFirework
    version: 1.0
    main: me.zeinaty.joinfirework.JoinFirework
    description: Official Hexteria Factions server JoinFirework plugin!
    Here is a picture of the packages:
    [​IMG]
     
  13. Offline

    timtower Administrator Administrator Moderator

    @Zeinaty plugin.yml should be in the project root, not in the src folder.
     
  14. Offline

    Zeinaty

    Thanks! I will try that when I wake up in a few hours, I'm about to fall asleep. I'll let you know if it works! (It probably will, so I'll mark this thread as solved.)

    Thanks so much!

    EDIT: @timtower I tried it, it didn't work... any ideas?
    [​IMG]
     
    Last edited: Jul 9, 2015
    timtower likes this.
  15. Offline

    Zeinaty

  16. Offline

    Zombie_Striker

    @Zeinaty
    You did not have the "ListenerClass" in the post before. What other changes have you made that might be interfering with your plugin?
     
  17. Offline

    teej107

    @Zeinaty An error will be thrown if a plugin failed to load otherwise it is not in the correct directory. Please post your stacktrace/console log.
     
  18. @Zeinaty Can we please see your full start up log in pastebin.com and your ListenerClass class.
     
  19. Offline

    Zeinaty

    @Zombie_Striker and @bwfcwalshy The Listener Class is just there in case later I decide to use it for new additions to the plugin, this is the only code in it:
    Code:
    package me.zeinaty.joinfirework;
    
    import org.bukkit.event.Listener;
    
    public class ListenerClass implements Listener {
       
        public ListenerClass(JoinFirework plugin) {
            plugin.getServer().getPluginManager().registerEvents(this, plugin);
        }
    }
    
    @teej107 and @bwfcwalshy The plugin doesn't even register as a plugin in the logs, nothing from it pops up at all, it has to do with the plugin's format, not errors.
     
  20. @Zeinaty Please post your full startup log.
     
    teej107 likes this.
  21. Offline

    teej107

    @Zeinaty
     
  22. Offline

    Zeinaty

    @bwfcwalshy @teej107 Here is a link to the pastebin: http://pastebin.com/vntfM4jf
    You're right! I did CTRL + F and searched for JoinFirework and there's an error! Sorry for not believing you! But do you think you can solve THAT error for me?
     
  23. Locked, offline mode is not supported here.
     
Thread Status:
Not open for further replies.

Share This Page