Search in sources :

Example 71 with Permission

use of gg.projecteden.nexus.framework.commands.models.annotations.Permission in project Nexus by ProjectEdenGG.

the class Statue20Command method sign.

@Permission(Group.STAFF)
@Path("sign <player>")
void sign(String player) {
    Sign sign = getTargetSignRequired();
    sign.setLine(0, header);
    sign.setLine(1, player);
    sign.update();
}
Also used : Sign(org.bukkit.block.Sign) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Example 72 with Permission

use of gg.projecteden.nexus.framework.commands.models.annotations.Permission in project Nexus by ProjectEdenGG.

the class WeeklyWakkaCommand method move.

@Path("move")
@Permission(Group.ADMIN)
public void move() {
    List<Warp> warps = WarpType.WEEKLY_WAKKA.getAll();
    WeeklyWakkaService service = new WeeklyWakkaService();
    WeeklyWakka weeklyWakka = service.get0();
    warps.stream().filter(warp -> warp.getName().equals(weeklyWakka.getCurrentLocation())).findFirst().ifPresent(warps::remove);
    List<Supplier<JsonBuilder>> newTips = new ArrayList<>();
    for (Supplier<JsonBuilder> tip : tips) {
        if (weeklyWakka.getCurrentTip() == null) {
            newTips.addAll(tips);
            break;
        }
        if (!(tips.indexOf(tip) + "").equals(weeklyWakka.getCurrentTip()))
            newTips.add(tip);
    }
    Supplier<JsonBuilder> newTip = RandomUtils.randomElement(newTips);
    Warp newWarp = RandomUtils.randomElement(warps);
    weeklyWakka.setCurrentLocation(newWarp.getName());
    weeklyWakka.setCurrentTip(String.valueOf(tips.indexOf(newTip)));
    weeklyWakka.getFoundPlayers().clear();
    service.save(weeklyWakka);
    NPC npc = getNPC();
    final World world = newWarp.getLocation().getWorld();
    final CompletableFuture<Chunk> oldLocation = world.getChunkAtAsync(npc.getStoredLocation());
    final CompletableFuture<Chunk> newLocation = world.getChunkAtAsync(newWarp.getLocation());
    final Runnable teleport = () -> npc.teleport(newWarp.getLocation(), TeleportCause.PLUGIN);
    CompletableFuture.allOf(oldLocation, newLocation).thenRun(teleport);
    if (sender() != null)
        send(json("The Weekly Wakka NPC has moved to location #" + newWarp.getName()).command("/weeklywakka " + newWarp.getName()));
}
Also used : NPC(net.citizensnpcs.api.npc.NPC) Warp(gg.projecteden.nexus.models.warps.Warps.Warp) WeeklyWakkaService(gg.projecteden.nexus.models.weeklywakka.WeeklyWakkaService) ArrayList(java.util.ArrayList) World(org.bukkit.World) Chunk(org.bukkit.Chunk) JsonBuilder(gg.projecteden.nexus.utils.JsonBuilder) WeeklyWakka(gg.projecteden.nexus.models.weeklywakka.WeeklyWakka) Supplier(java.util.function.Supplier) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Example 73 with Permission

use of gg.projecteden.nexus.framework.commands.models.annotations.Permission in project Nexus by ProjectEdenGG.

the class VanishCommand method toggleInteract.

@Path("(ni|nointeract)")
@Permission("pv.use")
void toggleInteract() {
    final boolean disabling = player().hasPermission(INTERACT_PERMISSIONS.get(0));
    final PermissionChangeBuilder change = disabling ? PermissionChange.unset() : PermissionChange.set();
    change.uuid(uuid()).permissions(INTERACT_PERMISSIONS).runAsync().thenRun(() -> send(PREFIX + "Interaction " + (disabling ? "&cdisabled" : "&aenabled")));
}
Also used : PermissionChangeBuilder(gg.projecteden.nexus.utils.LuckPermsUtils.PermissionChange.PermissionChangeBuilder) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Example 74 with Permission

use of gg.projecteden.nexus.framework.commands.models.annotations.Permission in project Nexus by ProjectEdenGG.

the class VanishCommand method fakeJoin.

@Path("(fj|fakejoin)")
@Permission("vanish.fakeannounce")
void fakeJoin() {
    JoinQuit.join(player());
    new NerdService().edit(nerd(), nerd -> nerd.setLastUnvanish(LocalDateTime.now()));
    runCommand("vanish off");
}
Also used : NerdService(gg.projecteden.nexus.models.nerd.NerdService) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Example 75 with Permission

use of gg.projecteden.nexus.framework.commands.models.annotations.Permission in project Nexus by ProjectEdenGG.

the class DyeStationCommand method dye.

@Path("color <color>")
@Permission(Group.STAFF)
void dye(ChatColor chatColor) {
    ItemStack item = getToolRequired();
    Colored.of(chatColor.getColor()).apply(item);
}
Also used : ItemStack(org.bukkit.inventory.ItemStack) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Aggregations

Permission (gg.projecteden.nexus.framework.commands.models.annotations.Permission)94 Path (gg.projecteden.nexus.framework.commands.models.annotations.Path)93 Async (gg.projecteden.annotations.Async)15 JsonBuilder (gg.projecteden.nexus.utils.JsonBuilder)13 ItemStack (org.bukkit.inventory.ItemStack)13 List (java.util.List)10 CustomCommand (gg.projecteden.nexus.framework.commands.models.CustomCommand)9 Group (gg.projecteden.nexus.framework.commands.models.annotations.Permission.Group)9 CommandEvent (gg.projecteden.nexus.framework.commands.models.events.CommandEvent)9 Arg (gg.projecteden.nexus.framework.commands.models.annotations.Arg)8 Description (gg.projecteden.nexus.framework.commands.models.annotations.Description)8 ArrayList (java.util.ArrayList)8 Nerd (gg.projecteden.nexus.models.nerd.Nerd)7 NerdService (gg.projecteden.nexus.models.nerd.NerdService)7 Utils (gg.projecteden.nexus.utils.Utils)7 HashMap (java.util.HashMap)7 BiFunction (java.util.function.BiFunction)7 Map (java.util.Map)6 Location (org.bukkit.Location)6 Aliases (gg.projecteden.nexus.framework.commands.models.annotations.Aliases)5