TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/command/Command_clearchat.java

28 lines
923 B
Java
Raw Normal View History

2019-01-11 17:04:32 +00:00
package me.totalfreedom.totalfreedommod.command;
import java.util.stream.IntStream;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
2020-06-30 07:25:38 +00:00
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Clears the chat for players who are not opt-out.", usage = "/<command>", aliases = "cc")
2019-01-11 17:04:32 +00:00
public class Command_clearchat extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
2019-01-12 03:05:12 +00:00
2020-06-30 07:25:38 +00:00
for (Player player : server.getOnlinePlayers())
2019-01-11 17:04:32 +00:00
{
2020-06-30 07:25:38 +00:00
if (!plugin.al.isAdmin(player))
2019-01-12 03:05:12 +00:00
{
2020-06-30 07:25:38 +00:00
IntStream.range(0, 100).mapToObj(i -> "").forEach(player::sendMessage);
2019-01-12 03:05:12 +00:00
}
}
2019-01-11 17:04:32 +00:00
return true;
}
}