Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Event happens, save to yml?

Comments in 'Plugin Development' started by PixelGuy75, Jan 6, 2015.

  1. PixelGuy75
    Offline

    PixelGuy75 Notable Member Plugin Developer

    Joined:
    Feb 9, 2014
    Posts:
    316
    Plugins:
    2
    Minecraft User:
    PixelGuy75
    How would you make it so when an event happens, it saves to a .yml file. For example, when a player joins the game, how would you make it in a .yml say joins: 1
    Praxthisnovcht likes this.
  2. Dutok
    Offline

    Dutok Notable Member Plugin Developer

    Joined:
    Jun 20, 2014
    Posts:
    371
    Plugins:
    3
    Minecraft User:
    Dutok
    Here is some pseudocode:

    Code:
    onPlayerJoinEvent() {
        open joins.yml;
        get value;
        increment value;
        close joins.yml;
    }
    
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    That's actually slow.
    Code:
    init:
      open joins.yml
      decode to memory
    onJoin:
      increment value
    finalize:
      encode from memory
      close joins.yml
    PixelGuy75 likes this.
  4. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,167
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    how do you store all data stored in memory to a file.yml and load all of the data back again to memory when the plugin is enabled again?
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    -_-"
    $memory = yaml_parse_file("file.yml");
    yaml_emit_file("file.yml", $memory);
  6. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,167
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    got it before seeing this with different method. anyways, thank you :D

Share This Page

Advertisement