Compare commits
7
Commits
773638c222
...
ignore_fix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e437079e4 | ||
|
|
45eceaf4a6 | ||
|
|
c5eebb7e88 | ||
|
|
5e34e6e7fa | ||
|
|
c5c60d25b1 | ||
|
|
804e619e8a | ||
|
|
b3e545a0c8 |
@@ -3,9 +3,10 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly("com.alttd:Galaxy-API:1.21-R0.1-SNAPSHOT") {
|
// compileOnly("com.alttd:Galaxy-API:1.21-R0.1-SNAPSHOT") {
|
||||||
// exclude("net.kyori")
|
// exclude("net.kyori")
|
||||||
}
|
// }
|
||||||
|
compileOnly("io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT")
|
||||||
compileOnly("org.spongepowered:configurate-yaml:4.1.2") // Configurate
|
compileOnly("org.spongepowered:configurate-yaml:4.1.2") // Configurate
|
||||||
compileOnly("net.luckperms:api:5.3") // Luckperms
|
compileOnly("net.luckperms:api:5.3") // Luckperms
|
||||||
}
|
}
|
||||||
@@ -24,4 +25,4 @@ publishing {
|
|||||||
credentials(PasswordCredentials::class)
|
credentials(PasswordCredentials::class)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ plugins {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(":api")) // API
|
implementation(project(":api")) // API
|
||||||
compileOnly("com.alttd:Galaxy-API:1.21-R0.1-SNAPSHOT") // Galaxy
|
// compileOnly("com.alttd:Galaxy-API:1.21-R0.1-SNAPSHOT") // Galaxy
|
||||||
|
compileOnly("io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT")
|
||||||
compileOnly("com.gitlab.ruany:LiteBansAPI:0.3.5") // move to proxy
|
compileOnly("com.gitlab.ruany:LiteBansAPI:0.3.5") // move to proxy
|
||||||
compileOnly("org.apache.commons:commons-lang3:3.12.0") // needs an alternative, already removed from upstream api and will be removed in server
|
compileOnly("org.apache.commons:commons-lang3:3.12.0") // needs an alternative, already removed from upstream api and will be removed in server
|
||||||
compileOnly("net.luckperms:api:5.3") // Luckperms
|
compileOnly("net.luckperms:api:5.3") // Luckperms
|
||||||
@@ -21,4 +22,4 @@ tasks {
|
|||||||
dependsOn(shadowJar)
|
dependsOn(shadowJar)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class ChatPlugin extends JavaPlugin {
|
|||||||
chatAPI = new ChatImplementation();
|
chatAPI = new ChatImplementation();
|
||||||
chatHandler = new ChatHandler();
|
chatHandler = new ChatHandler();
|
||||||
DatabaseConnection.initialize();
|
DatabaseConnection.initialize();
|
||||||
serverConfig = new ServerConfig(Bukkit.getServerName());
|
serverConfig = new ServerConfig(Bukkit.getServer().getName());
|
||||||
ChatLogHandler chatLogHandler = ChatLogHandler.getInstance(true);
|
ChatLogHandler chatLogHandler = ChatLogHandler.getInstance(true);
|
||||||
registerListener(new PlayerListener(serverConfig), new ChatListener(chatLogHandler), new BookListener(), new ShutdownListener(chatLogHandler, this));
|
registerListener(new PlayerListener(serverConfig), new ChatListener(chatLogHandler), new BookListener(), new ShutdownListener(chatLogHandler, this));
|
||||||
if(serverConfig.GLOBALCHAT) {
|
if(serverConfig.GLOBALCHAT) {
|
||||||
@@ -119,7 +119,7 @@ public class ChatPlugin extends JavaPlugin {
|
|||||||
public void ReloadConfig() {
|
public void ReloadConfig() {
|
||||||
chatAPI.ReloadConfig();
|
chatAPI.ReloadConfig();
|
||||||
chatAPI.ReloadChatFilters();
|
chatAPI.ReloadChatFilters();
|
||||||
serverConfig = new ServerConfig(Bukkit.getServerName());
|
serverConfig = new ServerConfig(Bukkit.getServer().getName());
|
||||||
Bukkit.broadcast(Utility.parseMiniMessage("Reloaded ChatPlugin Config."), "command.chat.reloadchat");
|
Bukkit.broadcast(Utility.parseMiniMessage("Reloaded ChatPlugin Config."), "command.chat.reloadchat");
|
||||||
ALogger.info("Reloaded ChatPlugin config.");
|
ALogger.info("Reloaded ChatPlugin config.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class ChatChannel extends BukkitCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(args.length == 0 && player.hasPermission(channel.getPermission())) {
|
if(args.length == 0 && player.hasPermission(channel.getPermission())) {
|
||||||
player.sendMiniMessage(Config.CUSTOM_CHANNEL_TOGGLED, TagResolver.resolver(
|
player.sendRichMessage(Config.CUSTOM_CHANNEL_TOGGLED, TagResolver.resolver(
|
||||||
Placeholder.unparsed("channel", channel.getChannelName()),
|
Placeholder.unparsed("channel", channel.getChannelName()),
|
||||||
Placeholder.component("status", toggleableForCustomChannel.toggle(player.getUniqueId())
|
Placeholder.component("status", toggleableForCustomChannel.toggle(player.getUniqueId())
|
||||||
? Config.TOGGLED_ON : Config.TOGGLED_OFF)));
|
? Config.TOGGLED_ON : Config.TOGGLED_OFF)));
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class PartyChat extends Toggleable implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(args.length == 0) {
|
if(args.length == 0) {
|
||||||
player.sendMiniMessage(Config.PARTY_TOGGLED, Placeholder.component("status",
|
player.sendRichMessage(Config.PARTY_TOGGLED, Placeholder.component("status",
|
||||||
toggle(player.getUniqueId()) ? Config.TOGGLED_ON : Config.TOGGLED_OFF));
|
toggle(player.getUniqueId()) ? Config.TOGGLED_ON : Config.TOGGLED_OFF));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public class ChatHandler {
|
public class ChatHandler {
|
||||||
|
|
||||||
@@ -130,7 +131,7 @@ public class ChatHandler {
|
|||||||
Placeholder.component("sender", senderName),
|
Placeholder.component("sender", senderName),
|
||||||
Placeholder.component("prefix", prefix),
|
Placeholder.component("prefix", prefix),
|
||||||
Placeholder.component("message", parseMessageContent(player, message)),
|
Placeholder.component("message", parseMessageContent(player, message)),
|
||||||
Placeholder.parsed("server", Bukkit.getServerName())
|
Placeholder.parsed("server", Bukkit.getServer().getName())
|
||||||
);
|
);
|
||||||
|
|
||||||
Component component = Utility.parseMiniMessage(Config.GCFORMAT, placeholders);
|
Component component = Utility.parseMiniMessage(Config.GCFORMAT, placeholders);
|
||||||
@@ -164,7 +165,7 @@ public class ChatHandler {
|
|||||||
TagResolver placeholders = TagResolver.resolver(
|
TagResolver placeholders = TagResolver.resolver(
|
||||||
Placeholder.component("sender", senderName),
|
Placeholder.component("sender", senderName),
|
||||||
Placeholder.component("message", parseMessageContent(player, message)),
|
Placeholder.component("message", parseMessageContent(player, message)),
|
||||||
Placeholder.parsed("server", Bukkit.getServerName()),
|
Placeholder.parsed("server", Bukkit.getServer().getName()),
|
||||||
Placeholder.parsed("channel", channel.getChannelName())
|
Placeholder.parsed("channel", channel.getChannelName())
|
||||||
);
|
);
|
||||||
Component component = Utility.parseMiniMessage(channel.getFormat(), placeholders);
|
Component component = Utility.parseMiniMessage(channel.getFormat(), placeholders);
|
||||||
@@ -237,12 +238,21 @@ public class ChatHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendChatChannelMessage(CustomChannel chatChannel, UUID uuid, Component component) {
|
private void sendChatChannelMessage(CustomChannel chatChannel, UUID uuid, Component component) {
|
||||||
if (!chatChannel.getServers().contains(Bukkit.getServerName())) return;
|
if (!chatChannel.getServers().contains(Bukkit.getServer().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Bukkit.getServer().getOnlinePlayers().stream()
|
Player player = Bukkit.getPlayer(uuid);
|
||||||
.filter(p -> p.hasPermission(chatChannel.getPermission()))
|
if (player == null) {
|
||||||
.filter(p -> !ChatUserManager.getChatUser(p.getUniqueId()).getIgnoredPlayers().contains(uuid))
|
return;
|
||||||
.forEach(p -> p.sendMessage(component));
|
}
|
||||||
|
|
||||||
|
Stream<? extends Player> stream = Bukkit.getServer().getOnlinePlayers().stream()
|
||||||
|
.filter(p -> p.hasPermission(chatChannel.getPermission()));
|
||||||
|
if (!player.hasPermission("chat.ignorebypass")) {
|
||||||
|
stream = stream.filter(p -> !ChatUserManager.getChatUser(p.getUniqueId()).getIgnoredPlayers().contains(uuid) && !p.hasPermission("chat.ignorebypass"));
|
||||||
|
}
|
||||||
|
stream.forEach(p -> p.sendMessage(component));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendPluginMessage(Player player, String channel, Component component) {
|
private void sendPluginMessage(Player player, String channel, Component component) {
|
||||||
|
|||||||
@@ -32,8 +32,10 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public class ChatListener implements Listener {
|
public class ChatListener implements Listener {
|
||||||
|
|
||||||
@@ -81,13 +83,14 @@ public class ChatListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
UUID uuid = player.getUniqueId();
|
||||||
|
|
||||||
Component input = event.message().colorIfAbsent(NamedTextColor.WHITE);
|
Component input = event.message().colorIfAbsent(NamedTextColor.WHITE);
|
||||||
|
|
||||||
ModifiableString modifiableString = new ModifiableString(input);
|
ModifiableString modifiableString = new ModifiableString(input);
|
||||||
|
|
||||||
// todo a better way for this
|
// todo a better way for this
|
||||||
if(!RegexManager.filterText(player.getName(), player.getUniqueId(), modifiableString, true, "chat", filterType -> {
|
if(!RegexManager.filterText(player.getName(), uuid, modifiableString, true, "chat", filterType -> {
|
||||||
if (!filterType.equals(FilterType.PUNISH)) {
|
if (!filterType.equals(FilterType.PUNISH)) {
|
||||||
ALogger.warn("Received another FilterType than punish when filtering chat and executing a filter action");
|
ALogger.warn("Received another FilterType than punish when filtering chat and executing a filter action");
|
||||||
return;
|
return;
|
||||||
@@ -95,7 +98,7 @@ public class ChatListener implements Listener {
|
|||||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||||
out.writeUTF("punish");
|
out.writeUTF("punish");
|
||||||
out.writeUTF(player.getName());
|
out.writeUTF(player.getName());
|
||||||
out.writeUTF(player.getUniqueId().toString());
|
out.writeUTF(uuid.toString());
|
||||||
out.writeUTF(modifiableString.string());
|
out.writeUTF(modifiableString.string());
|
||||||
player.sendPluginMessage(ChatPlugin.getInstance(), Config.MESSAGECHANNEL, out.toByteArray());
|
player.sendPluginMessage(ChatPlugin.getInstance(), Config.MESSAGECHANNEL, out.toByteArray());
|
||||||
})) {
|
})) {
|
||||||
@@ -103,14 +106,18 @@ public class ChatListener implements Listener {
|
|||||||
GalaxyUtility.sendBlockedNotification("Language", player,
|
GalaxyUtility.sendBlockedNotification("Language", player,
|
||||||
modifiableString.component(),
|
modifiableString.component(),
|
||||||
"");
|
"");
|
||||||
chatLogHandler.addChatLog(player.getUniqueId(), player.getServer().getServerName(), PlainTextComponentSerializer.plainText().serialize(input), true);
|
chatLogHandler.addChatLog(uuid, player.getServer().getName(), PlainTextComponentSerializer.plainText().serialize(input), true);
|
||||||
return; // the message was blocked
|
return; // the message was blocked
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<Player> receivers = event.viewers().stream().filter(audience -> audience instanceof Player)
|
Stream<Player> stream = event.viewers().stream().filter(audience -> audience instanceof Player)
|
||||||
.map(audience -> (Player) audience)
|
.map(audience -> (Player) audience);
|
||||||
.filter(receiver -> !ChatUserManager.getChatUser(receiver.getUniqueId()).getIgnoredPlayers().contains(player.getUniqueId()))
|
|
||||||
.collect(Collectors.toSet());
|
if (!player.hasPermission("chat.ignorebypass")) {
|
||||||
|
stream = stream.filter(receiver -> !ChatUserManager.getChatUser(receiver.getUniqueId()).getIgnoredPlayers().contains(uuid)
|
||||||
|
&& !receiver.hasPermission("chat.ignorebypass"));
|
||||||
|
}
|
||||||
|
Set<Player> receivers = stream.collect(Collectors.toSet());
|
||||||
|
|
||||||
Set<Player> playersToPing = new HashSet<>();
|
Set<Player> playersToPing = new HashSet<>();
|
||||||
pingPlayers(playersToPing, modifiableString, player);
|
pingPlayers(playersToPing, modifiableString, player);
|
||||||
@@ -122,7 +129,7 @@ public class ChatListener implements Listener {
|
|||||||
for (Player pingPlayer : playersToPing) {
|
for (Player pingPlayer : playersToPing) {
|
||||||
pingPlayer.playSound(pingPlayer.getLocation(), Sound.BLOCK_NOTE_BLOCK_BASS, 1, 1);
|
pingPlayer.playSound(pingPlayer.getLocation(), Sound.BLOCK_NOTE_BLOCK_BASS, 1, 1);
|
||||||
}
|
}
|
||||||
chatLogHandler.addChatLog(player.getUniqueId(), player.getServer().getServerName(), modifiableString.string(), false);
|
chatLogHandler.addChatLog(uuid, player.getServer().getName(), modifiableString.string(), false);
|
||||||
ALogger.info(PlainTextComponentSerializer.plainText().serialize(input));
|
ALogger.info(PlainTextComponentSerializer.plainText().serialize(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,11 +143,12 @@ public class ChatListener implements Listener {
|
|||||||
Pattern nickPattern = Pattern.compile("\\b(?<!\\\\)" + nickName + "\\b", Pattern.CASE_INSENSITIVE);
|
Pattern nickPattern = Pattern.compile("\\b(?<!\\\\)" + nickName + "\\b", Pattern.CASE_INSENSITIVE);
|
||||||
// Pattern escapedNickPattern = Pattern.compile("\\b\\\\" + nickName + "\\b", Pattern.CASE_INSENSITIVE);
|
// Pattern escapedNickPattern = Pattern.compile("\\b\\\\" + nickName + "\\b", Pattern.CASE_INSENSITIVE);
|
||||||
|
|
||||||
|
ChatUser onlinePlayerUser = ChatUserManager.getChatUser(onlinePlayer.getUniqueId());
|
||||||
if (namePattern.matcher(modifiableString.string()).find()) {
|
if (namePattern.matcher(modifiableString.string()).find()) {
|
||||||
modifiableString.replace(TextReplacementConfig.builder()
|
modifiableString.replace(TextReplacementConfig.builder()
|
||||||
.once()
|
.once()
|
||||||
.match(namePattern)
|
.match(namePattern)
|
||||||
.replacement(mention.append(onlinePlayer.displayName()))
|
.replacement(mention.append(onlinePlayerUser.getDisplayName()))
|
||||||
.build());
|
.build());
|
||||||
//TODO replace all instances of \name with just name but using the match result so the capitalization doesn't change
|
//TODO replace all instances of \name with just name but using the match result so the capitalization doesn't change
|
||||||
// modifiableString.replace(TextReplacementConfig.builder()
|
// modifiableString.replace(TextReplacementConfig.builder()
|
||||||
@@ -150,15 +158,17 @@ public class ChatListener implements Listener {
|
|||||||
// String substring = a.group().substring(1);
|
// String substring = a.group().substring(1);
|
||||||
// return ;
|
// return ;
|
||||||
// });
|
// });
|
||||||
if (!ChatUserManager.getChatUser(onlinePlayer.getUniqueId()).getIgnoredPlayers().contains(player.getUniqueId()))
|
if (!ChatUserManager.getChatUser(onlinePlayer.getUniqueId()).getIgnoredPlayers().contains(player.getUniqueId())
|
||||||
|
&& !player.hasPermission("chat.ignorebypass"))
|
||||||
playersToPing.add(onlinePlayer);
|
playersToPing.add(onlinePlayer);
|
||||||
} else if (nickPattern.matcher(modifiableString.string()).find()) {
|
} else if (nickPattern.matcher(modifiableString.string()).find()) {
|
||||||
modifiableString.replace(TextReplacementConfig.builder()
|
modifiableString.replace(TextReplacementConfig.builder()
|
||||||
.once()
|
.once()
|
||||||
.match(nickPattern)
|
.match(nickPattern)
|
||||||
.replacement(mention.append(onlinePlayer.displayName()))
|
.replacement(mention.append(onlinePlayerUser.getDisplayName()))
|
||||||
.build());
|
.build());
|
||||||
if (!ChatUserManager.getChatUser(onlinePlayer.getUniqueId()).getIgnoredPlayers().contains(player.getUniqueId()))
|
if (!ChatUserManager.getChatUser(onlinePlayer.getUniqueId()).getIgnoredPlayers().contains(player.getUniqueId())
|
||||||
|
&& !player.hasPermission("chat.ignorebypass"))
|
||||||
playersToPing.add(onlinePlayer);
|
playersToPing.add(onlinePlayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -209,4 +219,4 @@ public class ChatListener implements Listener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,20 +15,20 @@ import com.alttd.chat.util.Utility;
|
|||||||
import com.google.common.io.ByteArrayDataInput;
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
import com.google.common.io.ByteStreams;
|
import com.google.common.io.ByteStreams;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
|
||||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class PluginMessage implements PluginMessageListener {
|
public class PluginMessage implements PluginMessageListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPluginMessageReceived(String channel, Player player, byte[] bytes) {
|
public void onPluginMessageReceived(String channel, @NotNull Player ignored, byte[] bytes) {
|
||||||
if (!channel.equals(Config.MESSAGECHANNEL)) {
|
if (!channel.equals(Config.MESSAGECHANNEL)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -38,35 +38,36 @@ public class PluginMessage implements PluginMessageListener {
|
|||||||
case "privatemessagein": {
|
case "privatemessagein": {
|
||||||
UUID uuid = UUID.fromString(in.readUTF());
|
UUID uuid = UUID.fromString(in.readUTF());
|
||||||
String target = in.readUTF();
|
String target = in.readUTF();
|
||||||
Player p = Bukkit.getPlayer(uuid);
|
Player player = Bukkit.getPlayer(uuid);
|
||||||
String message = in.readUTF();
|
String message = in.readUTF();
|
||||||
UUID targetuuid = UUID.fromString(in.readUTF());
|
UUID targetuuid = UUID.fromString(in.readUTF());
|
||||||
if (p != null) {
|
if (player == null) {
|
||||||
ChatUser chatUser = ChatUserManager.getChatUser(uuid);
|
break;
|
||||||
if (!chatUser.getIgnoredPlayers().contains(targetuuid)) {
|
}
|
||||||
p.sendMessage(GsonComponentSerializer.gson().deserialize(message));
|
ChatUser chatUser = ChatUserManager.getChatUser(uuid);
|
||||||
p.playSound(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_BASS, 1, 1); // todo load this from config
|
if (isTargetNotIgnored(chatUser, targetuuid)) {
|
||||||
ChatUser user = ChatUserManager.getChatUser(uuid);
|
player.sendMessage(GsonComponentSerializer.gson().deserialize(message));
|
||||||
if (!user.getReplyContinueTarget().equalsIgnoreCase(target))
|
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_BASS, 1, 1); // todo load this from config
|
||||||
user.setReplyTarget(target);
|
ChatUser user = ChatUserManager.getChatUser(uuid);
|
||||||
}
|
if (!user.getReplyContinueTarget().equalsIgnoreCase(target))
|
||||||
|
user.setReplyTarget(target);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case "privatemessageout": {
|
case "privatemessageout": {
|
||||||
UUID uuid = UUID.fromString(in.readUTF());
|
UUID uuid = UUID.fromString(in.readUTF());
|
||||||
String target = in.readUTF();
|
String target = in.readUTF();
|
||||||
Player p = Bukkit.getPlayer(uuid);
|
Player player = Bukkit.getPlayer(uuid);
|
||||||
String message = in.readUTF();
|
String message = in.readUTF();
|
||||||
UUID targetuuid = UUID.fromString(in.readUTF());
|
UUID targetuuid = UUID.fromString(in.readUTF());
|
||||||
if (p != null) {
|
if (player == null) {
|
||||||
ChatUser chatUser = ChatUserManager.getChatUser(uuid);
|
break;
|
||||||
if (!chatUser.getIgnoredPlayers().contains(targetuuid)) {
|
}
|
||||||
chatUser.setReplyTarget(target);
|
ChatUser chatUser = ChatUserManager.getChatUser(uuid);
|
||||||
p.sendMessage(GsonComponentSerializer.gson().deserialize(message));
|
if (isTargetNotIgnored(chatUser, targetuuid)) {
|
||||||
|
chatUser.setReplyTarget(target);
|
||||||
|
player.sendMessage(GsonComponentSerializer.gson().deserialize(message));
|
||||||
// ChatUser user = ChatUserManager.getChatUser(uuid);
|
// ChatUser user = ChatUserManager.getChatUser(uuid);
|
||||||
// user.setReplyTarget(target);
|
// user.setReplyTarget(target);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -78,7 +79,7 @@ public class PluginMessage implements PluginMessageListener {
|
|||||||
|
|
||||||
Bukkit.getOnlinePlayers().stream().filter(p -> p.hasPermission(Config.GCPERMISSION)).forEach(p -> {
|
Bukkit.getOnlinePlayers().stream().filter(p -> p.hasPermission(Config.GCPERMISSION)).forEach(p -> {
|
||||||
ChatUser chatUser = ChatUserManager.getChatUser(p.getUniqueId());
|
ChatUser chatUser = ChatUserManager.getChatUser(p.getUniqueId());
|
||||||
if (!chatUser.getIgnoredPlayers().contains(uuid)) {
|
if (isTargetNotIgnored(chatUser, uuid)) {
|
||||||
p.sendMessage(GsonComponentSerializer.gson().deserialize(message));
|
p.sendMessage(GsonComponentSerializer.gson().deserialize(message));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -193,7 +194,7 @@ public class PluginMessage implements PluginMessageListener {
|
|||||||
ALogger.warn("Received ChatChannel message for non existent channel.");
|
ALogger.warn("Received ChatChannel message for non existent channel.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!chatChannel.getServers().contains(Bukkit.getServerName())) {
|
if (!chatChannel.getServers().contains(Bukkit.getServer().getName())) {
|
||||||
ALogger.warn("Received ChatChannel message for the wrong server.");
|
ALogger.warn("Received ChatChannel message for the wrong server.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -216,4 +217,15 @@ public class PluginMessage implements PluginMessageListener {
|
|||||||
}.runTaskAsynchronously(ChatPlugin.getInstance());
|
}.runTaskAsynchronously(ChatPlugin.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
private boolean isTargetNotIgnored(ChatUser chatUser, UUID targetUUID) {
|
||||||
|
if (!chatUser.getIgnoredPlayers().contains(targetUUID)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Player target = Bukkit.getPlayer(targetUUID);
|
||||||
|
if (target == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return target.hasPermission("chat.ignorebypass");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -149,24 +149,24 @@ public class NickUtilities
|
|||||||
|
|
||||||
public static boolean validNick(Player sender, OfflinePlayer target, String nickName) {
|
public static boolean validNick(Player sender, OfflinePlayer target, String nickName) {
|
||||||
if (!noBlockedCodes(nickName)) {
|
if (!noBlockedCodes(nickName)) {
|
||||||
sender.sendMiniMessage(Config.NICK_BLOCKED_COLOR_CODES, null);
|
sender.sendRichMessage(Config.NICK_BLOCKED_COLOR_CODES);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Utility.checkNickBrightEnough(nickName)) {
|
if (!Utility.checkNickBrightEnough(nickName)) {
|
||||||
sender.sendMiniMessage("<red>At least one color must be brighter than 30 for each color</red>", null);
|
sender.sendRichMessage("<red>At least one color must be brighter than 30 for each color</red>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
String cleanNick = NickUtilities.removeAllColors(nickName);
|
String cleanNick = NickUtilities.removeAllColors(nickName);
|
||||||
|
|
||||||
if (cleanNick.length() < 3 || cleanNick.length() > 16) {
|
if (cleanNick.length() < 3 || cleanNick.length() > 16) {
|
||||||
sender.sendMiniMessage(Config.NICK_INVALID_LENGTH, null);
|
sender.sendRichMessage(Config.NICK_INVALID_LENGTH);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cleanNick.matches("[a-zA-Z0-9_]*") || nickName.length() > 192) { //192 is if someone puts {#xxxxxx<>} in front of every letter
|
if (!cleanNick.matches("[a-zA-Z0-9_]*") || nickName.length() > 192) { //192 is if someone puts {#xxxxxx<>} in front of every letter
|
||||||
sender.sendMiniMessage(Config.NICK_INVALID_CHARACTERS, null);
|
sender.sendRichMessage(Config.NICK_INVALID_CHARACTERS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ public class NickUtilities
|
|||||||
if (uniqueId.equals(uuid)){
|
if (uniqueId.equals(uuid)){
|
||||||
ChatPlugin.getInstance().getLogger().info(uuid + " " + uniqueId);
|
ChatPlugin.getInstance().getLogger().info(uuid + " " + uniqueId);
|
||||||
}
|
}
|
||||||
sender.sendMiniMessage(Config.NICK_TAKEN, null);
|
sender.sendRichMessage(Config.NICK_TAKEN);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ public class Nicknames implements CommandExecutor, TabCompleter {
|
|||||||
Placeholder.component("nickname", chatUser.getDisplayName()),
|
Placeholder.component("nickname", chatUser.getDisplayName()),
|
||||||
Placeholder.parsed("currentnickname", chatUser.getNickNameString())
|
Placeholder.parsed("currentnickname", chatUser.getNickNameString())
|
||||||
);
|
);
|
||||||
player.sendMiniMessage(Config.NICK_CURRENT, placeholders);
|
player.sendRichMessage(Config.NICK_CURRENT, placeholders);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "help":
|
case "help":
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ public class ToggleableForCustomChannel extends Toggleable {
|
|||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
ALogger.info(String.format("%s sent %s message: %s", player.getName(), customChannel.getChannelName(), message));
|
||||||
ChatPlugin.getInstance().getChatHandler().chatChannel(player, customChannel, message);
|
ChatPlugin.getInstance().getChatHandler().chatChannel(player, customChannel, message);
|
||||||
}
|
}
|
||||||
}.runTaskAsynchronously(ChatPlugin.getInstance());
|
}.runTaskAsynchronously(ChatPlugin.getInstance());
|
||||||
|
|||||||
+12
-1
@@ -4,11 +4,14 @@ include(":api")
|
|||||||
include(":galaxy")
|
include(":galaxy")
|
||||||
include(":velocity")
|
include(":velocity")
|
||||||
|
|
||||||
|
val nexusUser = providers.gradleProperty("alttdSnapshotUsername").get()
|
||||||
|
val nexusPass = providers.gradleProperty("alttdSnapshotPassword").get()
|
||||||
|
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
repositories {
|
repositories {
|
||||||
// mavenLocal()
|
// mavenLocal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://repo.destro.xyz/snapshots") // Altitude - Galaxy
|
// maven("https://repo.destro.xyz/snapshots") // Altitude - Galaxy
|
||||||
maven("https://oss.sonatype.org/content/groups/public/") // Adventure
|
maven("https://oss.sonatype.org/content/groups/public/") // Adventure
|
||||||
maven("https://oss.sonatype.org/content/repositories/snapshots/") // Minimessage
|
maven("https://oss.sonatype.org/content/repositories/snapshots/") // Minimessage
|
||||||
maven("https://nexus.velocitypowered.com/repository/") // Velocity
|
maven("https://nexus.velocitypowered.com/repository/") // Velocity
|
||||||
@@ -16,6 +19,14 @@ dependencyResolutionManagement {
|
|||||||
maven("https://repo.spongepowered.org/maven") // Configurate
|
maven("https://repo.spongepowered.org/maven") // Configurate
|
||||||
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/") // Papi
|
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/") // Papi
|
||||||
maven("https://jitpack.io")
|
maven("https://jitpack.io")
|
||||||
|
maven {
|
||||||
|
name = "nexus"
|
||||||
|
url = uri("https://repo.alttd.com/repository/alttd-snapshot/")
|
||||||
|
credentials {
|
||||||
|
username = nexusUser
|
||||||
|
password = nexusPass
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ dependencies {
|
|||||||
implementation("org.spongepowered", "configurate-yaml", "4.1.2")
|
implementation("org.spongepowered", "configurate-yaml", "4.1.2")
|
||||||
compileOnly("net.kyori:adventure-text-minimessage:4.10.1")
|
compileOnly("net.kyori:adventure-text-minimessage:4.10.1")
|
||||||
compileOnly("com.gitlab.ruany:LiteBansAPI:0.3.5")
|
compileOnly("com.gitlab.ruany:LiteBansAPI:0.3.5")
|
||||||
compileOnly("com.alttd.proxydiscordlink:ProxyDiscordLink:1.0.0-BETA-SNAPSHOT")
|
compileOnly("com.alttd.proxydiscordlink:ProxyDiscordLink:1.0.1-SNAPSHOT")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
@@ -30,4 +30,4 @@ tasks {
|
|||||||
dependsOn(shadowJar)
|
dependsOn(shadowJar)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user