Don't attempt to refresh auto op if server is stopping (#1989)

This commit is contained in:
Luck 2020-02-27 13:19:53 +00:00
parent e66ab1be0d
commit 6fea194ef5
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
2 changed files with 12 additions and 1 deletions

View File

@ -88,6 +88,7 @@ public class LPBukkitBootstrap extends JavaPlugin implements LuckPermsBootstrap
private final CountDownLatch loadLatch = new CountDownLatch(1); private final CountDownLatch loadLatch = new CountDownLatch(1);
private final CountDownLatch enableLatch = new CountDownLatch(1); private final CountDownLatch enableLatch = new CountDownLatch(1);
private boolean serverStarting = true; private boolean serverStarting = true;
private boolean serverStopping = false;
// if the plugin has been loaded on an incompatible version // if the plugin has been loaded on an incompatible version
private boolean incompatibleVersion = false; private boolean incompatibleVersion = false;
@ -150,6 +151,8 @@ public class LPBukkitBootstrap extends JavaPlugin implements LuckPermsBootstrap
return; return;
} }
this.serverStopping = true;
this.serverStopping = false;
this.startTime = Instant.now(); this.startTime = Instant.now();
try { try {
this.plugin.enable(); this.plugin.enable();
@ -167,8 +170,8 @@ public class LPBukkitBootstrap extends JavaPlugin implements LuckPermsBootstrap
return; return;
} }
this.serverStopping = true;
this.plugin.disable(); this.plugin.disable();
this.serverStarting = true;
} }
@Override @Override
@ -185,6 +188,10 @@ public class LPBukkitBootstrap extends JavaPlugin implements LuckPermsBootstrap
return this.serverStarting; return this.serverStarting;
} }
public boolean isServerStopping() {
return this.serverStopping;
}
// provide information about the plugin // provide information about the plugin
@Override @Override

View File

@ -333,6 +333,10 @@ public class LPBukkitPlugin extends AbstractLuckPermsPlugin {
return; return;
} }
if (!callerIsSync && this.bootstrap.isServerStopping()) {
return;
}
User user = getUserManager().getIfLoaded(player.getUniqueId()); User user = getUserManager().getIfLoaded(player.getUniqueId());
boolean value; boolean value;