Improve the Saddle API for Horses

Not all horses with Saddles have armor. This lets us break up the horses with saddles
and access their saddle state separately from an interface shared with Armor.
This commit is contained in:
Aikar 2016-12-10 16:12:48 -05:00
parent 48d1719745
commit 9895d6c5c3
4 changed files with 31 additions and 18 deletions

View File

@ -0,0 +1,22 @@
package org.bukkit.inventory;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;
@NullMarked
public interface ArmoredHorseInventory extends AbstractHorseInventory {
/**
* Gets the item in the horse's armor slot.
*
* @return the armor item
*/
@Nullable ItemStack getArmor();
/**
* Sets the item in the horse's armor slot.
*
* @param stack the new item
*/
void setArmor(@Nullable ItemStack stack);
}

View File

@ -5,20 +5,4 @@ import org.jetbrains.annotations.Nullable;
/**
* An interface to the inventory of a Horse.
*/
public interface HorseInventory extends AbstractHorseInventory {
/**
* Gets the item in the horse's armor slot.
*
* @return the armor item
*/
@Nullable
ItemStack getArmor();
/**
* Sets the item in the horse's armor slot.
*
* @param stack the new item
*/
void setArmor(@Nullable ItemStack stack);
}
public interface HorseInventory extends AbstractHorseInventory, ArmoredHorseInventory {}

View File

@ -6,7 +6,7 @@ import org.jetbrains.annotations.Nullable;
/**
* An interface to the inventory of a {@link Llama}.
*/
public interface LlamaInventory extends AbstractHorseInventory {
public interface LlamaInventory extends SaddledHorseInventory {
/**
* Gets the item in the llama's decor slot.

View File

@ -0,0 +1,7 @@
package org.bukkit.inventory;
import org.jspecify.annotations.NullMarked;
@NullMarked
public interface SaddledHorseInventory extends AbstractHorseInventory {
}