From 58de2ea259b21651adf93277a6ad637b692c47d3 Mon Sep 17 00:00:00 2001 From: FeuSalamander Date: Mon, 13 Mar 2023 10:37:12 +0100 Subject: [PATCH] added the "all" option --- .../me/feusalamander/vmessage/Configuration.java | 6 ++++++ .../java/me/feusalamander/vmessage/Listeners.java | 15 ++++++++++----- .../java/me/feusalamander/vmessage/VMessage.java | 2 +- src/main/resources/config.toml | 1 + 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/main/java/me/feusalamander/vmessage/Configuration.java b/src/main/java/me/feusalamander/vmessage/Configuration.java index 7b72f5a..576d0cb 100644 --- a/src/main/java/me/feusalamander/vmessage/Configuration.java +++ b/src/main/java/me/feusalamander/vmessage/Configuration.java @@ -18,6 +18,7 @@ public final class Configuration { private boolean leaveEnabled; private boolean changeEnabled; private boolean minimessage; + private boolean all; private Toml config; private static File file; @@ -33,6 +34,7 @@ public final class Configuration { changeEnabled = config.getBoolean("Server-change.enabled", false); minimessage = config.getBoolean("Message-format.minimessage"); + all = config.getBoolean("Message.all", false); this.config = config; } @@ -98,6 +100,9 @@ public final class Configuration { public boolean isMinimessageEnabled(){ return this.minimessage; } + public boolean isAllEnabled(){ + return this.all; + } void reload(){ config = config.read(file); this.messageFormat = config.getString("Message.format"); @@ -111,5 +116,6 @@ public final class Configuration { this.changeEnabled = config.getBoolean("Server-change.enabled"); this.minimessage = config.getBoolean("Message-format.minimessage"); + all = config.getBoolean("Message.all", false); } } diff --git a/src/main/java/me/feusalamander/vmessage/Listeners.java b/src/main/java/me/feusalamander/vmessage/Listeners.java index fa8bb9d..a1dbd45 100644 --- a/src/main/java/me/feusalamander/vmessage/Listeners.java +++ b/src/main/java/me/feusalamander/vmessage/Listeners.java @@ -132,10 +132,15 @@ public final class Listeners { } else { finalMessage = SERIALIZER.deserialize(message); } - proxyServer.getAllServers().forEach(server -> { - if (!Objects.equals(p.getCurrentServer().map(ServerConnection::getServerInfo).orElse(null), server.getServerInfo())) { - server.sendMessage(finalMessage); - } - }); + if(configuration.isAllEnabled()){ + proxyServer.getAllServers().forEach(server -> server.sendMessage(finalMessage)); + }else { + proxyServer.getAllServers().forEach(server -> { + if (!Objects.equals(p.getCurrentServer().map(ServerConnection::getServerInfo).orElse(null), server.getServerInfo())) { + server.sendMessage(finalMessage); + } + }); + } + } } diff --git a/src/main/java/me/feusalamander/vmessage/VMessage.java b/src/main/java/me/feusalamander/vmessage/VMessage.java index 8b35ff1..0019639 100644 --- a/src/main/java/me/feusalamander/vmessage/VMessage.java +++ b/src/main/java/me/feusalamander/vmessage/VMessage.java @@ -16,7 +16,7 @@ import java.nio.file.Path; @Plugin( id = "vmessage", name = "Vmessage", - version = "1.5.1", + version = "1.5.2", description = "A velocity plugin that creates a multi server chat for the network", authors = {"FeuSalamander"}, dependencies = { @Dependency(id = "luckperms", optional = true) } diff --git a/src/main/resources/config.toml b/src/main/resources/config.toml index 867de68..83d2144 100644 --- a/src/main/resources/config.toml +++ b/src/main/resources/config.toml @@ -9,6 +9,7 @@ minimessage = false #- "#message#" : return the player's message #- "#server#" : return the player's server name format = "&a(#server#) #prefix# #player# &8&l> &r#message#" +all = false #if the formated message is sent even in the server where the player is located (can cause some issues with other plugins) enabled = true [Join] #place holders: