Solved Question about yaml (config) layout design setup [Req: Close post]

Discussion in 'Plugin Development' started by ti07shadow, Apr 22, 2015.

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

    mythbusterma

    @ti07shadow

    Again, I don't see why you can't use ConfigurationSerializable, like we've been saying before. Other than "well, WorldGuard doesn't use it and I need to be like WorldGuard."
     
  2. Offline

    Koobaczech

    Is this still going on? When you save a location Y U NO DO DIS DOE in one block at the time
    Code:
    /savelocation loc //Do some save command
    
    saveLoc(args[0]); //Call the functionatron
    
    void saveLoc(Player p, String loc) //Here is where magic is made
    {
    config.set("Location."+loc+".World", p.getWorld().getName());
    config.set("Location."+loc+".X", (int)p.getLocation().getX());
    config.set("Location."+loc+".Y", (int)p.getLocation().getY());
    config.set("Location."+loc+".Z", (int)p.getLocation().getZ());
    config.set("Location."+loc+".Yaw", p.getLocation().getYaw());
    config.set("Location."+loc+".Pitch", p.getLocation().getPitch());
    saveConfig();
    }
    
     
    Last edited: Apr 24, 2015
  3. Offline

    mythbusterma

    @Koobaczech

    Please don't, that's what they were doing before. Look at ConfigurationSerializable, it provides a consistent and easy to use interface for doing this.
     
    timtower likes this.
  4. Offline

    RuthlessRage

    @mythbusterma what is everyone talking about my method works fine as long as you define the variable right
     
  5. Offline

    1Rogue

    Your solution is undefensive and prone to breaking under an API or format change, whereas serialization allows mutation of the contents.
     
    timtower likes this.
  6. Offline

    ti07shadow

    Not trying to be like world guard. I had the idea before I knew world guard used it, since that WAS not used in their last versions. I checked plugins to see if they did it and found several including world guard that do it.

    Also as, since people other than ruthless refuse to try to answer the initial question, I am closing topic and going to mark as solved, even though the answer seeking was dodged and nothing but shut down. I know there's other ways, I know there's better ways and thank you for pointing them out, but seriously could have put that out there after helping with the initial question at hand. As such I do formally request this topic to be locked. I have marked as solved.


    Thank you :)
     
    Last edited: Apr 25, 2015
  7. Offline

    timtower Administrator Administrator Moderator

    Locked on request.

    Please use the report button for that next time.
     
Thread Status:
Not open for further replies.

Share This Page