Dieser Commit ist enthalten in:
Ursprung
2b779ab40b
Commit
7679998285
@ -60,27 +60,27 @@ public class CheckpointUtils {
|
|||||||
Bukkit.getOnlinePlayers().forEach(player -> player.kickPlayer(null));
|
Bukkit.getOnlinePlayers().forEach(player -> player.kickPlayer(null));
|
||||||
|
|
||||||
List<?> networkManagers = TinyProtocol.networkManagers.get(TinyProtocol.getServerConnection(Core.getInstance()));
|
List<?> networkManagers = TinyProtocol.networkManagers.get(TinyProtocol.getServerConnection(Core.getInstance()));
|
||||||
if(networkManagers.isEmpty()) {
|
if(!networkManagers.isEmpty()) {
|
||||||
Path path = FileSystems.getDefault().getPath(checkpointFile);
|
Core.getInstance().getLogger().log(Level.INFO, "Waiting for players to disconnect for checkpointing");
|
||||||
|
Bukkit.getScheduler().runTaskLater(Core.getInstance(), CheckpointUtils::freeze, 1);
|
||||||
try {
|
|
||||||
freezeInternal(path);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Bukkit.shutdown();
|
|
||||||
throw new SecurityException(e);
|
|
||||||
} finally {
|
|
||||||
// Delete checkpoint
|
|
||||||
try (Stream<Path> stream = Files.walk(path)) {
|
|
||||||
stream.sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
|
|
||||||
} catch (IOException e) {
|
|
||||||
//ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Core.getInstance().getLogger().log(Level.INFO, "Waiting for players to disconnect for checkpointing");
|
Path path = FileSystems.getDefault().getPath(checkpointFile);
|
||||||
Bukkit.getScheduler().runTaskLater(Core.getInstance(), CheckpointUtils::freeze, 1);
|
|
||||||
|
try {
|
||||||
|
freezeInternal(path);
|
||||||
|
} catch (Exception e) {
|
||||||
|
Bukkit.shutdown();
|
||||||
|
throw new SecurityException(e);
|
||||||
|
} finally {
|
||||||
|
// Delete checkpoint
|
||||||
|
try (Stream<Path> stream = Files.walk(path)) {
|
||||||
|
stream.sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
|
||||||
|
} catch (IOException e) {
|
||||||
|
//ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren