org.bukkit.inventory.HorseInventory Java Examples
The following examples show how to use
org.bukkit.inventory.HorseInventory.
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: HorseArmourModule.java From UHC with MIT License | 5 votes |
@EventHandler(ignoreCancelled = true) public void on(InventoryDragEvent event) { if (isEnabled()) return; if (!(event.getView().getTopInventory() instanceof HorseInventory)) return; // if it's not a disabled type do nothing if (!DISABLED.contains(event.getOldCursor().getType())) return; event.getWhoClicked().sendMessage(messages.getRaw("disabled message")); event.setCancelled(true); }
Example #2
Source File: Horse.java From Kettle with GNU General Public License v3.0 | 4 votes |
@Override public HorseInventory getInventory();
Example #3
Source File: CraftHorse.java From Kettle with GNU General Public License v3.0 | 4 votes |
@Override public HorseInventory getInventory() { return new CraftInventoryHorse(getHandle().horseChest); }
Example #4
Source File: EntityHorsePet.java From SonarPet with GNU General Public License v3.0 | 4 votes |
@Override public void setArmour(HorseArmour a) { ((HorseInventory) ((InventoryHolder) getBukkitEntity()).getInventory()) .setArmor(a.getMaterial() == null ? null : new ItemStack(a.getMaterial(), 1)); }
Example #5
Source File: CraftHorse.java From Thermos with GNU General Public License v3.0 | 4 votes |
public HorseInventory getInventory() { return new CraftInventoryHorse(getHandle().horseChest); }
Example #6
Source File: HorseArmourModule.java From UHC with MIT License | 4 votes |
@EventHandler(ignoreCancelled = true) public void on(InventoryClickEvent event) { if (isEnabled()) return; if (!(event.getView().getTopInventory() instanceof HorseInventory)) return; // clicked outside of the window if (event.getClickedInventory() == null) return; final InventoryType clicked = event.getClickedInventory().getType(); // get any relevant stack to check the type of based on the action took Optional<ItemStack> relevant = Optional.absent(); switch (event.getAction()) { case MOVE_TO_OTHER_INVENTORY: // only worry about player -> horse if (clicked == InventoryType.PLAYER) { relevant = Optional.fromNullable(event.getCurrentItem()); } break; case PLACE_ALL: case PLACE_SOME: case PLACE_ONE: case SWAP_WITH_CURSOR: // only worry about within the horse if (clicked != InventoryType.PLAYER) { relevant = Optional.fromNullable(event.getCursor()); } break; case HOTBAR_SWAP: // only worry about within a horse if (clicked != InventoryType.PLAYER) { relevant = Optional.fromNullable( event.getWhoClicked().getInventory().getItem(event.getHotbarButton()) ); } break; default: } if (relevant.isPresent() && DISABLED.contains(relevant.get().getType())) { event.getWhoClicked().sendMessage(messages.getRaw("disabled message")); event.setCancelled(true); } }