当前位置: 首页>>代码示例>>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;未经允许,请勿转载。