Storing player's GameMode

Discussion in 'Plugin Development' started by MrGermanrain, Aug 25, 2013.

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

    MrGermanrain

    I have been trying to figure out how to store a players gamemode and get that gamemode again later.

    I think that is all the info you need, let me know if you would need more.
     
  2. Offline

    aredherring

    How do you mean store?
    For most intents and purposes you can use Metadata.
     
  3. Offline

    xTrollxDudex

    MrGermanrain
    On a hash map with string and string, when you get the player, check if the value is "survival" or something
     
  4. Offline

    MrlolDestructo

    Well there's two ways you can do this. You can either do p.getGameMode(), which returns a GameMode from an enum, or you can put it in a HashMap with String and GameMode, and just put it in using p.getGameMode(). Hope this helps :)
     
  5. Offline

    MrGermanrain

    I was just wondering if I could do something like this:

    Code:java
    1. string gm = p.getGameMode();
    2.  
    3. //later:
    4.  
    5. p.setGameMode(gm);
    6.  
    7. //would this work?
     
  6. Offline

    metalhedd


    no, but only because p.getGameMode() doesn't return a string, it returns a GameMode. just change your type declaration and that will work fine.
     
Thread Status:
Not open for further replies.

Share This Page