Merge pull request #126 from RealTriassic/add-sendonlogin-permission

Add ability to require permission to send-on-login
This commit is contained in:
Adrian 2023-10-09 10:55:45 -05:00 committed by GitHub
commit b71666be9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View File

@ -80,6 +80,12 @@ public class ProxyConfiguration {
return this.sendOnLogin;
}
@Comment("Require players to have the authmevelocity.send-on-login permission?")
private boolean requirePermission = false;
public boolean isRequirePermission() {
return this.requirePermission;
}
@Comment("""
List of servers to send
One of these servers will be chosen at random""")

View File

@ -15,7 +15,7 @@ repositories {
includeGroup("net.byteflux")
}
}
maven("https://maven.elytrium.net/repo/")
maven("https://mvn.exceptionflug.de/repository/exceptionflug-public/")
}
dependencies {

View File

@ -134,6 +134,10 @@ public final class PluginMessageListener implements Listener<PluginMessageEvent>
return;
}
if (plugin.config().get().sendOnLogin().isRequirePermission() && !player.hasPermission("authmevelocity.send-on-login")) {
return;
}
eventManager.fire(new PreSendOnLoginEvent(player, loginServer, toSend.object()))
.thenAccept(event -> {
if (!event.getResult().isAllowed()) {