use of com.sk89q.worldedit.world.storage.MissingWorldException in project FastAsyncWorldEdit by IntellectualSites.
the class LegacySnapshotCommands method before.
void before(Actor actor, World world, LocalSession session, ZonedDateTime date) {
LocalConfiguration config = we.getConfiguration();
try {
Snapshot snapshot = config.snapshotRepo.getSnapshotBefore(date, world.getName());
if (snapshot == null) {
actor.print(Caption.of("worldedit.snapshot.none-before", TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date))));
} else {
session.setSnapshot(snapshot);
actor.print(Caption.of("worldedit.snapshot.use", TextComponent.of(snapshot.getName())));
}
} catch (MissingWorldException ex) {
actor.print(Caption.of("worldedit.restore.none-for-world"));
}
}
use of com.sk89q.worldedit.world.storage.MissingWorldException 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