Merge pull request #7 from unilock/server-name-join-msg

Allow using server name in join and leave messages
This commit is contained in:
FeuSalamander 2023-03-15 15:37:34 +01:00 committed by GitHub
commit 79b542d052
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View File

@ -53,11 +53,13 @@ public final class Listeners {
return;
}
Player p = e.getPlayer();
if (p.getCurrentServer().isEmpty()) {
Optional<ServerConnection> 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);
}

View File

@ -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
enabled = true