本文整理汇总了Java中org.bukkit.inventory.HorseInventory类的典型用法代码示例。如果您正苦于以下问题:Java HorseInventory类的具体用法?Java HorseInventory怎么用?Java HorseInventory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HorseInventory类属于org.bukkit.inventory包,在下文中一共展示了HorseInventory类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPetInventoryOpened
import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onPetInventoryOpened(InventoryOpenEvent event) {
Player player = (Player) event.getPlayer();
if (!InventoryManager.playerIsLoaded(player)) {
return;
}
final PlayerWrapper playerWrapper = InventoryManager.get(player);
if (playerWrapper.hasPet() && event.getInventory().getHolder() == playerWrapper.getPet()) {
playerWrapper.openInventory();
event.setCancelled(true);
new BukkitRunnable() {
@Override
public void run() {
HorseInventory horseInv = ((Horse) playerWrapper.getPet()).getInventory();
horseInv.setSaddle(new ItemStack(Material.SADDLE));
}
}.runTaskLater(RPGInventory.getInstance(), 1);
}
}
示例2: getSaddle
import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
public static ItemStack getSaddle(final Entity entity) {
if (!Sddls.isHorse(entity)) return null;
final Inventory inv = ((InventoryHolder) entity).getInventory();;
if (inv instanceof HorseInventory)
return ((HorseInventory) inv).getSaddle();
return inv.getItem(0);
}
示例3: equip
import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
@Override
public boolean equip(Entity entity, ItemStack item) {
PreCon.notNull(entity);
PreCon.notNull(item);
if (!(entity instanceof Horse))
return false;
Horse horse = (Horse)entity;
HorseInventory inventory = horse.getInventory();
Material material = item.getType();
if (material == Material.SADDLE) {
inventory.setSaddle(item);
}
else {
if (Materials.hasProperty(material, MaterialProperty.HORSE_ARMOR)) {
inventory.setArmor(item);
}
else {
return false;
}
}
return true;
}
示例4: clear
import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
@Override
public List<ItemStack> clear(Entity entity) {
PreCon.notNull(entity);
if (!(entity instanceof Horse))
return new ArrayList<>(0);
Horse horse = (Horse)entity;
HorseInventory inventory = horse.getInventory();
List<ItemStack> result = new ArrayList<>(2);
ItemStack saddle = inventory.getSaddle();
if (saddle != null) {
result.add(saddle);
inventory.setSaddle(null);
}
ItemStack armor = inventory.getArmor();
if (armor != null) {
result.add(armor);
inventory.setArmor(null);
}
return result;
}
示例5: getInventory
import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
public HorseInventory getInventory() {
return new CraftInventoryHorse(getHandle().horseChest);
}
示例6: getInventory
import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
@Override
public HorseInventory getInventory();
示例7: setArmour
import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
@Override
public void setArmour(HorseArmour a) {
((HorseInventory) ((InventoryHolder) getBukkitEntity()).getInventory())
.setArmor(a.getMaterial() == null ? null : new ItemStack(a.getMaterial(), 1));
}
示例8: getInventory
import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
public HorseInventory getInventory() {
throw new NotImplementedException("getInventory()");
}
示例9: getInventory
import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
public HorseInventory getInventory() {
return new CraftInventoryHorse(getHandle().inventoryChest);
}
示例10: getInventory
import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
@Override
public HorseInventory getInventory() {
return PoreHorseInventory.of(getHandle().getInventory());
}
示例11: onInventoryClick
import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if (event.getInventory() instanceof HorseInventory && event.getSlotType() != InventoryType.SlotType.QUICKBAR && event.getSlot() < 9) {
event.setCancelled(true);
}
}
示例12: getInventory
import org.bukkit.inventory.HorseInventory; //导入依赖的package包/类
HorseInventory getInventory();