Search in sources :

Example 1 with Description

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

the class StatsCommands method decrement.

@Subcommand("decrement")
@Description("Allows you to decrement the stats of another user")
@CommandPermission("%admin")
@CommandCompletion("@players @stats")
public void decrement(User sender, @Description("the user which stats should be changed") @Flags("other") User user, @Description("the stats type to change") Trackable type, @Description("the amount to decrement, defaults to 1") @Default("1") int amount) {
    StatInstance stat = user.getUserData().getStat(type);
    stat.decrement(amount);
    Lang.msg(sender, LangKey.STATS_DECREMENT, user.getDisplayName(), type.getDisplayName(), type.formatLong(stat.getVal(), sender.getLocale()));
}
Also used : StatInstance(com.voxelgameslib.voxelgameslib.stats.StatInstance) Description(co.aikar.commands.annotation.Description) Subcommand(co.aikar.commands.annotation.Subcommand) CommandCompletion(co.aikar.commands.annotation.CommandCompletion) CommandPermission(co.aikar.commands.annotation.CommandPermission)

Example 2 with Description

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

the class WorldCommands method load.

@Subcommand("load")
@CommandPermission("%admin")
@Syntax("<mapname> - the name of the map to load")
@Description("Loads a map onto the server")
public void load(@Nonnull User sender, @Nonnull String mapName) {
    Optional<Map> o = handler.getMap(mapName);
    Map map = o.orElseGet(() -> handler.loadMap(mapName));
    handler.loadWorld(map, sender.getUuid(), false);
}
Also used : 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 3 with Description

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

the class StatsCommands method set.

@Subcommand("set")
@Description("Allows you to set the stats of another user")
@CommandPermission("%admin")
@CommandCompletion("@players @stats")
public void set(User sender, @Description("the user which stats should be changed") @Flags("other") User user, @Description("the stats type to change") Trackable type, @Description("the new amount") double amount) {
    StatInstance stat = user.getUserData().getStat(type);
    stat.setVal(amount);
    Lang.msg(sender, LangKey.STATS_SET, user.getDisplayName(), type.getDisplayName(), type.formatShort(stat.getVal()));
}
Also used : StatInstance(com.voxelgameslib.voxelgameslib.stats.StatInstance) Description(co.aikar.commands.annotation.Description) Subcommand(co.aikar.commands.annotation.Subcommand) CommandCompletion(co.aikar.commands.annotation.CommandCompletion) CommandPermission(co.aikar.commands.annotation.CommandPermission)

Example 4 with Description

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

the class StatsCommands method increment.

@Subcommand("increment")
@Description("Allows you to increment the stats of another user")
@CommandPermission("%admin")
@CommandCompletion("@players @stats")
public void increment(User sender, @Description("the user which stats should be changed") @Flags("other") User user, @Description("the stats type to change") Trackable type, @Description("the amount to increment, defaults to 1") @Default("1") int amount) {
    StatInstance stat = user.getUserData().getStat(type);
    stat.increment(amount);
    Lang.msg(sender, LangKey.STATS_INCREMENT, user.getDisplayName(), type.getDisplayName(), type.formatLong(stat.getVal(), sender.getLocale()));
}
Also used : StatInstance(com.voxelgameslib.voxelgameslib.stats.StatInstance) Description(co.aikar.commands.annotation.Description) Subcommand(co.aikar.commands.annotation.Subcommand) CommandCompletion(co.aikar.commands.annotation.CommandCompletion) CommandPermission(co.aikar.commands.annotation.CommandPermission)

Example 5 with Description

use of co.aikar.commands.annotation.Description 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)

Aggregations

CommandPermission (co.aikar.commands.annotation.CommandPermission)5 Description (co.aikar.commands.annotation.Description)5 Subcommand (co.aikar.commands.annotation.Subcommand)5 CommandCompletion (co.aikar.commands.annotation.CommandCompletion)3 StatInstance (com.voxelgameslib.voxelgameslib.stats.StatInstance)3 Syntax (co.aikar.commands.annotation.Syntax)2 Map (com.voxelgameslib.voxelgameslib.map.Map)2 World (org.bukkit.World)1