package info.tregmine.commands;

import static org.bukkit.ChatColor.*;
import org.bukkit.GameMode;

import info.tregmine.Tregmine;
import info.tregmine.api.TregminePlayer;

public class GameModeCommand extends AbstractCommand
{
    private GameMode mode;

    public GameModeCommand(Tregmine tregmine, String name, GameMode mode)
    {
        super(tregmine, name);

        this.mode = mode;
    }

    @Override
    public boolean handlePlayer(TregminePlayer player, String[] args)
    {
        if (!player.getRank().canUseCreative()) {
            return true;
        }

        player.setGameMode(mode);
        player.sendMessage(YELLOW + "You are now in "
                + mode.toString().toLowerCase() + " mode.");

        if (player.getRank().canFly()) {
            player.setAllowFlight(true);
        }

        return true;
    }
}

@@ -63,16 +63,48 @@
 Color.*;
+%0A%0Aimport info.tregmine.api.Rank;
 %0Aimport 
@@ -279,16 +279,44 @@
 de mode;
+%0A%09private Tregmine tregmine;
 %0A%0A    pu
@@ -447,16 +447,44 @@
 = mode;%0A
+%09%09this.tregmine = tregmine;%0A
     %7D%0A%0A 
@@ -643,24 +643,24 @@
 eturn true;%0A
-
         %7D%0A%0A 
@@ -650,32 +650,505 @@
 rue;%0A        %7D%0A%0A
+%09%09if (%09(player.getWorld().getName().equalsIgnoreCase(tregmine.getRulelessWorld().getName()) %7C%7C%0A%09%09%09%09player.getWorld().getName().equalsIgnoreCase(tregmine.getRulelessEnd().getName()) %7C%7C%0A%09%09%09%09player.getWorld().getName().equalsIgnoreCase(tregmine.getRulelessNether().getName())) &&%0A%09%09%09%09player.getRank() == Rank.BUILDER) %7B%0A%0A%09%09%09player.sendMessage(RED + %22Builders can not be in creative!%22 + DARK_RED + %22 Disabled.%22);%0A%09%09%09player.setGameMode(GameMode.SURVIVAL);%0A%09%09%09return false;%0A%09%09%7D%0A%0A
         player.s

Stop builders creative privledge in Anarchy