mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-01-12 02:40:39 +01:00
Removed AuthMeServerStop shutdown hook.
- Players now will be kicked if AuthMe was disabled. - Fix #413
This commit is contained in:
parent
44d35154aa
commit
2081fd7e34
@ -32,7 +32,6 @@ import fr.xephi.authme.listener.AuthMePlayerListener;
|
||||
import fr.xephi.authme.listener.AuthMePlayerListener16;
|
||||
import fr.xephi.authme.listener.AuthMePlayerListener18;
|
||||
import fr.xephi.authme.listener.AuthMeServerListener;
|
||||
import fr.xephi.authme.listener.AuthMeServerStop;
|
||||
import fr.xephi.authme.listener.AuthMeTabCompletePacketAdapter;
|
||||
import fr.xephi.authme.mail.SendMailSSL;
|
||||
import fr.xephi.authme.modules.ModuleManager;
|
||||
@ -307,13 +306,6 @@ public class AuthMe extends JavaPlugin {
|
||||
// Show settings warnings
|
||||
showSettingsWarnings();
|
||||
|
||||
// Register a server shutdown hook
|
||||
try {
|
||||
Runtime.getRuntime().addShutdownHook(new AuthMeServerStop(this));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Sponsor messages
|
||||
ConsoleLogger.info("AuthMe hooks perfectly with the VeryGames server hosting!");
|
||||
ConsoleLogger.info("Development builds are available on our jenkins, thanks to f14stelt.");
|
||||
@ -521,10 +513,10 @@ public class AuthMe extends JavaPlugin {
|
||||
public void onDisable() {
|
||||
// Save player data
|
||||
Collection<? extends Player> players = Utils.getOnlinePlayers();
|
||||
if (players != null) {
|
||||
for (Player player : players) {
|
||||
this.savePlayer(player);
|
||||
}
|
||||
for (Player player : players) {
|
||||
savePlayer(player);
|
||||
// TODO: add a MessageKey
|
||||
player.kickPlayer("Server is restarting or AuthMe plugin was disabled.");
|
||||
}
|
||||
|
||||
// Do backup on stop if enabled
|
||||
|
@ -1,30 +0,0 @@
|
||||
package fr.xephi.authme.listener;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
public class AuthMeServerStop extends Thread {
|
||||
|
||||
private AuthMe plugin;
|
||||
|
||||
public AuthMeServerStop(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
// TODO: add a MessageKey
|
||||
if (Settings.kickPlayersBeforeStopping) {
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : plugin.getServer().getOnlinePlayers()) {
|
||||
p.kickPlayer("Server is restarting");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user