use of gg.projecteden.nexus.framework.commands.models.annotations.Permission 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.framework.commands.models.annotations.Permission in project Nexus by ProjectEdenGG.
the class Pugmas21Command method advent_config.
@Path("advent config set <day>")
@Permission(Group.ADMIN)
void advent_config(@Arg(min = 1, max = 25) int day) {
final Block block = getTargetBlockRequired();
if (block.getType() != Material.BARRIER)
error("You must be looking at a barrier");
adventConfig.set(day, block.getLocation());
adventService.save(adventConfig);
send(PREFIX + "Advent day #" + day + " configured");
}
use of gg.projecteden.nexus.framework.commands.models.annotations.Permission in project Nexus by ProjectEdenGG.
the class Pugmas21Command method advent_lootOrigin.
@Path("advent config setLootOrigin")
@Permission(Group.ADMIN)
void advent_lootOrigin() {
final Block block = getTargetBlockRequired();
adventConfig.setLootOrigin(block.getLocation());
adventService.save(adventConfig);
send(PREFIX + "lootOrigin configured");
}
use of gg.projecteden.nexus.framework.commands.models.annotations.Permission in project Nexus by ProjectEdenGG.
the class Pugmas21Command method advent_nearest.
@Path("advent nearest")
@Permission(Group.ADMIN)
void advent_nearest() {
AdventPresent nearestPresent = null;
double nearestDistance = 500;
for (AdventPresent present : adventConfig.getPresents()) {
double distance = present.getLocation().distance(location());
if (distance < nearestDistance) {
nearestDistance = distance;
nearestPresent = present;
}
}
if (nearestPresent == null)
error("None found");
send("Nearest: #" + nearestPresent.getDay());
}
use of gg.projecteden.nexus.framework.commands.models.annotations.Permission in project Nexus by ProjectEdenGG.
the class HomesCommand method fixHomeOwner.
@Async
@Permission(Group.ADMIN)
@Path("fixHomeOwner")
void fixHomeOwner() {
AtomicInteger fixed = new AtomicInteger(0);
List<HomeOwner> all = service.getAll();
all.forEach(homeOwner -> {
List<Home> collect = homeOwner.getHomes().stream().filter(home -> !homeOwner.getUuid().equals(home.getUuid())).collect(Collectors.toList());
if (collect.isEmpty())
return;
fixed.getAndAdd(collect.size());
send(PREFIX + "Fixing " + collect.size() + " homes for " + homeOwner.getNickname());
collect.forEach(home -> home.setUuid(homeOwner.getUuid()));
service.saveSync(homeOwner);
});
send(PREFIX + "Fixed " + fixed.get() + " homes");
}
Aggregations