Update chatuser object
This commit is contained in:
parent
198e80aa7a
commit
8d723cc0c6
|
|
@ -20,6 +20,7 @@ public class ChatUser {
|
|||
private long gcCooldown;
|
||||
|
||||
private LinkedList<Mail> mails;
|
||||
private LinkedList<UUID> ignoredPlayers;
|
||||
|
||||
public ChatUser(UUID uuid, int partyId, boolean toggled_chat, boolean force_tp, boolean toggle_Gc) {
|
||||
this.uuid = uuid;
|
||||
|
|
@ -39,8 +40,9 @@ public class ChatUser {
|
|||
|
||||
toggleGc = toggle_Gc;
|
||||
replyTarget = null;
|
||||
gcCooldown = System.currentTimeMillis(); //
|
||||
gcCooldown = System.currentTimeMillis(); // players can't use gc for 30 seconds after logging in if we use this?
|
||||
mails = new LinkedList<>(); // todo load mails
|
||||
ignoredPlayers = new LinkedList<>(); // todo load ignoredPlayers
|
||||
}
|
||||
|
||||
public UUID getUuid() {
|
||||
|
|
@ -125,7 +127,19 @@ public class ChatUser {
|
|||
mails.add(mail);
|
||||
}
|
||||
|
||||
public LinkedList<UUID> getIgnoredPlayers() {
|
||||
return ignoredPlayers;
|
||||
}
|
||||
|
||||
public void addIgnoredPlayers(UUID uuid) {
|
||||
ignoredPlayers.add(uuid);
|
||||
}
|
||||
|
||||
public long getGcCooldown() {
|
||||
return gcCooldown;
|
||||
}
|
||||
|
||||
public void setGcCooldown(long time) {
|
||||
this.gcCooldown = time;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,53 +0,0 @@
|
|||
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;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
|
||||
import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||
import com.velocitypowered.api.command.BrigadierCommand;
|
||||
import com.velocitypowered.api.command.CommandMeta;
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import net.luckperms.api.LuckPerms;
|
||||
import net.luckperms.api.node.Node;
|
||||
|
||||
public class GlobalChatToggle {
|
||||
|
||||
// todo q - can this be implemented in /gc toggle or /gc true/false
|
||||
public GlobalChatToggle(ProxyServer proxyServer) {
|
||||
LiteralCommandNode<CommandSource> command = LiteralArgumentBuilder
|
||||
.<CommandSource>literal("toggleglobalchat")
|
||||
.requires(ctx -> ctx instanceof Player)
|
||||
.requires(ctx -> ctx.hasPermission("command.proxy.globalchat"))// TODO permission system? load permissions from config?
|
||||
.then(RequiredArgumentBuilder
|
||||
.<CommandSource, String>argument("message", StringArgumentType.greedyString())
|
||||
.executes(context -> {
|
||||
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?
|
||||
user.data().add(Node.builder(Config.GCPERMISSION).build());
|
||||
} else {
|
||||
user.data().remove(Node.builder(Config.GCPERMISSION).build());
|
||||
}
|
||||
});
|
||||
return 1;
|
||||
})
|
||||
)
|
||||
.executes(context -> 0)
|
||||
.build();
|
||||
|
||||
BrigadierCommand brigadierCommand = new BrigadierCommand(command);
|
||||
|
||||
CommandMeta.Builder metaBuilder = proxyServer.getCommandManager().metaBuilder(brigadierCommand);
|
||||
metaBuilder.aliases("togglegc");
|
||||
|
||||
CommandMeta meta = metaBuilder.build();
|
||||
|
||||
proxyServer.getCommandManager().register(meta, brigadierCommand);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user