本文整理了Java中org.bukkit.inventory.Inventory.getLocation()
方法的一些代码示例,展示了Inventory.getLocation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Inventory.getLocation()
方法的具体详情如下:
包路径:org.bukkit.inventory.Inventory
类名称:Inventory
方法名:getLocation
暂无
代码示例来源:origin: BentoBoxWorld/BentoBox
checkIsland(e, e.getInventory().getLocation(), Flags.MOUNT_INVENTORY);
checkIsland(e, e.getInventory().getLocation(), Flags.CONTAINER);
checkIsland(e, e.getInventory().getLocation(), Flags.DISPENSER);
checkIsland(e, e.getInventory().getLocation(), Flags.DROPPER);
checkIsland(e, e.getInventory().getLocation(), Flags.HOPPER);
checkIsland(e, e.getInventory().getLocation(), Flags.FURNACE);
checkIsland(e, e.getInventory().getLocation(), Flags.BREWING);
checkIsland(e, e.getInventory().getLocation(), Flags.BEACON);
代码示例来源:origin: NyaaCat/RPGItems-reloaded
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onInventoryOpen(final InventoryOpenEvent e) {
if (e.getInventory().getHolder() == null || e.getInventory().getLocation() == null)
return;
if (e.getInventory().getType() != InventoryType.CHEST) {
Inventory in = e.getInventory();
Iterator<ItemStack> it = in.iterator();
try {
while (it.hasNext()) {
ItemStack item = it.next();
ItemManager.toRPGItem(item).ifPresent(rpgItem -> rpgItem.updateItem(item));
}
} catch (ArrayIndexOutOfBoundsException ex) {
logger.log(Level.WARNING, "Exception when InventoryOpenEvent. May be harmless.", ex);
// Fix for the bug with anvils in craftbukkit
}
}
}
代码示例来源:origin: gvlfm78/BukkitOldCombatMechanics
@EventHandler
public void onInventoryOpen(InventoryOpenEvent e){
if(!isEnabled(e.getPlayer().getWorld())) return;
Inventory inv = e.getInventory();
if(inv == null) return;
Location loc = null;
try{
loc = inv.getLocation();
} catch(Exception ignored){
}
if(loc == null) return;
Block block = loc.getBlock();
if(!block.getType().equals(Material.BREWING_STAND)) return;
BrewingStand stand = (BrewingStand) block.getState();
stand.setFuelLevel(20);
stand.update();
}
代码示例来源:origin: AddstarMC/Minigames
InventoryHolder inv = (InventoryHolder) block;
if(inv instanceof DoubleChest){
Location left = ((DoubleChest) inv).getLeftSide().getInventory().getLocation().clone();
Location right = ((DoubleChest) inv).getRightSide().getInventory().getLocation().clone();
if (bdata.getLocation() == left){
addInventory(bdata,((DoubleChest) inv).getLeftSide());
代码示例来源:origin: mcMMO-Dev/mcMMO
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onInventoryMoveItemEvent(InventoryMoveItemEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getSource().getLocation().getWorld()))
return;
Inventory inventory = event.getDestination();
if (!(inventory instanceof BrewerInventory)) {
return;
}
InventoryHolder holder = inventory.getHolder();
if (!(holder instanceof BrewingStand)) {
return;
}
ItemStack item = event.getItem();
if (Config.getInstance().getPreventHopperTransferIngredients() && item.getType() != Material.POTION && item.getType() != Material.SPLASH_POTION && item.getType() != Material.LINGERING_POTION) {
event.setCancelled(true);
return;
}
if (Config.getInstance().getPreventHopperTransferBottles() && (item.getType() == Material.POTION || item.getType() == Material.SPLASH_POTION || item.getType() == Material.LINGERING_POTION)) {
event.setCancelled(true);
return;
}
if (Config.getInstance().getEnabledForHoppers() && AlchemyPotionBrewer.isValidIngredient(null, item)) {
AlchemyPotionBrewer.scheduleCheck(null, (BrewingStand) holder);
}
}
内容来源于网络,如有侵权,请联系作者删除!