Error using /warp

Discussion in 'Spigot Plugin Development' started by izoody, Jun 30, 2018.

  1. Im learning to code and starting out with making a custom warp plugin i have to commands /setwarp and /warp when the setwarp command its run by a player it works fine then when i do /warp <name> it get a error the two paste bins below are the code and the error

    Code: https://pastebin.com/a7beQBQM
    Error: https://pastebin.com/1YHtkciH
     
  2. You imported the wrong world. Dont build against the server implementation unless you're using NMS. Build against the API and this wont happen.
     
  3. can you simplify this im so new to coding xD
     
  4. You used the wrong import for World. Use the Bukkit one instead.
     
    • Agree Agree x 1
  5. okay so i fixed the problem thanks to your guys help but now i wanna add the ability to stop warps with the same name being made
     
  6. Optic_Fusion1

    Resource Staff

    You'll want to loop through the names of all of the current warps created, if the name matches the warp the player wants to create, don't create it
     
    • Agree Agree x 1
  7. Something like
    @Override
    public void onCommand...
    Code (Text):
      for(String warpname : data.getConfigurationSection("warps").getKeys(false)){
     
    That loops through the keys of the config so you can get the name if your config looks like
    warps
    warp 1:
    loc:
    warp 2:
    loc:
    I reccomended reading up more on spigot configuration files.
    Then you can check if like args[0] is equal to warpname.