3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-26 02:50:06 +01:00

Somewhat improved the bad backup error message.

Dieser Commit ist enthalten in:
sk89q 2010-11-16 00:40:19 -08:00
Ursprung a8972e9f04
Commit 767c7de163
2 geänderte Dateien mit 20 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -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;
}
} }

Datei anzeigen

@ -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.",