Saving locations

Discussion in 'Plugin Development' started by Retherz_, Nov 13, 2012.

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

    Retherz_

    Hi, im wondering how i can save locations like homes and when you right click a block you get teleported there.
     
  2. Are you asking us to code you a plugin now? Because that should be in the plugin requests forum...
     
  3. Offline

    Retherz_

    blackwolf12333 no im wondering how i can save locations with a command then go to them with an event
     
  4. Offline

    Kanlaki101

    There are multiple ways to save, depending on your needs.

    Are these locations going to be global, or player based?
    Do they need to persist over restarts?
     
  5. Offline

    TwistedMexi

    You can store the location to a hashmap when the command is used. just use a string as the key. Then use if events on the block, so if it's a certain block, and if it's a right-click, then teleport the player to hashmap.get("keyname").

    The thing is, if you want the list of locations to persist after a reload/restart, you'll need to either convert the location to a string, or use a custom method to make it serialized (so that it can be written to file).
     
  6. Offline

    Retherz_

    Kanlaki101 Persist when restarts player based and can be changed
     
  7. Offline

    TwistedMexi

    Like I said, if you want it to persist on restart you'll need to save it, and locations aren't serializable. You'll either need to convert the .getX, getY, .getZ into an string and parse it or use a custom serializableLocation method.
     
Thread Status:
Not open for further replies.

Share This Page