Solved Plugin no loading at begining

Discussion in 'Spigot Plugin Development' started by Flaquito, Feb 20, 2020.

Thread Status:
Not open for further replies.
  1. Hello. When I start my server the plugin does not load (no error), but when I "reload" the server, it loads normally. What could be?
     
  2. send you main.class and plugin.yml!
     
  3. Please send your Main class and your plugin.yml file please?
    Otherwise we cannot help you.
    If the issue has been solved, then please add the solved tag on this thread.
     
    • Optimistic Optimistic x 1
  4. Part of my Main:
    Code (Java):
    public static Main main;
        public PlayerInteractive pi = new PlayerInteractive();
        Manager m;
        PluginManager pm = Bukkit.getPluginManager();
        public static WorldInteractive worldinteractive = new WorldInteractive();
       
        @Override
        public void onEnable() {
            main = Main.this;
            m = new Manager();
            m.saveConfig();
           
            pm.registerEvents(new Events(), this);
            new Commands(this);
           
           
            pi.ranksToPlayer();
        }
       
        @Override
        public void onDisable() {
            //setTextsFloatings("remove");
        }
    My plugin.yml:

    Code (YAML):
    name: Gamemode
    main
    : com.Main.Main
    version
    : 0.5
    author
    : Flakito

    api-version
    : 1.13

    commands
    :
        info
    :
        loguear
    :
        registrar
    :
        cambiarpass
    :
        ayuda
    :
        ir
    :
        hora
    :
        otorgar
    :
            aliases
    : ot
            permission
    : op
        prueba
    :
            permission
    : op
        ubicacion
    :
            aliases
    : u
     
  5. What console error do you get?
    Check carefully, It's easy to miss your errors at startup since other plugins load aswell and many messages are spammed.
     
    • Useful Useful x 1
  6. PluginManager pm = Bukkit.getPluginManager();

    Has to be in the onEnable method. I think that’s the problem.
     
  7. No what are you talking about?
     
    • Like Like x 1
  8. I think the main class has not been registered properly.
    Make sure the main inside your config really leads to your main class.
    That is why I wanted the whole project, but it is ok if you do not want to share the whole project's code.
    That is why I am asking for the console error, it tells you where the error was thrown.
    So I can see the problem.
     
    • Useful Useful x 1
  9. If your plugin isn't enabling, there should be at least some error being logged that causes it.
    Your Main class's static singleton pattern isn't being enforced (i.e.: "main" can be changed at any time if someone chose to do so). You probably access main in another class during static initialization, causing an NPE or something along those lines.

    Are you sure com.Main.Main is the right package name? It's not included in your class snippet, so only you'd be sure.
     
  10. lol you just copied me
     
    • Funny Funny x 1
  11. Code (Text):
    main: com.Main.Main
    Might actually be com.main.Main
    com.main - package
    Main - Class name
     
  12. It’s funny cuz you did the exact same thing in your first reply :)

    She even added some information, so what’s the problem? I didn’t know this was a competition ?
     
    • Funny Funny x 2
  13. haha, ok fun asside.
    Let's focus ont he person needing help.
    If you need help atleast respond..
     
    #13 retrooper, Feb 20, 2020
    Last edited: Feb 20, 2020
    • Like Like x 1
  14. Just stop post spamming and playing the innocent. You did that too man.
     
    • Agree Agree x 2
  15. No no, I don't have errors. When I start my server, it stars normally by without the plugin loading or enabling. Just starts.
     
  16. I don't have console errors. Just starts normally but without the plugin loading or enabling.

    Ehm, I don't have problem showing my coding, I just put that part 'cause the other I think it's not important. But I'll put it complete.
     
  17. Yeah yeah, it's everything okey. If there is a problem with the package name or somthing else, when I reload the server it doesn't load the plugin, 'cause that's what it is happening. I reload the server and the plugin load normally, without error. Just when I start the server the plugin does not load.
     
  18. The all code of Main class:

    Code (Java):
    package com.Main;

    import java.text.*;
    import java.util.*;

    import org.bukkit.*;
    import org.bukkit.entity.*;
    import org.bukkit.plugin.*;
    import org.bukkit.plugin.java.JavaPlugin;

    import com.Events.Events;

    import com.Commands.Commands;
    import com.PlayerInteractive.*;
    import com.Main.WorldInteractive;

    public class Main extends JavaPlugin{
       
        public static Main main;
        public PlayerInteractive pi = new PlayerInteractive();
        Manager m;
        PluginManager pm = Bukkit.getPluginManager();
        public static WorldInteractive worldinteractive = new WorldInteractive();
       
        @Override
        public void onEnable() {
            main = Main.this;
            m = new Manager();
            m.saveConfig();
           
            pm.registerEvents(new Events(), this);
            new Commands(this);
           
           
            pi.ranksToPlayer();
        }
       
        @Override
        public void onDisable() {
            //setTextsFloatings("remove");
        }
       
        public static Main getPluginForMe() {
            return main;
        }
       
        public void setTextsFloatings(String option) {
            World world = Bukkit.getWorld("survival");
           
            if(option.equalsIgnoreCase("put")) {
                Location loctext1 = new Location(world, 0, 64, -6).add(0.5, 0, 0.5);
                ArmorStand text1 = (ArmorStand) world.spawnEntity(loctext1, EntityType.ARMOR_STAND);
                Location loctext2 = new Location(world, 0, 64, -6).add(0.5, -0.5, 0.5);
                ArmorStand text2 = (ArmorStand) world.spawnEntity(loctext2, EntityType.ARMOR_STAND);
               
                text1.setSmall(true);
                text1.setGravity(false);
                text1.setInvulnerable(true);
                text1.setVisible(false);
                text1.setCustomName("§3§l| • ParadiseCraft • |");
                text1.setCustomNameVisible(true);
               
                text2.setSmall(true);
                text2.setGravity(false);
                text2.setInvulnerable(true);
                text2.setVisible(false);
                text2.setCustomName("§2Hecho para los testigos de Jehová");
                text2.setCustomNameVisible(true);
            }
            if(option.equalsIgnoreCase("remove")) {
                for(Entity entity : world.getEntities()) {
                    if(entity instanceof ArmorStand) {
                        if(!entity.getCustomName().isEmpty()) {
                            entity.remove();
                        }else {
                            continue;
                        }
                    }else {
                        continue;
                    }
                }
            }
        }
       
        public void datetime() {
            DateFormat dateFormatter = new SimpleDateFormat("hh:mm:ss");
            Timer timer = new Timer();
            try {
                Date date = dateFormatter.parse("10:52:00");
                timer.schedule(new toExecute(), date);
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
       
        private static class toExecute extends TimerTask {
            public void run() {
                Bukkit.broadcastMessage("Ha comenzado");
                //worldinteractive.event_0_1();
                cancel();
            }
        }
       
        /* Fin de la clase */
    }
     
  19. Can you send a log of the server's startup?
     
  20. I used the Spigot API and it works now.
     
    • Funny Funny x 1
Thread Status:
Not open for further replies.