From ad3feaec66ba35223bea2a334fd012c5fce67992 Mon Sep 17 00:00:00 2001 From: unilock Date: Wed, 15 Mar 2023 09:21:28 -0400 Subject: [PATCH 1/2] allow using server name in join and leave messages Signed-off-by: unilock --- src/main/java/me/feusalamander/vmessage/Listeners.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/feusalamander/vmessage/Listeners.java b/src/main/java/me/feusalamander/vmessage/Listeners.java index af9b4be..ecc9cee 100644 --- a/src/main/java/me/feusalamander/vmessage/Listeners.java +++ b/src/main/java/me/feusalamander/vmessage/Listeners.java @@ -53,11 +53,13 @@ public final class Listeners { return; } Player p = e.getPlayer(); - if (p.getCurrentServer().isEmpty()) { + Optional server = p.getCurrentServer(); + if (server.isEmpty()) { return; } String message = configuration.getLeaveFormat() - .replace("#player#", p.getUsername()); + .replace("#player#", p.getUsername()) + .replace("#oldserver#", server.get().getServerInfo().getName()); if (luckPermsAPI != null) { message = luckperms(message, p); } @@ -98,7 +100,9 @@ public final class Listeners { if (!configuration.isJoinEnabled()) { return; } - String message = configuration.getJoinFormat().replace("#player#", p.getUsername()); + String message = configuration.getJoinFormat() + .replace("#player#", p.getUsername()) + .replace("#server#", actual.getServerInfo().getName()); if (luckPermsAPI != null) { message = luckperms(message, p); } From e57af6c5667d92d69b89fc01ad3aeac481693fe4 Mon Sep 17 00:00:00 2001 From: unilock Date: Wed, 15 Mar 2023 09:35:13 -0400 Subject: [PATCH 2/2] update default config Signed-off-by: unilock --- src/main/resources/config.toml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/resources/config.toml b/src/main/resources/config.toml index 83d2144..53dddc7 100644 --- a/src/main/resources/config.toml +++ b/src/main/resources/config.toml @@ -14,16 +14,18 @@ enabled = true [Join] #place holders: #- "#player#" : return the player name +#- "#server#" : return the new player's server name #- "#prefix#" : return the player's luckperms prefix #- "#suffix#" : return the player's luckperms suffix -format = "&7#prefix# #player# &ejoined the network" +format = "&7#prefix# #player# &ejoined &7#server#" enabled = true [Leave] #place holders: #- "#player#" : return the player name +#- "#oldserver#" : return the previous player's server name #- "#prefix#" : return the player's luckperms prefix #- "#suffix#" : return the player's luckperms suffix -format = "#&7prefix# #player# &eleft the network" +format = "#&7prefix# #player# &eleft &7#oldserver#" enabled = true [Server-change] #place holders: @@ -33,4 +35,4 @@ enabled = true #- "#oldserver#" : return the previous player's server name #- "#server#" : return the new player's server name format = "&7#prefix# #player# &eleft &c#oldserver# &eto join &a#server#" -enabled = true \ No newline at end of file +enabled = true