當前位置: 首頁>>代碼示例>>Java>>正文


Java ClickType.SHIFT_LEFT屬性代碼示例

本文整理匯總了Java中org.bukkit.event.inventory.ClickType.SHIFT_LEFT屬性的典型用法代碼示例。如果您正苦於以下問題:Java ClickType.SHIFT_LEFT屬性的具體用法?Java ClickType.SHIFT_LEFT怎麽用?Java ClickType.SHIFT_LEFT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.bukkit.event.inventory.ClickType的用法示例。


在下文中一共展示了ClickType.SHIFT_LEFT屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onIdeasClick

private void onIdeasClick(InventoryClickEvent event) {
    event.setCancelled(true);
    PageGUI.playSound(event);
    ItemStack button = event.getCurrentItem();
    if (button == null) {
        return;
    }

    HumanEntity player = event.getWhoClicked();
    if (button.equals(BACK)) {
        openGroups(player);
        return;
    } else if (!faction.isPrivileged(player)) {
        return;
    }

    Idea idea = IdeaGroup.getIdeaByIcon(button);
    if (faction.getIdeaGroups().contains(idea.getGroup()) && !faction.getIdeas().contains(idea) && event.getClick() == ClickType.SHIFT_LEFT) {
        boolean purchased = idea.purchase(faction);
        MessageUtil.sendMessage(player, (purchased ? FMessage.MISC_PURCHASE_SUCCESS : FMessage.MISC_PURCHASE_FAIL).getMessage(idea.getName()));
    }
    openIdeas(player, idea.getGroup());
}
 
開發者ID:DRE2N,項目名稱:FactionsXL,代碼行數:23,代碼來源:IdeaMenu.java

示例2: onGroupsClick

private void onGroupsClick(InventoryClickEvent event) {
    HumanEntity player = event.getWhoClicked();
    ItemStack button = event.getCurrentItem();
    event.setCancelled(true);
    PageGUI.playSound(event);
    IdeaGroup group = IdeaGroup.getByIcon(button);
    if (event.getClick() == ClickType.SHIFT_LEFT) {
        boolean selected = group.select(faction);
        MessageUtil.sendMessage(player, (selected ? FMessage.IDEA_MENU_GROUPS_SELECTED : FMessage.IDEA_MENU_GROUPS_DESELECTED).getMessage(group.getName()));
        openGroups(player);
    } else {
        openIdeas(player, group);
    }
}
 
開發者ID:DRE2N,項目名稱:FactionsXL,代碼行數:14,代碼來源:IdeaMenu.java

示例3: onClick

public boolean onClick(VPPlayer clicker, int slot, Long coolDownUntil, MenuLink ml,
		InventoryClickEvent event) {
	Icon icon = this.getIcon(clicker, slot);
	if (icon != null) {
		event.setCancelled(!icon.canMove(clicker));
		long now = System.currentTimeMillis();
		if (coolDownUntil == null || coolDownUntil < now) {
			if(icon.closeOnClick())
				clicker.getPlayer().closeInventory();
			if(icon.onClick(clicker, event.getClick(), ml)){
				return true;
			}
		}
	}
	if(!event.isCancelled()) {

		if(event.getClick() == ClickType.DOUBLE_CLICK || event.getClick() == ClickType.SHIFT_LEFT || event.getClick() == ClickType.SHIFT_RIGHT || event.getClick() == ClickType.NUMBER_KEY) {
			ItemStack item = event.getCurrentItem();
			if(item != null && item.getType() != Material.AIR && MinecraftUtils.getExtra(item, Icon.FREEZE).equals("1"))
				event.setCancelled(true);
			else if(event.getClick() == ClickType.NUMBER_KEY){
				item = event.getWhoClicked().getInventory().getItem(event.getHotbarButton());
				if(item != null && item.getType() != Material.AIR && MinecraftUtils.getExtra(item, Icon.FREEZE).equals("1"))
					event.setCancelled(true);
			}
		}
	}
	return false;
}
 
開發者ID:dracnis,項目名稱:VanillaPlus,代碼行數:29,代碼來源:Menu.java


注:本文中的org.bukkit.event.inventory.ClickType.SHIFT_LEFT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。