mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +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.
|
* Count of the number of chunks that could be loaded for other reasons.
|
||||||
*/
|
*/
|
||||||
private ArrayList<Vector2D> errorChunks;
|
private ArrayList<Vector2D> errorChunks;
|
||||||
|
/**
|
||||||
|
* Last error message.
|
||||||
|
*/
|
||||||
|
private String lastErrorMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the snapshot restore operation.
|
* Construct the snapshot restore operation.
|
||||||
@ -153,8 +157,10 @@ public class SnapshotRestore {
|
|||||||
missingChunks.add(chunkPos);
|
missingChunks.add(chunkPos);
|
||||||
} catch (DataException de) {
|
} catch (DataException de) {
|
||||||
errorChunks.add(chunkPos);
|
errorChunks.add(chunkPos);
|
||||||
|
lastErrorMessage = de.getMessage();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
errorChunks.add(chunkPos);
|
errorChunks.add(chunkPos);
|
||||||
|
lastErrorMessage = ioe.getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -188,4 +194,11 @@ public class SnapshotRestore {
|
|||||||
public boolean hadTotalFailure() {
|
public boolean hadTotalFailure() {
|
||||||
return missingChunks.size() + errorChunks.size() == getChunksAffected();
|
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);
|
restore.restore(editSession);
|
||||||
|
|
||||||
if (restore.hadTotalFailure()) {
|
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 {
|
} else {
|
||||||
player.print(String.format("Restored; %d "
|
player.print(String.format("Restored; %d "
|
||||||
+ "missing chunks and %d other errors.",
|
+ "missing chunks and %d other errors.",
|
||||||
|
Loading…
Reference in New Issue
Block a user