mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
Somewhat improved the bad backup error message.
This commit is contained in:
parent
a8972e9f04
commit
767c7de163
@ -49,6 +49,10 @@ public class SnapshotRestore {
|
||||
* Count of the number of chunks that could be loaded for other reasons.
|
||||
*/
|
||||
private ArrayList<Vector2D> errorChunks;
|
||||
/**
|
||||
* Last error message.
|
||||
*/
|
||||
private String lastErrorMessage;
|
||||
|
||||
/**
|
||||
* Construct the snapshot restore operation.
|
||||
@ -153,8 +157,10 @@ public class SnapshotRestore {
|
||||
missingChunks.add(chunkPos);
|
||||
} catch (DataException de) {
|
||||
errorChunks.add(chunkPos);
|
||||
lastErrorMessage = de.getMessage();
|
||||
} catch (IOException ioe) {
|
||||
errorChunks.add(chunkPos);
|
||||
lastErrorMessage = ioe.getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -188,4 +194,11 @@ public class SnapshotRestore {
|
||||
public boolean hadTotalFailure() {
|
||||
return missingChunks.size() + errorChunks.size() == getChunksAffected();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the lastErrorMessage
|
||||
*/
|
||||
public String getLastErrorMessage() {
|
||||
return lastErrorMessage;
|
||||
}
|
||||
}
|
||||
|
@ -1353,7 +1353,13 @@ public class WorldEditListener extends PluginListener {
|
||||
restore.restore(editSession);
|
||||
|
||||
if (restore.hadTotalFailure()) {
|
||||
player.printError("No blocks could be restored. (Bad backup?)");
|
||||
String error = restore.getLastErrorMessage();
|
||||
if (error != null) {
|
||||
player.printError("Errors prevented any blocks from being restored.");
|
||||
player.printError("Last error: " + error);
|
||||
} else {
|
||||
player.printError("No chunks could be loaded. (Bad archive?)");
|
||||
}
|
||||
} else {
|
||||
player.print(String.format("Restored; %d "
|
||||
+ "missing chunks and %d other errors.",
|
||||
|
Loading…
Reference in New Issue
Block a user