本文整理匯總了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);
}
示例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();
}
}
示例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);
}
示例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);
}
示例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
}
示例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);
}
}
}
示例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);
}
}
}
}
示例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;
}
示例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;
}
}
}
示例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());
}
}
}
}
示例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);
}
}
示例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));
}
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
}