Name Cannot Be Validated

Discussion in 'Spigot Plugin Development' started by Zao, Jun 11, 2017.

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

    Zao

    So, I'm having a issue with Bukkit#getWorld() and I don't understand why.

    ERROR:
    Code (Text):

    java.lang.IllegalArgumentException: Name cannot be null
            at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[Aethra%
    20Spigot.jar:git-Spigot-e4d4710-e1ebe52]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.getWorld(CraftServer.java:
    1014) ~[Aethra%20Spigot.jar:git-Spigot-e4d4710-e1ebe52]
            at org.bukkit.Bukkit.getWorld(Bukkit.java:496) ~[Aethra%20Spigot.jar:git
    -Spigot-e4d4710-e1ebe52]
            at me.zao.cheststuff.CHESTSTUFF.loadChests(CHESTSTUFF.java:55)
     ~[?:?]
            at me.zao.cheststuff.CHESTSTUFF.<init>(CHESTSTUFF.java:40) ~[?
    :?]
            at me.zao.cheststuff.CS.onEnable(CS.java:30) ~[?:?]
    The code where that line is this:

    Code (Text):
     Location loc = new Location(Bukkit.getWorld(_c.getString(path + ".loc.world")), _c.getInt(path + ".loc.x"), _c.getInt(path + ".loc.y"), _c.getInt(path + ".loc.z"));
    The config line where that is is this:
    Code (Text):

      chest1:
        type: '1'
        id: 1
        loc:
          world: world_nether
          x: -60
          y: 58
          z: -427
     
  2. Is the ".loc." supposed to be there?
    And please, name your classes appropriately, not with all caps.
     
  3. Try printing out the location to console. See what it is trying to retrieve. Is the path correct?
     
  4. It'd make sense to, looks most likely to be a wrong path before the ".loc."
     
  5. Ohh, I see, I didn't notice the "path+" in front. It most likely is so. Try printing the values in a sysout to see if they are null.
     
  6. Already suggested :p; it is most likely a wrong path, we'll see when the OP tests
     
    • Winner Winner x 1
  7. Zao

    Zao

    Was a issue on my config, I looked over it and there was some names defined but no world defined for that name. Thanks.
     
Thread Status:
Not open for further replies.