use of com.sk89q.worldedit.world.snapshot.Snapshot in project FastAsyncWorldEdit by IntellectualSites.
the class LegacySnapshotCommands method sel.
void sel(Actor actor, World world, LocalSession session, int index) {
LocalConfiguration config = we.getConfiguration();
if (index < 1) {
actor.print(Caption.of("worldedit.snapshot.index-above-0"));
return;
}
try {
List<Snapshot> snapshots = config.snapshotRepo.getSnapshots(true, world.getName());
if (snapshots.size() < index) {
actor.print(Caption.of("worldedit.snapshot.index-oob", TextComponent.of(snapshots.size())));
return;
}
Snapshot snapshot = snapshots.get(index - 1);
if (snapshot == null) {
actor.print(Caption.of("worldedit.restore.not-available"));
return;
}
session.setSnapshot(snapshot);
actor.print(Caption.of("worldedit.snapshot.use", TextComponent.of(snapshot.getName())));
} catch (MissingWorldException e) {
actor.print(Caption.of("worldedit.restore.none-for-world"));
}
}
Aggregations