allow using server name in join and leave messages

Signed-off-by: unilock <unilock@fennet.rentals>
This commit is contained in:
unilock 2023-03-15 09:21:28 -04:00
parent 66ea6211a2
commit ad3feaec66

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);
}