Plex/src/main/java/dev/plex/command/impl/OpAllCMD.java

29 lines
1000 B
Java
Raw Normal View History

2021-01-03 07:21:15 +00:00
package dev.plex.command.impl;
2020-11-02 20:50:51 +00:00
2022-01-04 03:04:39 +00:00
import dev.plex.command.PlexCommand;
2021-01-03 07:21:15 +00:00
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.rank.enums.Rank;
import dev.plex.util.PlexUtils;
import net.kyori.adventure.text.Component;
2020-11-02 20:50:51 +00:00
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
2020-11-02 20:50:51 +00:00
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
2020-11-02 20:50:51 +00:00
@CommandParameters(name = "opall", description = "Op everyone on the server", aliases = "opa")
2020-11-02 20:50:51 +00:00
@CommandPermissions(level = Rank.ADMIN)
public class OpAllCMD extends PlexCommand
{
@Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
2020-11-02 20:50:51 +00:00
{
for (Player player : Bukkit.getOnlinePlayers())
2020-11-06 01:29:38 +00:00
{
2020-11-02 20:50:51 +00:00
player.setOp(true);
2020-11-06 01:29:38 +00:00
}
2022-02-25 07:09:55 +00:00
PlexUtils.broadcast(messageComponent("oppedAllPlayers", sender.getName()));
return null;
2020-11-02 20:50:51 +00:00
}
}