Help with something

Discussion in 'Plugin Development' started by roflcopter399, Jul 29, 2012.

  1. Offline

    roflcopter399

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Just a quick question, how do you check the player to see if he is in gamemode/survival?
  2. Offline

    Firefly

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    player.getGameMode()
  3. Offline

    roflcopter399

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    so if player.getGameMode() == 1, then he is in creative :confused:?
  4. Offline

    Firefly

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Look what getGameMode returns in the javadocs.


    Answer:

    a GameMode enum.

    Therefore we have to check getGameMode against GameMode.CREATIVE

    This post has been edited 2 times. It was last edited by Firefly Jul 29, 2012.
  5. Offline

    McLuke500

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I think its if (player.getGameMode() == GameMode.CREATIVE) {
    //Do Something
    }

    But thats off the top of my head.
  6. Offline

    Firefly

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Copy/pasteable code. Bad, bad :p
  7. Offline

    McLuke500

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Ok it is GameMode.CREATIVE because of fireflys post
  8. Offline

    McLuke500

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    ?
  9. Offline

    Firefly

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    You gave him the easy way out instead of letting him learn by himself.
  10. Offline

    McLuke500

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Ahh, I thought you were accusing me of copying your post, to which I was D: and has screenshot ready to show I didnt.

    @rolfcopter399
    Basically to get a list of possible GameMode.* on eclipse if you type GameMode. It will list the possible ones such as
    MATERIAL. and other ones :3

Share This Page