Updated to 1.21 by switching to cosmos
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.alttd.chat.commands;
|
||||
|
||||
import com.alttd.chat.util.Utility;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
@@ -9,26 +8,29 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ChatClear implements CommandExecutor {
|
||||
|
||||
private static final Component component = MiniMessage.miniMessage().deserialize("\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n");
|
||||
private static final Component component = MiniMessage.miniMessage().deserialize("\n".repeat(100));
|
||||
MiniMessage miniMessage = MiniMessage.miniMessage();
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
public boolean onCommand(CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||
if (!sender.hasPermission("chat.command.clear-chat")) {
|
||||
sender.sendMessage(Utility.parseMiniMessage("<red>You don't have permission to use this command.</red>"));
|
||||
sender.sendRichMessage("<red>You don't have permission to use this command.</red>");
|
||||
return true;
|
||||
}
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
if (!player.hasPermission("chat.clear-bypass"))
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (!player.hasPermission("chat.clear-bypass")) {
|
||||
player.sendMessage(component);
|
||||
}
|
||||
}
|
||||
|
||||
Bukkit.getServer().sendMessage(miniMessage.deserialize(
|
||||
"<gold><player> cleared chat.</gold>",
|
||||
Placeholder.component("player",sender.name()))
|
||||
);
|
||||
"<gold><player> cleared chat.</gold>",
|
||||
Placeholder.component("player", sender.name()))
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user