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<>());
|
ghostBarriers.put(player.getUniqueId(), new HashSet<>());
|
||||||
lastLocation.put(player.getUniqueId(), player.getLocation());
|
lastLocation.put(player.getUniqueId(), player.getLocation());
|
||||||
FightSystem.getPlugin().getLogger().log(Level.INFO, () -> player.getName() + " was added to border " + name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean contains(Player player) {
|
public boolean contains(Player player) {
|
||||||
@@ -72,7 +71,6 @@ public class Border {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void removePlayer(Player player) {
|
public void removePlayer(Player player) {
|
||||||
FightSystem.getPlugin().getLogger().log(Level.INFO, () -> player.getName() + " was removed from border " + name);
|
|
||||||
lastLocation.remove(player.getUniqueId());
|
lastLocation.remove(player.getUniqueId());
|
||||||
Set<Block> blocks = ghostBarriers.remove(player.getUniqueId());
|
Set<Block> blocks = ghostBarriers.remove(player.getUniqueId());
|
||||||
if(blocks == null || !player.isOnline())
|
if(blocks == null || !player.isOnline())
|
||||||
|
|||||||
@@ -45,10 +45,27 @@ public class CheckpointUtils {
|
|||||||
private CheckpointUtils() {}
|
private CheckpointUtils() {}
|
||||||
|
|
||||||
public static void signalHandler() {
|
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() {
|
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");
|
String checkpointFile = System.getProperty("checkpoint");
|
||||||
if(!CRIUSupport.isCheckpointAllowed() || checkpointFile == null) {
|
if(!CRIUSupport.isCheckpointAllowed() || checkpointFile == null) {
|
||||||
Bukkit.shutdown();
|
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.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 final Reflection.MethodInvoker bind = Reflection.getMethod(TinyProtocol.serverConnection, null, InetAddress.class, int.class);
|
||||||
private static void freezeInternal(Path path) throws Exception {
|
private static void freezeInternal(Path path) throws Exception {
|
||||||
@@ -145,3 +163,4 @@ public class CheckpointUtils {
|
|||||||
Core.getInstance().getLogger().log(Level.INFO, "Checkpoint restored");
|
Core.getInstance().getLogger().log(Level.INFO, "Checkpoint restored");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user