TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/command/Command_opall.java
2020-01-02 10:24:29 -05:00

29 lines
1007 B
Java

package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
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>")
public class Command_opall extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
FUtil.adminAction(sender.getName(), "Opping all players on the server", false);
for (Player player : server.getOnlinePlayers())
{
player.setOp(true);
player.sendMessage(FreedomCommand.YOU_ARE_OP);
}
return true;
}
}