Solved Error retrieving Material from Config.yml

Discussion in 'Plugin Development' started by Anonymous350, Apr 15, 2014.

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

    Anonymous350

    Hello, I'm having errors when trying to retrieve the Material from the config.yml file.

    Code:
    Code:java
    1. Material m1 = Material.getMaterial(this.getConfig().getString("Kits.kit.Item").toUpperCase());
    2. ItemStack kit1 = new ItemStack(m1);
    3. ItemMeta kit1Meta = kit1.getItemMeta();
    4. Material m2 = Material.getMaterial(this.getConfig().getString("Kits.kit2.Item").toUpperCase());
    5. ItemStack kit2 = new ItemStack(m2);
    6. ItemMeta kit2Meta = kit2.getItemMeta();
    7. Material m3 = Material.getMaterial(this.getConfig().getString("Kits.kit3.Item").toUpperCase());
    8. ItemStack kit3 = new ItemStack(m3);
    9. ItemMeta kit3Meta = kit3.getItemMeta();
    10. Material m4 = Material.getMaterial(this.getConfig().getString("Kits.kit4.Item").toUpperCase());
    11. ItemStack kit4 = new ItemStack(m4);
    12. ItemMeta kit4Meta = kit4.getItemMeta();
    13. Material m5 = Material.getMaterial(this.getConfig().getString("Kits.kit5.Item").toUpperCase());
    14. ItemStack kit5 = new ItemStack(m5);
    15. ItemMeta kit5Meta = kit5.getItemMeta();
    16. Material m6 = Material.getMaterial(this.getConfig().getString("Kits.kit6.Item").toUpperCase());
    17. ItemStack kit6 = new ItemStack(m6);
    18. ItemMeta kit6Meta = kit6.getItemMeta();
    19. Material m7 = Material.getMaterial(this.getConfig().getString("Kits.kit7.Item").toUpperCase());
    20. ItemStack kit7 = new ItemStack(m7);
    21. ItemMeta kit7Meta = kit7.getItemMeta();
    22. Material m8 = Material.getMaterial(this.getConfig().getString("Kits.kit8.Item").toUpperCase());
    23. ItemStack kit8 = new ItemStack(m8);
    24. ItemMeta kit8Meta = kit8.getItemMeta();
    25. Material m9 = Material.getMaterial(this.getConfig().getString("Kits.kit9.Item").toUpperCase());
    26. ItemStack kit9 = new ItemStack(m9);
    27. ItemMeta kit9Meta = kit9.getItemMeta();


    Config:
    PHP:
    Kits:
      
    kitArcher
        Item
    bow
      kit2
    Soldier
        Item
    iron_chestplate
      kit3
    Mage
        Item
    blaze_rod
      kit4
    Medic
        Item
    potion
      kit5
    kit5
        Item
    dirt
      kit6
    kit6
        Item
    dirt
      kit7
    kit7
        Item
    dirt
      kit8
    kit8
        Item
    dirt
      kit9
    kit9
        Item
    dirt
    Error:
    Code:
    [15:35:32 ERROR]: Could not pass event PlayerInteractEvent to KitPvP v1.7.4
    org.bukkit.event.EventException
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:320) ~[craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g
    85f5776-b3022jnks]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85
    f5776-b3022jnks]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:486) [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g
    85f5776-b3022jnks]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:471) [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g
    85f5776-b3022jnks]
            at org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory.callPlayerInte
    ractEvent(CraftEventFactory.java:195) [craftbukkit-1.7.2-R0.4-20140212.071124-2.
    jar:git-Bukkit-1.7.2-R0.3-2-g85f5776-b3022jnks]
            at org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory.callPlayerInte
    ractEvent(CraftEventFactory.java:165) [craftbukkit-1.7.2-R0.4-20140212.071124-2.
    jar:git-Bukkit-1.7.2-R0.3-2-g85f5776-b3022jnks]
            at net.minecraft.server.v1_7_R1.PlayerConnection.a(PlayerConnection.java
    :604) [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85f
    5776-b3022jnks]
            at net.minecraft.server.v1_7_R1.PacketPlayInBlockPlace.a(SourceFile:60)
    [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85f5776-b
    3022jnks]
            at net.minecraft.server.v1_7_R1.PacketPlayInBlockPlace.handle(SourceFile
    :9) [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85f57
    76-b3022jnks]
            at net.minecraft.server.v1_7_R1.NetworkManager.a(NetworkManager.java:146
    ) [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85f5776
    -b3022jnks]
            at net.minecraft.server.v1_7_R1.ServerConnection.c(SourceFile:134) [craf
    tbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85f5776-b3022j
    nks]
            at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:6
    55) [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85f57
    76-b3022jnks]
            at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:2
    50) [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85f57
    76-b3022jnks]
            at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:5
    45) [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85f57
    76-b3022jnks]
            at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java
    :457) [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85f
    5776-b3022jnks]
            at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:6
    17) [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85f57
    76-b3022jnks]
    Caused by: java.lang.NullPointerException
            at me.anonymous350.kitpvp.kitpvp.openGUI(kitpvp.java:107) ~[?:?]
            at me.anonymous350.kitpvp.kitpvp.onPlayerInteract(kitpvp.java:287) ~[?:?
    ]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0
    _21]
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0
    _21]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .7.0_21]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_21]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:318) ~[craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g
    85f5776-b3022jnks]
            ... 15 more
    >
     
  2. You have a null on line 107 of kitpvp.java. Which line is that? Either way, it'll probably be faster if you post the whole class. :)
     
  3. Offline

    Anonymous350

    AdamQpzm

    Line 107 is the following below:
    Code:java
    1. Material m1 = Material.getMaterial(this.getConfig().getString("Kits.kit.Item").toUpperCase());
     
  4. Anonymous350 Ah the very first one. Interesting. Okay, check if any of the following is true:

    • Does this.getConfig() return null?
    • Does this.getConfig().getString("Kits.kit.Item") return null?
    • Does this.getConfig().getString("Kits.kit.Item").toUpperCase() return null? (This seems unlikely)
     
  5. Offline

    Anonymous350

    AdamQpzm

    It would be caused by
    Code:
    this.getConfig().getString("Kits.kit.Item")
    Johnny Crazy

    Yeah, The config is having problems with the, Item: (itemname)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  6. Anonymous350 Most likely, yes. But don't pretend that you can be certain of that from the limited selection that's been given. :)
     
  7. Offline

    Anonymous350

    AdamQpzm

    It's been figured out that config can't get getString(Kits.kit.Item)

    Code:
    ERROR:
     
    mapping values are not allowed here
      in "<unicode string>", line 9, column 9:
            Item: bow
    AdamQpzm Johnny Crazy

    I fixed the YML file by doing the following:

    PHP:
    Kits:
      
    kitArcher
      item
    bow
      kit2
    Soldier
      item
    iron_chestplate
      kit3
    Mage
      item
    blaze_rod
      kit4
    Medic
      item
    potion
      kit5
    kit5
      item
    dirt
      kit6
    kit6
      item
    dirt
      kit7
    kit7
      item
    dirt
      kit8
    kit8
      item
    dirt
      kit9
    kit9
      item
    dirt
    but now I run into error on line 287 which would be:

    Code:java
    1. @EventHandler
    2. public void onPlayerInteract(PlayerInteractEvent event) {
    3. Action a = event.getAction();
    4. ItemStack is = event.getItem();
    5.  
    6. if (a == Action.PHYSICAL || is == null || is.getType() == Material.AIR)
    7. return;
    8.  
    9. if (is.getType() == Material.NETHER_STAR)
    10. openGUI(event.getPlayer());
    11.  
    12. }
    13.  


    Code:
    openGUI(event.getPlayer());
    Which comes from

    Code:java
    1. public void openGUI(Player player) {
    2. Inventory inv = Bukkit.createInventory(null, 27, ChatColor.BLUE + "Kit Selector");
    3.  
    4. Material m1 = Material.getMaterial(this.getConfig().getString("Kits.kit.item").toUpperCase());
    5. ItemStack kit1 = new ItemStack(m1);
    6. ItemMeta kit1Meta = kit1.getItemMeta();
    7. Material m2 = Material.getMaterial(this.getConfig().getString("Kits.kit2.item").toUpperCase());
    8. ItemStack kit2 = new ItemStack(m2);
    9. ItemMeta kit2Meta = kit2.getItemMeta();
    10. Material m3 = Material.getMaterial(this.getConfig().getString("Kits.kit3.item").toUpperCase());
    11. ItemStack kit3 = new ItemStack(m3);
    12. ItemMeta kit3Meta = kit3.getItemMeta();
    13. Material m4 = Material.getMaterial(this.getConfig().getString("Kits.kit4.item").toUpperCase());
    14. ItemStack kit4 = new ItemStack(m4);
    15. ItemMeta kit4Meta = kit4.getItemMeta();
    16. Material m5 = Material.getMaterial(this.getConfig().getString("Kits.kit5.item").toUpperCase());
    17. ItemStack kit5 = new ItemStack(m5);
    18. ItemMeta kit5Meta = kit5.getItemMeta();
    19. Material m6 = Material.getMaterial(this.getConfig().getString("Kits.kit6.item").toUpperCase());
    20. ItemStack kit6 = new ItemStack(m6);
    21. ItemMeta kit6Meta = kit6.getItemMeta();
    22. Material m7 = Material.getMaterial(this.getConfig().getString("Kits.kit7.item").toUpperCase());
    23. ItemStack kit7 = new ItemStack(m7);
    24. ItemMeta kit7Meta = kit7.getItemMeta();
    25. Material m8 = Material.getMaterial(this.getConfig().getString("Kits.kit8.item").toUpperCase());
    26. ItemStack kit8 = new ItemStack(m8);
    27. ItemMeta kit8Meta = kit8.getItemMeta();
    28. Material m9 = Material.getMaterial(this.getConfig().getString("Kits.kit9.item").toUpperCase());
    29. ItemStack kit9 = new ItemStack(m9);
    30. ItemMeta kit9Meta = kit9.getItemMeta();


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
    AdamQpzm likes this.
  8. Anonymous350 Yeah, just change it to something like:

    Code:
    kit:
      name: soldier
      item: iron_chestplate
    kit2:
      name: archer
      item: bow
    Or more simply, if you know they're only going to get 1 item per kit (which does sound strange to be honest):

    Code:
    archer: bow
    soldier: iron_chestplate
    Edit: Aha, you beat me to it. What error do you get? Post full stacktrace please (this would still probably be faster with the whole class)
     
  9. Try to use this config.yml:
    Code:
    Kits:
      - kit:
        - Item: bow
      - kit2:
        - Item: iron_chestplate
      - kit3:
        - Item: blaze_rod
      - kit4:
        - Item: potion
      - kit5:
        - Item: dirt
      - kit6:
        - Item: dirt
      - kit7:
        - Item: dirt
      - kit8:
        - Item: dirt
      - kit9:
        - Item: dirt
    
     
  10. Offline

    Anonymous350

    AdamQpzm

    This is from OpenGUI Inventory, Which when Netherstar is clicked it opens a Inventory size of 27 and you select a kit. I already have it setup... Full code: http://pastebin.com/Uwd6BfZJ
     
  11. Anonymous350 Please provide the stacktrace/error log too :)
     
  12. If you use your provided YML, you can't use Kits.kit.Item, you would have to use Kits.Item, which makes no sense,

    Use my provided YML and it should work
     
  13. Offline

    Anonymous350

    Johnny Crazy

    Fixed.

    Config:
    Code:
    Kits:
      - kit:
        - name: Archer
        - item: bow
      - kit2:
        - name: Soldier
        - item: iron_chestplate
      - kit3:
        - name: Mage
        - item: blaze_rod
      - kit4:
        - name: Medic
        - item: potion
      - kit5:
        - name: kit5
        - item: stone
      - kit6:
        - name: kit6
        - item: stone
      - kit7:
        - name: kit7
        - item: stone
      - kit8:
        - name: kit8
        - item: stone
      - kit9:
        - name: kit9
        - item: stone
    Code:
    Code:java
    1. public void openGUI(Player player) {
    2. Inventory inv = Bukkit.createInventory(null, 27, ChatColor.BLUE + "Kit Selector");
    3.  
    4. Material m1 = Material.getMaterial(this.getConfig().getString("Kits.item").toUpperCase());
    5. ItemStack kit1 = new ItemStack(m1);
    6. ItemMeta kit1Meta = kit1.getItemMeta();
    7. Material m2 = Material.getMaterial(this.getConfig().getString("Kits.item").toUpperCase());
    8. ItemStack kit2 = new ItemStack(m2);
    9. ItemMeta kit2Meta = kit2.getItemMeta();
    10. Material m3 = Material.getMaterial(this.getConfig().getString("Kits.item").toUpperCase());
    11. ItemStack kit3 = new ItemStack(m3);
    12. ItemMeta kit3Meta = kit3.getItemMeta();
    13. Material m4 = Material.getMaterial(this.getConfig().getString("Kits.item").toUpperCase());
    14. ItemStack kit4 = new ItemStack(m4);
    15. ItemMeta kit4Meta = kit4.getItemMeta();
    16. Material m5 = Material.getMaterial(this.getConfig().getString("Kits.item").toUpperCase());
    17. ItemStack kit5 = new ItemStack(m5);
    18. ItemMeta kit5Meta = kit5.getItemMeta();
    19. Material m6 = Material.getMaterial(this.getConfig().getString("Kits.item").toUpperCase());
    20. ItemStack kit6 = new ItemStack(m6);
    21. ItemMeta kit6Meta = kit6.getItemMeta();
    22. Material m7 = Material.getMaterial(this.getConfig().getString("Kits.item").toUpperCase());
    23. ItemStack kit7 = new ItemStack(m7);
    24. ItemMeta kit7Meta = kit7.getItemMeta();
    25. Material m8 = Material.getMaterial(this.getConfig().getString("Kits.item").toUpperCase());
    26. ItemStack kit8 = new ItemStack(m8);
    27. ItemMeta kit8Meta = kit8.getItemMeta();
    28. Material m9 = Material.getMaterial(this.getConfig().getString("Kits.item").toUpperCase());
    29. ItemStack kit9 = new ItemStack(m9);
    30. ItemMeta kit9Meta = kit9.getItemMeta();
    31.  
    32. kit1Meta.setDisplayName(ChatColor.GREEN + getConfig().getString("Kits.name"));
    33. kit1.setItemMeta(kit1Meta);
    34.  
    35. kit2Meta.setDisplayName(ChatColor.GREEN + getConfig().getString("Kits.name"));
    36. kit2.setItemMeta(kit2Meta);
    37.  
    38. kit3Meta.setDisplayName(ChatColor.GREEN + getConfig().getString("Kits.name"));
    39. kit3.setItemMeta(kit3Meta);
    40.  
    41. kit4Meta.setDisplayName(ChatColor.GREEN + getConfig().getString("Kits.name"));
    42. kit4.setItemMeta(kit4Meta);
    43.  
    44. kit5Meta.setDisplayName(ChatColor.GREEN + getConfig().getString("Kits.name"));
    45. kit5.setItemMeta(kit5Meta);
    46.  
    47. kit6Meta.setDisplayName(ChatColor.GREEN + getConfig().getString("Kits.name"));
    48. kit6.setItemMeta(kit6Meta);
    49.  
    50. kit7Meta.setDisplayName(ChatColor.GREEN + getConfig().getString("Kits.name"));
    51. kit7.setItemMeta(kit7Meta);
    52.  
    53. kit8Meta.setDisplayName(ChatColor.GREEN + getConfig().getString("Kits.name"));
    54. kit8.setItemMeta(kit8Meta);
    55.  
    56. kit9Meta.setDisplayName(ChatColor.GREEN + getConfig().getString("Kits.name"));
    57. kit9.setItemMeta(kit9Meta);
    58.  
    59. inv.setItem(0, kit1);
    60. inv.setItem(1, kit2);
    61. inv.setItem(2, kit3);
    62. inv.setItem(3, kit4);
    63. inv.setItem(4, kit5);
    64. inv.setItem(5, kit6);
    65. inv.setItem(6, kit7);
    66. inv.setItem(7, kit8);
    67. inv.setItem(8, kit9);
    68.  
    69. player.openInventory(inv);
    70.  
    71. }
     
  14. Perfect :) (Didn't know you need the names at all :p )
     
  15. Offline

    Anonymous350

    I just wanted to add that to make it nicer like Adam suggested.

    AdamQpzm

    Code: http://pastebin.com/0E94Bdvc

    Error:
    Code:
    [16:37:10 ERROR]: Could not pass event PlayerInteractEvent to KitPvP v1.7.4
    org.bukkit.event.EventException
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:320) ~[craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g
    85f5776-b3022jnks]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85
    f5776-b3022jnks]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:486) [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g
    85f5776-b3022jnks]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:471) [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g
    85f5776-b3022jnks]
            at org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory.callPlayerInte
    ractEvent(CraftEventFactory.java:195) [craftbukkit-1.7.2-R0.4-20140212.071124-2.
    jar:git-Bukkit-1.7.2-R0.3-2-g85f5776-b3022jnks]
            at org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory.callPlayerInte
    ractEvent(CraftEventFactory.java:165) [craftbukkit-1.7.2-R0.4-20140212.071124-2.
    jar:git-Bukkit-1.7.2-R0.3-2-g85f5776-b3022jnks]
            at net.minecraft.server.v1_7_R1.PlayerConnection.a(PlayerConnection.java
    :604) [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85f
    5776-b3022jnks]
            at net.minecraft.server.v1_7_R1.PacketPlayInBlockPlace.a(SourceFile:60)
    [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85f5776-b
    3022jnks]
            at net.minecraft.server.v1_7_R1.PacketPlayInBlockPlace.handle(SourceFile
    :9) [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85f57
    76-b3022jnks]
            at net.minecraft.server.v1_7_R1.NetworkManager.a(NetworkManager.java:146
    ) [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85f5776
    -b3022jnks]
            at net.minecraft.server.v1_7_R1.ServerConnection.c(SourceFile:134) [craf
    tbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85f5776-b3022j
    nks]
            at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:6
    55) [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85f57
    76-b3022jnks]
            at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:2
    50) [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85f57
    76-b3022jnks]
            at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:5
    45) [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85f57
    76-b3022jnks]
            at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java
    :457) [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85f
    5776-b3022jnks]
            at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:6
    17) [craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g85f57
    76-b3022jnks]
    Caused by: java.lang.NullPointerException
            at me.anonymous350.kitpvp.kitpvp.openGUI(kitpvp.java:107) ~[?:?]
            at me.anonymous350.kitpvp.kitpvp.onPlayerInteract(kitpvp.java:287) ~[?:?
    ]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0
    _21]
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0
    _21]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .7.0_21]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_21]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:318) ~[craftbukkit-1.7.2-R0.4-20140212.071124-2.jar:git-Bukkit-1.7.2-R0.3-2-g
    85f5776-b3022jnks]
            ... 15 more
    >
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  16. Anonymous350 The error is this line:

    Code:
    Material m1 = Material.getMaterial(this.getConfig().getString("Kits.item").toUpperCase());
    
    And "Kits.item" doesn't exist in your config - make it point to something that does. :)
     
  17. Offline

    Anonymous350

    AdamQpzm

    It does acctually...

    Code:
    Kits:
      - kit:
        - name: Archer
        - item: bow
      - kit2:
        - name: Soldier
        - item: iron_chestplate
      - kit3:
        - name: Mage
        - item: blaze_rod
      - kit4:
        - name: Medic
        - item: potion
      - kit5:
        - name: kit5
        - item: stone
      - kit6:
        - name: kit6
        - item: stone
      - kit7:
        - name: kit7
        - item: stone
      - kit8:
        - name: kit8
        - item: stone
      - kit9:
        - name: kit9
        - item: stone
     
  18. No, it must me Kits.kit.item or Kits.kit2.item etc.

    Your current code doesnt make sense, since you always fetch the same string
     
    AdamQpzm likes this.
  19. Offline

    Anonymous350

    Johnny Crazy

    I must have miss-read your post.

    I fixed it by removing "this.getConfig()" with getConfig() , However I found the problem.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  20. Although "this" should'nt make a difference, glad you could solve it :) Mark the thread as solved, so it's locked
     
Thread Status:
Not open for further replies.

Share This Page