Search in sources :

Example 61 with Permission

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

the class ItemTagsCommand method updateInv.

@Path("updateInv")
@Permission(Group.ADMIN)
@Description("Update item tags on all items in inventory")
void updateInv() {
    ItemStack[] contents = inventory().getContents();
    int count = 0;
    for (ItemStack item : contents) {
        if (isNullOrAir(item))
            continue;
        ItemTagsUtils.updateItem(item);
        ++count;
    }
    send(PREFIX + count + " items itemtags updated!");
}
Also used : ItemStack(org.bukkit.inventory.ItemStack) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Description(gg.projecteden.nexus.framework.commands.models.annotations.Description) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Example 62 with Permission

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

the class ItemTagsCommand method setCondition.

@Path("setCondition <condition>")
@Permission(Group.ADMIN)
void setCondition(Condition condition) {
    ItemStack tool = getToolRequired();
    ItemTagsUtils.updateCondition(tool, condition);
    Condition.setDurability(tool, condition);
}
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)

Example 63 with Permission

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

the class HomesCommand method lockInWorld.

@Async
@Confirm
@Path("lockInWorld <world>")
@Permission(Group.ADMIN)
void lockInWorld(World world) {
    int count = 0;
    for (HomeOwner owner : service.getAll()) {
        boolean updated = false;
        for (Home home : homeOwner.getHomes()) {
            if (world.equals(home.getLocation().getWorld()) && !home.isLocked()) {
                ++count;
                updated = true;
                home.setLocked(true);
            }
        }
        if (updated)
            service.save(owner);
    }
    send(PREFIX + "Locked " + count + " homes");
}
Also used : HomeOwner(gg.projecteden.nexus.models.home.HomeOwner) Home(gg.projecteden.nexus.models.home.Home) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Async(gg.projecteden.annotations.Async) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission) Confirm(gg.projecteden.nexus.framework.commands.models.annotations.Confirm)

Example 64 with Permission

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

the class ArmorStandEditorCommand method position_arms.

@Path("position arms left")
@Permission(Group.ADMIN)
void position_arms() {
    ArmorStand armorStand = (ArmorStand) getTargetEntityRequired(EntityType.ARMOR_STAND);
    if (!isPerkAllowedAt(player(), armorStand.getLocation()))
        error("You cannot edit armor stands here");
    float yaw = LocationUtils.normalizeYaw(location());
    float pitch = location().getPitch();
    line();
    send("yaw: " + yaw + " / pitch: " + pitch);
    double x;
    if (yaw > 180)
        x = yaw + pitch;
    else
        x = yaw - pitch;
    double y = yaw + 180;
    if (y > 360)
        y -= 360;
    double z = 0;
    double xr = Math.toRadians(x);
    double yr = Math.toRadians(y);
    double zr = Math.toRadians(z);
    send(StringUtils.getDf().format(x) + " " + StringUtils.getDf().format(y) + " " + StringUtils.getDf().format(z));
    send(StringUtils.getDf().format(xr) + " " + StringUtils.getDf().format(yr) + " " + StringUtils.getDf().format(zr));
    EulerAngle ea = new EulerAngle(xr, yr, zr);
    armorStand.setLeftArmPose(ea);
}
Also used : ArmorStand(org.bukkit.entity.ArmorStand) EulerAngle(org.bukkit.util.EulerAngle) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Example 65 with Permission

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

the class Pugmas20Command method treeRegion.

@Permission(Group.ADMIN)
@Path("tree region <treeType> <id>")
void treeRegion(PugmasTreeType treeType, int id) {
    ProtectedRegion region = treeType.getRegion(id);
    String command = region == null ? "define" : "redefine";
    runCommand("mcmd /here ;; rg " + command + " pugmas20_trees_" + treeType.name().toLowerCase() + "_" + id);
}
Also used : ProtectedRegion(com.sk89q.worldguard.protection.regions.ProtectedRegion) 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