Java Code Examples for org.spongepowered.api.item.inventory.ItemStack#empty()

The following examples show how to use org.spongepowered.api.item.inventory.ItemStack#empty() . 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: UCVHelper8.java    From UltimateChat with GNU General Public License v3.0 5 votes vote down vote up
@Override
public ItemStack getItemInHand(Player sender) {
    if (!sender.getItemInHand(HandTypes.MAIN_HAND).isEmpty()) {
        return sender.getItemInHand(HandTypes.MAIN_HAND);
    } else if (!sender.getItemInHand(HandTypes.OFF_HAND).isEmpty()) {
        return sender.getItemInHand(HandTypes.OFF_HAND);
    }
    return ItemStack.empty();
}
 
Example 2
Source File: UCVHelper7.java    From UltimateChat with GNU General Public License v3.0 5 votes vote down vote up
@Override
public ItemStack getItemInHand(Player sender) {
    if (sender.getItemInHand(HandTypes.MAIN_HAND).isPresent()) {
        return sender.getItemInHand(HandTypes.MAIN_HAND).get();
    } else if (sender.getItemInHand(HandTypes.OFF_HAND).isPresent()) {
        return sender.getItemInHand(HandTypes.OFF_HAND).get();
    }
    return ItemStack.empty();
}
 
Example 3
Source File: VersionHelper56.java    From RedProtect with GNU General Public License v3.0 5 votes vote down vote up
@Override
public ItemStack getItemMainHand(Player player) {
    if (player.getItemInHand(HandTypes.MAIN_HAND).isPresent())
        return player.getItemInHand(HandTypes.MAIN_HAND).get();

    return ItemStack.empty();
}
 
Example 4
Source File: VersionHelper56.java    From RedProtect with GNU General Public License v3.0 5 votes vote down vote up
@Override
public ItemStack getItemOffHand(Player player) {
    if (player.getItemInHand(HandTypes.OFF_HAND).isPresent())
        return player.getItemInHand(HandTypes.OFF_HAND).get();

    return ItemStack.empty();
}
 
Example 5
Source File: VersionHelper7.java    From RedProtect with GNU General Public License v3.0 5 votes vote down vote up
@Override
public ItemStack getItemMainHand(Player player) {
    if (player.getItemInHand(HandTypes.MAIN_HAND).isPresent())
        return player.getItemInHand(HandTypes.MAIN_HAND).get();

    return ItemStack.empty();
}
 
Example 6
Source File: VersionHelper7.java    From RedProtect with GNU General Public License v3.0 5 votes vote down vote up
@Override
public ItemStack getItemOffHand(Player player) {
    if (player.getItemInHand(HandTypes.OFF_HAND).isPresent())
        return player.getItemInHand(HandTypes.OFF_HAND).get();

    return ItemStack.empty();
}
 
Example 7
Source File: VersionHelper8.java    From RedProtect with GNU General Public License v3.0 5 votes vote down vote up
@Override
public ItemStack getItemMainHand(Player player) {
    if (!player.getItemInHand(HandTypes.MAIN_HAND).isEmpty())
        return player.getItemInHand(HandTypes.MAIN_HAND);

    return ItemStack.empty();
}
 
Example 8
Source File: VersionHelper8.java    From RedProtect with GNU General Public License v3.0 5 votes vote down vote up
@Override
public ItemStack getItemOffHand(Player player) {
    if (!player.getItemInHand(HandTypes.OFF_HAND).isEmpty())
        return player.getItemInHand(HandTypes.OFF_HAND);

    return ItemStack.empty();
}