当前位置: 首页>>代码示例>>Java>>正文


Java Inventory.getType方法代码示例

本文整理汇总了Java中org.bukkit.inventory.Inventory.getType方法的典型用法代码示例。如果您正苦于以下问题:Java Inventory.getType方法的具体用法?Java Inventory.getType怎么用?Java Inventory.getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.inventory.Inventory的用法示例。


在下文中一共展示了Inventory.getType方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CraftContainer

import org.bukkit.inventory.Inventory; //导入方法依赖的package包/类
public CraftContainer(final Inventory inventory, final HumanEntity player, int id) {
    this(new InventoryView() {
        @Override
        public Inventory getTopInventory() {
            return inventory;
        }

        @Override
        public Inventory getBottomInventory() {
            return player.getInventory();
        }

        @Override
        public HumanEntity getPlayer() {
            return player;
        }

        @Override
        public InventoryType getType() {
            return inventory.getType();
        }
    }, id);
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:24,代码来源:CraftContainer.java

示例2: rowType

import org.bukkit.inventory.Inventory; //导入方法依赖的package包/类
public static boolean rowType(Integer row, Integer slot, Inventory inventory) {
	if (slot != null && row != null) {
		Integer mod = 9;
		if (inventory != null) {
			if (inventory.getType() == InventoryType.DISPENSER ||inventory.getType() == InventoryType.WORKBENCH || inventory.getType() == InventoryType.DROPPER) {
				mod = 3;
			} else if (inventory.getType() == InventoryType.CHEST || inventory.getType() == InventoryType.ENDER_CHEST || inventory.getType() == InventoryType.PLAYER){
				mod = 9;
			} else {
				mod = inventory.getSize();
			}
		}
		Integer calculate = row * mod;
		return slot >= calculate - mod && slot < calculate;
	}
	return false;
}
 
开发者ID:WheezyGold7931,项目名称:skLib,代码行数:18,代码来源:ExprClickedRow.java

示例3: GUIMaker

import org.bukkit.inventory.Inventory; //导入方法依赖的package包/类
public GUIMaker(Inventory inv) {
	if (inv.getType() == InventoryType.CHEST) { // 自定义大小的 Inventory
		this.inv = Bukkit.createInventory(inv.getHolder(), inv.getSize(), inv.getTitle());
	} else { // 自定义类型的 Inventory
		this.inv = Bukkit.createInventory(inv.getHolder(), inv.getType(), inv.getTitle());
	}
	this.inv.setContents(inv.getContents());
}
 
开发者ID:jiongjionger,项目名称:NeverLag,代码行数:9,代码来源:GUIMaker.java

示例4: onInventoryDrag

import org.bukkit.inventory.Inventory; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true)
public void onInventoryDrag(InventoryDragEvent event) {
    Player player = (Player) event.getWhoClicked();

    if (!InventoryManager.playerIsLoaded(player)) {
        return;
    }

    for (Integer rawSlotId : event.getRawSlots()) {
        ItemStack cursor = event.getOldCursor();
        Inventory inventory = event.getInventory();

        if (PetManager.isPetItem(cursor)) {
            event.setCancelled(true);
            return;
        }

        if (inventory.getType() == InventoryType.CRAFTING) {
            if (InventoryManager.get(player).isOpened()) {
                return;
            }

            // Shield slot is QUICKBAR and has rawId - 45 o.O
            if (rawSlotId >= 1 && rawSlotId <= 8 || rawSlotId == 45) {
                event.setCancelled(true);
                return;
            }
        } else if (InventoryAPI.isRPGInventory(inventory)) {
            if (rawSlotId < 54) {
                event.setCancelled(true);
                return;
            }
        }
    }
}
 
开发者ID:EndlessCodeGroup,项目名称:RPGInventory,代码行数:36,代码来源:InventoryListener.java

示例5: refresh

import org.bukkit.inventory.Inventory; //导入方法依赖的package包/类
public void refresh(VPPlayer viewer) {
	if(viewer.getMenu() != null)
		viewer.getMenu().refresh(viewer, viewer.getPlayer().getInventory());
	Inventory inv = viewer.getPlayer().getOpenInventory().getTopInventory();
	if(inv == null || inv.getType() == InventoryType.CRAFTING) {
		return;
	}
	if (inv.getHolder() instanceof MenuLink)
		((MenuLink) inv.getHolder()).getIconMenu().refresh(viewer, inv);
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:11,代码来源:MenuManager.java

示例6: onBreakWorkbench

import org.bukkit.inventory.Inventory; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onBreakWorkbench(BlockBreakEvent e)
{
	if(e.isCancelled()) return;
	Block workbench = e.getBlock();

	if (!workbench.hasMetadata("shared_players") || workbench.getType() != Material.WORKBENCH)
		return;
	
	@SuppressWarnings("unchecked")
	List<UUID> list = (workbench.getMetadata("shared_players").get(0).value() instanceof List<?>) ? (List<UUID>)workbench.getMetadata("shared_players").get(0).value() : new ArrayList<UUID>();
	
	Iterator<UUID> iterator = list.iterator();
	
	Inventory sharedInventory = Bukkit.createInventory(null, InventoryType.WORKBENCH);
	
	while (iterator.hasNext())
	{
		UUID next = iterator.next();
		
		iterator.remove();
		
		final Player idPlayer = Bukkit.getPlayer(next);
		
		if (idPlayer != null)
		{
			idPlayer.removeMetadata("shared_inv", Survival.instance);
			
			if(idPlayer.isOnline())
			{
				final Inventory open = idPlayer.getOpenInventory().getTopInventory();
				
				if (open != null && open.getType() == InventoryType.WORKBENCH)
				{
					sharedInventory.setContents(open.getContents());
					open.clear();
					idPlayer.closeInventory();
				}
			}
		}
	}
	
	for(int i = 1; i < sharedInventory.getSize(); i++)
	{
		ItemStack item = sharedInventory.getItem(i);
		if(item != null)
			workbench.getWorld().dropItem(workbench.getLocation(), item);
	}
	
	workbench.removeMetadata("shared_players", Survival.instance);
}
 
开发者ID:FattyMieo,项目名称:SurvivalPlus,代码行数:52,代码来源:WorkbenchShare.java

示例7: ensureOurInventory

import org.bukkit.inventory.Inventory; //导入方法依赖的package包/类
private boolean ensureOurInventory(Inventory inventory) {
    return inventory.getName().equals(this.inventory.getName()) && inventory.getType() == this.inventory.getType() && inventory.getViewers().equals(this.inventory.getViewers());
}
 
开发者ID:shawlaf,项目名称:Banmanager,代码行数:4,代码来源:UserInterface.java

示例8: isSimilar

import org.bukkit.inventory.Inventory; //导入方法依赖的package包/类
public boolean isSimilar(Inventory inv) {
    return inv != null &&
            getType() == inv.getType() &&
            getTitle().equals(inv.getTitle()) &&
            getSize() == inv.getSize();
}
 
开发者ID:EntryPointKR,项目名称:MCLibrary,代码行数:7,代码来源:GUISignature.java


注:本文中的org.bukkit.inventory.Inventory.getType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。