This commit is contained in:
Super_ 2020-01-02 10:24:29 -05:00
parent 35ef866690
commit 81c5775150

View File

@ -8,7 +8,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH, cooldown = 30)
@CommandParameters(description = "Op everyone on the server, optionally change everyone's gamemode at the same time.", usage = "/<command> [-c | -s | -a]")
@CommandParameters(description = "Op everyone on the server, optionally change everyone's gamemode at the same time.", usage = "/<command>")
public class Command_opall extends FreedomCommand
{
@ -17,18 +17,10 @@ public class Command_opall extends FreedomCommand
{
FUtil.adminAction(sender.getName(), "Opping all players on the server", false);
boolean doSetGamemode = false;
GameMode targetGamemode = GameMode.CREATIVE;
for (Player player : server.getOnlinePlayers())
{
player.setOp(true);
player.sendMessage(FreedomCommand.YOU_ARE_OP);
if (doSetGamemode && !player.getGameMode().equals(GameMode.SPECTATOR))
{
player.setGameMode(targetGamemode);
}
}
return true;