Solved Error occured while enabling Plugin (Is it up to date?)...

Discussion in 'Plugin Development' started by Bladibudies, Jan 23, 2016.

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

    Bladibudies

    When I start my server, I get this error in the console:
    Code:
    [14:31:48] [Server thread/INFO]: Starting minecraft server version 1.8.8
    [14:31:48] [Server thread/INFO]: Loading properties
    [14:31:48] [Server thread/INFO]: Default game type: SURVIVAL
    [14:31:48] [Server thread/INFO]: Generating keypair
    [14:31:49] [Server thread/INFO]: Starting Minecraft server on *:25565
    [14:31:49] [Server thread/INFO]: Using default channel type
    [14:31:50] [Server thread/INFO]: This server is running CraftBukkit version git-Bukkit-07c3001 (MC: 1.8.8) (Implementing API version 1.8.8-R0.1-SNAPSHOT)
    [14:31:51] [Server thread/WARN]: [MeiCraftCTW] Default system encoding may have misread config.yml from plugin jar
    [14:31:51] [Server thread/INFO]: [MeiCraftCTW] Loading MeiCraftCTW v1.0
    [14:31:51] [Server thread/INFO]: [WorldEdit] Loading WorldEdit v6.1;no_git_id
    [14:31:51] [Server thread/INFO]: Preparing level "world"
    [14:31:51] [Server thread/INFO]: Preparing start region for level 0 (Seed: -514624657721392316)
    [14:31:52] [Server thread/INFO]: Preparing spawn area: 12%
    [14:31:53] [Server thread/INFO]: Preparing spawn area: 38%
    [14:31:54] [Server thread/INFO]: Preparing spawn area: 92%
    [14:31:54] [Server thread/INFO]: Preparing start region for level 1 (Seed: -514624657721392316)
    [14:31:55] [Server thread/INFO]: Preparing spawn area: 31%
    [14:31:56] [Server thread/INFO]: Preparing spawn area: 67%
    [14:31:57] [Server thread/INFO]: Preparing start region for level 2 (Seed: -514624657721392316)
    [14:31:58] [Server thread/INFO]: [MeiCraftCTW] Enabling MeiCraftCTW v1.0
    [14:31:58] [Server thread/INFO]: [MeiCraftCTW] has been enabled successfully!
    [14:31:58] [Server thread/ERROR]: Error occurred while enabling MeiCraftCTW v1.0 (Is it up to date?)
    java.lang.NullPointerException
        at meicraft.ctw.main.JoinArena.<init>(JoinArena.java:89) ~[?:?]
        at meicraft.ctw.main.Main.onEnable(Main.java:33) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[spigot.jar:git-Bukkit-07c3001]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [spigot.jar:git-Bukkit-07c3001]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:404) [spigot.jar:git-Bukkit-07c3001]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:342) [spigot.jar:git-Bukkit-07c3001]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:314) [spigot.jar:git-Bukkit-07c3001]
        at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:406) [spigot.jar:git-Bukkit-07c3001]
        at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:370) [spigot.jar:git-Bukkit-07c3001]
        at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:325) [spigot.jar:git-Bukkit-07c3001]
        at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:235) [spigot.jar:git-Bukkit-07c3001]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:504) [spigot.jar:git-Bukkit-07c3001]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_65]
    [14:31:58] [Server thread/INFO]: [WorldEdit] Enabling WorldEdit v6.1;no_git_id
    [14:31:59] [Server thread/INFO]: WEPIF: Using the Bukkit Permissions API.
    [14:31:59] [Server thread/INFO]: [WorldEdit] Using com.sk89q.worldedit.bukkit.adapter.impl.Spigot_v1_8_R3 as the Bukkit adapter
    [14:31:59] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
    [14:31:59] [Server thread/INFO]: Done (8,248s)! For help, type "help" or "?"
    This is my main.java:
    Code:
    package meicraft.ctw.main;
    
    import org.bukkit.Bukkit;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    
    import meicraft.ctw.main.JoinArena;
    import meicraft.ctw.main.InGame;
    
    public class Main extends JavaPlugin{
       
        String prefix = getConfig().getString("prefix");
       
        public void loadConfig(){
            getConfig().options().copyHeader(true);
            getConfig().options().copyDefaults(true);
            saveConfig();
        }
        private static Main instance;
        public void log(String string) {
            System.out.println(string);
        }
        public static Main getInstance(){
            return instance;
        }
        @Override
        public void onEnable(){
            getLogger().info("has been enabled successfully!");
            instance = this;
            loadConfig();
            Bukkit.getServer().getPluginManager().registerEvents(new JoinArena(), this);
            Bukkit.getServer().getPluginManager().registerEvents(new InGame(), this);
        }
        @Override
        public void onDisable(){
            getLogger().info("has been disabled successfully");
            instance = null;
        }
       
        public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[]args){
           
            if(cmd.getName().equalsIgnoreCase("ctw") && sender instanceof Player){
               
                Player p = (Player) sender;
                int tam = args.length;
                    if (tam == 1){
                    if (p.hasPermission("ctw.admin")){
                        if(args[0].equalsIgnoreCase("setlobby")){
                            getConfig().set("Lobby.X", p.getLocation().getX());
                            getConfig().set("Lobby.Y", p.getLocation().getY());
                            getConfig().set("Lobby.Z", p.getLocation().getZ());
                            getConfig().set("Lobby.Yaw", p.getLocation().getYaw());
                            getConfig().set("Lobby.Pitch", p.getLocation().getPitch());
                            p.sendMessage(prefix + " §aCTW Lobby colocado correctamente!");
                            }
                    if(args[0].equalsIgnoreCase("arena1")){
                        if(args[1].equalsIgnoreCase("setspawn1")){
                                getConfig().set("Arena01.X1", p.getLocation().getX());
                                getConfig().set("Arena01.Y1", p.getLocation().getY());
                                getConfig().set("Arena01.Z1", p.getLocation().getZ());
                                getConfig().set("Arena01.Yaw1", p.getLocation().getYaw());
                                getConfig().set("Arena01.Pitch1", p.getLocation().getPitch());
                                p.sendMessage(prefix + " §aSpawnpoint 1 de la Arena01 colocado correctamente!");
                                }
                        if(args[1].equalsIgnoreCase("setspawn2")){
                                getConfig().set("Arena01.X2", p.getLocation().getX());
                                getConfig().set("Arena01.Y2", p.getLocation().getY());
                                getConfig().set("Arena01.Z2", p.getLocation().getZ());
                                getConfig().set("Arena01.Yaw2", p.getLocation().getYaw());
                                getConfig().set("Arena01.Pitch2", p.getLocation().getPitch());
                                p.sendMessage(prefix + " §aSpawnpoint 2 de la Arena01 colocado correctamente!");
                            }
                        } if(args[0].equalsIgnoreCase("reload"))reloadConfig();
                    } else p.sendMessage(prefix + "§cNo tienes permiso!");
                }
            }
            return false;
        }
    }
    
     
  2. Offline

    Zombie_Striker

    Can we see join arena? Something there is null at line 89.
     
  3. Offline

    Bladibudies

    @Zombie_Striker JoinArena.java class:
    Code:
    package meicraft.ctw.main;
    
    import java.util.HashMap;
    import java.util.Random;
    
    import org.bukkit.Bukkit;
    import org.bukkit.GameMode;
    import org.bukkit.Location;
    import org.bukkit.Material;
    import org.bukkit.block.Sign;
    import org.bukkit.entity.Entity;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.Action;
    import org.bukkit.event.block.SignChangeEvent;
    import org.bukkit.event.inventory.InventoryClickEvent;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.inventory.Inventory;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.meta.ItemMeta;
    
    import meicraft.ctw.main.Main;
    
    public class JoinArena implements Listener{
       
        public void onComplete(){
            int x1 = instance1.getConfig().getInt("Arena01.X1"), y1 = instance1.getConfig().getInt("Arena01.Y1"), z1 = instance1.getConfig().getInt("Arena01.Z1"), p1 = instance1.getConfig().getInt("Arena01.Pitch1"), yaw1 = instance1.getConfig().getInt("Arena01.Yaw1");
            int x2 = instance1.getConfig().getInt("Arena01.X2"), y2 = instance1.getConfig().getInt("Arena01.Y2"), z2 = instance1.getConfig().getInt("Arena01.Z2"), p2 = instance1.getConfig().getInt("Arena01.Pitch2"), yaw2 = instance1.getConfig().getInt("Arena01.Yaw2");
            Player worldplayers = (Player) Bukkit.getWorld("CTW").getPlayers();
            if (intctw1 > 1 & intctw2 > 1){
                worldplayers.sendMessage(prefix + "§a§lEquipos completos! Comenzando la partida :D");
                worldplayers.sendMessage(prefix + "§a§lLa partida comenzara en 15 segundos!");
                try {
                    Thread.sleep(10000);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                worldplayers.sendMessage(prefix + "§a§lLa partida comenzara en 5 segundos!");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e4) {
                    // TODO Auto-generated catch block
                    e4.printStackTrace();
                }
                worldplayers.sendMessage(prefix + "§a§lLa partida comenzara en 4 segundos!");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e3) {
                    // TODO Auto-generated catch block
                    e3.printStackTrace();
                }
                worldplayers.sendMessage(prefix + "§a§lLa partida comenzara en 3 segundos!");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e2) {
                    // TODO Auto-generated catch block
                    e2.printStackTrace();
                }
                worldplayers.sendMessage(prefix + "§a§lLa partida comenzara en 2 segundos!");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                }
                worldplayers.sendMessage(prefix + "§a§lLa partida comenzara en 1 segundo!");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                worldplayers.sendMessage(prefix + "§a§lLa partida ha comenzado!");
                if (onRed.containsValue(worldplayers.getName())){
                    worldplayers.teleport((Entity) new Location(worldplayers.getWorld(), x1, y1, z1, p1, yaw1));
                    worldplayers.getInventory().clear();
                    worldplayers.setFlying(false);
                }
                if (onBlue.containsValue(worldplayers.getName())){
                    worldplayers.teleport((Entity) new Location(worldplayers.getWorld(), x2, y2, z2, p2, yaw2));
                    worldplayers.getInventory().clear();
                    worldplayers.setFlying(false);
                }
            }
        }
       
        String prefix = instance1.getConfig().getString("prefix");
       
        HashMap<String, String> inctwarena = new HashMap<String, String>();
        HashMap<String, String> onRed = new HashMap<String, String>();
        HashMap<String, String> onBlue = new HashMap<String, String>();
        int intctw1;
        int intctw2;
       
        private static Main instance1;
        public void log(String string) {
            System.out.println(string);   
            }
        public static Main getInstance(){
            return instance1;
        }
        public int numero1 = 0;
       
        @EventHandler
        public void SignChange(SignChangeEvent e){
            if (e.getPlayer().hasPermission("ctw.admin")){
                if(e.getLine(0).equalsIgnoreCase("CTW")) {
                    if (e.getLine(1).isEmpty()){
                        if (e.getLine(2).isEmpty()){
                            if (e.getLine(3).isEmpty()){
                                e.setLine(0, "§b§l[CTW DUO]");
                                e.setLine(1, "§2Esperando");
                                e.setLine(3, "§8" + numero1 + " §8Jugadores");
                                e.getPlayer().sendMessage(prefix + " §aCartel de CTW creado correctamente!");
                            }}}}}}
        @EventHandler
        public void onClick(PlayerInteractEvent e){
    
            Random random = new Random();
            int redteam;
           
            if (e.getPlayer().hasPermission("ctw.join")){
                if (!(e.getAction() == Action.RIGHT_CLICK_BLOCK))return;
                if (e.getClickedBlock().getState() instanceof Sign){
                    Sign letrerodeinteract = (Sign) e.getClickedBlock().getState();
                    if (letrerodeinteract.getLine(0).equalsIgnoreCase("§b§l[CTW DUO]")){
                        letrerodeinteract.setLine(3, "§8" + numero1 + " §8Jugadores");
                        letrerodeinteract.update();
                        int x1 = instance1.getConfig().getInt("Arena01.X1"), y1 = instance1.getConfig().getInt("Arena01.Y1"), z1 = instance1.getConfig().getInt("Arena01.Z1");
                        e.getPlayer().teleport((Entity) new Location(e.getPlayer().getWorld(), x1, y1, z1));
                        e.getPlayer().setGameMode(GameMode.SURVIVAL);
                        e.getPlayer().setFlying(true);
                        ItemStack ct = new ItemStack (Material.BOOK);
                        ItemMeta ctm = ct.getItemMeta();
                        ctm.setDisplayName("§aSelector de equipo");
                        ct.setItemMeta(ctm);
                        e.getPlayer().getInventory().addItem(ct);
                        //METER AL JUGADOR EN UN EQUIPO ALEATORIO
                        for(int teamred =1; teamred<=1;teamred++){
                            redteam = 1+random.nextInt(2);
                            if (redteam == 1){
                                if(intctw1 < 3){
                                    Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard teams join rojo " + e.getPlayer().getName());
                                    intctw1 = intctw1 + 1;
                                    inctwarena.put(e.getPlayer().getName(), null);
                                    onRed.put(e.getPlayer().getName(), null);
                                    e.getPlayer().sendMessage(prefix + "§cHas entrado al equipo rojo!");
                                }  else if (redteam==2){
                                if(intctw2 < 3){
                                    Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard teams join azul " + e.getPlayer().getName());
                                    intctw2 = intctw2 + 1;
                                    onBlue.put(e.getPlayer().getName(), null);
                                    inctwarena.put(e.getPlayer().getName(), null);
                                    e.getPlayer().sendMessage(prefix + "§9Has entrado al equipo azul!");
                                }}}}}}}}
        private void TeamSelector(Player p){
            Inventory TeamSelector = Bukkit.createInventory(null, 27, "§8Selector de team");
    
            ItemStack rojo = new ItemStack (Material.WOOL, 1, (byte)14);
            ItemMeta rmeta = rojo.getItemMeta();
            ItemStack azul = new ItemStack (Material.WOOL, 1, (byte)11);
            ItemMeta ameta = azul.getItemMeta();
    
            rmeta.setDisplayName("§cEquipo Rojo");
            rojo.setItemMeta(rmeta);
            ameta.setDisplayName("§bEquipo Azul");
            azul.setItemMeta(ameta);
    
            TeamSelector.setItem(11, rojo);
            TeamSelector.setItem(15, azul);
    
            p.openInventory(TeamSelector);
        }
        @EventHandler
        public void onClick(InventoryClickEvent e){
            Player p = (Player) e.getWhoClicked();
            if (e.getInventory().getTitle()=="§8Selector de team"){
                //Entrar al equipo rojo
                if (e.getSlot()==11){
                    if(onRed.containsValue(e.getWhoClicked().getName())){
                        onRed.remove(e.getWhoClicked().getName(), null);
                        intctw1 = intctw1 - 1;
                        e.getWhoClicked().sendMessage(prefix + "§cHas entrado al equipo rojo!");
                        intctw1 = intctw1 + 1;
                        onRed.put(e.getWhoClicked().getName(), null);
                        Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard teams join rojo " + e.getWhoClicked().getName());
                    } else if(onBlue.containsValue(e.getWhoClicked().getName())){
                        onBlue.remove(e.getWhoClicked().getName(), null);
                        intctw2 = intctw2 - 1;
                        e.getWhoClicked().sendMessage(prefix + "§cHas entrado al equipo rojo!");
                        intctw1 = intctw1 + 1;
                        onRed.put(e.getWhoClicked().getName(), null);
                        Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard teams join rojo " + e.getWhoClicked().getName());
                    }
                    p.closeInventory();
                //Entrar al equipo azul
                } else if (e.getSlot()==15){
                    if(onRed.containsValue(e.getWhoClicked().getName())){
                        onRed.remove(e.getWhoClicked().getName(), null);
                        intctw1 = intctw1 - 1;
                        e.getWhoClicked().sendMessage(prefix + "§bHas entrado al equipo azul!");
                        intctw2 = intctw2 + 1;
                        onBlue.put(e.getWhoClicked().getName(), null);
                        Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard teams join azul " + e.getWhoClicked().getName());
                    } else if(onBlue.containsValue(e.getWhoClicked().getName())){
                        onBlue.remove(e.getWhoClicked().getName(), null);
                        intctw2 = intctw2 - 1;
                        e.getWhoClicked().sendMessage(prefix + "§bHas entrado al equipo azul!");
                        intctw2 = intctw2 + 1;
                        onBlue.put(e.getWhoClicked().getName(), null);
                        Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard teams join azul " + e.getWhoClicked().getName());
                    }
                    p.closeInventory();
                }
            }
        }
        @EventHandler
        public void onUse(PlayerInteractEvent e){
            Player p = e.getPlayer();
         if (p.hasPermission("ctw.chooseteam")){
                if(p.getItemInHand().getType() == Material.BOOK){
                    if (p.getWorld() == Bukkit.getWorld("CTW")){
                        TeamSelector(p);
                    }}}}
    }
     
  4. Offline

    teej107

  5. Offline

    Zombie_Striker

    Initialization occurs right when the class is created. Not a single method has ran when initialization occurs. "instance1" is not set to anything, and prefix is trying to access instance1 before it is even equal to anything. Set prefix to whatever is in the config after instance1 is equal to something.
     
  6. Offline

    Bladibudies

    @Zombie_Striker Like this?
    Code:
    public class Main extends JavaPlugin{
       
        public void loadConfig(){
            getConfig().options().copyHeader();
            getConfig().options().copyDefaults();
            saveConfig();
        }
        private static Main instance;
        public void log(String string) {
            System.out.println(string);
        }
        public static Main getInstance(){
            return instance;
        }
        @Override
        public void onEnable(){
            getLogger().info("has been enabled successfully!");
            instance = this;
            loadConfig();
            Bukkit.getServer().getPluginManager().registerEvents(new JoinArena(), this);
            Bukkit.getServer().getPluginManager().registerEvents(new InGame(), this);
        }
        @Override
        public void onDisable(){
            getLogger().info("has been disabled successfully");
            instance = null;
        }
       
        String prefix = getConfig().getString("prefix");
        
     
  7. Offline

    Zombie_Striker

    @Bladibudies
    I guess that could work.

    BTW: Why do you have a static instance of Main inside the main class? There is no reason for you to use static instead of passing the instance of Main through constructors. Remove those static methods and just pass the instance between classes.
     
  8. Offline

    Bladibudies

    @Zombie_Striker No, It doesn't work, the same error. / Ok, I removed it.
    Code:
    [15:44:49] [Server thread/INFO]: [MeiCraftCTW] Enabling MeiCraftCTW v1.0
    [15:44:49] [Server thread/INFO]: [MeiCraftCTW] has been enabled successfully!
    [15:44:49] [Server thread/ERROR]: Error occurred while enabling MeiCraftCTW v1.0 (Is it up to date?)
    java.lang.NullPointerException
        at meicraft.ctw.main.JoinArena.<init>(JoinArena.java:98) ~[?:?]
        at meicraft.ctw.main.Main.onEnable(Main.java:31) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[spigot.jar:git-Bukkit-07c3001]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [spigot.jar:git-Bukkit-07c3001]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:404) [spigot.jar:git-Bukkit-07c3001]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:342) [spigot.jar:git-Bukkit-07c3001]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:314) [spigot.jar:git-Bukkit-07c3001]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.reload(CraftServer.java:720) [spigot.jar:git-Bukkit-07c3001]
        at org.bukkit.Bukkit.reload(Bukkit.java:544) [spigot.jar:git-Bukkit-07c3001]
        at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25) [spigot.jar:git-Bukkit-07c3001]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:140) [spigot.jar:git-Bukkit-07c3001]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:620) [spigot.jar:git-Bukkit-07c3001]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchServerCommand(CraftServer.java:606) [spigot.jar:git-Bukkit-07c3001]
        at net.minecraft.server.v1_8_R3.DedicatedServer.aO(DedicatedServer.java:372) [spigot.jar:git-Bukkit-07c3001]
        at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:336) [spigot.jar:git-Bukkit-07c3001]
        at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:629) [spigot.jar:git-Bukkit-07c3001]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:537) [spigot.jar:git-Bukkit-07c3001]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_65]
     
  9. Offline

    mcdorli

    Actually, he uses a "rare" technique called singleton. Singleton is a class, wich can only be created once. These lasses include a static instance of themself, and a static "getInstance" method, wich returns the above mentioned instance.

    In my opinion, this is only a lazy way to get around passing the class' instance in constructors.

    Even IntelliJ has a template, to create a Singleton class. I'm amazed.
     
    Zombie_Striker likes this.
  10. Offline

    Zombie_Striker

    @mcdorli
    True, it does exist and on occasions it can be useful (instead of passing a single instance between several classes that may not need it, you can just grab the instance from the class that needs it), in this case it is just lazy and create unnecessary static objects and methods.

    @Bladibudies
    Can you show us what line 98 is?
     
  11. Offline

    Bladibudies

    @Zombie_Striker Thanks for the help! My error was that I putted the "String prefix = instance2.getConfig().getString("prefix");" in the line 32, now I putted it in all the EventHandlers and commands using it. And that solves the error :D

    @Zombie_Striker But, now I have another error! How can I getConfig from a class that doesn't extends JavaPlugin?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jan 23, 2016
  12. Offline

    Zombie_Striker

    @Bladibudies
    You need to pass the instance that does extend Java plugin around using constructors. If you do not know what a constructor is/ how to pass objects around using constructors, use google. There should be a dozen pages explaining better than I could in a post.
     
Thread Status:
Not open for further replies.

Share This Page