mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 22:16:22 +00:00
update to built-in modules style
This commit is contained in:
85 files changed
+455
-702
No files matched your search
@@ -0,0 +1,68 @@
|
||||
package net.draycia.carbon.channels;
|
||||
|
||||
import co.aikar.commands.BukkitCommandManager;
|
||||
import net.draycia.carbon.CarbonChat;
|
||||
import net.draycia.carbon.commands.AliasedChannelCommand;
|
||||
import net.draycia.carbon.util.Registry;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class ChannelRegistry implements Registry<ChatChannel> {
|
||||
|
||||
private final Map<String, ChatChannel> registry = new HashMap<>();
|
||||
private final List<AliasedChannelCommand> channelCommands = new ArrayList<>();
|
||||
|
||||
private final CarbonChat carbonChat;
|
||||
|
||||
public ChannelRegistry(CarbonChat carbonChat) {
|
||||
this.carbonChat = carbonChat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean register(@NotNull String key, @NotNull ChatChannel value) {
|
||||
boolean registerSuccessful = registry.putIfAbsent(key, value) == null;
|
||||
|
||||
if (registerSuccessful) {
|
||||
BukkitCommandManager commandManager = carbonChat.getCommandManager().getCommandManager();
|
||||
commandManager.getCommandReplacements().addReplacement("channelName", value.getAliases());
|
||||
|
||||
AliasedChannelCommand command = new AliasedChannelCommand(value);
|
||||
|
||||
commandManager.registerCommand(command);
|
||||
channelCommands.add(command);
|
||||
|
||||
if (value instanceof Listener) {
|
||||
Bukkit.getPluginManager().registerEvents((Listener)value, carbonChat);
|
||||
}
|
||||
}
|
||||
|
||||
return registerSuccessful;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<ChatChannel> values() {
|
||||
return registry.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ChatChannel get(String key) {
|
||||
return registry.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearAll() {
|
||||
registry.clear();
|
||||
|
||||
for (AliasedChannelCommand command : channelCommands) {
|
||||
carbonChat.getLogger().info("Unregistering command for channel: " + command.getChatChannel().getName());
|
||||
carbonChat.getCommandManager().getCommandManager().unregisterCommand(command);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package net.draycia.carbon.channels;
|
||||
|
||||
import net.draycia.carbon.events.PreChatFormatEvent;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
import net.kyori.adventure.audience.ForwardingAudience;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public abstract class ChatChannel implements ForwardingAudience {
|
||||
|
||||
/**
|
||||
* @return The color that represents this channel. Optionally used in formatting.
|
||||
*/
|
||||
public abstract TextColor getChannelColor(ChatUser user);
|
||||
|
||||
/**
|
||||
* @return The MiniMessage styled format for the group in this channel.
|
||||
*/
|
||||
public abstract String getFormat(String group);
|
||||
|
||||
/**
|
||||
* @return If this is the default (typically Global) channel players use when they're in no other channel.
|
||||
*/
|
||||
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 shouldBungee();
|
||||
|
||||
/**
|
||||
* @return The name of this channel.
|
||||
*/
|
||||
public abstract String getName();
|
||||
|
||||
public abstract String getKey();
|
||||
|
||||
@Nullable
|
||||
public abstract String getMessagePrefix();
|
||||
|
||||
public abstract String getAliases();
|
||||
|
||||
/**
|
||||
* @return The message to be sent to the player when switching to this channel.
|
||||
*/
|
||||
public abstract String getSwitchMessage();
|
||||
|
||||
public abstract String getSwitchOtherMessage();
|
||||
|
||||
public abstract String getSwitchFailureMessage();
|
||||
|
||||
/**
|
||||
* @return The message to be send to the player when toggling this channel off.
|
||||
*/
|
||||
|
||||
public abstract String getToggleOffMessage();
|
||||
|
||||
/**
|
||||
* @return The message to be send to the player when toggling this channel on.
|
||||
*/
|
||||
|
||||
public abstract String getToggleOnMessage();
|
||||
|
||||
public abstract String getToggleOtherOnMessage();
|
||||
|
||||
public abstract String getToggleOtherOffMessage();
|
||||
|
||||
public abstract String getCannotUseMessage();
|
||||
|
||||
public abstract Boolean primaryGroupOnly();
|
||||
|
||||
public abstract Boolean honorsRecipientList();
|
||||
|
||||
public abstract Boolean permissionGroupMatching();
|
||||
|
||||
public abstract boolean testContext(ChatUser sender, ChatUser target);
|
||||
|
||||
public abstract Object getContext(String key);
|
||||
|
||||
public abstract List<String> getGroupOverrides();
|
||||
|
||||
/**
|
||||
* @return If the player can use this channel.
|
||||
*/
|
||||
public abstract Boolean canPlayerUse(ChatUser user);
|
||||
|
||||
public abstract Boolean canPlayerSee(ChatUser sender, ChatUser target, boolean checkSpying);
|
||||
|
||||
public abstract Boolean canPlayerSee(ChatUser target, boolean checkSpying);
|
||||
|
||||
/**
|
||||
* @return If the channel should forward its formatting / formatted message to other servers
|
||||
*/
|
||||
public Boolean shouldForwardFormatting() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract List<Pattern> getItemLinkPatterns();
|
||||
|
||||
/**
|
||||
* Parses the specified message, calls a {@link PreChatFormatEvent}, and sends the message to everyone who can view this channel.
|
||||
* @param user The player who is saying the message.
|
||||
* @param message The message to be sent.
|
||||
*/
|
||||
public abstract void sendMessage(ChatUser user, String message, boolean fromBungee);
|
||||
|
||||
public abstract void sendMessage(ChatUser user, Collection<ChatUser> recipients, String message, boolean fromBungee);
|
||||
|
||||
public abstract void sendComponent(ChatUser user, Component component);
|
||||
|
||||
public String processPlaceholders(ChatUser user, String input) { return input; }
|
||||
|
||||
public abstract boolean shouldCancelChatEvent();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package net.draycia.carbon.channels.contexts;
|
||||
|
||||
import net.draycia.carbon.channels.ChatChannel;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
|
||||
public interface MessageContext {
|
||||
ChatUser getSender();
|
||||
ChatUser getTarget();
|
||||
ChatChannel getChatChannel();
|
||||
Object getValue();
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package net.draycia.carbon.channels.contexts.impl;
|
||||
|
||||
import net.draycia.carbon.channels.contexts.MessageContext;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class DistanceContext implements Function<MessageContext, Boolean> {
|
||||
|
||||
@Override
|
||||
public Boolean apply(MessageContext context) {
|
||||
if (!context.getSender().isOnline() || !context.getTarget().isOnline()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Location senderLocation = context.getSender().asPlayer().getLocation();
|
||||
Location targetLocation = context.getTarget().asPlayer().getLocation();
|
||||
|
||||
if (!senderLocation.getWorld().equals(targetLocation.getWorld())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Double value = (Double) context.getValue();
|
||||
|
||||
if (value > 0) {
|
||||
return senderLocation.distance(targetLocation) <= value;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package net.draycia.carbon.channels.contexts.impl;
|
||||
|
||||
import net.draycia.carbon.CarbonChat;
|
||||
import net.draycia.carbon.events.PreChatFormatEvent;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
public class EconomyContext implements Listener {
|
||||
private final CarbonChat carbonChat;
|
||||
private final Economy economy;
|
||||
|
||||
public EconomyContext(CarbonChat carbonChat) {
|
||||
this.carbonChat = carbonChat;
|
||||
this.economy = carbonChat.getServer().getServicesManager().getRegistration(Economy.class).getProvider();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onChatReqBal(PreChatFormatEvent event) {
|
||||
Object requiredBalObject = event.getChannel().getContext("vault-balance");
|
||||
|
||||
Double requiredBal;
|
||||
|
||||
if (requiredBalObject instanceof Double) {
|
||||
requiredBal = (Double) requiredBalObject;
|
||||
} else if (requiredBalObject instanceof Integer) {
|
||||
requiredBal = Double.valueOf((Integer) requiredBalObject);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (requiredBal.equals(0.0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getUser().asPlayer();
|
||||
|
||||
if (!economy.has(player, requiredBal)) {
|
||||
event.setCancelled(true);
|
||||
|
||||
event.getUser().sendMessage(carbonChat.getAdventureManager()
|
||||
.processMessageWithPapi(player, event.getChannel().getCannotUseMessage()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onChatCost(PreChatFormatEvent event) {
|
||||
Object costObject = event.getChannel().getContext("vault-cost");
|
||||
|
||||
Double cost;
|
||||
|
||||
if (costObject instanceof Double) {
|
||||
cost = (Double) costObject;
|
||||
} else if (costObject instanceof Integer) {
|
||||
cost = Double.valueOf((Integer) costObject);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cost.equals(0.0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getUser().asPlayer();
|
||||
|
||||
if (!economy.has(player, cost)) {
|
||||
event.setCancelled(true);
|
||||
|
||||
event.getUser().sendMessage(carbonChat.getAdventureManager()
|
||||
.processMessageWithPapi(player, event.getChannel().getCannotUseMessage()));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
economy.withdrawPlayer(player, cost);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package net.draycia.carbon.channels.contexts.impl;
|
||||
|
||||
import net.draycia.carbon.channels.ChatChannel;
|
||||
import net.draycia.carbon.channels.contexts.MessageContext;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
|
||||
public class SimpleMessageContext implements MessageContext {
|
||||
private final ChatUser sender;
|
||||
private final ChatUser target;
|
||||
private final ChatChannel chatChannel;
|
||||
private final Object value;
|
||||
|
||||
public SimpleMessageContext(ChatUser sender, ChatUser target, ChatChannel chatChannel, Object value) {
|
||||
this.sender = sender;
|
||||
this.target = target;
|
||||
this.chatChannel = chatChannel;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChatUser getSender() {
|
||||
return sender;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChatUser getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChatChannel getChatChannel() {
|
||||
return chatChannel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package net.draycia.carbon.channels.contexts.impl;
|
||||
|
||||
import com.palmergames.bukkit.towny.TownyAPI;
|
||||
import com.palmergames.bukkit.towny.event.TownRemoveResidentEvent;
|
||||
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
||||
import com.palmergames.bukkit.towny.object.Resident;
|
||||
import net.draycia.carbon.CarbonChat;
|
||||
import net.draycia.carbon.events.ChannelSwitchEvent;
|
||||
import net.draycia.carbon.events.PreChatFormatEvent;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
public final class TownyContext implements Listener {
|
||||
|
||||
private final CarbonChat carbonChat;
|
||||
private static final String KEY = "towny-town";
|
||||
|
||||
public TownyContext(CarbonChat carbonChat) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
this.carbonChat.getContextManager().register("towny-town", (context) -> {
|
||||
if ((context.getValue() instanceof Boolean) && ((Boolean) context.getValue())) {
|
||||
return isInSameTown(context.getSender(), context.getTarget());
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onChannelSwitch(ChannelSwitchEvent event) {
|
||||
Object town = event.getChannel().getContext(KEY);
|
||||
|
||||
if ((town instanceof Boolean) && ((Boolean) town)) {
|
||||
if (!isInTown(event.getUser())) {
|
||||
event.setCancelled(true);
|
||||
event.setFailureMessage(carbonChat.getConfig().getString("contexts.Towny.cancellation-message"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onChannelMessage(PreChatFormatEvent event) {
|
||||
// TODO: event.setFailureMessage
|
||||
Object town = event.getChannel().getContext(KEY);
|
||||
|
||||
if ((town instanceof Boolean) && ((Boolean) town)) {
|
||||
if (!isInTown(event.getUser())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onResidentRemove(TownRemoveResidentEvent event) {
|
||||
String name = event.getResident().getName();
|
||||
ChatUser user = carbonChat.getUserService().wrap(name);
|
||||
Object town = user.getSelectedChannel().getContext(KEY);
|
||||
|
||||
if ((town instanceof Boolean) && ((Boolean) town)) {
|
||||
user.clearSelectedChannel();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
ChatUser user = carbonChat.getUserService().wrap(event.getPlayer());
|
||||
Object town = user.getSelectedChannel().getContext(KEY);
|
||||
|
||||
if ((town instanceof Boolean) && ((Boolean) town) && !isInTown(user)) {
|
||||
user.clearSelectedChannel();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInTown(ChatUser user) {
|
||||
try {
|
||||
return TownyAPI.getInstance().getDataSource().getResident(user.asPlayer().getName()).hasTown();
|
||||
} catch (NotRegisteredException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isInSameTown(ChatUser user1, ChatUser user2) {
|
||||
if (!user1.isOnline() || !user2.isOnline()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
Resident resident = TownyAPI.getInstance().getDataSource().getResident(user1.asPlayer().getName());
|
||||
|
||||
if (resident.hasTown()) {
|
||||
return resident.getTown().hasResident(user2.asPlayer().getName());
|
||||
}
|
||||
} catch (NotRegisteredException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package net.draycia.carbon.channels.contexts.impl;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
import com.sk89q.worldguard.protection.regions.RegionContainer;
|
||||
import com.sk89q.worldguard.protection.regions.RegionQuery;
|
||||
import net.draycia.carbon.CarbonChat;
|
||||
import net.draycia.carbon.events.ChannelSwitchEvent;
|
||||
import net.draycia.carbon.events.PreChatFormatEvent;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public final class WorldGuardContext implements Listener {
|
||||
|
||||
private static final String KEY = "worldguard-region";
|
||||
|
||||
public WorldGuardContext(CarbonChat carbonChat) {
|
||||
carbonChat.getContextManager().register(KEY, (context) -> {
|
||||
return this.testContext(context.getSender(), context.getTarget(), context.getValue());
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onChannelSwitch(ChannelSwitchEvent event) {
|
||||
// TODO: cancellation message
|
||||
Object value = event.getChannel().getContext(KEY);
|
||||
|
||||
if ((value instanceof String || value instanceof List) && !isInRegionOrRegions(value, event.getUser())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onChannelMessage(PreChatFormatEvent event) {
|
||||
// TODO: cancellation message
|
||||
Object value = event.getChannel().getContext(KEY);
|
||||
|
||||
if ((value instanceof String || value instanceof List) && !isInRegionOrRegions(value, event.getUser())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isInRegionOrRegions(Object value, ChatUser user) {
|
||||
if ((value instanceof String)) {
|
||||
return isInRegion((String) value, user);
|
||||
}
|
||||
|
||||
if (value instanceof List) {
|
||||
for (String region : ((List<String>) value)) {
|
||||
if (isInRegion(region, user)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean testContext(ChatUser sender, ChatUser target, Object value) {
|
||||
boolean user1InRegion = false;
|
||||
boolean user2InRegion = false;
|
||||
|
||||
if ((value instanceof Boolean) && ((Boolean) value)) {
|
||||
return isInSameRegion(sender, target);
|
||||
} else if (value instanceof String) {
|
||||
user1InRegion = isInRegion((String)value, sender);
|
||||
user2InRegion = isInRegion((String)value, target);
|
||||
} else if (value instanceof List) {
|
||||
for (String item : (List<String>)value) {
|
||||
if (!user1InRegion) {
|
||||
user1InRegion = isInRegion(item, sender);
|
||||
}
|
||||
|
||||
if (!user2InRegion) {
|
||||
user2InRegion = isInRegion(item, target);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
return user1InRegion && user2InRegion;
|
||||
}
|
||||
|
||||
public boolean isInSameRegion(ChatUser user1, ChatUser user2) {
|
||||
if (!user1.isOnline() || !user2.isOnline()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Location user1Location = BukkitAdapter.adapt(user1.asPlayer().getLocation());
|
||||
Location user2Location = BukkitAdapter.adapt(user2.asPlayer().getLocation());
|
||||
|
||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||
RegionQuery regionQuery = container.createQuery();
|
||||
|
||||
ApplicableRegionSet user1Regions = regionQuery.getApplicableRegions(user1Location);
|
||||
ApplicableRegionSet user2Regions = regionQuery.getApplicableRegions(user2Location);
|
||||
|
||||
for (ProtectedRegion region : user1Regions) {
|
||||
if (user2Regions.getRegions().contains(region)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isInRegion(String region, ChatUser user) {
|
||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||
World world = BukkitAdapter.adapt(user.asPlayer().getWorld());
|
||||
ProtectedRegion protection = container.get(world).getRegion(region);
|
||||
|
||||
return isInRegion(protection, user);
|
||||
}
|
||||
|
||||
public boolean isInRegion(ProtectedRegion region, ChatUser user) {
|
||||
Location location = BukkitAdapter.adapt(user.asPlayer().getLocation());
|
||||
|
||||
return region.contains(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package net.draycia.carbon.channels.contexts.impl;
|
||||
|
||||
import com.gmail.nossr50.api.PartyAPI;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent;
|
||||
import net.draycia.carbon.CarbonChat;
|
||||
import net.draycia.carbon.events.ChannelSwitchEvent;
|
||||
import net.draycia.carbon.events.PreChatFormatEvent;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
public final class mcMMOContext implements Listener {
|
||||
|
||||
private CarbonChat carbonChat;
|
||||
|
||||
public mcMMOContext(CarbonChat carbonChat) {
|
||||
this.carbonChat = carbonChat;
|
||||
|
||||
this.carbonChat.getContextManager().register("mcmmo-party", (context) -> {
|
||||
if ((context.getValue() instanceof Boolean) && ((Boolean) context.getValue())) {
|
||||
return isInSameParty(context.getSender(), context.getTarget());
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onChannelSwitch(ChannelSwitchEvent event) {
|
||||
Object party = event.getChannel().getContext("mcmmo-party");
|
||||
|
||||
if ((party instanceof Boolean) && ((Boolean) party)) {
|
||||
if (!isInParty(event.getUser())) {
|
||||
event.setCancelled(true);
|
||||
event.setFailureMessage(carbonChat.getConfig().getString("contexts.mcMMO.cancellation-message"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onChannelMessage(PreChatFormatEvent event) {
|
||||
Object party = event.getChannel().getContext("mcmmo-party");
|
||||
|
||||
if ((party instanceof Boolean) && ((Boolean) party)) {
|
||||
if (!isInParty(event.getUser())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final McMMOPartyChangeEvent.EventReason LEFT = McMMOPartyChangeEvent.EventReason.LEFT_PARTY;
|
||||
private final McMMOPartyChangeEvent.EventReason KICKED = McMMOPartyChangeEvent.EventReason.KICKED_FROM_PARTY;
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPartyLeave(McMMOPartyChangeEvent event) {
|
||||
if (event.getReason() != LEFT && event.getReason() != KICKED) {
|
||||
return;
|
||||
}
|
||||
|
||||
ChatUser user = carbonChat.getUserService().wrap(event.getPlayer());
|
||||
Object party = user.getSelectedChannel().getContext("mcmmo-party");
|
||||
|
||||
if ((party instanceof Boolean) && ((Boolean) party)) {
|
||||
user.clearSelectedChannel();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
ChatUser user = carbonChat.getUserService().wrap(event.getPlayer());
|
||||
Object party = user.getSelectedChannel().getContext("mcmmo-party");
|
||||
|
||||
if ((party instanceof Boolean) && ((Boolean) party) && !isInParty(user)) {
|
||||
user.clearSelectedChannel();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInParty(ChatUser user) {
|
||||
return PartyAPI.inParty(user.asPlayer());
|
||||
}
|
||||
|
||||
public boolean isInSameParty(ChatUser user1, ChatUser user2) {
|
||||
if (!user1.isOnline() || !user2.isOnline()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return PartyAPI.inSameParty(user1.asPlayer(), user2.asPlayer());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,592 @@
|
||||
package net.draycia.carbon.channels.impls;
|
||||
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import net.draycia.carbon.CarbonChat;
|
||||
import net.draycia.carbon.channels.ChatChannel;
|
||||
import net.draycia.carbon.events.ChatComponentEvent;
|
||||
import net.draycia.carbon.events.ChatFormatEvent;
|
||||
import net.draycia.carbon.events.PreChatFormatEvent;
|
||||
import net.draycia.carbon.storage.ChatUser;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyFormat;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class CarbonChatChannel extends ChatChannel {
|
||||
|
||||
private final String key;
|
||||
|
||||
private final CarbonChat carbonChat;
|
||||
private final ConfigurationSection config;
|
||||
|
||||
public CarbonChatChannel(String key, CarbonChat carbonChat, ConfigurationSection config) {
|
||||
this.key = key;
|
||||
this.carbonChat = carbonChat;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public CarbonChat getCarbonChat() {
|
||||
return carbonChat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testContext(ChatUser sender, ChatUser target) {
|
||||
return carbonChat.getContextManager().testContext(sender, target, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean canPlayerUse(ChatUser user) {
|
||||
return user.asPlayer().hasPermission("carbonchat.channels." + getName() + ".use");
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<ChatUser> audiences() {
|
||||
List<ChatUser> audience = new ArrayList<>();
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
ChatUser playerUser = carbonChat.getUserService().wrap(player);
|
||||
|
||||
if (canPlayerSee(playerUser, true)) {
|
||||
audience.add(playerUser);
|
||||
}
|
||||
}
|
||||
|
||||
return audience;
|
||||
}
|
||||
|
||||
private void updateUserNickname(ChatUser user) {
|
||||
if (user.isOnline()) {
|
||||
if (user.getNickname() != null) {
|
||||
user.asPlayer().setDisplayName(user.getNickname());
|
||||
|
||||
if (carbonChat.getConfig().getBoolean("nicknames-set-tab-name")) {
|
||||
user.asPlayer().setPlayerListName(user.getNickname());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private TextColor getColor(ChatUser user) {
|
||||
TextColor userColor = user.getChannelSettings(this).getColor();
|
||||
|
||||
if (userColor != null) {
|
||||
return userColor;
|
||||
} else {
|
||||
return getChannelColor(user);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendMessage(ChatUser user, Collection<ChatUser> recipients, String message, boolean fromRemote) {
|
||||
updateUserNickname(user);
|
||||
|
||||
// Get player's formatting
|
||||
String messageFormat = getFormat(user);
|
||||
|
||||
// Call custom chat event
|
||||
PreChatFormatEvent preFormatEvent = new PreChatFormatEvent(user, this, messageFormat, message);
|
||||
Bukkit.getPluginManager().callEvent(preFormatEvent);
|
||||
|
||||
// Return if cancelled or message is emptied
|
||||
|
||||
if (preFormatEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (preFormatEvent.getMessage().trim().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String displayName;
|
||||
|
||||
if (user.isOnline()) {
|
||||
displayName = user.asPlayer().getDisplayName();
|
||||
} else {
|
||||
displayName = user.asOfflinePlayer().getName();
|
||||
}
|
||||
|
||||
// Iterate through players who should receive messages in this channel
|
||||
for (ChatUser target : recipients) {
|
||||
// Call second format event. Used for relational stuff (placeholders etc)
|
||||
ChatFormatEvent formatEvent = new ChatFormatEvent(user, target, this, preFormatEvent.getFormat(), preFormatEvent.getMessage());
|
||||
Bukkit.getPluginManager().callEvent(formatEvent);
|
||||
|
||||
// Again, return if cancelled or message is emptied
|
||||
if (formatEvent.isCancelled()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (formatEvent.getMessage().trim().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
TextComponent formattedMessage = (TextComponent) carbonChat.getAdventureManager().processMessage(formatEvent.getFormat(),
|
||||
"br", "\n",
|
||||
"displayname", displayName,
|
||||
"color", "<" + getColor(target).asHexString() + ">",
|
||||
"phase", Long.toString(System.currentTimeMillis() % 25),
|
||||
"server", carbonChat.getConfig().getString("server-name", "Server"),
|
||||
"message", formatEvent.getMessage());
|
||||
|
||||
if (isUserSpying(user, target)) {
|
||||
String prefix = processPlaceholders(user, carbonChat.getConfig().getString("spy-prefix"));
|
||||
|
||||
formattedMessage = (TextComponent) MiniMessage.get().parse(prefix, "color",
|
||||
getColor(target).asHexString()).append(formattedMessage);
|
||||
}
|
||||
|
||||
ChatComponentEvent newEvent = new ChatComponentEvent(user, target, this, formattedMessage,
|
||||
formatEvent.getMessage());
|
||||
|
||||
Bukkit.getPluginManager().callEvent(newEvent);
|
||||
|
||||
target.sendMessage(newEvent.getComponent());
|
||||
}
|
||||
|
||||
ChatFormatEvent consoleFormatEvent = new ChatFormatEvent(user, null, this, preFormatEvent.getFormat(),
|
||||
preFormatEvent.getMessage());
|
||||
|
||||
Bukkit.getPluginManager().callEvent(consoleFormatEvent);
|
||||
|
||||
TextComponent consoleMessage = (TextComponent) carbonChat.getAdventureManager().processMessage(consoleFormatEvent.getFormat(),
|
||||
"br", "\n",
|
||||
"displayname", displayName,
|
||||
"color", "<" + getColor(user).asHexString() + ">",
|
||||
"phase", Long.toString(System.currentTimeMillis() % 25),
|
||||
"server", carbonChat.getConfig().getString("server-name", "Server"),
|
||||
"message", consoleFormatEvent.getMessage());
|
||||
|
||||
ChatComponentEvent consoleEvent = new ChatComponentEvent(user, null, this, consoleMessage,
|
||||
consoleFormatEvent.getMessage());
|
||||
|
||||
Bukkit.getPluginManager().callEvent(consoleEvent);
|
||||
|
||||
// Log message to console
|
||||
System.out.println(CarbonChat.LEGACY.serialize(consoleEvent.getComponent()));
|
||||
|
||||
// Route message to bungee / discord (if message originates from this server)
|
||||
// Use instanceof and not isOnline, if this message originates from another then the instanceof will
|
||||
// fail, but isOnline may succeed if the player is online on both servers (somehow).
|
||||
if (user.isOnline() && !fromRemote && shouldBungee()) {
|
||||
sendMessageToBungee(user.asPlayer(), consoleEvent.getComponent());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(ChatUser user, String message, boolean fromRemote) {
|
||||
this.sendMessage(user, this.audiences(), message, fromRemote);
|
||||
}
|
||||
|
||||
public String getFormat(ChatUser user) {
|
||||
for (String group : this.getGroupOverrides()) {
|
||||
if (userHasGroup(user, group)) {
|
||||
String format = getFormat(group);
|
||||
|
||||
if (format != null) {
|
||||
return format;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (primaryGroupOnly()) {
|
||||
return getPrimaryGroupFormat(user);
|
||||
} else {
|
||||
return getFirstFoundUserFormat(user);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean userHasGroup(ChatUser user, String group) {
|
||||
if (user.isOnline()) {
|
||||
if (carbonChat.getPermission().playerInGroup(user.asPlayer(), group)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (carbonChat.getPermission().playerInGroup(null, user.asOfflinePlayer(), group)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (user.isOnline() && this.permissionGroupMatching()) {
|
||||
return user.asPlayer().hasPermission("carbonchat.group." + group);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private String getFirstFoundUserFormat(ChatUser user) {
|
||||
String[] playerGroups;
|
||||
|
||||
if (user.isOnline()) {
|
||||
playerGroups = carbonChat.getPermission().getPlayerGroups(user.asPlayer());
|
||||
} else {
|
||||
playerGroups = carbonChat.getPermission().getPlayerGroups(null, user.asOfflinePlayer());
|
||||
}
|
||||
|
||||
for (String group : playerGroups) {
|
||||
String groupFormat = getFormat(group);
|
||||
|
||||
if (groupFormat != null) {
|
||||
return groupFormat;
|
||||
}
|
||||
}
|
||||
|
||||
return getDefaultFormat();
|
||||
}
|
||||
|
||||
private String getPrimaryGroupFormat(ChatUser user) {
|
||||
String primaryGroup;
|
||||
|
||||
if (user.isOnline()) {
|
||||
primaryGroup = carbonChat.getPermission().getPrimaryGroup(user.asPlayer());
|
||||
} else {
|
||||
primaryGroup = carbonChat.getPermission().getPrimaryGroup(null, user.asOfflinePlayer());
|
||||
}
|
||||
|
||||
String primaryGroupFormat = getFormat(primaryGroup);
|
||||
|
||||
if (primaryGroupFormat != null) {
|
||||
return primaryGroupFormat;
|
||||
}
|
||||
|
||||
return getDefaultFormat();
|
||||
}
|
||||
|
||||
private String getDefaultFormat() {
|
||||
return getFormat(getDefaultFormatName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFormat(String group) {
|
||||
return getString("formats." + group);
|
||||
}
|
||||
|
||||
private boolean isUserSpying(ChatUser sender, ChatUser target) {
|
||||
if (!canPlayerSee(sender, target, false)) {
|
||||
return target.getChannelSettings(this).isSpying();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendComponent(ChatUser player, Component component) {
|
||||
for (ChatUser user : audiences()) {
|
||||
if (!user.isIgnoringUser(player)) {
|
||||
user.sendMessage(component);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println(CarbonChat.LEGACY.serialize(component));
|
||||
}
|
||||
|
||||
public void sendMessageToBungee(Player player, Component component) {
|
||||
carbonChat.getMessageManager().sendMessage("channel-component", player.getUniqueId(), (byteArray) -> {
|
||||
byteArray.writeUTF(this.getKey());
|
||||
byteArray.writeUTF(carbonChat.getAdventureManager().getAudiences().gsonSerializer().serialize(component));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean canPlayerSee(ChatUser target, boolean checkSpying) {
|
||||
Player targetPlayer = target.asPlayer();
|
||||
|
||||
if (checkSpying && targetPlayer.hasPermission("carbonchat.spy." + getName())) {
|
||||
if (target.getChannelSettings(this).isSpying()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!targetPlayer.hasPermission("carbonchat.channels." + getName() + ".see")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isIgnorable()) {
|
||||
return !target.getChannelSettings(this).isIgnored();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public Boolean canPlayerSee(ChatUser sender, ChatUser target, boolean checkSpying) {
|
||||
Player targetPlayer = target.asPlayer();
|
||||
|
||||
if (canPlayerSee(target, checkSpying)){
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isIgnorable()) {
|
||||
if (target.isIgnoringUser(sender) && !targetPlayer.hasPermission("carbonchat.ignore.exempt")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !target.getChannelSettings(this).isIgnored();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextColor getChannelColor(ChatUser user) {
|
||||
String color = getString("color");
|
||||
|
||||
if (color == null) {
|
||||
color = "white";
|
||||
}
|
||||
|
||||
if (user.isOnline()) {
|
||||
color = PlaceholderAPI.setPlaceholders(user.asPlayer(), color);
|
||||
}
|
||||
|
||||
for (NamedTextColor namedColor : NamedTextColor.values()) {
|
||||
if (namedColor.toString().equalsIgnoreCase(color)) {
|
||||
return namedColor;
|
||||
}
|
||||
}
|
||||
|
||||
if (color.startsWith("&")) {
|
||||
LegacyFormat legacyFormat = LegacyComponentSerializer.parseChar(color.charAt(1));
|
||||
|
||||
if (legacyFormat != null) {
|
||||
TextColor legacyColor = legacyFormat.color();
|
||||
|
||||
if (legacyColor != null) {
|
||||
return legacyColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TextColor textColor = TextColor.fromHexString(color);
|
||||
|
||||
if (textColor != null) {
|
||||
return textColor;
|
||||
}
|
||||
|
||||
if (carbonChat.getConfig().getBoolean("show-tips")) {
|
||||
carbonChat.getLogger().warning("Tip: Channel color found (" + color + ") is invalid!");
|
||||
carbonChat.getLogger().warning("Falling back to #FFFFFF");
|
||||
}
|
||||
|
||||
return NamedTextColor.WHITE;
|
||||
}
|
||||
|
||||
private String getDefaultFormatName() {
|
||||
return getString("default-group");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isDefault() {
|
||||
return getBoolean("default");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isIgnorable() {
|
||||
return getBoolean("ignorable");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean shouldBungee() {
|
||||
return getBoolean("should-bungee");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean honorsRecipientList() {
|
||||
return getBoolean("honors-recipient-list");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean permissionGroupMatching() {
|
||||
return getBoolean("permission-group-matching");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroupOverrides() {
|
||||
return getStringList("group-overrides");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
String name = getString("name");
|
||||
return name == null ? key : name;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getMessagePrefix() {
|
||||
if (config != null && config.contains("message-prefix")) {
|
||||
return config.getString("message-prefix");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSwitchMessage() {
|
||||
return getString("switch-message");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSwitchOtherMessage() {
|
||||
return getString("switch-other-message");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSwitchFailureMessage() {
|
||||
return getString("switch-failure-message");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToggleOffMessage() {
|
||||
return getString("toggle-off-message");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToggleOnMessage() {
|
||||
return getString("toggle-on-message");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToggleOtherOnMessage() {
|
||||
return getString("toggle-other-on");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToggleOtherOffMessage() {
|
||||
return getString("toggle-other-off");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCannotUseMessage() {
|
||||
return getString("cannot-use-channel");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean shouldForwardFormatting() {
|
||||
return getBoolean("forward-format");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean primaryGroupOnly() {
|
||||
return getBoolean("primary-group-only");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pattern> getItemLinkPatterns() {
|
||||
ArrayList<Pattern> itemPatterns = new ArrayList<>();
|
||||
|
||||
for (String entry : carbonChat.getConfig().getStringList("item-link-placeholders")) {
|
||||
itemPatterns.add(Pattern.compile(Pattern.quote(entry)));
|
||||
}
|
||||
|
||||
return itemPatterns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContext(String key) {
|
||||
ConfigurationSection section = config.getConfigurationSection("contexts");
|
||||
|
||||
if (section == null) {
|
||||
ConfigurationSection defaultSection = carbonChat.getConfig().getConfigurationSection("default");
|
||||
|
||||
if (defaultSection == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ConfigurationSection defaultContexts = defaultSection.getConfigurationSection("contexts");
|
||||
|
||||
if (defaultContexts == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return defaultContexts.get(key);
|
||||
}
|
||||
|
||||
return section.get(key);
|
||||
}
|
||||
|
||||
private String getString(String key) {
|
||||
if (config != null && config.contains(key)) {
|
||||
return config.getString(key);
|
||||
}
|
||||
|
||||
ConfigurationSection defaultSection = carbonChat.getConfig().getConfigurationSection("default");
|
||||
|
||||
if (defaultSection != null && defaultSection.contains(key)) {
|
||||
return defaultSection.getString(key);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<String> getStringList(String key) {
|
||||
if (config != null && config.contains(key)) {
|
||||
return config.getStringList(key);
|
||||
}
|
||||
|
||||
ConfigurationSection defaultSection = carbonChat.getConfig().getConfigurationSection("default");
|
||||
|
||||
if (defaultSection != null && defaultSection.contains(key)) {
|
||||
return defaultSection.getStringList(key);
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private boolean getBoolean(String key) {
|
||||
if (config != null && config.contains(key)) {
|
||||
return config.getBoolean(key);
|
||||
}
|
||||
|
||||
ConfigurationSection defaultSection = carbonChat.getConfig().getConfigurationSection("default");
|
||||
|
||||
if (defaultSection != null && defaultSection.contains(key)) {
|
||||
return defaultSection.getBoolean(key);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private double getDouble(String key) {
|
||||
if (config != null && config.contains(key)) {
|
||||
return config.getDouble(key);
|
||||
}
|
||||
|
||||
ConfigurationSection defaultSection = carbonChat.getConfig().getConfigurationSection("default");
|
||||
|
||||
if (defaultSection != null && defaultSection.contains(key)) {
|
||||
return defaultSection.getDouble(key);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAliases() {
|
||||
String aliases = getString("aliases");
|
||||
|
||||
if (aliases == null) {
|
||||
return getKey();
|
||||
}
|
||||
|
||||
return aliases;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCancelChatEvent() {
|
||||
return getBoolean("cancel-message-event");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user