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


Java ClickType.RIGHT属性代码示例

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


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

示例1: rightClickIcon

@EventHandler
public void rightClickIcon(final ObserverInteractEvent event) {
    if(event.getClickType() != ClickType.RIGHT) return;

    MatchPlayer player = event.getPlayer();
    if(!canUse(player)) return;

    ItemStack hand = event.getClickedItem();
    if(ItemUtils.isNothing(hand)) return;

    String displayName = hand.getItemMeta().getDisplayName();
    if(displayName == null) return;

    if(hand.getType() == Button.JOIN.material) {
        event.setCancelled(true);
        if(canOpenWindow(player)) {
            showWindow(player);
        } else {
            // If there is nothing to pick, just join immediately
            jmm.requestJoin(player, JoinRequest.user());
        }
    } else if(hand.getType() == Button.LEAVE.material) {
        event.setCancelled(true);
        jmm.requestObserve(player);
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:26,代码来源:PickerMatchModule.java

示例2: showInventories

@EventHandler(ignoreCancelled = true)
public void showInventories(final ObserverInteractEvent event) {
    if(event.getClickType() != ClickType.RIGHT) return;
    if(event.getPlayer().isDead()) return;

    if(event.getClickedParticipant() != null) {
        event.setCancelled(true);
        if(canPreviewInventory(event.getPlayer(), event.getClickedParticipant())) {
            this.previewPlayerInventory(event.getPlayer().getBukkit(), event.getClickedParticipant().getInventory());
        }
    } else if(event.getClickedEntity() instanceof InventoryHolder && !(event.getClickedEntity() instanceof Player)) {
        event.setCancelled(true);
        this.previewInventory(event.getPlayer().getBukkit(), ((InventoryHolder) event.getClickedEntity()).getInventory());
    } else if(event.getClickedBlockState() instanceof InventoryHolder) {
        event.setCancelled(true);
        this.previewInventory(event.getPlayer().getBukkit(), ((InventoryHolder) event.getClickedBlockState()).getInventory());
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:18,代码来源:ViewInventoryMatchModule.java

示例3: onInteract

@EventHandler(priority = EventPriority.LOW)
public void onInteract(PlayerInteractEvent event) {
    if(!event.hasItem()) return;

    final ClickType click;
    switch(event.getAction()) {
        case LEFT_CLICK_AIR:
        case LEFT_CLICK_BLOCK:
            click = ClickType.LEFT;
            break;

        case RIGHT_CLICK_AIR:
        case RIGHT_CLICK_BLOCK:
            click = ClickType.RIGHT;
            break;

        default:
            return;
    }

    if(onButtonClick(event.getItem(), event.getActor(), click, event)) {
        event.setUseItemInHand(Event.Result.DENY);
        event.setUseInteractedBlock(Event.Result.DENY);
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:25,代码来源:ButtonManager.java

示例4: onInventoryClick

@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
    Player player = (Player) event.getWhoClicked();
    ItemStack clicked = event.getCurrentItem();
    Inventory inventory = event.getInventory();

    if (inventory.getName().equals("Faction Management")) {

        if (clicked.getType() == Material.SKULL_ITEM) {
            if (event.getClick() == ClickType.LEFT) {
                Bukkit.dispatchCommand(player, "f promote " + clicked.getItemMeta().getDisplayName());
                event.setCancelled(true);
            }
            if (event.getClick() == ClickType.MIDDLE){
                Bukkit.dispatchCommand(player, "f leader " + clicked.getItemMeta().getDisplayName());
                event.setCancelled(true);
            }
            if (event.getClick() == ClickType.RIGHT) {
                Bukkit.dispatchCommand(player, "f demote " + clicked.getItemMeta().getDisplayName());
                event.setCancelled(true);
            }
        }
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:24,代码来源:FactionManagerArgument.java

示例5: convertClick

ClickType convertClick(ClickType clickType, Player player) {
    if(clickType == ClickType.RIGHT && player.isSneaking()) {
        return ClickType.SHIFT_RIGHT;
    } else {
        return clickType;
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:7,代码来源:EventFilterMatchModule.java

示例6: onClick

@Override
public void onClick(Player player, ItemStack stack, String action, ClickType clickType)
{
    if (action.startsWith("slot_"))
    {
        int slot = Integer.parseInt(action.split("_")[1]);

        if (clickType == ClickType.LEFT && this.getRemainingPowders() > 0)
        {
            this.numbers[slot]++;
        }
        else if (clickType == ClickType.RIGHT && this.numbers[slot] > 0)
        {
            this.numbers[slot]--;
        }

        this.update(player);
    }
    else if (action.equals("confirm"))
    {
        if (this.getRemainingPowders() == 0)
        {
            this.hub.getInteractionManager().getWellManager().startPearlCrafting(player, this.numbers);
            this.hub.getGuiManager().openGui(player, new GuiWell(this.hub, this.parent));
        }
        else
        {
            player.sendMessage(Well.TAG + ChatColor.RED + "Vous devez placer l'intégralité des poussières d'\u272F !");
        }
    }
    else if (action.equals("reset"))
    {
        System.arraycopy(new int[] {0, 0, 0, 0}, 0, this.numbers, 0, 4);
        this.update(player);
    }
    else if (action.equals("back"))
    {
        this.hub.getGuiManager().openGui(player, new GuiWell(this.hub, this.parent));
    }
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:40,代码来源:GuiWellCraft.java

示例7: enableCosmetic

@Override
public void enableCosmetic(Player player, ClothCosmetic cosmetic, ClickType clickType, boolean login)
{
    if (clickType == ClickType.RIGHT)
        this.startPreview(player, cosmetic);
    else
        super.enableCosmetic(player, cosmetic, null, login);
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:8,代码来源:ClothManager.java

示例8: onClick

@EventHandler
public void onClick(InventoryClickEvent e) {
    if (ChatColor.stripColor(e.getInventory().getTitle()).equals("장신구 장착")) {
        if (e.getSlotType() != InventoryType.SlotType.OUTSIDE) {
            if ((e.getClick() == ClickType.RIGHT) || (e.getClick() == ClickType.LEFT)) {
                if ((e.getRawSlot() == 20) || (e.getRawSlot() == 21) || (e.getRawSlot() == 22) || (e.getRawSlot() == 23) || (e.getRawSlot() == 24)) {

                } else if (e.getRawSlot() <= e.getInventory().getSize()) {
                    e.setCancelled(true);
                }

            } else e.setCancelled(true);
        }
    }
}
 
开发者ID:SkyLightQP,项目名称:ArmorPlus,代码行数:15,代码来源:GUIEvent.java

示例9: onClick

@Override
public boolean onClick(VPPlayer viewer, ClickType type, MenuLink ml){
	if(type == ClickType.RIGHT){
		if(VanillaPlusCore.getTitleManager().hasAdminUse(viewer)){
			viewer.setTitle(title);
			VanillaPlusCore.getMenuManager().refresh(viewer);
			return true;
		}
	}else if(type == ClickType.MIDDLE){
		if(VanillaPlusCore.getTitleManager().hasSwitch(viewer)){
			if(viewer.hasTitle(title.getID()))
				viewer.removeTitle(title);
			else
				viewer.addTitle(title.getID());
			VanillaPlusCore.getMenuManager().refresh(viewer);
			return true;
		}
	}
	if(VanillaPlusCore.getTitleManager().hasUse(viewer)){
		if(viewer.getTitle() != null && viewer.getTitle().getID()==title.getID()){
			viewer.setTitle(null);
		}else if(viewer.hasTitle(title.getID())){
			viewer.setTitle(title);
		}
		else
			return true;
		VanillaPlusCore.getMenuManager().refresh(viewer);
	}
	return true;
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:30,代码来源:IconTitle.java

示例10: onClick

@Override
public void onClick(Player player, ItemStack stack, String action, ClickType clickType)
{
    if (action.equals("beta_vip") && SamaGamesAPI.get().getPermissionsManager().hasPermission(player, "hub.beta.vip"))
    {
        player.teleport(this.hub.getGameManager().getGameByIdentifier("beta_vip").getLobbySpawn());
    }
    else if (action.equals("switch_hub"))
    {
        this.hub.getGuiManager().openGui(player, new GuiSwitchHub(this.hub, 1));
    }
    else if (action.equals("spawn"))
    {
        player.teleport(this.hub.getPlayerManager().getSpawn());
    }
    else if (action.equals("parkour"))
    {
        player.teleport(this.hub.getParkourManager().getParkours().get(0).getFail());
    }
    else if (action.startsWith("game"))
    {
        String[] actions = action.split("_");
        AbstractGame game = this.hub.getGameManager().getGameByIdentifier(actions[1]);

        if (game.getState() == AbstractGame.State.LOCKED || game.getState() == AbstractGame.State.SOON)
        {
            player.sendMessage(ChatColor.RED + "Ce jeu n'est pas disponible.");
            return;
        }

        if (clickType == ClickType.LEFT)
        {
            player.teleport(game.getLobbySpawn());
        }
        else if (clickType == ClickType.RIGHT && game.getWebsiteDescriptionURL() != null)
        {
            this.hub.getGuiManager().closeGui(player);
            new FancyMessage(ChatColor.YELLOW + "Cliquez sur ").then("[Accéder]").color(ChatColor.GOLD).style(ChatColor.BOLD).link(game.getWebsiteDescriptionURL()).then(" pour accéder aux règles du jeu.").color(ChatColor.YELLOW).send(player);
        }
    }
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:41,代码来源:GuiMain.java


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