Cannot locate my error..

Discussion in 'Spigot Plugin Development' started by TheSupreme, Apr 18, 2017.

  1. Error.
    Code (Text):
    c133e]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_121]
    [23:45:15 WARN]: [Empires] Task #9 for Empires v1.0 generated an exception
    java.lang.NullPointerException
            at net.prickledpvp.empires.PlayerObject.setClan(PlayerObject.java:42) ~[?:?]
            at net.prickledpvp.empires.Update.update(Update.java:15) ~[?:?]
            at net.prickledpvp.empires.Main$1.run(Main.java:37) ~[?:?]
            at org.bukkit.craftbukkit.v1_11_R1.scheduler.CraftTask.run(CraftTask.java:71) ~[spigot.jar:git-Spigot-54ec0b8-1ac133e]
            at org.bukkit.craftbukkit.v1_11_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:353) [spigot.jar:git-Spigot-54ec0b8-1ac133e]
            at net.minecraft.server.v1_11_R1.MinecraftServer.D(MinecraftServer.java:738) [spigot.jar:git-Spigot-54ec0b8-1ac133e]
            at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:399) [spigot.jar:git-Spigot-54ec0b8-1ac133e]
            at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:678) [spigot.jar:git-Spigot-54ec0b8-1ac133e]
            at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:576) [spigot.jar:git-Spigot-54ec0b8-1ac133e]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_121]
    [23:45:16 WARN]: [Empires] Task #9 for Empires v1.0 generated an exception
    java.lang.NullPointerException
            at net.prickledpvp.empires.PlayerObject.setClan(PlayerObject.java:42) ~[?:?]
            at net.prickledpvp.empires.Update.update(Update.java:15) ~[?:?]
            at net.prickledpvp.empires.Main$1.run(Main.java:37) ~[?:?]
            at org.bukkit.craftbukkit.v1_11_R1.scheduler.CraftTask.run(CraftTask.java:71) ~[spigot.jar:git-Spigot-54ec0b8-1ac133e]
            at org.bukkit.craftbukkit.v1_11_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:353) [spigot.jar:git-Spigot-54ec0b8-1ac133e]
            at net.minecraft.server.v1_11_R1.MinecraftServer.D(MinecraftServer.java:738) [spigot.jar:git-Spigot-54ec0b8-1ac133e]
            at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:399) [spigot.jar:git-Spigot-54ec0b8-1ac133e]
            at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:678) [spigot.jar:git-Spigot-54ec0b8-1ac133e]
            at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:576) [spigot.jar:git-Spigot-54ec0b8-1ac133e]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_121]
    [23:45:17 WARN]: [Empires] Task #9 for Empires v1.0 generated an exception
    java.lang.NullPointerException
            at net.prickledpvp.empires.PlayerObject.setClan(PlayerObject.java:42) ~[?:?]
            at net.prickledpvp.empires.Update.update(Update.java:15) ~[?:?]
            at net.prickledpvp.empires.Main$1.run(Main.java:37) ~[?:?]
            at org.bukkit.craftbukkit.v1_11_R1.scheduler.CraftTask.run(CraftTask.java:71) ~[spigot.jar:git-Spigot-54ec0b8-1ac133e]
            at org.bukkit.craftbukkit.v1_11_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:353) [spigot.jar:git-Spigot-54ec0b8-1ac133e]
            at net.minecraft.server.v1_11_R1.MinecraftServer.D(MinecraftServer.java:738) [spigot.jar:git-Spigot-54ec0b8-1ac133e]
            at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:399) [spigot.jar:git-Spigot-54ec0b8-1ac133e]
            at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:678) [spigot.jar:git-Spigot-54ec0b8-1ac133e]
            at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:576) [spigot.jar:git-Spigot-54ec0b8-1ac133e]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_121]
    ClanManager
    Code (Text):

    public static void clanSetup()
        {

            /* If this pathname does not denote a directory, then listFiles() returns null. */
            File[] files = new File("plugins/Empires/ClanObjects").listFiles();

            for (File f : files) {
               if (f.isFile()) {
                  String tId = f.getName().substring(0, f.getName().length() - 4);
                    if (!Clans.containsKey(tId)){
                        Clans.put(tId, new ClanObject(tId));  
                    }        
               }
            }
        }
    ClanObject
    Code (Text):
        /* INIT */
        public ClanObject(String clanId) {  
            Id = clanId;
            file = new File("plugins/Empires/ClanObjects", Id + ".yml");
            config = YamlConfiguration.loadConfiguration(file);
        }
    PlayerObject
    Code (Text):
        /* CLAN */
        public void setClan(String arg)
        {
            String id = "";
           
            for(Entry<String, ClanObject> entry : ClanManager.Clans.entrySet()) {
                ClanObject clanObject = entry.getValue();
                if (clanObject.getName().equals(arg))
                    id = clanObject.Id;
            }
            System.out.println(arg);
            System.out.println(id);
            config.set("Clan.Name", arg);
            config.set("Clan.Id", id);
            saveObject();
        }