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


Java Action.RIGHT_CLICK_AIR屬性代碼示例

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


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

示例1: onInteract

@EventHandler(priority = EventPriority.HIGHEST)
public void onInteract(PlayerInteractEvent event) {
    Action action = event.getAction();
    ItemStack item = event.getItem();

    if (item == null) {
        return;
    }

    if (action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK) {
        Player player = event.getPlayer();
        InventoryData data = InventoryData.getData(player);
        // check if we are consuming an item.
        if (item.getType().isEdible() || item.getType() == Material.POTION) {
            // update data.
            data.setConsumeTime(System.currentTimeMillis());
        }
    }

}
 
開發者ID:Vrekt,項目名稱:Arc-v2,代碼行數:20,代碼來源:InventoryListener.java

示例2: onSpectatorInteract

@EventHandler
public void onSpectatorInteract(PlayerInteractEvent event) {
	Player p = event.getPlayer();
	Gamer g = Gamer.get(p.getName());
	if (!g.isInvisible())
		return;
	
	if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.PHYSICAL) {
		event.setCancelled(true);
		return;
	}
	
	
	int cur = 0;
	if (g.getVariable("spectating") != null)
		cur = (Integer) g.getVariable("spectating");
	int next = cur + 1;
	if (next + 1 >= Game.getTributes().size())
		next = 0;
	g.setVariable("spectating", next);
	Gamer t = Game.getTributes().get(next);
	g.getPlayer().teleport(t.getPlayer().getLocation());
	Chat.player(g.getPlayer(), "&2[SG] &eCurrently spectating " + g.getPrefix() + g.getName());
	event.setCancelled(true);
}
 
開發者ID:thekeenant,項目名稱:mczone,代碼行數:25,代碼來源:Events.java

示例3: onPlayerInteract2

@EventHandler
public void onPlayerInteract2(PlayerInteractEvent e) {
    Player player = e.getPlayer();
    PlayerInventory inventory = player.getInventory();
    if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
        Material material = inventory.getItemInHand().getType();
        if(material == Material.BOW) {
            DynamicAC.getManager().getBackend().logBowWindUp(player, System.currentTimeMillis());
        } else if(Utilities.isFood(material)) {
            DynamicAC.getManager().getBackend().logEatingStart(player);
        }
    }
    Block block = e.getClickedBlock();
    if(block != null) {
        Distance distance = new Distance(player.getLocation(), block.getLocation());
        DynamicAC.getManager().getBackend().checkLongReachBlock(player,distance.getXDifference(),distance
                .getYDifference(),distance.getZDifference());
    }
}
 
開發者ID:Notoh,項目名稱:DynamicAC,代碼行數:19,代碼來源:PlayerListener.java

示例4: onPlayerInteract

@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
	if (e.getAction() == Action.RIGHT_CLICK_AIR && e.getItem() != null && e.getItem().getType() != null && e.getItem().getType() == getItem().getType() && e.getItem().getDurability() == getItem().getDurability() && ((e.getPlayer().getFoodLevel() < 20 && hasToBeHungry()) || (!hasToBeHungry())) ) {
		if (e.getItem().getAmount() - 1 != 0) {
			ItemStack it = e.getItem();
			it.setAmount(e.getItem().getAmount() - 1);
			e.getPlayer().getInventory().setItem(e.getPlayer().getInventory().first(e.getItem()), it);
		}
		
		else {
			e.getPlayer().getInventory().clear(e.getPlayer().getInventory().first(e.getItem()));
		}
		e.getPlayer().setFoodLevel(e.getPlayer().getFoodLevel() + getNutritionLevel() <= 20 ? e.getPlayer().getFoodLevel() + getNutritionLevel() : 20);
		e.getPlayer().setSaturation(e.getPlayer().getSaturation() + getNutritionLevel() <= 20 ? e.getPlayer().getSaturation() + getSaturationLevel() : 20);
		e.getPlayer().playSound(e.getPlayer().getLocation(), Sound.ENTITY_PLAYER_BURP, 100, 1);
		onEat(e.getPlayer());
		e.setCancelled(true);
	}
}
 
開發者ID:GigaGamma,項目名稱:SuperiorCraft,代碼行數:19,代碼來源:CustomFood.java

示例5: onPlayerInteract

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    Player player = event.getPlayer();

    if (!(Gizmos.gizmoMap.get(player) instanceof LauncherGizmo)) return;

    if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.RIGHT_CLICK_AIR) return;
    if (player.getItemInHand().getType() != this.getIcon()) return;

    Firework oldFirework = this.launchedPlayers.get(player);
    if (oldFirework == null || oldFirework.isDead()) {
        Firework firework = this.buildFirework(player.getLocation());
        firework.setPassenger(player);
        this.launchedPlayers.put(player, firework);
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:16,代碼來源:LauncherGizmo.java

示例6: onArcherJumpClick

@EventHandler(ignoreCancelled=false, priority=EventPriority.HIGH)
public void onArcherJumpClick(PlayerInteractEvent event)
{
    Action action = event.getAction();
    if (((action == Action.RIGHT_CLICK_AIR) || (action == Action.RIGHT_CLICK_BLOCK)) &&
            (event.hasItem()) && (event.getItem().getType() == Material.FEATHER))
    {
        if (this.plugin.getPvpClassManager().getEquippedClass(event.getPlayer()) != this) {
            return;
        }
        Player player = event.getPlayer();
        UUID uuid = player.getUniqueId();
        long timestamp = this.archerJumpCooldowns.get(uuid);
        long millis = System.currentTimeMillis();
        long remaining = timestamp == this.archerJumpCooldowns.getNoEntryValue() ? -1L : timestamp - millis;
        if (remaining > 0L)
        {
            player.sendMessage(ChatColor.RED + "Cannot use Jump Boost for another " + DurationFormatUtils.formatDurationWords(remaining, true, true) + ".");
        }
        else
        {
            ItemStack stack = player.getItemInHand();
            if (stack.getAmount() == 1) {
                player.setItemInHand(new ItemStack(Material.AIR, 1));
            } else {
                stack.setAmount(stack.getAmount() - 1);
            }
            player.sendMessage(ChatColor.GREEN + "Jump Boost 4 activated for 7 seconds.");

            this.plugin.getEffectRestorer().setRestoreEffect(player, ARCHER_JUMP_EFFECT);
            this.archerJumpCooldowns.put(event.getPlayer().getUniqueId(), System.currentTimeMillis() + ARCHER_JUMP_COOLDOWN_DELAY);
        }
    }
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:34,代碼來源:ArcherClass.java

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

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

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

示例10: onInteract

@EventHandler
public void onInteract(PlayerInteractEvent e){
    Player p = e.getPlayer();
    Weapon weapon;

    if (e.getItem() == null || e.getHand() != EquipmentSlot.HAND) return;

    if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK){
        if (e.getItem().getType() == Material.POTION) return;
        if (e.getItem() == null || Weapon.getWeaponByItemStack(e.getItem()) == null || !Weapon.isWeapon(e.getItem())) return;
        weapon = Weapon.getWeaponByItemStack(e.getItem());

        if (weapon != null) e.setCancelled(true);
        if (weapon == null) return;

        weapon.shoot(p);
        return;
    }

    if (e.getAction() == Action.LEFT_CLICK_AIR || e.getAction() == Action.LEFT_CLICK_BLOCK){
        if (e.getItem() == null || Weapon.getWeaponByItemStack(e.getItem()) == null || !Weapon.isWeapon(e.getItem())) return;
        weapon = Weapon.getWeaponByItemStack(e.getItem());

        if (weapon != null) e.setCancelled(true);
        if (weapon == null) return;

        if (weapon.getId() == 0) return;

        weapon.watch(p);
    }
}
 
開發者ID:cadox8,項目名稱:WC,代碼行數:31,代碼來源:Weapons.java

示例11: onPlayerInteract

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event)
{
    Player player = event.getPlayer();
    ItemStack item = player.getInventory().getItemInMainHand();

    //are they using one of our picks
    if ((event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)
        && (Xpick.isPick(item) || Pickoplenty.isPick(item) || XPickoPlenty.isPick(item))
        && item.getDurability() > 0)
    {
        if (!hideRepair.contains(player.getName()))
        {
            if (Pickoplenty.isPick(item))
            {
                player.sendMessage(Config.CHAT_POP_REPAIR + "[Pickaxe Repaired]");
            } else if (XPickoPlenty.isPick(item))
            {
                player.sendMessage(Config.CHAT_XPOP_REPAIR + "[Pickaxe Repaired]");
            } else
            {
                player.sendMessage(Config.CHAT_EXPLOSIVE_REPAIR + "[Pickaxe Repaired]");
            }
        }
        short s = 0;
        item.setDurability(s);
    }
}
 
開發者ID:ThePhilderbeast,項目名稱:prisonPicks,代碼行數:28,代碼來源:Events.java

示例12: onSpawn

@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onSpawn(PlayerInteractEvent e){
    Player p = e.getPlayer();

    if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
        if(e.getHand() != EquipmentSlot.HAND) return;
        if (e.getItem() == null || !e.getItem().hasItemMeta() || !e.getItem().getItemMeta().hasDisplayName() || e.getItem().getType() != Material.MONSTER_EGG) return;
        if (!ChatColor.stripColor(e.getItem().getItemMeta().getDisplayName()).contains("Spawn")) return;
        int id = Integer.parseInt(e.getItem().getItemMeta().getLore().get(0));
        String s = e.getItem().getItemMeta().getLore().get(1);

        boolean canCatch = true;
        ApplicableRegionSet region = plugin.getWg().getRegionManager(p.getWorld()).getApplicableRegions(p.getLocation());
        for (ProtectedRegion r : region.getRegions()) if (!r.getOwners().contains(p.getName())) canCatch = false;

        if (!canCatch) {
            p.sendMessage(SafariNet.getInstance().getPrefix() + ChatColor.RED + "No puedes spawnear un mob en parcelas ajenas");
            return;
        }

        SNMob mob = new SNMob(p);
        if (!mob.isOwner(id)) {
           p.sendMessage(SafariNet.getInstance().getPrefix() + ChatColor.RED + "No eres el dueño de este huevo");
            return;
        }
        mob.spawnMob(id, s);
        p.getInventory().getItemInMainHand().setAmount(-1);
    }
}
 
開發者ID:cadox8,項目名稱:PA,代碼行數:29,代碼來源:SpawnMob.java

示例13: onOpenInv

@EventHandler
public void onOpenInv(PlayerInteractEvent evt){
    if(evt.getAction() == Action.RIGHT_CLICK_AIR || evt.getAction() == Action.RIGHT_CLICK_BLOCK){
        if(evt.getItem() != null && evt.getItem().getType() != Material.AIR){
            if(evt.getItem().getType().equals(Material.EMERALD) && evt.getItem().getItemMeta().hasDisplayName() && evt.getItem().getItemMeta().getDisplayName().equals(itemName)){
                    openInv(evt.getPlayer());
            }
        }
    }
}
 
開發者ID:JHXSMatthew,項目名稱:CSGO_lobby,代碼行數:10,代碼來源:KitController.java

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

示例15: onRightClick

@EventHandler
public void onRightClick(PlayerInteractEvent event){
if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) {
	System.out.println("イベントだよー");
	Player player = event.getPlayer();
    String playername = player.getName();
	Location loc = player.getEyeLocation();
    System.out.println(playername + "さんのXYZだよー" + loc.getX() +"、"+ loc.getY()+"、"+ loc.getZ());
}
else {

}
}
 
開發者ID:rintech,項目名稱:Sword_Skill,代碼行數:13,代碼來源:Main.java


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