use of co.aikar.commands.annotation.CommandPermission in project VoxelGamesLibv2 by VoxelGamesLib.
the class EditMode method gui.
@Subcommand("gui")
@CommandPermission("%admin")
public void gui(@Nonnull User sender) {
if (editMode.contains(sender.getUuid())) {
// TODO implement paginated invs
InventoryMenuBuilder builder = new InventoryMenuBuilder().withSize(9).withTitle(Lang.legacy(LangKey.INV_MARKER));
for (int i = 0; i < mapHandler.getMarkerDefinitions().size(); i++) {
MarkerDefinition markerDefinition = mapHandler.getMarkerDefinitions().get(i);
ItemStack is = new ItemBuilder(Material.SKULL_ITEM).durability(3).name(markerDefinition.getPrefix()).meta((itemMeta -> {
char prefix = markerDefinition.getPrefix().toUpperCase().charAt(0);
Skin skin = textureHandler.getSkin(prefix + "").orElseThrow(() -> new VoxelGameLibException("Unknown skull " + prefix));
((SkullMeta) itemMeta).setPlayerProfile(textureHandler.getPlayerProfile(skin));
((SkullMeta) itemMeta).setOwner(markerDefinition.getPrefix());
})).build();
builder.withItem(i, is, (player, clickType, itemStack) -> sender.getPlayer().performCommand("editmode skull " + itemStack.getItemMeta().getDisplayName()), ClickType.LEFT);
}
builder.show(sender.getPlayer());
} else {
Lang.msg(sender, LangKey.EDITMODE_NOT_ENABLED);
}
}
use of co.aikar.commands.annotation.CommandPermission in project VoxelGamesLibv2 by VoxelGamesLib.
the class EditMode method skull.
@Subcommand("skull")
@CommandPermission("%admin")
@Syntax("<name> - the name of the skull")
public void skull(@Nonnull User sender, @Nonnull String name) {
if (editMode.contains(sender.getUuid())) {
ItemStack skull = new ItemBuilder(Material.SKULL_ITEM).durability(3).name(name).meta((itemMeta -> {
char prefix = name.toUpperCase().charAt(0);
Skin skin = textureHandler.getSkin(prefix + "").orElseThrow(() -> new VoxelGameLibException("Unknown skull " + prefix));
((SkullMeta) itemMeta).setPlayerProfile(textureHandler.getPlayerProfile(skin));
((SkullMeta) itemMeta).setOwner(name);
})).build();
sender.getPlayer().getInventory().setItemInMainHand(skull);
} else {
Lang.msg(sender, LangKey.EDITMODE_NOT_ENABLED);
}
}
use of co.aikar.commands.annotation.CommandPermission 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()));
}
use of co.aikar.commands.annotation.CommandPermission 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);
}
use of co.aikar.commands.annotation.CommandPermission in project VoxelGamesLibv2 by VoxelGamesLib.
the class LangCommands method lang.
@Default
@CommandPermission("%user")
public void lang(@Nonnull User sender) {
StringBuilder sb = new StringBuilder();
for (Locale loc : langHandler.getInstalledLocales()) {
sb.append(loc.getTag()).append(" (").append(loc.getName()).append("), ");
}
sb.setLength(sb.length() - 1);
Lang.msg(sender, LangKey.LANG_INSTALLED, sb.toString());
Lang.msg(sender, LangKey.LANG_CURRENT, sender.getLocale().getName());
Lang.msg(sender, LangKey.TRANSLATED_BY);
}
Aggregations