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


Java Action.LEFT_CLICK_AIR屬性代碼示例

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


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

示例1: call

@Override
public void call(Event event) {
	if (event instanceof PlayerInteractEvent) {
		final PlayerInteractEvent pie = (PlayerInteractEvent) event;

		// Types of interacting where the arm must swing.
		if (pie.getAction() == Action.LEFT_CLICK_AIR || pie.getAction() == Action.LEFT_CLICK_BLOCK) {
			lastInteract = System.currentTimeMillis();
		}
	} else if (event instanceof PlayerAnimationEvent) {
		final PlayerAnimationEvent pae = (PlayerAnimationEvent) event;

		if (pae.getAnimationType() == PlayerAnimationType.ARM_SWING) {
			final long difference = System.currentTimeMillis() - lastInteract;

			Bukkit.broadcastMessage("swing difference: " + difference);
		}
	}
}
 
開發者ID:davidm98,項目名稱:Crescent,代碼行數:19,代碼來源:NoSwingA.java

示例2: onWalkieTalkieInteract

@EventHandler
public void onWalkieTalkieInteract(PlayerInteractEvent e) {
	if (e.getPlayer().getInventory().getItemInMainHand().getType() != Material.REDSTONE_COMPARATOR)
		return;
	if (e.getHand() == EquipmentSlot.OFF_HAND)
		return;

	WalkieTalkie wt = new WalkieTalkie(main,
			main.getPlayerManager().getPlayer(e.getPlayer()).getCurrentWalkieTalkieFrequency());

	// Left click to tune frequency.
	if (e.getAction() == Action.LEFT_CLICK_AIR || e.getAction() == Action.LEFT_CLICK_BLOCK) {
		if (e.getPlayer().isSneaking()) {
			wt.decreaseFrequency(e.getPlayer());
		} else {
			wt.increaseFrequency(e.getPlayer());
		}
	}

}
 
開發者ID:kadeska,項目名稱:MT_Communication,代碼行數:20,代碼來源:WalkieTalkieListener.java

示例3: onClick

@SuppressWarnings("deprecation")
@EventHandler
public void onClick(PlayerInteractEvent e) {
	if(e.getAction() == Action.PHYSICAL) return;
    KingdomFactionsPlayer p = PlayerModule.getInstance().getPlayer(e.getPlayer());
    if(p.getPlayer().getInventory() == null) return;
    if(p.getPlayer().getItemInHand() == null) return;
    if(p.getPlayer().getItemInHand().getType() != Material.BLAZE_ROD) return;
    if(!p.getPlayer().getItemInHand().hasItemMeta()) return;
    if(!p.getPlayer().getItemInHand().getItemMeta().getDisplayName().equals(ChatColor.RED + "Empire Wand")) return;
	e.setCancelled(true);
	if(e.getAction() == Action.LEFT_CLICK_AIR || e.getAction() == Action.LEFT_CLICK_BLOCK) { 
		if(p.hasCooldown(CooldownType.WAND)) {
			p.sendMessage(ChatColor.GOLD + "[" + ChatColor.GRAY + "X" + ChatColor.GOLD + "] "
					+ "Je moet nog " + ChatColor.GRAY + p.getCooldown(CooldownType.WAND).getCooldown() + " seconde(n)" + ChatColor.GOLD + " wachten!");
			return;
		}
			if(p.getSpell() == null) {
			p.setSpell(SpellModule.getInstance().getSpell("Spark"));
		}
       p.getSpell().execute(p);
       p.addCooldown(new Cooldown(CooldownType.WAND, p, 60));
	} else if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
		p.rotateSpells();
	}
}
 
開發者ID:ThEWiZ76,項目名稱:KingdomFactions,代碼行數:26,代碼來源:EmpireWandInteractEventListener.java

示例4: getDatas

@EventHandler
private void getDatas(PlayerInteractEvent e){
	if(!(e.getAction()==Action.LEFT_CLICK_BLOCK||e.getAction()==Action.LEFT_CLICK_AIR))return;
	if(!canUsePeople.contains(e.getPlayer().getUniqueId()))return;
	e.setCancelled(true);
	Block block=e.getPlayer().getWorld().getBlockAt(e.getPlayer().getTargetBlock((Set<Material>)null, 6).getLocation()); 
	if(block!=null)
		e.getPlayer().sendMessage("��b������: ��3��l"+block.getType());
	if(e.getPlayer().getInventory().getItemInMainHand()!=null)
		e.getPlayer().sendMessage("��b��Ʒ��: ��3��l"+e.getPlayer().getInventory().getItemInMainHand().getType());
	double _temper1=getTemper(e.getPlayer(),e.getPlayer().getWorld().getTemperature(e.getPlayer().getLocation().getBlockX(), e.getPlayer().getLocation().getBlockZ()));
	e.getPlayer().sendMessage("��b�����¶�: ��3��l"+_temper1+"��");
	if(block!=null){
		double _temper2=getTemper(e.getPlayer(),e.getPlayer().getWorld().getTemperature(block.getX(), block.getZ()));
		e.getPlayer().sendMessage("��bĿ�귽���¶�: ��3��l"+_temper2+"��");
		e.getPlayer().sendMessage("��bĿ�귽������Ⱥϵ: ��3��l"+block.getBiome());
	}
	
	
}
 
開發者ID:SchoolUniform,項目名稱:RealSurvival,代碼行數:20,代碼來源:TestCMD.java

示例5: onInteract

@EventHandler(priority = EventPriority.LOWEST)
public void onInteract(PlayerInteractEvent evt) {
    if (!evt.getPlayer().equals(currentPainter))
        return;

    Block target = evt.getPlayer().getTargetBlock((Set<Material>) null, 50);
    if (target.getZ() != ARENA_Z || target.getX() < MIN_X || target.getX() > MAX_X)
        return; // Not clicking on the canvas.

    if (target.getY() > MAX_Y && target.getY() <= MAX_Y + 5) { // Pick color.
        penTime = 0;
        currentColor = target.getData();
        updateActionBar();
        currentPainter.playSound(currentPainter.getLocation(), Sound.BLOCK_BREWING_STAND_BREW, 0.75F, 1.75F);
    } else if (evt.getAction() == Action.RIGHT_CLICK_AIR) { // Pen Tool
        penTime = System.currentTimeMillis() + 200;
        placeInk();
        evt.setCancelled(true); // Prevent "cl
    } else if (evt.getAction() == Action.LEFT_CLICK_AIR) { // Fill
        playSound(Sound.ENTITY_BOBBER_SPLASH, 1.5F, 0.5F);
        floodFill(target);
    }
}
 
開發者ID:Kneesnap,項目名稱:Kineticraft,代碼行數:23,代碼來源:Pictionary.java

示例6: onCellPhoneInteract

@EventHandler
public void onCellPhoneInteract(PlayerInteractEvent e) {
  Player p = e.getPlayer();
  
  if (p.getInventory().getItemInMainHand().getType() != Material.WATCH)
    return;
  
  e.setCancelled(true);
  
  CellularPhone phone = new CellularPhone(main);
  
  // Left click for recipient toggle
  if (e.getAction() == Action.LEFT_CLICK_AIR || e.getAction() == Action.LEFT_CLICK_BLOCK) {
    if (p.isSneaking()) {
      phone.getNextContact(p);
      
    } else {
      phone.getPreviousContact(p);
      
    }
  }
  
  // Right click for text messages
  if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
    if (p.isSneaking()) {
      phone.checkTextMessages(p);
      
    } else {
      phone.deleteTextMessage(p);
      
    }
  }
  
}
 
開發者ID:kadeska,項目名稱:MT_Communication,代碼行數:34,代碼來源:CellularPhoneListener.java

示例7: onInteract

@EventHandler
public void onInteract(final PlayerInteractEvent event) {
    if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) return;

    ItemStack item = event.getItem();
    if (item instanceof PlayerheadItemStack) {
        event.setCancelled(true);
        Player player = event.getPlayer();

        //Use the item
        if (item.getAmount() > 1) item.setAmount(item.getAmount() - 1);
        else player.getInventory().remove(item);

        MainConfiguration config = UHC.getInstance().getMainConfig();

        //Give effects & crap
        PlayerheadItemStack playerhead = (PlayerheadItemStack) item;
        boolean golden = playerhead.isGolden();
        player.sendMessage(colour("&aYou ate " + playerhead.getFrom() + "'s playerhead!"));

        int regenDuration = golden ? config.getGoldenHeadRegenerationDuration() : config.getHeadRegenerationDuration();
        int regenAmpf = golden ? config.getGoldenHeadRegenerationAmplifier() : config.getHeadRegenerationAmplifier();
        int absorpDuration = golden ? config.getGoldenHeadAbsorptionDuration() : config.getHeadAbsorptionDuration();
        int absorpAmpf = golden ? config.getGoldenHeadAbsorptionAmplifier() : config.getHeadAbsorptionAmplifier();

        player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, regenDuration, regenAmpf, false, true));
        player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, absorpDuration, absorpAmpf, false, true));
    }
}
 
開發者ID:Project-Coalesce,項目名稱:UHC,代碼行數:29,代碼來源:HeadEatHandler.java

示例8: clickable

@EventHandler(priority = EventPriority.HIGHEST)
public void clickable(PlayerInteractEvent evt) {
    Action act = evt.getAction();
    if ((evt.isCancelled() && act != Action.LEFT_CLICK_AIR && act != Action.LEFT_CLICK_AIR) || evt.isAsynchronous()) return;
    
    ItemStack stack = evt.getItem();
    if (stack == null) return;
    ItemMeta meta = stack.getItemMeta();
    if (!meta.hasLore()) return;
    
    for (String lore : meta.getLore()) {
        Item item = ItemFactory.items.get(lore);
        if (item instanceof ClickableItem) {
            if (item instanceof LeftClickOnly) {
                if (act == Action.LEFT_CLICK_BLOCK || act == Action.LEFT_CLICK_AIR) {
                    ((ClickableItem) item).run(evt);
                }
                continue;
            }
            
            if (item instanceof RightClickOnly) {
                if (act == Action.RIGHT_CLICK_BLOCK || act == Action.RIGHT_CLICK_AIR) {
                    ((ClickableItem) item).run(evt);
                }
                continue;
            }
            
            // common type
            ((ClickableItem) item).run(evt);
        }
    }
}
 
開發者ID:Recraft,項目名稱:Recreator,代碼行數:32,代碼來源:ItemActionListener.java

示例9: onAnvilOrEnchantInteract

@EventHandler
public void onAnvilOrEnchantInteract(PlayerInteractEvent event) {
    if (event.getClickedBlock() != null) {
        if (event.getPlayer().getGameMode() == GameMode.CREATIVE && (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK))
            return;
        Material type = event.getClickedBlock().getType();
        for (Material m : RESTRICTED_TYPES) {
            if (m == type) {
                event.setCancelled(true);
                break;
            }
        }
    }
}
 
開發者ID:edasaki,項目名稱:ZentrelaRPG,代碼行數:14,代碼來源:EnvironmentManager.java

示例10: onSpellClicks

@EventHandler
public void onSpellClicks(PlayerInteractEvent event) {
    Player p = event.getPlayer();
    if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)
        click(p, true);
    else if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)
        click(p, false);
}
 
開發者ID:edasaki,項目名稱:ZentrelaRPG,代碼行數:8,代碼來源:SpellManager.java

示例11: onPlayerInteract

@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
	if(e.getPlayer().getGameMode() != GameMode.CREATIVE)
		e.setCancelled(true);
	
	GamePlayer player = Absorption.getPlayer(e.getPlayer());
	if(player == null) return;
	
	if(e.getPlayer().getItemInHand().getType() == Material.AIR) return;
	
	if(player.getState() == PlayerState.WAITING) {
		
	} else if(player.getState() == PlayerState.PLAYING) {
		int slot = e.getPlayer().getInventory().getHeldItemSlot();
		if(e.getAction() == Action.LEFT_CLICK_AIR || e.getAction() == Action.LEFT_CLICK_BLOCK) {
			if(slot == 0) {
				player.getKit().onLeftClick(player);
			} else if(slot == 1) {
				player.getKit().getSecondaryWeapon().onLeftClick(player);
			} else if(slot == 2) {
				player.getKit().getSpecialWeapon().onLeftClick(player);
			}
		} else if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
			if(slot == 0) {
				player.getKit().onRightClick(player);
			} else if(slot == 1) {
				player.getKit().getSecondaryWeapon().onRightClick(player);
			} else if(slot == 2) {
				player.getKit().getSpecialWeapon().onRightClick(player);
			}
		}
	} else if(player.getState() == PlayerState.RESPAWNING) {
		
	} else if(player.getState() == PlayerState.END) {
		// Nothing
	}
}
 
開發者ID:SamaGames,項目名稱:Absorption,代碼行數:37,代碼來源:InteractionListener.java

示例12: onPlayerInteract

@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
	if (e != null && e.getPlayer() != null && e.getClickedBlock() != null) {
		if (e.getAction() == Action.LEFT_CLICK_BLOCK) {
			return;
		}
		if (e.getAction() == Action.LEFT_CLICK_AIR) {
			return;
		}
		if (e.getAction() == Action.RIGHT_CLICK_AIR) {
			return;
		}
		ChunkHelper.cancelEventIfNotOwned(e.getPlayer(), e.getClickedBlock().getChunk(), e);
	}
}
 
開發者ID:cjburkey01,項目名稱:ClaimChunk,代碼行數:15,代碼來源:CancellableChunkEvents.java

示例13: isValidProjectileAction

private static boolean isValidProjectileAction(Action action, ClickAction clickAction) {
    switch(clickAction) {
        case RIGHT:
            return action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK;
        case LEFT:
            return action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK;
        case BOTH:
            return action != Action.PHYSICAL;
    }
    return false;
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:11,代碼來源:ProjectilePlayerFacet.java

示例14: onSignClick

@EventHandler
public void onSignClick(PlayerInteractEvent event) {
	if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_AIR)
		return;
	
	Block b = event.getClickedBlock();
	if (b.getType() == Material.SIGN_POST || b.getType() == Material.WALL_SIGN) {
		Sign sign = (Sign) b.getState();
		SignClickEvent ev = new SignClickEvent(event.getPlayer(), sign, event.getClickedBlock(), event.getAction() == Action.RIGHT_CLICK_BLOCK);
		Bukkit.getServer().getPluginManager().callEvent(ev);
	}
}
 
開發者ID:thekeenant,項目名稱:mczone,代碼行數:12,代碼來源:GeneralEvents.java

示例15: onPlayerInteract

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
	if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)
		return;
	
	Player p = event.getPlayer();
	Gamer g = Gamer.get(p);
	
	Block b = event.getClickedBlock();
	for (Course c : Course.getList()) {
		Block test1 = c.getButton();
		Block test2 = c.getEnd();

		if (test1 != null && test1.getX() == b.getX() && test1.getY() == b.getY() && test1.getZ() == b.getZ()) {
			g.setVariable("parkour", c);
			p.teleport(c.getStart());
			return;
		}
		
		if (test2 != null && test2.getX() == b.getX() && test2.getY() == b.getY() && test2.getZ() == b.getZ()) {
			Chat.server(Gamer.get(p.getName()).getRank().getPrefix() + p.getDisplayName() + " &ejust beat &2&l" + c.getTitle() + "");
			if (c.getNextCourse() != null) {
				Course next = Course.get(c.getNextCourse());
				if (next != null) {
					g.setVariable("parkour", next);
					p.teleport(next.getStart());
					return;
				}
			}
			p.teleport(c.getStart());
			return;
		}
	}
}
 
開發者ID:thekeenant,項目名稱:mczone,代碼行數:34,代碼來源:Parkour.java


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