LoChat/src/main/java/com/loki/lochat/commands/chat/LocalChatCommand.java
loki5512344 2d79d2a91d chore: update .gitignore and build.gradle.kts for local server testing
- Added entries to .gitignore for local Paper test server and API documentation.
- Included the run-paper plugin in build.gradle.kts for local server execution.
- Configured runServer task with Minecraft version 1.21.4 for testing.
2026-04-01 16:09:15 +02:00

39 lines
1.4 KiB
Java

package com.loki.lochat.commands.chat;
import com.loki.lochat.LoChat;
import com.loki.lochat.api.service.ChatService;
import com.loki.lochat.utils.ChatFormatter;
import net.kyori.adventure.text.minimessage.MiniMessage;
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 LocalChatCommand implements CommandExecutor {
private static final MiniMessage MM = MiniMessage.miniMessage();
private final LoChat plugin;
private final ChatService chatService;
public LocalChatCommand(LoChat plugin) {
this.plugin = plugin;
this.chatService = plugin.getServiceRegistry().get(ChatService.class);
}
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player player)) {
sender.sendMessage(plugin.getConfigManager().getMessagesConfig().getPlayerOnly());
return true;
}
if (args.length == 0) {
player.sendMessage(ChatFormatter.parse(plugin.getMessageConfig().getInvalidUsage("/l <сообщение>")));
return true;
}
chatService.sendLocalMessage(player, MM.deserialize(String.join(" ", args)));
return true;
}
}