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

Disabling playerdata!

Comments in 'Plugin Development' started by TheMineBench, Jul 12, 2015.

  1. TheMineBench
    Offline

    TheMineBench New Member

    Joined:
    Jul 10, 2015
    Posts:
    5
    Minecraft User:
    TheMineBench
    Greetings,
    I am trying to make a plugin where when players login it's as if they login for the first time. Is there a way to disable saving player data. I know that player data is saved in the "players" folder instead of in the world's folder where it is stored for the PC. Is there a simple way of disabling saving this data?

    I could just delete the file when they leave, but I'm looking for a more happy way of doing this. :p

    ~Bench
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    /save-off
  3. TheMineBench
    Offline

    TheMineBench New Member

    Joined:
    Jul 10, 2015
    Posts:
    5
    Minecraft User:
    TheMineBench
    That turns off the world saving, but it still saves the the player information in /players/playername.dat
  4. Asidert
    Offline

    Asidert Active Member Plugin Developer

    Joined:
    Oct 21, 2014
    Posts:
    123
    Plugins:
    1
    Minecraft User:
    Asidert
    Try this
    PHP:
    unlink("/your/folder/players/playersname.dat")
  5. TheMineBench
    Offline

    TheMineBench New Member

    Joined:
    Jul 10, 2015
    Posts:
    5
    Minecraft User:
    TheMineBench
    Yes, I thought of doing that when they leave, which I think would work. However I was looking for a nicer way of doing I.E. a setting or something.
  6. Asidert
    Offline

    Asidert Active Member Plugin Developer

    Joined:
    Oct 21, 2014
    Posts:
    123
    Plugins:
    1
    Minecraft User:
    Asidert
    PHP:
    public function onQuit(PlayerQuitEvent $e){
    $p=$e->getPlayer();
    $name=$p->getName();
    unlink("/your/folder/players/".$name.".dat")
    }
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Change $name to lowercase. Some systems are case sensitive.
  8. Asidert
    Offline

    Asidert Active Member Plugin Developer

    Joined:
    Oct 21, 2014
    Posts:
    123
    Plugins:
    1
    Minecraft User:
    Asidert
    Omg, really, I forgot use strtolower() :(
  9. TheMineBench
    Offline

    TheMineBench New Member

    Joined:
    Jul 10, 2015
    Posts:
    5
    Minecraft User:
    TheMineBench
    I asked for a way nicer way then unlinking the file when they leave. I already thought of this, but am kinda unhappy cause then it's going create the file just to later be deleted.
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Creating the file is inevitable. Whether to read it is another question.
  11. TheMineBench
    Offline

    TheMineBench New Member

    Joined:
    Jul 10, 2015
    Posts:
    5
    Minecraft User:
    TheMineBench
    Ahhh, ok so how do you disable reading from the player's files?
  12. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    You can also override the Player class. However, it will be a nasty hack.

Share This Page

Advertisement