use of gg.projecteden.nexus.utils.WorldEditUtils in project Nexus by ProjectEdenGG.
the class Pugmas21Command method randomizePresents.
@Path("randomizePresents")
@Permission(Group.ADMIN)
@Description("Randomizes the presents in your selection")
void randomizePresents() {
List<Instrument> instruments = List.of(Instrument.DIDGERIDOO, Instrument.PLING);
WorldEditUtils WEUtils = new WorldEditUtils(player());
Region selection = WEUtils.getPlayerSelection(player());
for (Block block : WEUtils.getBlocks(selection)) {
if (block.getType() != Material.NOTE_BLOCK)
continue;
NoteBlock noteBlock = (NoteBlock) block.getBlockData();
noteBlock.setInstrument(RandomUtils.randomElement(instruments));
noteBlock.setNote(new Note(RandomUtils.randomInt(0, 24)));
block.setBlockData(noteBlock);
}
}
use of gg.projecteden.nexus.utils.WorldEditUtils in project Nexus by ProjectEdenGG.
the class WorldEditUtilsCommand method clipboard.
@Path("clipboard [--build] [--async] [--entities]")
void clipboard(@Switch @Arg("false") boolean build, @Switch @Arg("false") boolean async, @Switch @Arg("false") boolean entities) {
final WorldEditUtils utils = new WorldEditUtils(world());
List<CompletableFuture<Void>> futures = new ArrayList<>();
Runnable task = () -> {
final Paster paster = utils.paster("Testing clipboard").clipboard(player()).at(location()).entities(entities);
if (build) {
send("Building " + (async ? "async" : "sync"));
for (int i = 0; i < 5; i++) futures.add(paster.build());
} else {
send("Pasting " + (async ? "async" : "sync"));
for (int i = 0; i < 5; i++) futures.add(paster.pasteAsync());
}
CompletableFutures.allOf(futures).thenRun(() -> send("done"));
};
if (async)
Tasks.async(task);
else
task.run();
}
use of gg.projecteden.nexus.utils.WorldEditUtils in project Nexus by ProjectEdenGG.
the class WorldEditUtilsCommand method rotate.
@Path("rotate [y] [x] [z]")
void rotate(int y, int x, int z) {
final WorldEditUtils worldedit = new WorldEditUtils(player());
worldedit.paster("Testing rotate").clipboard(worldedit.getPlayerSelection(player())).at(location()).transform(new AffineTransform().rotateY(y).rotateX(x).rotateZ(z)).pasteAsync();
}
use of gg.projecteden.nexus.utils.WorldEditUtils in project Nexus by ProjectEdenGG.
the class LocationCodeCommand method selection.
@Path("selection")
void selection() {
try {
WorldEditUtils utils = new WorldEditUtils(player());
Region selection = utils.getPlayerSelection(player());
if (selection == null)
throw new IncompleteRegionException();
Location loc = utils.toLocation(selection.getMinimumPoint());
send(asJava(loc));
} catch (IncompleteRegionException exception) {
error("Incomplete region. Please select positions 1 & 2");
}
}
use of gg.projecteden.nexus.utils.WorldEditUtils in project Nexus by ProjectEdenGG.
the class MinigamesCommand method schemSave.
@Path("schem save <arena> <name>")
@Permission(PERMISSION_MANAGE)
void schemSave(Arena arena, String name) {
WorldEditUtils worldedit = new WorldEditUtils(player());
GameMode originalGameMode = player().getGameMode();
Location originalLocation = location().clone();
Location location = worldedit.toLocation(worldedit.getPlayerSelection(player()).getMinimumPoint());
player().setGameMode(GameMode.SPECTATOR);
player().teleportAsync(location);
runCommand("mcmd /copy ;; wait 10 ;; /schem save " + (arena.getSchematicBaseName() + name) + " -f");
Tasks.wait(20, () -> {
player().teleportAsync(originalLocation);
player().setGameMode(originalGameMode);
});
send(PREFIX + "Saved schematic " + name);
}
Aggregations