use of org.bukkit.inventory.Inventory in project Denizen-For-Bukkit by DenizenScript.
the class ImprovedOfflinePlayer_v1_11_R1 method getEnderChest.
@Override
public Inventory getEnderChest() {
if (offlineEnderChests.containsKey(getUniqueId())) {
return offlineEnderChests.get(getUniqueId());
}
InventoryEnderChest endchest = new InventoryEnderChest(null);
endchest.a(((CompoundTag_v1_11_R1) this.compound).toNMSTag().getList("EnderItems", 10));
org.bukkit.inventory.Inventory inv = new CraftInventory(endchest);
offlineEnderChests.put(getUniqueId(), inv);
return inv;
}
use of org.bukkit.inventory.Inventory in project Denizen-For-Bukkit by DenizenScript.
the class ImprovedOfflinePlayer_v1_9_R2 method getEnderChest.
@Override
public Inventory getEnderChest() {
if (offlineEnderChests.containsKey(getUniqueId())) {
return offlineEnderChests.get(getUniqueId());
}
InventoryEnderChest endchest = new InventoryEnderChest();
endchest.a(((CompoundTag_v1_9_R2) this.compound).toNMSTag().getList("EnderItems", 10));
Inventory inv = new CraftInventory(endchest);
offlineEnderChests.put(getUniqueId(), inv);
return inv;
}
use of org.bukkit.inventory.Inventory in project Denizen-For-Bukkit by DenizenScript.
the class ScribeCommand method giveBook.
private void giveBook(Player player, ItemStack book) {
Inventory inv = player.getInventory();
int emptySpot = inv.firstEmpty();
if (emptySpot != -1) {
player.getInventory().addItem(book);
} else {
player.getWorld().dropItem(player.getLocation(), book);
dB.log("Player's inventory is full, dropped book.");
}
}
use of org.bukkit.inventory.Inventory in project Jobs by GamingMesh.
the class JobsPaymentListener method onInventoryRepair.
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onInventoryRepair(InventoryClickEvent event) {
// make sure plugin is enabled
if (!plugin.isEnabled())
return;
Inventory inv = event.getInventory();
// If event is nothing or place, do nothing
switch(event.getAction()) {
case NOTHING:
case PLACE_ONE:
case PLACE_ALL:
case PLACE_SOME:
return;
default:
break;
}
// must be anvil inventory
if (!(inv instanceof AnvilInventory))
return;
// Must be "container" slot 9
if (!event.getSlotType().equals(SlotType.CONTAINER) || event.getSlot() != 2)
return;
if (!(event.getWhoClicked() instanceof Player))
return;
Player player = (Player) event.getWhoClicked();
ItemStack resultStack = event.getCurrentItem();
if (resultStack == null)
return;
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
return;
// check if in creative
if (player.getGameMode().equals(GameMode.CREATIVE) && !ConfigManager.getJobsConfiguration().payInCreative())
return;
double multiplier = ConfigManager.getJobsConfiguration().getRestrictedMultiplier(player);
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.REPAIR), multiplier);
}
use of org.bukkit.inventory.Inventory in project Jobs by GamingMesh.
the class JobsPaymentListener method onEnchantItem.
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEnchantItem(EnchantItemEvent event) {
// make sure plugin is enabled
if (!plugin.isEnabled())
return;
Inventory inv = event.getInventory();
if (!(inv instanceof EnchantingInventory))
return;
Player player = event.getEnchanter();
ItemStack resultStack = ((EnchantingInventory) inv).getItem();
if (resultStack == null)
return;
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
return;
// check if in creative
if (player.getGameMode().equals(GameMode.CREATIVE) && !ConfigManager.getJobsConfiguration().payInCreative())
return;
double multiplier = ConfigManager.getJobsConfiguration().getRestrictedMultiplier(player);
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.ENCHANT), multiplier);
}
Aggregations