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
@@ -11,9 +11,13 @@ import com.alttd.chat.listeners.PluginMessage;
import com.alttd.chat.util.ALogger;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.PluginCommand;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.Collections;
import java.util.List;
public class ChatPlugin extends JavaPlugin {
private static ChatPlugin instance;
@@ -43,6 +47,7 @@ public class ChatPlugin extends JavaPlugin {
registerCommand("unignore", new Unignore());
registerCommand("muteserver", new MuteServer());
registerCommand("spy", new Spy());
registerCommand("chatchannel", new ChatChannel(), Config.CHATCHANNEL_CHANNELS);
messageChannel = Config.MESSAGECHANNEL;
getServer().getMessenger().registerOutgoingPluginChannel(this, messageChannel);
@@ -60,8 +65,14 @@ public class ChatPlugin extends JavaPlugin {
}
}
public void registerCommand(String commandName, CommandExecutor CommandExecutor) {
getCommand(commandName).setExecutor(CommandExecutor);
public void registerCommand(String commandName, CommandExecutor commandExecutor) {
getCommand(commandName).setExecutor(commandExecutor);
}
public void registerCommand(String commandName, CommandExecutor commandExecutor, List<String> aliases) {
PluginCommand command = getCommand(commandName);
command.setAliases(aliases);
command.setExecutor(commandExecutor);
}
public static ChatPlugin getInstance() {