Search in sources :

Example 16 with CommandPermission

use of co.aikar.commands.annotation.CommandPermission in project VoxelGamesLibv2 by VoxelGamesLib.

the class TextureCommands method getById.

@Subcommand("get")
@CommandPermission("%admin")
public void getById(@Nonnull User user, @Nonnull Integer id) {
    Lang.msg(user, LangKey.TEXTURE_FETCHING_TEXTURE);
    textureHandler.fetchSkin(id, skin -> {
        ItemStack skull = textureHandler.getSkull(skin);
        user.getPlayer().getInventory().addItem(skull);
        Lang.msg(user, LangKey.TEXTURE_TEXTURE_APPLIED);
    });
}
Also used : ItemStack(org.bukkit.inventory.ItemStack) Subcommand(co.aikar.commands.annotation.Subcommand) CommandPermission(co.aikar.commands.annotation.CommandPermission)

Example 17 with CommandPermission

use of co.aikar.commands.annotation.CommandPermission in project VoxelGamesLibv2 by VoxelGamesLib.

the class WorldCommands method tp.

@Subcommand("tp")
@CommandPermission("%admin")
@Syntax("<world> - the name of the world to tp to")
@Description("Teleports you to a world")
public void tp(@Nonnull User sender, @Nonnull String world) {
    Optional<Map> o = handler.getMap(world);
    if (o.isPresent()) {
        Map map = o.get();
        sender.getPlayer().teleport(map.getCenter().toLocation(map.getLoadedName(sender.getUuid())));
    } else {
        World w = Bukkit.getWorld(world);
        if (w != null) {
            sender.getPlayer().teleport(Bukkit.getWorld(world).getSpawnLocation());
        }
        Lang.msg(sender, LangKey.WORLD_UNKNOWN_MAP, world);
    }
}
Also used : World(org.bukkit.World) Map(com.voxelgameslib.voxelgameslib.map.Map) Description(co.aikar.commands.annotation.Description) Subcommand(co.aikar.commands.annotation.Subcommand) Syntax(co.aikar.commands.annotation.Syntax) CommandPermission(co.aikar.commands.annotation.CommandPermission)

Example 18 with CommandPermission

use of co.aikar.commands.annotation.CommandPermission in project VoxelGamesLibv2 by VoxelGamesLib.

the class EditMode method chest.

@Subcommand("chest")
@CommandPermission("%admin")
@Syntax("<name> - the name of the chest")
public void chest(@Nonnull User sender, @Nonnull String name) {
    if (editMode.contains(sender.getUuid())) {
        ItemStack chest = new ItemBuilder(Material.CHEST).name(name).build();
        sender.getPlayer().getInventory().setItemInMainHand(chest);
    } else {
        Lang.msg(sender, LangKey.EDITMODE_NOT_ENABLED);
    }
}
Also used : ItemBuilder(com.voxelgameslib.voxelgameslib.utils.ItemBuilder) ItemStack(org.bukkit.inventory.ItemStack) Subcommand(co.aikar.commands.annotation.Subcommand) Syntax(co.aikar.commands.annotation.Syntax) CommandPermission(co.aikar.commands.annotation.CommandPermission)

Aggregations

CommandPermission (co.aikar.commands.annotation.CommandPermission)18 Subcommand (co.aikar.commands.annotation.Subcommand)17 Syntax (co.aikar.commands.annotation.Syntax)6 Description (co.aikar.commands.annotation.Description)5 CommandCompletion (co.aikar.commands.annotation.CommandCompletion)4 Map (com.voxelgameslib.voxelgameslib.map.Map)4 ItemStack (org.bukkit.inventory.ItemStack)4 Vector3D (com.voxelgameslib.voxelgameslib.map.Vector3D)3 StatInstance (com.voxelgameslib.voxelgameslib.stats.StatInstance)3 ItemBuilder (com.voxelgameslib.voxelgameslib.utils.ItemBuilder)3 VoxelGameLibException (com.voxelgameslib.voxelgameslib.exception.VoxelGameLibException)2 MapFeature (com.voxelgameslib.voxelgameslib.feature.features.MapFeature)2 SpawnFeature (com.voxelgameslib.voxelgameslib.feature.features.SpawnFeature)2 Game (com.voxelgameslib.voxelgameslib.game.Game)2 SkullMeta (org.bukkit.inventory.meta.SkullMeta)2 Skin (org.mineskin.data.Skin)2 Default (co.aikar.commands.annotation.Default)1 WorldException (com.voxelgameslib.voxelgameslib.exception.WorldException)1 GameMode (com.voxelgameslib.voxelgameslib.game.GameMode)1 Locale (com.voxelgameslib.voxelgameslib.lang.Locale)1