Added configurable chat channels

This commit is contained in:
2021-08-04 15:46:45 +02:00
parent 7c15731dcd
commit 9d9b8f0bf2
6 changed files with 140 additions and 25 deletions
@@ -0,0 +1,31 @@
package com.alttd.chat.commands;
import com.alttd.chat.ChatPlugin;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.apache.commons.lang.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
public class ChatChannel implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!(sender instanceof Player player)) { // must be a player
return true;
}
if(args.length == 0) return false;
String message = StringUtils.join(args, " ", 0, args.length);
new BukkitRunnable() {
@Override
public void run() {
ChatPlugin.getInstance().getChatHandler().chatChannel(player, label, message);
}
}.runTaskAsynchronously(ChatPlugin.getInstance());
return false;
}
}