use of co.aikar.commands.annotation.Subcommand 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.Subcommand 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.Subcommand 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.Subcommand 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.Subcommand in project VoxelGamesLibv2 by VoxelGamesLib.
the class WorldCreator method world.
@Subcommand("world")
@CommandPermission("%admin")
public void world(@Nonnull User sender, @Nonnull String worldName) {
if (step != 1) {
Lang.msg(sender, LangKey.WORLD_CREATOR_WRONG_STEP, step, 1);
return;
}
this.worldName = worldName;
worldHandler.loadLocalWorld(worldName);
Location spawnLoc = Bukkit.getWorld(worldName).getSpawnLocation();
Vector3D spawn = new Vector3D(spawnLoc.getX(), spawnLoc.getY(), spawnLoc.getZ());
sender.getPlayer().teleport(spawnLoc);
game = gameHandler.startGame(EditModeGame.GAMEMODE);
game.getActivePhase().getNextPhase().getFeature(SpawnFeature.class).addSpawn(spawn);
Map map = new Map(null, worldName, spawn, 100);
map.load(game.getUuid(), worldName);
game.getActivePhase().getNextPhase().getFeature(MapFeature.class).setMap(map);
game.join(editor);
game.endPhase();
Lang.msg(sender, LangKey.WORLD_CREATOR_ENTER_CENTER, "/worldcreator center");
step = 2;
}
Aggregations