mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 14:38:48 +00:00
Scrap LP hook and fix bugs
This commit is contained in:
1 parent
3a6f51ddc6
commit
9f98f6a42d
12 files changed
+103
-154
No files matched your search
@@ -2,10 +2,8 @@ package net.draycia.simplechat;
|
||||
|
||||
import de.themoep.minedown.MineDown;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import net.draycia.simplechat.channels.ChatChannel;
|
||||
import net.draycia.simplechat.listeners.*;
|
||||
import net.draycia.simplechat.managers.*;
|
||||
import net.draycia.simplechat.managers.luckperms.LuckPermsHookManager;
|
||||
import net.draycia.simplechat.storage.UserService;
|
||||
import net.draycia.simplechat.storage.impl.JSONUserService;
|
||||
import net.draycia.simplechat.storage.impl.MySQLUserService;
|
||||
@@ -15,7 +13,6 @@ import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.serializer.bungeecord.BungeeCordComponentSerializer;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@@ -32,7 +29,6 @@ public final class SimpleChat extends JavaPlugin {
|
||||
private PluginMessageManager pluginMessageManager;
|
||||
private CommandManager commandManager;
|
||||
private ChannelManager channelManager;
|
||||
private LuckPermsHookManager luckPermsHookManager = null;
|
||||
private RedisManager redisManager = null;
|
||||
|
||||
private UserService userService;
|
||||
@@ -63,10 +59,6 @@ public final class SimpleChat extends JavaPlugin {
|
||||
commandManager = new CommandManager(this);
|
||||
channelManager = new ChannelManager(this);
|
||||
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("LuckPerms")) {
|
||||
luckPermsHookManager = new LuckPermsHookManager(this);
|
||||
}
|
||||
|
||||
if (getConfig().getBoolean("redis.enabled")) {
|
||||
redisManager = new RedisManager(this);
|
||||
}
|
||||
@@ -150,10 +142,6 @@ public final class SimpleChat extends JavaPlugin {
|
||||
return pluginMessageManager;
|
||||
}
|
||||
|
||||
public LuckPermsHookManager getLuckPermsHookManager() {
|
||||
return luckPermsHookManager;
|
||||
}
|
||||
|
||||
public RedisManager getRedisManager() {
|
||||
return redisManager;
|
||||
}
|
||||
|
||||
@@ -23,14 +23,14 @@ public abstract class ChatChannel {
|
||||
/**
|
||||
* @return If this is the default (typically Global) channel players use when they're in no other channel.
|
||||
*/
|
||||
public abstract boolean isDefault();
|
||||
public abstract Boolean isDefault();
|
||||
|
||||
/**
|
||||
* @return If this channel can be toggled off and if players can ignore player messages in this channel.
|
||||
*/
|
||||
public abstract boolean isIgnorable();
|
||||
public abstract Boolean isIgnorable();
|
||||
|
||||
public abstract boolean shouldBungee();
|
||||
public abstract Boolean shouldBungee();
|
||||
|
||||
/**
|
||||
* @return The name of this channel.
|
||||
@@ -44,7 +44,7 @@ public abstract class ChatChannel {
|
||||
/**
|
||||
* @return The distance other players must be within to the sender to see messages in this channel.
|
||||
*/
|
||||
public abstract double getDistance();
|
||||
public abstract Double getDistance();
|
||||
|
||||
/**
|
||||
* @return The message to be sent to the player when switching to this channel.
|
||||
@@ -71,21 +71,21 @@ public abstract class ChatChannel {
|
||||
|
||||
public abstract String getCannotUseMessage();
|
||||
|
||||
public abstract boolean firstMatchingGroup();
|
||||
public abstract Boolean firstMatchingGroup();
|
||||
|
||||
/**
|
||||
* @return If the player can use this channel.
|
||||
*/
|
||||
public abstract boolean canPlayerUse(ChatUser user);
|
||||
public abstract Boolean canPlayerUse(ChatUser user);
|
||||
|
||||
public abstract boolean canPlayerSee(ChatUser sender, ChatUser target, boolean checkSpying);
|
||||
public abstract Boolean canPlayerSee(ChatUser sender, ChatUser target, boolean checkSpying);
|
||||
|
||||
public abstract List<ChatUser> getAudience(ChatUser user);
|
||||
|
||||
/**
|
||||
* @return If the channel should forward its formatting / formatted message to other servers
|
||||
*/
|
||||
public boolean shouldForwardFormatting() {
|
||||
public Boolean shouldForwardFormatting() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+61
-38
@@ -35,11 +35,12 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
}
|
||||
|
||||
private String getDiscordFormatting() {
|
||||
return getFormats().getOrDefault("discord-to-mc", "<gray>[<blue>Discord<gray>] <username><white>: <message>");
|
||||
return getFormats().getOrDefault("discord-to-mc",
|
||||
"<gray>[<blue>Discord<gray>] <username><white>: <message>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlayerUse(ChatUser user) {
|
||||
public Boolean canPlayerUse(ChatUser user) {
|
||||
return user.asPlayer().hasPermission("simplechat.channels." + getName() + ".use");
|
||||
}
|
||||
|
||||
@@ -79,7 +80,8 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
"message", formatEvent.getMessage());
|
||||
|
||||
// Call custom chat event
|
||||
ChatComponentEvent componentEvent = new ChatComponentEvent(user, this, formattedMessage, formatEvent.getMessage(), getAudience(user));
|
||||
ChatComponentEvent componentEvent = new ChatComponentEvent(user, this, formattedMessage,
|
||||
formatEvent.getMessage(), getAudience(user));
|
||||
|
||||
Bukkit.getPluginManager().callEvent(componentEvent);
|
||||
|
||||
@@ -100,7 +102,8 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
chatUser.sendMessage(componentEvent.getComponent());
|
||||
}
|
||||
} else {
|
||||
prefix = prefix.replace("<color>", "<color:" + chatUser.getChannelSettings(this).getColor().asHexString() + ">");
|
||||
prefix = prefix.replace("<color>", "<color:" +
|
||||
chatUser.getChannelSettings(this).getColor().asHexString() + ">");
|
||||
String format = formatEvent.getFormat();
|
||||
|
||||
TextComponent newFormat = (TextComponent)simpleChat.processMessage(format,
|
||||
@@ -117,7 +120,8 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
return;
|
||||
}
|
||||
|
||||
ChatComponentEvent newEvent = new ChatComponentEvent(user, this, newFormat, formatEvent.getMessage(), Collections.singletonList(chatUser), true);
|
||||
ChatComponentEvent newEvent = new ChatComponentEvent(user, this, newFormat,
|
||||
formatEvent.getMessage(), Collections.singletonList(chatUser), true);
|
||||
|
||||
Bukkit.getPluginManager().callEvent(newEvent);
|
||||
|
||||
@@ -197,7 +201,7 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
return getFormat(group);
|
||||
}
|
||||
|
||||
public boolean canPlayerSee(ChatUser sender, ChatUser target, boolean checkSpying) {
|
||||
public Boolean canPlayerSee(ChatUser sender, ChatUser target, boolean checkSpying) {
|
||||
Player targetPlayer = target.asPlayer();
|
||||
|
||||
if (checkSpying && targetPlayer.hasPermission("simplechat.spy." + getName())) {
|
||||
@@ -245,7 +249,8 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
public Map<String, String> getFormats() {
|
||||
HashMap<String, String> formats = new HashMap<>();
|
||||
|
||||
ConfigurationSection section = simpleChat.getConfig().getConfigurationSection("channels").getConfigurationSection(getKey());
|
||||
ConfigurationSection channelsSection = simpleChat.getConfig().getConfigurationSection("channels");
|
||||
ConfigurationSection section = channelsSection.getConfigurationSection(getKey());
|
||||
ConfigurationSection formatSection = section.getConfigurationSection("formats");
|
||||
|
||||
if (formatSection == null) {
|
||||
@@ -261,84 +266,84 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
|
||||
@Override
|
||||
public TextColor getColor() {
|
||||
return TextColor.fromHexString((String) getSetting("color"));
|
||||
return TextColor.fromHexString(getSetting("color"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFormat(String group) {
|
||||
return getFormats().getOrDefault(group, getFormats().getOrDefault("default", "<white><%player_displayname%<white>> <message>"));
|
||||
return getFormats().getOrDefault(group, getFormats().getOrDefault("default",
|
||||
"<white><%player_displayname%<white>> <message>"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDefault() {
|
||||
return (Boolean) getSetting("default");
|
||||
public Boolean isDefault() {
|
||||
return getSetting("default") == null ? false : getSetting("default");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIgnorable() {
|
||||
return (Boolean)getSetting("ignorable");
|
||||
public Boolean isIgnorable() {
|
||||
return getSetting("ignorable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBungee() {
|
||||
return (Boolean) getSetting("should-bungee");
|
||||
public Boolean shouldBungee() {
|
||||
return getSetting("should-bungee");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
String name = (String) getSetting("name");
|
||||
String name = getSetting("name");
|
||||
return name == null ? key : name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDistance() {
|
||||
return (Integer) getSetting("distance");
|
||||
public Double getDistance() {
|
||||
return this.getSetting("distance");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSwitchMessage() {
|
||||
return (String) getSetting("switch-message");
|
||||
return getSetting("switch-message");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSwitchOtherMessage() {
|
||||
return (String) getSetting("switch-other-message");
|
||||
return getSetting("switch-other-message");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToggleOffMessage() {
|
||||
return (String) getSetting("toggle-off-message");
|
||||
return getSetting("toggle-off-message");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToggleOnMessage() {
|
||||
return (String) getSetting("toggle-on-message");
|
||||
return getSetting("toggle-on-message");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToggleOtherOnMessage() {
|
||||
return (String) getSetting("toggle-other-on");
|
||||
|
||||
return getSetting("toggle-other-on");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToggleOtherOffMessage() {
|
||||
return (String) getSetting("toggle-other-off");
|
||||
return getSetting("toggle-other-off");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCannotUseMessage() {
|
||||
return (String) getSetting("cannot-use-channel");
|
||||
return getSetting("cannot-use-channel");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldForwardFormatting() {
|
||||
return (Boolean) getSetting("forward-format");
|
||||
public Boolean shouldForwardFormatting() {
|
||||
return getSetting("forward-format");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean firstMatchingGroup() {
|
||||
return (Boolean) getSetting("first-matching-group");
|
||||
public Boolean firstMatchingGroup() {
|
||||
return getSetting("first-matching-group");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -352,20 +357,38 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
return itemPatterns;
|
||||
}
|
||||
|
||||
private Object getSetting(String key) {
|
||||
ConfigurationSection section = simpleChat.getConfig().getConfigurationSection("channels").getConfigurationSection(getKey());
|
||||
private <T> T getSetting(String key) {
|
||||
ConfigurationSection channelsSection = simpleChat.getConfig().getConfigurationSection("channels");
|
||||
ConfigurationSection section = channelsSection.getConfigurationSection(getKey());
|
||||
|
||||
if (section.contains(key)) {
|
||||
return section.get(key);
|
||||
if (section != null && section.contains(key)) {
|
||||
return (T)section.get(key);
|
||||
}
|
||||
|
||||
ConfigurationSection defaultSection = simpleChat.getConfig().getConfigurationSection("default");
|
||||
|
||||
if (defaultSection.contains(key)) {
|
||||
return defaultSection.get(key);
|
||||
if (defaultSection != null && defaultSection.contains(key)) {
|
||||
return (T)defaultSection.get(key);
|
||||
}
|
||||
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
private <T> T getSetting(String key, T def) {
|
||||
ConfigurationSection channelsSection = simpleChat.getConfig().getConfigurationSection("channels");
|
||||
ConfigurationSection section = channelsSection.getConfigurationSection(getKey());
|
||||
|
||||
if (section != null && section.contains(key)) {
|
||||
return (T)section.get(key, def);
|
||||
}
|
||||
|
||||
ConfigurationSection defaultSection = simpleChat.getConfig().getConfigurationSection("default");
|
||||
|
||||
if (defaultSection != null && defaultSection.contains(key)) {
|
||||
return (T)defaultSection.get(key, def);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -375,7 +398,7 @@ public class SimpleChatChannel extends ChatChannel {
|
||||
|
||||
@Override
|
||||
public String getAliases() {
|
||||
String aliases = (String)getSetting("aliases");
|
||||
String aliases = getSetting("aliases");
|
||||
|
||||
if (aliases == null) {
|
||||
return getKey();
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.draycia.simplechat.events;
|
||||
import net.draycia.simplechat.channels.ChatChannel;
|
||||
import net.draycia.simplechat.storage.ChatUser;
|
||||
import net.draycia.simplechat.util.Registry;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
@@ -27,6 +28,8 @@ public class ChannelRegisterEvent extends Event {
|
||||
private Registry<ChatChannel> registry;
|
||||
|
||||
public ChannelRegisterEvent(List<ChatChannel> registeredChannels, Registry<ChatChannel> registry) {
|
||||
super(Bukkit.isPrimaryThread());
|
||||
|
||||
this.registeredChannels = registeredChannels;
|
||||
this.registry = registry;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.draycia.simplechat.events;
|
||||
|
||||
import net.draycia.simplechat.channels.ChatChannel;
|
||||
import net.draycia.simplechat.storage.ChatUser;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
@@ -24,6 +25,8 @@ public class ChannelSwitchEvent extends Event {
|
||||
private ChatUser user;
|
||||
|
||||
public ChannelSwitchEvent(ChatChannel channel, ChatUser user) {
|
||||
super(Bukkit.isPrimaryThread());
|
||||
|
||||
this.channel = channel;
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ package net.draycia.simplechat.events;
|
||||
import net.draycia.simplechat.channels.ChatChannel;
|
||||
import net.draycia.simplechat.storage.ChatUser;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@@ -27,7 +28,7 @@ public class ChatComponentEvent extends Event implements Cancellable {
|
||||
}
|
||||
|
||||
public ChatComponentEvent(ChatUser user, ChatChannel chatChannel, TextComponent component, String originalMessage, List<ChatUser> recipients, boolean customPlayerFormat) {
|
||||
super(true);
|
||||
super(Bukkit.isPrimaryThread());
|
||||
|
||||
this.user = user;
|
||||
this.chatChannel = chatChannel;
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.draycia.simplechat.events;
|
||||
|
||||
import net.draycia.simplechat.channels.ChatChannel;
|
||||
import net.draycia.simplechat.storage.ChatUser;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@@ -18,7 +19,7 @@ public class ChatFormatEvent extends Event implements Cancellable {
|
||||
private String message;
|
||||
|
||||
public ChatFormatEvent(ChatUser user, ChatChannel chatChannel, String format, String message) {
|
||||
super(true);
|
||||
super(Bukkit.isPrimaryThread());
|
||||
|
||||
this.user = user;
|
||||
this.chatChannel = chatChannel;
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.draycia.simplechat.events;
|
||||
|
||||
import net.draycia.simplechat.storage.ChatUser;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
@@ -27,6 +28,8 @@ public class PrivateMessageEvent extends Event {
|
||||
private final String message;
|
||||
|
||||
public PrivateMessageEvent(ChatUser sender, ChatUser target, Component senderComponent, Component targetComponent, String message) {
|
||||
super(Bukkit.isPrimaryThread());
|
||||
|
||||
this.sender = sender;
|
||||
this.target = target;
|
||||
this.senderComponent = senderComponent;
|
||||
|
||||
@@ -37,11 +37,17 @@ public class ChannelManager {
|
||||
channels.add(channel);
|
||||
|
||||
if (channel.isDefault()) {
|
||||
simpleChat.getLogger().info("Default channel found: " + channel.getName());
|
||||
defaultChannelKey = channel.getKey();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (ChatChannel channel : channels) {
|
||||
simpleChat.getLogger().info("Registering channel: " + channel.getName());
|
||||
getRegistry().register(channel.getKey(), channel);
|
||||
}
|
||||
|
||||
Bukkit.getPluginManager().callEvent(new ChannelRegisterEvent(channels, getRegistry()));
|
||||
}
|
||||
|
||||
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
package net.draycia.simplechat.managers.luckperms;
|
||||
|
||||
import net.draycia.simplechat.SimpleChat;
|
||||
import net.draycia.simplechat.managers.luckperms.contexts.CanSeeChannelCalculator;
|
||||
import net.luckperms.api.LuckPerms;
|
||||
import net.luckperms.api.context.ContextCalculator;
|
||||
import net.luckperms.api.context.ContextManager;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class LuckPermsHookManager {
|
||||
|
||||
private final SimpleChat simpleChat;
|
||||
private final ContextManager contextManager;
|
||||
private final List<ContextCalculator<Player>> registeredCalculators = new ArrayList<>();
|
||||
|
||||
public LuckPermsHookManager(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
|
||||
LuckPerms luckPerms = this.simpleChat.getServer().getServicesManager().load(LuckPerms.class);
|
||||
|
||||
if (luckPerms == null) {
|
||||
throw new IllegalStateException("LuckPerms API not loaded.");
|
||||
}
|
||||
|
||||
this.contextManager = luckPerms.getContextManager();
|
||||
|
||||
register(() -> new CanSeeChannelCalculator(simpleChat));
|
||||
}
|
||||
|
||||
private void register(Supplier<ContextCalculator<Player>> calculatorSupplier) {
|
||||
ContextCalculator<Player> calculator = calculatorSupplier.get();
|
||||
|
||||
this.contextManager.registerCalculator(calculator);
|
||||
this.registeredCalculators.add(calculator);
|
||||
}
|
||||
|
||||
public void unregisterContexts() {
|
||||
this.registeredCalculators.forEach(this.contextManager::unregisterCalculator);
|
||||
this.registeredCalculators.clear();
|
||||
}
|
||||
|
||||
}
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
package net.draycia.simplechat.managers.luckperms.contexts;
|
||||
|
||||
import net.draycia.simplechat.SimpleChat;
|
||||
import net.draycia.simplechat.channels.ChatChannel;
|
||||
import net.luckperms.api.context.ContextCalculator;
|
||||
import net.luckperms.api.context.ContextConsumer;
|
||||
import net.luckperms.api.context.ImmutableContextSet;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CanSeeChannelCalculator implements ContextCalculator<Player> {
|
||||
|
||||
private static final String KEY = "can-see-channel";
|
||||
|
||||
private SimpleChat simpleChat;
|
||||
|
||||
public CanSeeChannelCalculator(SimpleChat simpleChat) {
|
||||
this.simpleChat = simpleChat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calculate(Player player, ContextConsumer consumer) {
|
||||
for (ChatChannel channel : simpleChat.getChannelManager().getRegistry().values()) {
|
||||
boolean canUse = channel.canPlayerUse(simpleChat.getUserService().wrap(player));
|
||||
|
||||
consumer.accept(KEY + ":" + channel.getKey(), canUse ? "true" : "false");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public net.luckperms.api.context.ContextSet estimatePotentialContexts() {
|
||||
ImmutableContextSet.Builder builder = ImmutableContextSet.builder();
|
||||
|
||||
for (ChatChannel channel : simpleChat.getChannelManager().getRegistry().values()) {
|
||||
builder.add(KEY + ":" + channel.getKey(), "true");
|
||||
builder.add(KEY + ":" + channel.getKey(), "false");
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
}
|
||||
+15
-7
@@ -118,22 +118,30 @@ public class MySQLUserService extends UserService {
|
||||
List<DbRow> channelSettings = database.getResults("SELECT * from sc_channel_settings WHERE uuid = ?;", uuid.toString());
|
||||
List<DbRow> ignoredUsers = database.getResults("SELECT * from sc_ignored_users WHERE uuid = ?;", uuid.toString());
|
||||
|
||||
user.setSelectedChannel(simpleChat.getChannelManager().getRegistry().get(users.getString("channel")));
|
||||
ChatChannel channel = simpleChat.getChannelManager().getChannelOrDefault(users.getString("channel"));
|
||||
|
||||
if (channel != null) {
|
||||
user.setSelectedChannel(channel);
|
||||
}
|
||||
|
||||
user.setMuted(users.<Boolean>get("muted"));
|
||||
user.setShadowMuted(users.<Boolean>get("shadowmuted"));
|
||||
user.setSpyingWhispers(users.<Boolean>get("spyingwhispers"));
|
||||
|
||||
for (DbRow channelSetting : channelSettings) {
|
||||
ChatChannel chatChannel = simpleChat.getChannelManager().getRegistry().get(channelSetting.getString("channel"));
|
||||
UserChannelSettings settings = user.getChannelSettings(chatChannel);
|
||||
|
||||
settings.setSpying(channelSetting.<Boolean>get("spying"));
|
||||
settings.setIgnoring(channelSetting.<Boolean>get("ignored"));
|
||||
if (chatChannel != null) {
|
||||
UserChannelSettings settings = user.getChannelSettings(chatChannel);
|
||||
|
||||
String color = channelSetting.getString("color");
|
||||
settings.setSpying(channelSetting.<Boolean>get("spying"));
|
||||
settings.setIgnoring(channelSetting.<Boolean>get("ignored"));
|
||||
|
||||
if (color != null) {
|
||||
settings.setColor(TextColor.fromHexString(color));
|
||||
String color = channelSetting.getString("color");
|
||||
|
||||
if (color != null) {
|
||||
settings.setColor(TextColor.fromHexString(color));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user