Solved Copying list, Not working / not saving in configuration file

Discussion in 'Spigot Plugin Development' started by Yorick, Oct 10, 2017.

Thread Status:
Not open for further replies.
  1. Hi people of spigot.

    It has been a long time ago when i posted a forum on the spigot forums.

    I made a custom plugin but for a section to make it work i need to copy a list thats some where else in my condifg in to a other section of my config. A lot of the things work of it but i doesn't save it in the config the copyied.

    Code (Text):

    Islands:
    - Beta <Edited>
    - Canity
    - Gargot

    Island:
      Beta:
          OtherIslandNames:
           - Canity
      Canity
         OtherIslandNames:
           - Beta
       Gargot
          - Beta
          - Canity
    Players:
        893737-389373ed-3he73ydh3
             Island: Beta
        12938dhn-39ked-3he73ydh3
             Island: Canity
        63hdy33-jd8437d-3he73ydh3
             Island: Gargot
     
    Thats my config how it should look like if it works. When a player opens a GUI it updates there OtherIslandNames to the new names - there own so it won't put that one in this is the code for that section i only put in the important part for what i get an error in the GUI opening the rest of it works fine.

    Code (Text):

          String islandname = Core.getInstance().getConfig().getString("Players." + playerUUID + ".Island");
          int start = 10;
          List<String> AllIslands = Core.getInstance().getConfig().getStringList("Islands");
       
          if(Core.getInstance().getConfig().getString("Island." + islandname + ".OtherIslandNames") == null) {
              System.out.println("A players has tried to load WareFare but doesn't hase any island to see.");
          }
       
          ArrayList<String> Islands = (ArrayList<String>) Core.getInstance().getConfig().getStringList("Island." + islandname + ".OtherIslandNames");
          Islands.add(AllIslands + "");
          Islands.remove(islandname + "");
       
          System.out.println(AllIslands + "");
          System.out.println(Islands + "");
       
          Core.getInstance().saveConfig();
     
    This is what i get if the code has been runned

    Code (Text):

    [15:54:48 INFO]: [Beta, Vanity, Gargot]
    [15:54:48 INFO]: [[Beta, Vanity, Gargot]]
     
    The GUI just works fine but if i check my Config to look it says do you want to reload? i reload ky config and then i do ctrl + f to search for OtherIslandNames and it doesn't find it.
     
    #1 Yorick, Oct 10, 2017
    Last edited: Oct 11, 2017 at 6:21 AM
  2. Don’t know if this is the source of your issue but you have “Beat” in the Islands section and “Beta” in the other.


    Sent from my iPhone using Tapatalk
     
  3. I see but Beat was i mis typo from me :(. I edited so its correct now but i think it is in that section of the code because the rest of the code is an loop that goes thro the list thats should have been created. But it doesn't create it in the config if i place it manualy and update it with the opening of the GUI it just disepears its gone of the config so the loop can't find it and won't loop anything of the list so the GUI stays empty. If you need anyone other code just ask me to post it. Thanks for the reply
     
  4. I have changed my code to loop throug the list and add them 1 by 1 but i still have 1 problem.
    it doesn't save in the configuration if i use System.out.PrintIN(); and then the variable for the list it gives me the name of the island
    that should be in the list but it won't set it in the configuration so the next if statement to check if the list is there detects null so it doesn't load
    the islands because the vaule is null.

    My changed code:
    Code (Text):

          String islandname = Core.getInstance().getConfig().getString("Players." + playerUUID + ".Island");
          int start = 10;
         
          ArrayList<String> Islands = (ArrayList<String>) Core.getInstance().getConfig().getStringList("Island." + islandname + ".WareFare");
         
          for(String msg : Core.getInstance().getConfig().getStringList("Islands")) {
              Islands.add(msg + "");
              Islands.remove(islandname + "");
             
          }
         
          System.out.println(Islands + "");
         
          if(Core.getInstance().getConfig().getString("Island." + islandname + ".WareFare") == null) {
              System.out.println("A players has tried to load WareFare but doesn't hase any island to see.");
              return true;
          }
     
     
  5. Do you use somethink like this ?
    Code (Text):
    config.saveConfig();
    Because if not, it's normal that your data isn't written in your file...
     
  6. Yhea at the end when its done it saves the config.
     
  7. OK great ! So now if i correctly understood you, you want these two lines to be the same ?
    Code (Text):
    [15:54:48 INFO]: [Beta, Vanity, Gargot]
    [15:54:48 INFO]: [[Beta, Vanity, Gargot]]
     
  8. Yhea i changed my code a bit in the post a bove as you can see and i get a new System out put. it out puts that it has succeded and it set Vanity an Gargot in your setup because it removed ytour island name out of the list.
     
  9. OK, so what's the problem right now ?
     
  10. Its does every thing but if i open my configuration file afther i executed the command that runs the copying list.. it ins't in the configuration.
    but from the console System.out/Printin it is in the configuration... so it isn't visual saved so the next part gets a null value
     
  11. OK, so put the entire code with your saving ways (with a spoiler) ;)
     
  12. Hope you can help me with it :D

    Code (Text):

    package yorick.dyeclash.GUI;

    import java.util.ArrayList;
    import java.util.List;
    import java.util.UUID;

    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.DyeColor;
    import org.bukkit.Material;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.event.Listener;
    import org.bukkit.inventory.Inventory;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.meta.ItemMeta;

    import dyeclash.yorick.Core;

    public class WareFare
      implements CommandExecutor, Listener
    {
      public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
      {
        if (commandLabel.equalsIgnoreCase("warefare"))
        {
          Inventory inv = Bukkit.createInventory(null, 45, ChatColor.BOLD + "WareFare");
         
          Player player = (Player)sender;

          UUID playerUUID = player.getUniqueId();

          List<String> buildingm = new ArrayList<String>();
          buildingm.add(" ");
          buildingm.add(cc("&7► Edit global announcements for your island."));
          buildingm.add(cc("&7► Players will see there on login."));

          List<String> playerm = new ArrayList<String>();
          playerm.add(" ");
          playerm.add(cc("&7► Control how new recruits join!"));
          playerm.add(cc("&7► Currently: &c&lUnknown"));

          List<String> warefarm = new ArrayList<String>();
          warefarm.add(" ");
          warefarm.add(cc("&7► Browse new recruits that you wish to join!"));
          warefarm.add(cc("&7► This is how new members join a island."));

          List<String> mainmenu = new ArrayList<String>();
          mainmenu.add(cc(" "));
          mainmenu.add(cc("&7► Go back to the Main Menu"));

          ItemStack mm = new ItemStack(Material.PAINTING);
          ItemMeta meta1 = mm.getItemMeta();
          meta1.setLore(mainmenu);
          meta1.setDisplayName(cc("&9&lMain Menu"));
          mm.setItemMeta(meta1);

          ItemStack Cancel = new ItemStack(Material.WOOL, 1, (short)14);
          ItemMeta meta = Cancel.getItemMeta();
          meta.setLore(buildingm);
          meta.setDisplayName(cc("&c&l<< Cancel >>"));
          Cancel.setItemMeta(meta);

          ItemStack Yes = new ItemStack(Material.WOOL, 1, (short)5);
          ItemMeta meta3 = Yes.getItemMeta();
          meta3.setLore(warefarm);
          meta3.setDisplayName(cc("&9&l<< Confirm >> "));
          Yes.setItemMeta(meta3);

          @SuppressWarnings("deprecation")
        ItemStack pane = new ItemStack(Material.STAINED_GLASS_PANE, 1, DyeColor.GRAY.getData());
          ItemMeta meta4 = pane.getItemMeta();
          pane.setItemMeta(meta4);

          inv.setItem(0, mm);
          inv.setItem(1, pane);
          inv.setItem(2, pane);
          inv.setItem(3, pane);
          inv.setItem(4, pane);
          inv.setItem(5, pane);
          inv.setItem(6, pane);
          inv.setItem(7, pane);
          inv.setItem(8, pane);
          inv.setItem(9, pane);
         
          String islandname = Core.getInstance().getConfig().getString("Players." + playerUUID + ".Island");
          int start = 10;
         
          ArrayList<String> Islands = (ArrayList<String>) Core.getInstance().getConfig().getStringList("Island." + islandname + ".WareFare");
         
          for(String msg : Core.getInstance().getConfig().getStringList("Islands")) {
              Islands.add(msg + "");
              Islands.remove(islandname + "");
             
          }
         
          Core.getInstance().saveConfig();
         
          System.out.println(Islands + "");
         
          if(Core.getInstance().getConfig().getString("Island." + islandname + ".WareFare") == null) {
              System.out.println("A players has tried to load WareFare but doesn't hase any island to see.");
              return true;
          }

          for (String Name : Core.getInstance().getConfig().getStringList("Island." + islandname + ".WareFare"))
          {
            String Desc = "An random island on the map of DyeClash.";
            int Level = Core.getInstance().getConfig().getInt("Island." + Name + ".TownHall.Lvl");
            int Online = Core.getInstance().getConfig().getInt("Island." + Name + ".Online");
            int Stone = Core.getInstance().getConfig().getInt("Island." + Name + ".Stone");
            int Wood = Core.getInstance().getConfig().getInt("Island." + Name + ".Log");

            int Buildings = Core.getInstance().getConfig().getInt("Island." + islandname + ".Buildings");
           
            // islands:
            // - beta < Jouw island
            // - Vanity
            // Island
            //     beta
            //       Islandstuff
            //      WareFrareIslands:
            //      - Vanity
            //  Vanity
            //      Islandstuf
            //    WareFrareIslands:
            //      - Beta
            // Players
            //  ROMMLE UUID TYVES LANG < Jouw UUID
            //      Island: Beta

            List<String> towndesc = new ArrayList<String>();
            towndesc.add(" ");
            towndesc.add(cc("&e&nDescription"));
            towndesc.add(cc("&7► " + Desc));
            towndesc.add(" ");
            towndesc.add(cc("&e&nInformation"));
            towndesc.add(cc("&7► Online: " + Online));
            towndesc.add(cc("&7► TownHall Level: " + Level));
            towndesc.add(" ");
            towndesc.add(cc("&e&nResources"));
            towndesc.add(cc("&7► Stone: " + Stone));
            towndesc.add(cc("&7► Wood: " + Wood));
            towndesc.add(cc(" "));

            ItemStack Town = new ItemStack(Material.getMaterial(Core.getInstance().getConfig().getString("Island." + islandname + ".TownHall.Icon")));
            ItemMeta meta51 = Town.getItemMeta();
            meta51.setLore(towndesc);
            meta51.setDisplayName(cc("&9&l" + Name));
            Town.setItemMeta(meta51);

            if ((Buildings > 0) && (Buildings < 21)) {
              inv.setItem(start++, Town);
            }

          }
         
          inv.setItem(17, pane);
          inv.setItem(18, pane);
          inv.setItem(26, pane);
          inv.setItem(27, pane);
          inv.setItem(35, pane);
          inv.setItem(36, pane);
          inv.setItem(37, pane);
          inv.setItem(38, pane);
          inv.setItem(39, pane);
          inv.setItem(40, pane);
          inv.setItem(41, pane);
          inv.setItem(42, pane);
          inv.setItem(43, pane);
          inv.setItem(44, pane);
         

          player.openInventory(inv);
          return true;
        }

        if (commandLabel.equalsIgnoreCase("checkerconfirm"))
        {
          Player player = (Player)sender;
          UUID playerUUID = player.getUniqueId();

          String Island = Core.getInstance().getConfig().getString("Players." + playerUUID + ".Island");
          String building = Core.getInstance().getConfig().getString("Players." + playerUUID + ".Building");
          int stone = Core.getInstance().getConfig().getInt("Island." + Island + "." + building + ".Upgrade.Stone");
          int wood = Core.getInstance().getConfig().getInt("Island." + Island + "." + building + ".Upgrade.Wood");

          int pwood = Core.getInstance().getConfig().getInt("Island." + Island + ".Log");
          int pstone = Core.getInstance().getConfig().getInt("Island." + Island + ".Stone");

          int newstone = pstone - stone;
          int newwood = pwood - wood;

          if (building.equals("None"))
          {
            sender.sendMessage(cc(Core.getInstance().getConfig().getString("Create.NoTask")));

            return true;
          }

          if ((pwood >= wood) && (pstone >= stone))
          {
            if (stone > 0)
            {
              Core.getInstance().getConfig().set("Island." + Core.getInstance().getConfig().getString(new StringBuilder("Players.").append(playerUUID).append(".Island").toString()) + ".Stone", Integer.valueOf(newstone));
            }

            if (wood > 0)
            {
              Core.getInstance().getConfig().set("Island." + Core.getInstance().getConfig().getString(new StringBuilder("Players.").append(playerUUID).append(".Island").toString()) + ".Log", Integer.valueOf(newwood));
            }
            Core.getInstance().saveConfig();

            List<String> workbenchlore = new ArrayList<String>();
            workbenchlore.add(" ");
            workbenchlore.add(cc("&e&nDescription"));
            workbenchlore.add(cc("&7► Place some where down on your island,"));
            workbenchlore.add(cc("&7► to preview your building."));
            workbenchlore.add(cc(" "));
            workbenchlore.add(cc("&7► If the location is right Click me"));
            workbenchlore.add(cc("&7► and click on confirm in the GUI."));

            ItemStack workbench = new ItemStack(Material.WORKBENCH);
            ItemMeta metaworkbench = workbench.getItemMeta();
            metaworkbench.setDisplayName(cc("&9&l" + building + " Builder"));
            metaworkbench.setLore(workbenchlore);
            workbench.setItemMeta(metaworkbench);

            player.getInventory().addItem(new ItemStack[] { workbench });

            player.closeInventory();
          }
          else {
            sender.sendMessage(cc(Core.getInstance().getConfig().getString("Create.ToLow")).replace("%wood", wood + "").replace("%stone", stone + ""));
            player.closeInventory();
          }
          return true;
        }

        return false;
      }

      public String cc(String msg)
      {
        return ChatColor.translateAlternateColorCodes('&', msg);
      }
    }
     
     
  13. Can you send your config.yml too ? I can't do it without this file...
    EDIT: as a spoiler too ^^
     
  14. Code (Text):

    Create:
      Error: '&4Error >> &cPlease do not use more then one word.'
      Succes: '&2&lSucces >> &aWe have succesfully created your island!'
      Remove: '&2&lSucces >> &aWe have succesfully removed your island!'
      Occupied: '&4&lError >> &cThis island already exists!'
      HasIsland: '&4&lError >> &cYou already have a island!'
      Enter: '&2&lCreate >> &aPlease enter your Island name in chat!'
      Fail: '&4&lFail >> &cSorry we failed loading your island!'
      NotEnough: '&4&l Error >>&cYou do not have enough gold for an island!                      &4&l
        Error >>&c The current price of an island is &l250 gold&c.'
      NoTask: '&4&lError >>&c Sorry but we can''t find anyting you where trying to confirm,
        Sorry try again!'
      ToLow: '&4&lError>>&c you need to have &l%stone&c Stone and &l%wood &cwood.'
    Shop:
      TAKEALOOK: '&9&lMerchant >> &eTake a look at my wares...'
      WeaponSmith: '&9&lMerchant >> &eYou have purchases a &l%Item% &9for &l%Prize% &9Gold.'
      Mine: '&9&lMerchant >> &eYou have purchases a &l%Item% &9for &l%Prize% &9Gold.'
      LoggingCamp: '&9&lMerchant >> &eYou have purchases a &l%Item% &9for &l%Prize% &9Gold.'
      NotEnough: '&9&lIsland >>&e You need to have %Stone% Stone and %Wood% Wood'
    Settings:
      Open: '&9&lDyeClash >> &eYour island settings have been set to Open for everyone.'
      Invte: '&9&lDyeClash >> &eYour island settings have been set to Invite Only.'
      Closed: '&9&lDyeClash >> &eYour island settings have been set to Closed.'
      Invite: '&9&lDyeClash >> &eYour island settings have been set to Invite Only.'
    John:
      NoShip: '&9&lJohn>> &eLeave me be! I''m researching about rare islands!'
    Boat:
      Water: '&9&lBoat>>&9 By falling in the water you mist your boat...'
    Spawn:
      Succes: '&2&lSucces >> &aWe have succesfully set the load island.'
    Staff:
      NoPermission: '&4&lError >> &cYou don''t have the right permission.'
      NotImplemented: ''
    ScoreBoard:
      hub:
        Title: '&9&lDye Clash'
        '0': '&r '
        '1': '&9&lTotal Players'
        '2': '&f %server_online% / %server_max%'
        '3': '&d '
        '4': '&9&lRank'
        '5': '&f %rank%'
        '6': '&l '
        '7': '&9&lGold'
        '8': '&f %bal%'
        '9': '&7 '
        '10': '&9&lYour Island'
        '11': '&f%island%'
      Island:
        Title: '&9&lDye Clash'
        '0': '&r '
        '1': '&9&lTotal Players'
        '2': '&f %server_online% / %server_max%'
        '3': '&d '
        '4': '&9&lRank'
        '5': '&f %rank%'
        '6': '&l '
        '7': '&9&lGold'
        '8': '&f %bal%'
        '9': '&7 '
        '10': '&9&lTown Online'
        '11': '&f %TOnline% / %TMembers%'
        '12': '&f '
        '13': '&9&lTown Resources'
        '14': '&f%Stone% Stone / %Wood% Wood'
    Islands:
    - Beta
    - Vanity
    Island:
      Beta:
        GUI:
          BuildingManagement: 1
          OrderBuilding: 2
          OrderDecoration: 1
        Loaded: 0
        TownHall:
          Desc: dfsdf
          Icon: BOOK_AND_QUILL
          Lvl: 1
          NextLvl: 2
          x: 108
          y: 51
          z: 236
          Upgrade:
            Stone: 150
            Wood: 0
            Time: Unknown
        Mine:
          Desc: dfsdf
          Icon: IRON_PICKAXE
          Lvl: 1
          NextLvl: 2
          x: 184
          y: 43
          z: 117
          Upgrade:
            Stone: 0
            Wood: 120
            Time: Unknown
        LoggingCamp:
          Desc: dfsdf
          Icon: IRON_AXE
          Lvl: 1
          NextLvl: 2
          x: 222
          y: 55
          z: 248
          Upgrade:
            Stone: 0
            Wood: 120
            Time: Unknown
        WareHouse:
          Desc: dfsdf
          Icon: STORAGE_MINECART
          Lvl: 1
          NextLvl: 2
          x: 182
          y: 45
          z: 218
          Upgrade:
            Stone: 0
            Wood: 150
            Time: Unknown
        WeaponSmith:
          Name: WeaponSmith
          Desc: dfsdf
          Icon: ANVIL
          Lvl: 1
          NextLvl: 2
          x: 151
          y: 44
          z: 233
          Upgrade:
            Stone: 30
            Wood: 0
            Time: Unknown
        Armory:
          Name: Armory
          Desc: dfsdf
          Icon: CHAINMAIL_CHESTPLATE
          Lvl: 1
          NextLvl: 1
          x: 150
          y: 44
          z: 208
          Upgrade:
            Stone: 225
            Wood: 0
            Time: Unknown
          NextLvl,: 2
        WarCamp:
          Name: WarCamp
          Desc: dfsdf
          Icon: IRON_SWORD
          Lvl: 1
          NextLvl: 2
          x: 259
          y: 53
          z: 217
          Upgrade:
            Stone: 0
            Wood: 750
            Time: Unknown
          NextLvl,: 2
        Fletcher:
          Name: Fletcher
          Desc: dfsdf
          Icon: BOW
          Lvl: 1
          NextLvl: 2
          x: 0
          y: 0
          z: 0
          Upgrade:
            Stone: 225
            Wood: 0
            Time: Unknown
        WizardsTower:
          Name: WizardsTower
          Desc: dfsdf
          Icon: BOOKSHELF
          Lvl: 0
          NextLvl: 1
          x: 0
          y: 0
          z: 0
          Upgrade:
            Stone: 0
            Wood: 750
            Time: Unknown
          NextLvl,: 2
        Alchemists:
          Name: Alchemists
          Desc: dfsdf
          Icon: POTION
          Lvl: 1
          NextLvl: 1
          x: 233
          y: 54
          z: 205
          Upgrade:
            Stone: 0
            Wood: 750
            Time: Unknown
          NextLvl,: 2
        Bank:
          Name: Bank
          Desc: dfsdf
          Icon: ENDER_CHEST
          Lvl: 0
          NextLvl: 1
          x: 0
          y: 0
          z: 0
          Upgrade:
            Stone: 500
            Wood: 300
            Time: Unknown
        SiegeWorkShop:
          Name: SiegeWorkShop
          Desc: dfsdf
          Icon: TNT
          Lvl: 0
          NextLvl: 1
          x: 0
          y: 0
          z: 0
          Upgrade:
            Stone: 500
            Wood: 0
            Time: Unknown
        Tower:
          Name: Tower
          Desc: dfsdf
          Icon: SMOOTH_BRICK
          Lvl: 0
          NextLvl: 1
          x: 0
          y: 0
          z: 0
          Upgrade:
            Stone: 45
            Wood: 0
            Time: Unknown
        AirShip:
          Name: AirShip
          Desc: dfsdf
          Icon: BOAT
          Lvl: 0
          NextLvl: 1
          x: 0
          y: 0
          z: 0
          Upgrade:
            Stone: 0
            Wood: 2000
            Time: Unknown
        Pane:
          Desc: '&cYou already bought this Building'
          Icon: BARRIER
          Upgrade:
            Stone: 0
            Wood: 0
            Time: Can't Build
        ForestStatue:
          Lvl: 0
          NextLvl: 1
          x: 0
          y: 0
          z: 0
          Upgrade:
            Stone: 1500
            Wood: 1500
            Time: Unknown
        Buildings: 9
        Max:
          Logs: 300
          Stones: 300
        Stone: 68
        Log: 25
        Members: 1
        MemberNames:
        - 257ff159-a933-4034-adf6-2c17ecc6f915
        BuildingNames:
        - WizardsTower
        - SiegeWorkShop
        - Bank
        - AirShip
        Settings:
          Open: 0
          Invite: 1
          Close: 0
        Wares:
          ShieldActive: 0
          SchieldTime: 0
          Attack: 1
        Owner: YorickBM
        Online: 1
        WizardTower:
          x: 42
          y: 51
          z: 136
      Vanity:
        TownHall:
          Desc: dfsdf
          Icon: BOOK_AND_QUILL
          Lvl: 1
          NextLvl: 2
          x: 108
          y: 51
          z: 236
          Upgrade:
            Stone: 150
            Wood: 0
            Time: Unknown
        Mine:
          Desc: dfsdf
          Icon: IRON_PICKAXE
          Lvl: 1
          NextLvl: 2
          x: 184
          y: 43
          z: 117
          Upgrade:
            Stone: 0
            Wood: 120
            Time: Unknown
        LoggingCamp:
          Desc: dfsdf
          Icon: IRON_AXE
          Lvl: 1
          NextLvl: 2
          x: 222
          y: 55
          z: 248
          Upgrade:
            Stone: 0
            Wood: 120
            Time: Unknown
        WareHouse:
          Desc: dfsdf
          Icon: STORAGE_MINECART
          Lvl: 1
          NextLvl: 2
          x: 182
          y: 45
          z: 218
          Upgrade:
            Stone: 0
            Wood: 150
            Time: Unknown
        WeaponSmith:
          Name: WeaponSmith
          Desc: dfsdf
          Icon: ANVIL
          Lvl: 1
          NextLvl: 2
          x: 151
          y: 44
          z: 233
          Upgrade:
            Stone: 225
            Wood: 0
            Time: Unknown
          NextLvl,: 2
        Armory:
          Name: Armory
          Desc: dfsdf
          Icon: CHAINMAIL_CHESTPLATE
          Lvl: 0
          NextLvl: 1
          x: 150
          y: 44
          z: 208
          Upgrade:
            Stone: 225
            Wood: 0
            Time: Unknown
          NextLvl,: 2
        WarCamp:
          Name: WarCamp
          Desc: dfsdf
          Icon: IRON_SWORD
          Lvl: 0
          NextLvl: 2
          x: 259
          y: 53
          z: 217
          Upgrade:
            Stone: 0
            Wood: 750
            Time: Unknown
          NextLvl,: 2
        Fletcher:
          Name: Fletcher
          Desc: dfsdf
          Icon: BOW
          Lvl: 0
          NextLvl: 2
          x: 0
          y: 0
          z: 0
          Upgrade:
            Stone: 225
            Wood: 0
            Time: Unknown
        WizardsTower:
          Name: WizardsTower
          Desc: dfsdf
          Icon: BOOKSHELF
          Lvl: 0
          NextLvl: 1
          x: 0
          y: 0
          z: 0
          Upgrade:
            Stone: 0
            Wood: 750
            Time: Unknown
          NextLvl,: 2
        Alchemists:
          Name: Alchemists
          Desc: dfsdf
          Icon: POTION
          Lvl: 0
          NextLvl: 1
          x: 233
          y: 54
          z: 205
          Upgrade:
            Stone: 0
            Wood: 750
            Time: Unknown
          NextLvl,: 2
        Bank:
          Name: Bank
          Desc: dfsdf
          Icon: ENDER_CHEST
          Lvl: 0
          NextLvl: 1
          x: 0
          y: 0
          z: 0
          Upgrade:
            Stone: 500
            Wood: 300
            Time: Unknown
        SiegeWorkShop:
          Name: SiegeWorkShop
          Desc: dfsdf
          Icon: TNT
          Lvl: 0
          NextLvl: 1
          x: 0
          y: 0
          z: 0
          Upgrade:
            Stone: 500
            Wood: 0
            Time: Unknown
        Tower:
          Name: Tower
          Desc: dfsdf
          Icon: SMOOTH_BRICK
          Lvl: 0
          NextLvl: 1
          x: 0
          y: 0
          z: 0
          Upgrade:
            Stone: 45
            Wood: 0
            Time: Unknown
        AirShip:
          Name: AirShip
          Desc: dfsdf
          Icon: BOAT
          Lvl: 0
          NextLvl: 1
          x: 0
          y: 0
          z: 0
          Upgrade:
            Stone: 0
            Wood: 2000
            Time: Unknown
        Pane:
          Desc: '&cYou already bought this Building'
          Icon: BARRIER
          Upgrade:
            Stone: 0
            Wood: 0
            Time: Can't Build
        GUI:
          BuildingManagement: 1
          OrderBuilding: 2
          OrderDecoration: 1
        Settings:
          Open: 0
          Invite: 1
          Close: 0
        Max:
          Logs: 300
          Stones: 300
        BuildingNames:
        - Armory
        - WarCamp
        - Tower
        - Fletcher
        - WizardsTower
        - Alchemists
        - SiegeWorkShop
        - Bank
        - AirShip
        Buildings: 9
        MemberNames:
        - 4d0048cc-c3e0-4f2a-af06-ab8b2db66dbe
        Wares:
          ShieldActive: 0
          SchieldTime: 1
          Attack: 0
        Stone: 70
        Log: 100
        Online: 1
        Members: 1
        Owner: Jens00
    '0': 0
    '1': 1
    '32': '2'
    '152': '0'
    Players:
      257ff159-a933-4034-adf6-2c17ecc6f915:
        Name: YorickBM
        Island: Beta
        Statistics:
          Rank: Emperor
          Wood: 0
          Stone: 0
          Wars: 0
          Join: 1/1/2017
          Login: 1/1/2017
          Played: 1 Hours 0 Minuts
        Building: SiegeWorkShop
        Teleport: WareHouse
        Location:
          x: 0
          y: 0
          z: 0
      4d0048cc-c3e0-4f2a-af06-ab8b2db66dbe:
        Island: Vanity
        Statistics:
          Rank: Member
          Wood: 0
          Stone: 0
          Wars: 0
          Played: 1/1/2017
          Login: 1/1/2017
        Teleport: LoggingCamp
        Building: None
        Location:
          x: 147
          y: 42
          z: 215
    NONE: TownHall
    'null': 1.0.1

     

    Thats my recent config hope it helpes a bit
     
  15. I'm not 100%sure, but you might have to reload the config first. So reload it to tell it that there's new information, and then save that.
     
  16. I tried it just now and still doesn't place the list in my configuration.
     
  17. Hmm, try saving it and THEN reloading it.
     
  18. @Yorick I don't understand what you're trying to do. You're using configuration sections that are not existing
    Code (Text):
    Core.getInstance().getConfig().getString("Island." + islandname + ".WareFare)"
     
  19. @jonacroco Thats for the part in mky code for System out put and it needs to create that list but that list is not created so it return NULL
    Code (Text):

       ArrayList<String> Islands = (ArrayList<String>) Core.getInstance().getConfig().getStringList("Island." + islandname + ".WareFare");
      System.out.println(Islands + "");

     if(Core.getInstance().getConfig().getString("Island." + islandname + ".WareFare") == null) {
              System.out.println("A players has tried to load WareFare but doesn't hase any island to see.");
              return true;
          }

     
    \

    butt the system out put prints the string list without an null error :/
     
    #20 Yorick, Oct 13, 2017 at 5:48 PM
    Last edited: Oct 13, 2017 at 6:44 PM
Thread Status:
Not open for further replies.

Share This Page