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


Java ClickType.LEFT属性代码示例

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


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

示例1: 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

示例2: onInteract

@EventHandler
public void onInteract(InventoryClickEvent e) {
	Player player = (Player) e.getWhoClicked();
	
	if(!ChatColor.stripColor(e.getClickedInventory().getTitle()).equalsIgnoreCase("HCRiots Donator Kits")) {
		return;
	}
	
	if(e.getInventory().getSize() != 45) {
		return;
	}
	
	if(e.getClick() != ClickType.LEFT) {
		return;
	}
	
	if(ChatColor.stripColor(e.getCurrentItem().getItemMeta().getDisplayName()).equalsIgnoreCase("Titanium Kit")) {
		this.giveTitaniumKit(player);
	}
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:20,代码来源:KitsCommand.java

示例3: 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

示例4: convertClick

@Nullable ClickType convertClick(Action action, Player player) {
    switch(action) {
        case LEFT_CLICK_BLOCK:
        case LEFT_CLICK_AIR:
            return ClickType.LEFT;

        case RIGHT_CLICK_BLOCK:
        case RIGHT_CLICK_AIR:
            return convertClick(ClickType.RIGHT, player);

        default:
            return null;
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:14,代码来源:EventFilterMatchModule.java

示例5: 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

示例6: 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

示例7: onInventoryClick

@SuppressWarnings("deprecation")
@EventHandler
public void onInventoryClick(InventoryClickEvent event)
{
	if(event.getInventory().getTitle() != Survival.Words.get("Firestriker"))
		return;
	
	final Player player = (Player) event.getWhoClicked();
	
	switch(event.getRawSlot())
	{
		case 1:
		event.setCancelled(true);
		player.closeInventory();
		break;
		
		case 2:
		event.setCancelled(true);
		if(event.getClick() == ClickType.LEFT)
		{
			if(event.getCursor() == null || event.getCursor().getType() == Material.AIR)
			{
				if(event.getInventory().getItem(2) == null || event.getInventory().getItem(2).getType() == Material.AIR)
				{
					if(event.getInventory().getItem(1) != null && event.getInventory().getItem(1).getType() == Material.WOOD_SPADE)
					{
						if(smeltCheck(event.getInventory(), event.getInventory().getItem(0)))
						{
							event.setCancelled(true);
							Random randBurn = new Random();
							player.getLocation().getWorld().playSound(player.getLocation(), Sound.ITEM_FLINTANDSTEEL_USE, 1.0F, randBurn.nextFloat() * 0.4F + 0.8F);
							player.getLocation().getWorld().playSound(player.getLocation(), Sound.ENTITY_GENERIC_BURN, 1.0F, randBurn.nextFloat() * 0.4F + 0.8F);
							
							ItemStack i_smelt = event.getInventory().getItem(0);
							i_smelt.setAmount(i_smelt.getAmount() - 1);
							event.getInventory().setItem(0, i_smelt);
							
							ItemStack i_firecracker = event.getInventory().getItem(1);
							i_firecracker.setDurability((short)(i_firecracker.getDurability() + 7));
							if(i_firecracker.getDurability() >= 56)
							{
								Random rand = new Random();
								player.getLocation().getWorld().playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0F, rand.nextFloat() * 0.4F + 0.8F);
								event.getInventory().setItem(1, null);
							}
						}
					}
				}
				else
				{
					event.setCursor(event.getInventory().getItem(2));
					event.getInventory().setItem(2, null);
				}
			}
			else
				event.setCancelled(true);
		}
		else
			event.setCancelled(true);
		Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Survival.instance, new Runnable()
	    {
	    	public void run()
	    	{
				player.updateInventory();
            }
	    }, 1L);
		break;
	}
}
 
开发者ID:FattyMieo,项目名称:SurvivalPlus,代码行数:69,代码来源:FirestrikerClick.java

示例8: 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.LEFT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。