mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +01:00
prevent logins until the plugin has started
This commit is contained in:
parent
87f94f6b8f
commit
9b92143501
@ -48,7 +48,7 @@ class BukkitListener extends AbstractListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onPlayerPreLogin(AsyncPlayerPreLoginEvent e) {
|
public void onPlayerPreLogin(AsyncPlayerPreLoginEvent e) {
|
||||||
if (!plugin.getDatastore().isAcceptingLogins()) {
|
if (!plugin.isStarted() || !plugin.getDatastore().isAcceptingLogins()) {
|
||||||
|
|
||||||
// The datastore is disabled, prevent players from joining the server
|
// The datastore is disabled, prevent players from joining the server
|
||||||
e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, Message.LOADING_ERROR.toString());
|
e.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, Message.LOADING_ERROR.toString());
|
||||||
@ -61,7 +61,7 @@ class BukkitListener extends AbstractListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerPreLoginMonitor(AsyncPlayerPreLoginEvent e) {
|
public void onPlayerPreLoginMonitor(AsyncPlayerPreLoginEvent e) {
|
||||||
if (plugin.getDatastore().isAcceptingLogins() && e.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) {
|
if (plugin.isStarted() && plugin.getDatastore().isAcceptingLogins() && e.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) {
|
||||||
|
|
||||||
// Login event was cancelled by another plugin
|
// Login event was cancelled by another plugin
|
||||||
onLeave(e.getUniqueId());
|
onLeave(e.getUniqueId());
|
||||||
|
Loading…
Reference in New Issue
Block a user