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

  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
    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
    warp 1:
    warp 2:
    I reccomended reading up more on spigot configuration files.
    Then you can check if like args[0] is equal to warpname.