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


Java Action.PHYSICAL屬性代碼示例

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


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

示例1: playerInteract

@EventHandler
public void playerInteract(final PlayerInteractEvent event) {
    if(event.getAction() == Action.PHYSICAL
            || !(Gizmos.gizmoMap.get(event.getPlayer()) instanceof GunGizmo)
            || event.getItem() == null || event.getItem().getType() != this.getIcon()) return;

    final Player player = event.getPlayer();
    RaindropUtil.giveRaindrops(Users.playerId(player), -1, new RaindropResult() {
        @Override
        public void run() {
            if(success) {
                Vector velocity = player.getLocation().getDirection().multiply(1.75D);

                Item item = player.getWorld().dropItem(event.getPlayer().getEyeLocation(), new ItemStack(Material.GHAST_TEAR));
                item.setVelocity(velocity);
                item.setTicksLived((5 * 60 * 20) - (5 * 20)); // 5 minutes - 5 seconds
                items.put(item, player.getUniqueId());
            } else {
                player.sendMessage(ChatColor.RED + LobbyTranslations.get().t("gizmo.gun.empty", player));
                player.playSound(player.getLocation(), Sound.UI_BUTTON_CLICK, 1f, 1f);
            }
        }
    }, null, false, true, false);
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:24,代碼來源:GunGizmo.java

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

示例3: onClick

@SuppressWarnings("deprecation")
@EventHandler
public void onClick(PlayerInteractEvent e) {
	if (e.getAction() == Action.PHYSICAL)
		return;
	if (e.getPlayer().getItemInHand() == null)
		return;
	if (!e.getPlayer().getItemInHand().getType().equals(Material.COMPASS))
		return;
	if (!e.getPlayer().getItemInHand().hasItemMeta())
		return;
	if (!e.getPlayer().getItemInHand().getItemMeta().getDisplayName()
			.equalsIgnoreCase(ChatColor.RED + "Selecteer jouw kingdom"))
		return;
	setKindomMenu(PlayerModule.getInstance().getPlayer(e.getPlayer()));
	e.setCancelled(true);
}
 
開發者ID:ThEWiZ76,項目名稱:KingdomFactions,代碼行數:17,代碼來源:KingdomMenu.java

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

示例5: onPlayerInteract

@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
    try {
        if (e.getHand() != EquipmentSlot.HAND)
            return;
    } catch (Error ignored) {
    }
    if (e.getAction() != Action.PHYSICAL)
        onClick(e); // this method cancels the event by himself
}
 
開發者ID:upperlevel,項目名稱:uppercore,代碼行數:10,代碼來源:HotbarManager.java

示例6: onPlayerInteractCrops

@EventHandler
public void onPlayerInteractCrops(PlayerInteractEvent event) {
    if (event.getAction() == Action.PHYSICAL) {
        Block b = event.getClickedBlock();
        if (b.getType() == Material.SOIL) {
            event.setCancelled(true);
            b.setTypeIdAndData(b.getType().getId(), b.getData(), true);
        }
        if (b.getType() == Material.CROPS) {
            event.setCancelled(true);
            b.setTypeIdAndData(b.getType().getId(), b.getData(), true);
        }
    }
}
 
開發者ID:edasaki,項目名稱:ZentrelaRPG,代碼行數:14,代碼來源:EnvironmentManager.java

示例7: PlayerFarmChecker

@EventHandler
public void PlayerFarmChecker(PlayerInteractEvent event){
    if(ConfigFunction.ProtectFarmenable){
        if(event.getAction() == Action.PHYSICAL){
            Block block = event.getClickedBlock();
            if(block.getType() == Material.SOIL||block.getType() == Material.CROPS){
                event.setCancelled(true);
            }
        }
    }
}
 
開發者ID:GelandiAssociation,項目名稱:EscapeLag,代碼行數:11,代碼來源:FarmProtecter.java

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

示例9: onInteract

@TargetedEventHandler(ignoreCancelled = true)
public void onInteract(PlayerInteractEvent event) {
    if(!restrictAccess()) return;
    if(event.getAction() == Action.RIGHT_CLICK_BLOCK) {
        switch(event.getClickedBlock().getType()) {
            case STONE_BUTTON:
            case WOOD_BUTTON:
            case LEVER:
            case DIODE_BLOCK_OFF:
            case DIODE_BLOCK_ON:
            case REDSTONE_COMPARATOR_OFF:
            case REDSTONE_COMPARATOR_ON:
                event.setCancelled(true);
                sendWarning();
                break;
            case TNT:
                if(event.getItem() != null && event.getItem().getType() == FLINT_AND_STEEL) {
                    event.setCancelled(true);
                    sendWarning();
                }
                break;
        }
    } else if(event.getAction() == Action.PHYSICAL) {
        switch(event.getClickedBlock().getType()) {
            case STONE_PLATE:
            case WOOD_PLATE:
            case GOLD_PLATE:
            case IRON_PLATE:
            case TRIPWIRE:
                event.setCancelled(true);
                break;
        }
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:34,代碼來源:LicenseAccessPlayerFacet.java

示例10: onBlockTrample

@EventWrapper
public void onBlockTrample(final PlayerInteractEvent event) {
    if(event.getAction() == Action.PHYSICAL) {
        Block block = event.getClickedBlock();
        if(block != null) {
            Material oldType = getTrampledType(block.getType());
            if(oldType != null) {
                callEvent(event, BlockStateUtils.cloneWithMaterial(block, oldType), block.getState(), event.getPlayer());
            }
        }
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:12,代碼來源:BlockTransformListener.java

示例11: openMenu

@EventHandler(priority = EventPriority.HIGHEST)
public void openMenu(final PlayerInteractEvent event) {
    if(event.getAction() == Action.PHYSICAL) return;

    Player player = event.getPlayer();
    if(player.getItemInHand().getType() == Material.GHAST_TEAR) {
        GizmoUtils.openMenu(event.getPlayer());
        purchasingMap.put(event.getPlayer(), null);
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:10,代碼來源:Gizmos.java

示例12: soilChangePlayer

@EventHandler
public void soilChangePlayer(PlayerInteractEvent e) {
      if(e.getClickedBlock() == null) return;
	if ((e.getAction() == Action.PHYSICAL) && (e.getClickedBlock().getType() == Material.SOIL)) {
		KingdomFactionsPlayer p = PlayerModule.getInstance().getPlayer(e.getPlayer());
		if(p.isVanished()) return;
		if(e.isCancelled()) return;
		if(!p.canBuild(e.getClickedBlock().getLocation())) {
			e.setCancelled(!ProtectionModule.getInstance().tryInfluence(p, 50));
		} 

	}
	}
 
開發者ID:ThEWiZ76,項目名稱:KingdomFactions,代碼行數:13,代碼來源:BuildEventListener.java

示例13: onPlayerInteract

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event)
{
    if (!this.isParkouring(event.getPlayer().getUniqueId()))
        return;

    event.setCancelled(true);

    if (event.getAction() == Action.PHYSICAL && event.getClickedBlock().getType() == Material.IRON_PLATE && event.getClickedBlock().getLocation().equals(this.minusFloor))
    {
        event.getPlayer().teleport(this.fail);
        event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.BLOCK_PISTON_CONTRACT, 1.0F, 1.0F);
    }
}
 
開發者ID:SamaGames,項目名稱:Hub,代碼行數:14,代碼來源:DeveloperRoomParkour.java

示例14: onPlayerInteract

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
	Gamer g = Gamer.get(event.getPlayer());
	
	if (event.getAction() != Action.PHYSICAL)
		return;
	
	Block b = event.getClickedBlock();
	if (!b.hasMetadata("Mine"))
		return;
	
	Mine mine = Mine.getList().get(b.getMetadata("Mine").get(0).asInt());
	
	Team playerTeam = Nexus.getRotary().getCurrentMap().getTeam(g);
	Team targetTeam = Nexus.getRotary().getCurrentMap().getTeam(mine.getGamer());
	
	if (playerTeam == targetTeam)
		return;
	
	mine.setIgnited(true);
	
	TNTPrimed e = (TNTPrimed) event.getPlayer().getWorld().spawnEntity(event.getPlayer().getEyeLocation(), EntityType.PRIMED_TNT);
	e.setFuseTicks(10);
	e.setYield(2.7F);
	e.setMetadata("Player", new FixedMetadataValue(Nexus.getPlugin(), mine.getGamer().getName()));
	e.setMetadata("Cause", new FixedMetadataValue(Nexus.getPlugin(), CustomDamageCause.TNT_MINE.name()));
	event.getClickedBlock().setType(Material.AIR);
}
 
開發者ID:thekeenant,項目名稱:mczone,代碼行數:28,代碼來源:KitEvents.java

示例15: onJump

@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onJump(PlayerInteractEvent e) {
	if (!cm.farmProtectEnabled) {
		return;
	}

	// 防止農作物被踩踏
	if (e.getAction() == Action.PHYSICAL) {
		if (e.getClickedBlock().getType() == Material.SOIL) {
			e.setCancelled(true);
		}
	}
}
 
開發者ID:jiongjionger,項目名稱:NeverLag,代碼行數:13,代碼來源:FarmProtecter.java


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