Push progress
This commit is contained in:
@@ -38,7 +38,7 @@ public class VelocityChat {
|
||||
private final Logger logger;
|
||||
private final Path dataDirectory;
|
||||
|
||||
private LuckPerms luckPerms;
|
||||
private ChatAPI chatAPI;
|
||||
private ChatHandler chatHandler;
|
||||
private ServerHandler serverHandler;
|
||||
|
||||
@@ -55,12 +55,8 @@ public class VelocityChat {
|
||||
@Subscribe
|
||||
public void onProxyInitialization(ProxyInitializeEvent event) {
|
||||
new ALogger(logger);
|
||||
Config.init(getDataDirectory());
|
||||
//new DatabaseConnection();
|
||||
//Queries.createTables();
|
||||
|
||||
//ChatUserManager.initialize(); // loads all the users from the db and adds them.
|
||||
RegexManager.initRegex(); // load the filters and regexes from config
|
||||
//Config.init(getDataDirectory());
|
||||
chatAPI = new ChatImplementation();
|
||||
|
||||
serverHandler = new ServerHandler();
|
||||
chatHandler = new ChatHandler();
|
||||
@@ -96,12 +92,6 @@ public class VelocityChat {
|
||||
// all (proxy)commands go here
|
||||
}
|
||||
|
||||
public LuckPerms getLuckPerms() {
|
||||
if(luckPerms == null)
|
||||
luckPerms = LuckPermsProvider.get();
|
||||
return luckPerms;
|
||||
}
|
||||
|
||||
public ChatHandler getChatHandler() {
|
||||
return chatHandler;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.alttd.chat.commands;
|
||||
|
||||
import com.alttd.chat.ChatAPI;
|
||||
import com.alttd.chat.VelocityChat;
|
||||
import com.alttd.chat.config.Config;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
@@ -25,7 +26,7 @@ public class GlobalChatToggle {
|
||||
.then(RequiredArgumentBuilder
|
||||
.<CommandSource, String>argument("message", StringArgumentType.greedyString())
|
||||
.executes(context -> {
|
||||
LuckPerms luckPerms = VelocityChat.getPlugin().getLuckPerms();
|
||||
LuckPerms luckPerms = ChatAPI.get().getLuckPerms();
|
||||
Player player = (Player) context;
|
||||
luckPerms.getUserManager().modifyUser(player.getUniqueId(), user -> {
|
||||
if(player.hasPermission(Config.GCPERMISSION)) { //TODO THIS MUST BE A CONSTANT FROM CONFIG?
|
||||
|
||||
@@ -74,7 +74,7 @@ public class ChatHandler {
|
||||
// Template.of("prefix", user.getPrefix()),
|
||||
// Template.of("message", message),
|
||||
// Template.of("server", player.getCurrentServer().isPresent() ? player.getCurrentServer().get().getServerInfo().getName() : "Altitude")
|
||||
// /*,Template.of("[i]", itemComponent(sender.getInventory().getItemInMainHand()))*/ //Todo move this into ChatFilters
|
||||
// /*,Template.of("[i]" , itemComponent(sender.getInventory().getItemInMainHand()))*/ //Todo move this into ChatFilters
|
||||
// ));
|
||||
|
||||
Map<String, String> map = new HashMap<>();
|
||||
@@ -91,6 +91,16 @@ public class ChatHandler {
|
||||
recipient.sendMessage(receiverMessage);
|
||||
}
|
||||
|
||||
public void globalAdminChat(String message) {
|
||||
MiniMessage miniMessage = MiniMessage.get();
|
||||
|
||||
Component component = miniMessage.parse(Config.GACFORMAT);
|
||||
|
||||
VelocityChat.getPlugin().getProxy().getAllPlayers().stream().filter(target -> target.hasPermission("command.proxy.globaladminchat")/*TODO permission*/).forEach(target -> {
|
||||
target.sendMessage(component);
|
||||
});
|
||||
}
|
||||
|
||||
public void globalAdminChat(CommandSource commandSource, String message) {
|
||||
String senderName = Config.CONSOLENAME;
|
||||
String serverName = "Altitude";
|
||||
|
||||
@@ -3,13 +3,14 @@ package com.alttd.chat.handlers;
|
||||
import com.alttd.chat.VelocityChat;
|
||||
import com.alttd.chat.config.ServerConfig;
|
||||
import com.alttd.chat.data.ServerWrapper;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ServerHandler {
|
||||
|
||||
|
||||
@@ -36,6 +36,9 @@ public class PluginMessageListener {
|
||||
// todo this is obsolete
|
||||
//VelocityChat.getPlugin().getServerHandler().sendGlobalChat(in.readUTF());
|
||||
break;
|
||||
case "globaladminchat":
|
||||
VelocityChat.getPlugin().getChatHandler().globalAdminChat(in.readUTF());
|
||||
break;
|
||||
default:
|
||||
VelocityChat.getPlugin().getLogger().info("server " + event.getSource());
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user