fa547dce64
- Rename and relocate package from DeluxeHubReloaded to VexlioHub - Remove deprecated modules: antiwdl, scoreboard, tablist, pvp_mode, teleportation_bow, anti_swear, lockchat, vanish, holograms - Refactor all commands to standard Bukkit CommandExecutor/TabCompleter registered dynamically via Bukkit CommandMap - Add particle, sound, and trail configurations for launchpad and double jump modules - Implement actionbar announcements and join title welcome animation modules - Fully customize, translate to Czech, and restyle all configuration files in the 'uprava/' directory with the purple-cyan gradient theme
66 lines
1.9 KiB
Java
66 lines
1.9 KiB
Java
package eu.milujukockoholky.vexliolobby.command.commands;
|
|
|
|
import eu.milujukockoholky.vexliolobby.VexlioHubPlugin;
|
|
import eu.milujukockoholky.vexliolobby.Permissions;
|
|
import eu.milujukockoholky.vexliolobby.config.Messages;
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.command.Command;
|
|
import org.bukkit.command.CommandExecutor;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.command.TabCompleter;
|
|
import org.bukkit.entity.Player;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.stream.Collectors;
|
|
|
|
public class ClearchatCommand implements CommandExecutor, TabCompleter {
|
|
|
|
public ClearchatCommand(VexlioHubPlugin plugin) {
|
|
}
|
|
|
|
@Override
|
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
|
|
|
|
if (!(sender.hasPermission(Permissions.COMMAND_CLEARCHAT.getPermission()))) {
|
|
Messages.NO_PERMISSION.send(sender);
|
|
return true;
|
|
}
|
|
|
|
if (args.length == 0) {
|
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
|
for (int i = 0; i < 100; i++) {
|
|
player.sendMessage("");
|
|
}
|
|
Messages.CLEARCHAT.send(player, "%player%", sender.getName());
|
|
}
|
|
} else if (args.length == 1) {
|
|
|
|
Player player = Bukkit.getPlayer(args[0]);
|
|
if (player == null) {
|
|
Messages.INVALID_PLAYER.send(sender, "%player%", args[0]);
|
|
return true;
|
|
}
|
|
|
|
for (int i = 0; i < 100; i++) {
|
|
player.sendMessage("");
|
|
}
|
|
Messages.CLEARCHAT_PLAYER.send(player, "%player%", sender.getName());
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String alias, String[] args) {
|
|
if (args.length == 1) {
|
|
String current = args[0].toLowerCase();
|
|
return Bukkit.getOnlinePlayers().stream()
|
|
.map(Player::getName)
|
|
.filter(name -> name.toLowerCase().startsWith(current))
|
|
.collect(Collectors.toList());
|
|
}
|
|
return Collections.emptyList();
|
|
}
|
|
}
|