Java Code Examples for org.spongepowered.api.entity.living.player.Player#setItemInHand()

The following examples show how to use org.spongepowered.api.entity.living.player.Player#setItemInHand() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ItemloreCommand.java    From UltimateCore with MIT License 6 votes vote down vote up
@Override
public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException {
    checkIfPlayer(sender);
    checkPermission(sender, ItemPermissions.UC_ITEM_ITEMLORE_BASE);
    Player p = (Player) sender;

    if (p.getItemInHand(HandTypes.MAIN_HAND).getType().equals(ItemTypes.NONE)) {
        throw new ErrorMessageException(Messages.getFormatted(p, "item.noiteminhand"));
    }
    ItemStack stack = p.getItemInHand(HandTypes.MAIN_HAND);

    Text unsplitlore = Messages.toText(args.<String>getOne("lore").get());
    stack.offer(Keys.ITEM_LORE, unsplitlore.toPlain().contains("|") ? TextUtil.split(unsplitlore, "|") : Arrays.asList(unsplitlore));
    p.setItemInHand(HandTypes.MAIN_HAND, stack);
    Messages.send(sender, "item.command.itemlore.success", "%arg%", unsplitlore);
    return CommandResult.success();
}
 
Example 2
Source File: ItemunbreakableCommand.java    From UltimateCore with MIT License 6 votes vote down vote up
@Override
public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException {
    checkIfPlayer(sender);
    checkPermission(sender, ItemPermissions.UC_ITEM_ITEMUNBREAKABLE_BASE);
    Player p = (Player) sender;

    Boolean value = args.<Boolean>getOne("enabled/disabled").get();

    if (p.getItemInHand(HandTypes.MAIN_HAND).getType().equals(ItemTypes.NONE)) {
        throw new ErrorMessageException(Messages.getFormatted(p, "item.noiteminhand"));
    }
    ItemStack stack = p.getItemInHand(HandTypes.MAIN_HAND);

    if (!stack.supports(Keys.UNBREAKABLE)) {
        throw new ErrorMessageException(Messages.getFormatted(sender, "item.command.itemunbreakable.notsupported"));
    }

    stack.offer(Keys.UNBREAKABLE, value);
    p.setItemInHand(HandTypes.MAIN_HAND, stack);
    Messages.send(sender, "item.command.itemunbreakable.success", "%arg%", value);
    return CommandResult.success();
}
 
Example 3
Source File: ItemquantityCommand.java    From UltimateCore with MIT License 6 votes vote down vote up
@Override
public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException {
    checkIfPlayer(sender);
    checkPermission(sender, ItemPermissions.UC_ITEM_ITEMDURABILITY_BASE);
    Player p = (Player) sender;

    if (p.getItemInHand(HandTypes.MAIN_HAND).getType().equals(ItemTypes.NONE)) {
        throw new ErrorMessageException(Messages.getFormatted(p, "item.noiteminhand"));
    }
    ItemStack stack = p.getItemInHand(HandTypes.MAIN_HAND);
    int quantity = args.<Integer>getOne("quantity").get();

    if (quantity > stack.getMaxStackQuantity()) {
        throw new ErrorMessageException(Messages.getFormatted(sender, "item.numberinvalid", "%number%", quantity));
    }

    stack.setQuantity(quantity);
    p.setItemInHand(HandTypes.MAIN_HAND, stack);
    Messages.send(sender, "item.command.itemquantity.success", "%arg%", quantity);
    return CommandResult.success();
}
 
Example 4
Source File: TakeExecutor.java    From EssentialCmds with MIT License 6 votes vote down vote up
public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException
{
	Player target = ctx.<Player> getOne("target").get();

	if (src instanceof Player)
	{
		Player player = (Player) src;

		if (target.getItemInHand(HandTypes.MAIN_HAND).isPresent())
		{
			player.getInventory().offer(target.getItemInHand(HandTypes.MAIN_HAND).get());
			target.setItemInHand(HandTypes.MAIN_HAND, null);
			player.sendMessage(Text.of(TextColors.GREEN, "Success! ", TextColors.YELLOW, "Took " + target.getName() + "'s held item."));
		}
		else
		{
			player.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Target is not holding anything!"));
		}
	}
	else
	{
		src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "You must be an in-game player to take other players items!"));
	}

	return CommandResult.success();
}
 
Example 5
Source File: ItemhidetagsCommand.java    From UltimateCore with MIT License 6 votes vote down vote up
@Override
public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException {
    checkIfPlayer(sender);
    checkPermission(sender, ItemPermissions.UC_ITEM_ITEMHIDETAGS_BASE);
    Player p = (Player) sender;

    if (p.getItemInHand(HandTypes.MAIN_HAND).getType().equals(ItemTypes.NONE)) {
        throw new ErrorMessageException(Messages.getFormatted(p, "item.noiteminhand"));
    }
    ItemStack stack = p.getItemInHand(HandTypes.MAIN_HAND);

    Key<Value<Boolean>> key = args.<Key<Value<Boolean>>>getOne("tag").get();
    boolean value = args.<Boolean>getOne("enabled").get();

    stack.offer(key, value);
    p.setItemInHand(HandTypes.MAIN_HAND, stack);
    Messages.send(sender, "item.command.itemhidetags.success", "%tag%", key.getName(), "%status%", Messages.getFormatted(value ? "item.command.itemhidetags.hidden" : "item.command.itemhidetags.shown"));
    return CommandResult.success();
}
 
Example 6
Source File: ItemnameCommand.java    From UltimateCore with MIT License 6 votes vote down vote up
@Override
public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException {
    checkIfPlayer(sender);
    checkPermission(sender, ItemPermissions.UC_ITEM_ITEMNAME_BASE);
    Player p = (Player) sender;

    if (p.getItemInHand(HandTypes.MAIN_HAND).getType().equals(ItemTypes.NONE)) {
        throw new ErrorMessageException(Messages.getFormatted(p, "item.noiteminhand"));
    }
    ItemStack stack = p.getItemInHand(HandTypes.MAIN_HAND);

    Text name = Messages.toText(args.<String>getOne("name").get());
    stack.offer(Keys.DISPLAY_NAME, name);
    p.setItemInHand(HandTypes.MAIN_HAND, stack);
    Messages.send(sender, "item.command.itemname.success", "%arg%", name);
    return CommandResult.success();
}
 
Example 7
Source File: ItemcanplaceonCommand.java    From UltimateCore with MIT License 6 votes vote down vote up
@Override
public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException {
    checkIfPlayer(sender);
    checkPermission(sender, ItemPermissions.UC_ITEM_ITEMCANPLACEON_BASE);
    Player p = (Player) sender;

    if (p.getItemInHand(HandTypes.MAIN_HAND).getType().equals(ItemTypes.NONE)) {
        throw new ErrorMessageException(Messages.getFormatted(p, "item.noiteminhand"));
    }
    ItemStack stack = p.getItemInHand(HandTypes.MAIN_HAND);
    Set<BlockType> types = new HashSet<>(args.<BlockType>getAll("blocktypes"));

    stack.offer(Keys.PLACEABLE_BLOCKS, types);
    p.setItemInHand(HandTypes.MAIN_HAND, stack);
    Text items = Text.joinWith(Text.of(", "), types.stream().map(type -> Text.of(type.getName())).collect(Collectors.toList()));
    Messages.send(sender, "item.command.itemcanplaceon.success", "%arg%", items);
    return CommandResult.success();
}
 
Example 8
Source File: ItemcanbreakCommand.java    From UltimateCore with MIT License 6 votes vote down vote up
@Override
public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException {
    checkIfPlayer(sender);
    checkPermission(sender, ItemPermissions.UC_ITEM_ITEMCANBREAK_BASE);
    Player p = (Player) sender;

    if (p.getItemInHand(HandTypes.MAIN_HAND).getType().equals(ItemTypes.NONE)) {
        throw new ErrorMessageException(Messages.getFormatted(p, "item.noiteminhand"));
    }
    ItemStack stack = p.getItemInHand(HandTypes.MAIN_HAND);
    Set<BlockType> types = new HashSet<>(args.<BlockType>getAll("blocktypes"));

    stack.offer(Keys.BREAKABLE_BLOCK_TYPES, types);
    p.setItemInHand(HandTypes.MAIN_HAND, stack);
    Text items = Text.joinWith(Text.of(", "), types.stream().map(type -> Text.of(type.getName())).collect(Collectors.toList()));
    Messages.send(sender, "item.command.itemcanbreak.success", "%arg%", items);
    return CommandResult.success();
}
 
Example 9
Source File: ItemdurabilityCommand.java    From UltimateCore with MIT License 6 votes vote down vote up
@Override
public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException {
    checkIfPlayer(sender);
    checkPermission(sender, ItemPermissions.UC_ITEM_ITEMDURABILITY_BASE);
    Player p = (Player) sender;

    if (p.getItemInHand(HandTypes.MAIN_HAND).getType().equals(ItemTypes.NONE)) {
        throw new ErrorMessageException(Messages.getFormatted(p, "item.noiteminhand"));
    }
    ItemStack stack = p.getItemInHand(HandTypes.MAIN_HAND);
    int durability = args.<Integer>getOne("durability").get();

    if (!stack.supports(DurabilityData.class)) {
        throw new ErrorMessageException(Messages.getFormatted(sender, "item.command.itemdurability.notsupported"));
    }

    if (durability < stack.get(DurabilityData.class).get().durability().getMinValue() || durability > stack.get(DurabilityData.class).get().durability().getMaxValue()) {
        throw new ErrorMessageException(Messages.getFormatted(sender, "item.numberinvalid", "%number%", durability));
    }

    stack.offer(Keys.ITEM_DURABILITY, durability);
    p.setItemInHand(HandTypes.MAIN_HAND, stack);
    Messages.send(sender, "item.command.itemdurability.success", "%arg%", durability);
    return CommandResult.success();
}
 
Example 10
Source File: ItemenchantCommand.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException {
    checkIfPlayer(sender);
    checkPermission(sender, ItemPermissions.UC_ITEM_ITEMENCHANT_BASE);
    Player p = (Player) sender;

    if (p.getItemInHand(HandTypes.MAIN_HAND).getType().equals(ItemTypes.NONE)) {
        throw new ErrorMessageException(Messages.getFormatted(p, "item.noiteminhand"));
    }
    ItemStack stack = p.getItemInHand(HandTypes.MAIN_HAND);

    EnchantmentType ench = args.<EnchantmentType>getOne("enchantment").get();
    int level = args.hasAny("level") ? args.<Integer>getOne("level").get() : 1;

    if (level > ItemPermissions.UC_ITEM_ITEMENCHANT_MAXLEVEL.getIntFor(p)) {
        throw Messages.error(p, "item.command.itemenchant.maxlevel", "%max%", ItemPermissions.UC_ITEM_ITEMENCHANT_MAXLEVEL.getIntFor(p));
    }

    List<Enchantment> enchs = stack.get(Keys.ITEM_ENCHANTMENTS).orElse(new ArrayList<>());
    if (level > 0) {
        enchs.add(Enchantment.builder().type(ench).level(level).build());
        stack.offer(Keys.ITEM_ENCHANTMENTS, enchs);
        p.setItemInHand(HandTypes.MAIN_HAND, stack);
        Messages.send(sender, "item.command.itemenchant.success", "%enchant%", ench.getTranslation().get(), "%level%", level);
        return CommandResult.success();
    } else {
        enchs = enchs.stream().filter(e -> !e.getType().equals(ench)).collect(Collectors.toList());
        stack.offer(Keys.ITEM_ENCHANTMENTS, enchs);
        p.setItemInHand(HandTypes.MAIN_HAND, stack);
        Messages.send(sender, "item.command.itemenchant.success2", "%enchant%", ench.getTranslation().get(), "%level%", level);
        return CommandResult.success();
    }
}
 
Example 11
Source File: MoreCommand.java    From UltimateCore with MIT License 5 votes vote down vote up
@Override
public CommandResult execute(CommandSource sender, CommandContext args) throws CommandException {
    checkIfPlayer(sender);
    checkPermission(sender, ItemPermissions.UC_ITEM_MORE_BASE);
    Player p = (Player) sender;
    if (p.getItemInHand(HandTypes.MAIN_HAND).getType().equals(ItemTypes.NONE)) {
        throw new ErrorMessageException(Messages.getFormatted(p, "item.noiteminhand"));
    }
    ItemStack stack = p.getItemInHand(HandTypes.MAIN_HAND);
    stack.setQuantity(stack.getMaxStackQuantity());
    p.setItemInHand(HandTypes.MAIN_HAND, stack);
    Messages.send(p, "item.command.more.success", "%amount%", stack.getMaxStackQuantity());
    return CommandResult.success();
}
 
Example 12
Source File: LoreBase.java    From EssentialCmds with MIT License 5 votes vote down vote up
public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException
{
	int number = ctx.<Integer> getOne("number").get();

	if (src instanceof Player)
	{
		Player player = (Player) src;

		if (player.getItemInHand(HandTypes.MAIN_HAND).isPresent())
		{
			ItemStack stack = player.getItemInHand(HandTypes.MAIN_HAND).get();
			LoreData loreData = stack.getOrCreate(LoreData.class).get();
			List<Text> newLore = loreData.lore().get();
			newLore.remove(number - 1);
			DataTransactionResult dataTransactionResult = stack.offer(Keys.ITEM_LORE, newLore);

			if (dataTransactionResult.isSuccessful())
			{
				player.setItemInHand(HandTypes.MAIN_HAND, stack);
				src.sendMessage(Text.of(TextColors.GREEN, "Success! ", TextColors.YELLOW, "Removed lore from item."));
			}
			else
			{
				src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Could not remove lore from item."));
			}
		}
		else
		{
			src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "You must be holding an item!"));
		}
	}
	else
	{
		src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "You must be a player to name items."));
	}
	return CommandResult.success();
}
 
Example 13
Source File: LoreBase.java    From EssentialCmds with MIT License 5 votes vote down vote up
public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException
{
	String lore = ctx.<String> getOne("lore").get();

	if (src instanceof Player)
	{
		Player player = (Player) src;

		if (player.getItemInHand(HandTypes.MAIN_HAND).isPresent())
		{
			ItemStack stack = player.getItemInHand(HandTypes.MAIN_HAND).get();
			LoreData loreData = stack.getOrCreate(LoreData.class).get();
			Text textLore = TextSerializers.FORMATTING_CODE.deserialize(lore);
			List<Text> newLore = loreData.lore().get();
			newLore.add(textLore);
			DataTransactionResult dataTransactionResult = stack.offer(Keys.ITEM_LORE, newLore);

			if (dataTransactionResult.isSuccessful())
			{
				player.setItemInHand(HandTypes.MAIN_HAND, stack);
				src.sendMessage(Text.of(TextColors.GREEN, "Success! ", TextColors.YELLOW, "Added lore to item."));
			}
			else
			{
				src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Could not add lore to item."));
			}
		}
		else
		{
			src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "You must be holding an item!"));
		}
	}
	else
	{
		src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "You must be a player to name items."));
	}
	return CommandResult.success();
}
 
Example 14
Source File: SetNameExecutor.java    From EssentialCmds with MIT License 5 votes vote down vote up
public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException
{
	String name = ctx.<String> getOne("name").get();

	if (src instanceof Player)
	{
		Player player = (Player) src;

		if (player.getItemInHand(HandTypes.MAIN_HAND).isPresent())
		{
			ItemStack stack = player.getItemInHand(HandTypes.MAIN_HAND).get();
			Text textName = TextSerializers.FORMATTING_CODE.deserialize(name);
			DataTransactionResult dataTransactionResult = stack.offer(Keys.DISPLAY_NAME, textName);
			
			if(dataTransactionResult.isSuccessful())
			{
				player.setItemInHand(HandTypes.MAIN_HAND, stack);
				src.sendMessage(Text.of(TextColors.GREEN, "Success! ", TextColors.YELLOW, "Set name on item."));
			}
			else
			{
				src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Could not set name on item."));
			}
		}
		else
		{
			src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "You must be holding an item!"));
		}
	}
	else
	{
		src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "You must be a player to name items."));
	}

	return CommandResult.success();
}
 
Example 15
Source File: MoreExecutor.java    From EssentialCmds with MIT License 5 votes vote down vote up
public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException
{
	if (src instanceof Player)
	{
		Player player = (Player) src;

		if (player.getItemInHand(HandTypes.MAIN_HAND).isPresent())
		{
			ItemStack stack = player.getItemInHand(HandTypes.MAIN_HAND).get();
			stack.setQuantity(64);
			player.setItemInHand(HandTypes.MAIN_HAND, stack);
			src.sendMessage(Text.of(TextColors.GREEN, "Success! ", TextColors.YELLOW, "Stacked the item in your hand!"));
		}
		else
		{
			src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "You're not holding anything to stack!"));
		}
	}
	else if (src instanceof ConsoleSource)
	{
		src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Must be an in-game player to use /more!"));
	}
	else if (src instanceof CommandBlockSource)
	{
		src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Must be an in-game player to use /more!"));
	}
	return CommandResult.success();
}
 
Example 16
Source File: MobSpawnerExecutor.java    From EssentialCmds with MIT License 5 votes vote down vote up
public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException
{
	EntityType entityType = ctx.<EntityType> getOne("mob").get();

	if (src instanceof Player)
	{
		Player player = (Player) src;

		ItemStack mobSpawnerStack = ItemStack.builder().itemType(ItemTypes.MOB_SPAWNER).quantity(1).build();
		Optional<MobSpawnerData> mobSpawnerData = mobSpawnerStack.getOrCreate(MobSpawnerData.class);

		if (mobSpawnerData.isPresent())
		{
			MobSpawnerData data = mobSpawnerData.get();
			data.nextEntityToSpawn().set(entityType, null);

			if (mobSpawnerStack.offer(data).isSuccessful())
			{
				player.setItemInHand(HandTypes.MAIN_HAND, mobSpawnerStack);
				player.sendMessage(Text.of(TextColors.GREEN, "Success! ", TextColors.YELLOW, "Created mob spawner."));
			}
			else
			{
				player.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Failed to set mob spawner entity."));
			}
		}
		else
		{
			player.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Failed to create mob spawner."));
		}
	}
	else
	{
		src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Must be an in-game player to use /mobspawner!"));
	}

	return CommandResult.success();
}
 
Example 17
Source File: HatExecutor.java    From EssentialCmds with MIT License 5 votes vote down vote up
@Override
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException
{
	if (src instanceof Player)
	{
		Player player = (Player) src;
		Optional<ItemStack> itemInHand = player.getItemInHand(HandTypes.MAIN_HAND);

		if (itemInHand.isPresent())
		{
			if (itemInHand.get().getQuantity() > 1)
			{
				ItemStack stack = itemInHand.get();
				stack.setQuantity(itemInHand.get().getQuantity() - 1);
				player.setItemInHand(HandTypes.MAIN_HAND, stack);
				stack.setQuantity(1);
				player.setHelmet(stack);
			}
			else
			{
				player.setHelmet(itemInHand.get());
				player.setItemInHand(HandTypes.MAIN_HAND, null);
			}
		}
		else
		{
			player.sendMessage(Text.of("No item selected in hotbar."));
		}
	}

	return CommandResult.success();
}
 
Example 18
Source File: RepairExecutor.java    From EssentialCmds with MIT License 4 votes vote down vote up
public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException
{
	if (src instanceof Player)
	{
		Player player = (Player) src;

		if (player.getItemInHand(HandTypes.MAIN_HAND).isPresent())
		{
			ItemStack stack = player.getItemInHand(HandTypes.MAIN_HAND).get();

			if (stack.get(DurabilityData.class).isPresent())
			{
				DurabilityData durabilityData = stack.get(DurabilityData.class).get();
				DataTransactionResult transactionResult = stack.offer(Keys.ITEM_DURABILITY, durabilityData.durability().getMaxValue());

				if (transactionResult.isSuccessful())
				{
					player.setItemInHand(HandTypes.MAIN_HAND, stack);
					src.sendMessage(Text.of(TextColors.GREEN, "Success! ", TextColors.YELLOW, "Repaired item in hand."));
				}
				else
				{
					src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Failed to repair item."));
				}
			}
			else
			{
				src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "The item you're holding is not reparable."));
			}
		}
		else
		{
			src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "You must be holding something to repair!"));
		}
	}
	else
	{
		src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Must be an in-game player to use /repair!"));
	}

	return CommandResult.success();
}
 
Example 19
Source File: LoreBase.java    From EssentialCmds with MIT License 4 votes vote down vote up
public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException
{
	String lore = ctx.<String> getOne("lore").get();

	if (src instanceof Player)
	{
		Player player = (Player) src;

		if (player.getItemInHand(HandTypes.MAIN_HAND).isPresent())
		{
			ItemStack stack = player.getItemInHand(HandTypes.MAIN_HAND).get();
			List<String> loreList = Lists.newArrayList();
			loreList.addAll(Arrays.asList(lore.split("\\s*,\\s*")));
			List<Text> loreTextList = Lists.newArrayList();

			for (String l : loreList)
			{
				loreTextList.add(TextSerializers.FORMATTING_CODE.deserialize(l));
			}

			DataTransactionResult dataTransactionResult = stack.offer(Keys.ITEM_LORE, loreTextList);

			if (dataTransactionResult.isSuccessful())
			{
				player.setItemInHand(HandTypes.MAIN_HAND, stack);
				src.sendMessage(Text.of(TextColors.GREEN, "Success! ", TextColors.YELLOW, "Set lore on item."));
			}
			else
			{
				src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "Could not set lore on item."));
			}
		}
		else
		{
			src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "You must be holding an item!"));
		}
	}
	else
	{
		src.sendMessage(Text.of(TextColors.DARK_RED, "Error! ", TextColors.RED, "You must be a player to name items."));
	}
	return CommandResult.success();
}