Created configurable chat channels
This commit is contained in:
@@ -1,17 +1,32 @@
|
||||
package com.alttd.chat.commands;
|
||||
|
||||
import com.alttd.chat.ChatPlugin;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import com.alttd.chat.objects.Channel;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.defaults.BukkitCommand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class ChatChannel extends BukkitCommand {
|
||||
|
||||
Channel channel;
|
||||
String command;
|
||||
|
||||
public ChatChannel(Channel channel) {
|
||||
super(channel.getChannelName().toLowerCase());
|
||||
this.channel = channel;
|
||||
this.command = channel.getChannelName().toLowerCase();
|
||||
this.description = "Chat channel named " + channel.getChannelName() + ".";
|
||||
this.usageMessage = "/" + command + " <message>";
|
||||
this.setAliases(Collections.emptyList());
|
||||
}
|
||||
|
||||
public class ChatChannel implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
public boolean execute(@NotNull CommandSender sender, @NotNull String command, @NotNull String[] args) {
|
||||
if(!(sender instanceof Player player)) { // must be a player
|
||||
return true;
|
||||
}
|
||||
@@ -22,7 +37,7 @@ public class ChatChannel implements CommandExecutor {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ChatPlugin.getInstance().getChatHandler().chatChannel(player, label, message);
|
||||
ChatPlugin.getInstance().getChatHandler().chatChannel(player, channel, message);
|
||||
}
|
||||
}.runTaskAsynchronously(ChatPlugin.getInstance());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user