Discussion in 'Spigot Plugin Development' started by CristianoTRS, Jun 7, 2018.

  1. Quando eu meto em GAMEMODE 1 ele muda o modo mas quando eu quero meter em GAMEMODE 0 ele nao funciona muda denovo para GAMEMODE 1

    Attached Files:

  2. Try using else if instead of } else {.
  3. You're casting sender to player without checking if sender is instanceof player, that would give a ClassCastException if console sent the message.
    You're missing brackets {}. syntax of if statements:
    Code (Java):
    if (condition) {
    //do something
    } else {
    //do something else
    you're checking if they have a permission, if they do, you set them in creative, if they dont have the permission, you set them in survival.

    These questions do not belong in spigot forums, as its not related to plugin development, but rather general java development.
    Try searching up tutorials on java syntax before posting to forums.
  4. try
    if(p.getGamemode() == GameMode.SURVIVAL){
    //do something
    }else if(p.getGamemode() == GameMode.CREATIVE)(