ArrayIndexOutOfBounds Error

Discussion in 'Plugin Development' started by feff890, Jul 22, 2015.

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

    feff890

  2. Code:
    String[] locs = config.getString("school").split("^");
    CuboidSelection selection = new CuboidSelection(Bukkit.getWorld(locs[0]), Methods.serialize(locs[1]), Methods.serialize(locs[2]));
    Show your config.yml
     
  3. Offline

    feff890

  4. @feff890
    Code:
    school: CraftWorld{name=world}^CraftWorld{name=world},115.0,67.0,268.0^CraftWorld{name=world},116.0,69.0,269.0
    Code:
    Bukkit.getWorld(locs[0]), Methods.serialize(locs[1]), Methods.serialize(locs[2])
    You don't even know what you're doing here :/. You're first saving the world in the "Methods" class as string, not as the world's name. And when you load it you expect locs[1] and locs[2] to be an x, y, and z while the world are in both places. I'm guessing most of this is copied.
     
  5. Offline

    feff890

    Can anyone actually teach me what i've done wrong here instead of lecture me on my crappy code work?
     
  6. Offline

    SuperSniper

    @feff890 You should probably use both WorldGuard and WorldEdit, to save a region using WorldGuard, then seeing if a player is inside of it.
     
Thread Status:
Not open for further replies.

Share This Page