forked from SteamWar/SteamWar
Wrap CheckpointUtils for OpenJDK support, remove Border debug messages
This commit is contained in:
@@ -64,7 +64,6 @@ public class Border {
|
||||
|
||||
ghostBarriers.put(player.getUniqueId(), new HashSet<>());
|
||||
lastLocation.put(player.getUniqueId(), player.getLocation());
|
||||
FightSystem.getPlugin().getLogger().log(Level.INFO, () -> player.getName() + " was added to border " + name);
|
||||
}
|
||||
|
||||
public boolean contains(Player player) {
|
||||
@@ -72,7 +71,6 @@ public class Border {
|
||||
}
|
||||
|
||||
public void removePlayer(Player player) {
|
||||
FightSystem.getPlugin().getLogger().log(Level.INFO, () -> player.getName() + " was removed from border " + name);
|
||||
lastLocation.remove(player.getUniqueId());
|
||||
Set<Block> blocks = ghostBarriers.remove(player.getUniqueId());
|
||||
if(blocks == null || !player.isOnline())
|
||||
|
||||
@@ -45,10 +45,27 @@ public class CheckpointUtils {
|
||||
private CheckpointUtils() {}
|
||||
|
||||
public static void signalHandler() {
|
||||
Signal.handle(new Signal("USR1"), signal -> Bukkit.getScheduler().runTask(Core.getInstance(), CheckpointUtils::freeze));
|
||||
try {
|
||||
J9Wrapper.signalHandler();
|
||||
} catch (NoClassDefFoundError e) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
|
||||
public static void freeze() {
|
||||
try {
|
||||
J9Wrapper.freeze();
|
||||
} catch (NoClassDefFoundError e) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
|
||||
private static class J9Wrapper {
|
||||
private static void signalHandler() {
|
||||
Signal.handle(new Signal("USR1"), signal -> Bukkit.getScheduler().runTask(Core.getInstance(), CheckpointUtils::freeze));
|
||||
}
|
||||
|
||||
private static void freeze() {
|
||||
String checkpointFile = System.getProperty("checkpoint");
|
||||
if(!CRIUSupport.isCheckpointAllowed() || checkpointFile == null) {
|
||||
Bukkit.shutdown();
|
||||
@@ -90,6 +107,7 @@ public class CheckpointUtils {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static final Reflection.FieldAccessor<List> channelFutures = Reflection.getField(TinyProtocol.serverConnection, List.class, 0, ChannelFuture.class);
|
||||
private static final Reflection.MethodInvoker bind = Reflection.getMethod(TinyProtocol.serverConnection, null, InetAddress.class, int.class);
|
||||
private static void freezeInternal(Path path) throws Exception {
|
||||
@@ -144,4 +162,5 @@ public class CheckpointUtils {
|
||||
Bukkit.getPluginManager().callEvent(new CRIUWakeupEvent());
|
||||
Core.getInstance().getLogger().log(Level.INFO, "Checkpoint restored");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user