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


Java Projectile.getWorld方法代碼示例

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


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

示例1: onProjectileHit

import org.bukkit.entity.Projectile; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.NORMAL)
public void onProjectileHit(ProjectileHitEvent event) {
    Projectile projectile = event.getEntity();
    World world = projectile.getWorld();
    PluginConfig worldConfig = plugin.getConfig(world);

    if (plugin.isActive(world) && plugin.isFeatureEnabled(world, Feature.FIRE_ARROWS) && worldConfig.getBoolean(Config.FEATURE_FIRE_ARROWS_IGNITE_TARGET)) {
        LivingEntity shooter = (LivingEntity) projectile.getShooter();
        if (shooter.getType() == EntityType.SKELETON) { //Not sure why this is here, or why fire arrows even work with it here
            return;
        }

        if (((CraftEntity) shooter).getHandle() instanceof EntitySkeleton && projectile.getFireTicks() > 0) {
            //if (shooter != null && ((CraftEntity)shooter).getHandle() instanceof EntitySkeleton && projectile.getFireTicks() > 0){
            Block block = projectile.getWorld().getBlockAt(projectile.getLocation());

            if (block.getType() == Material.AIR) {
                block.setType(Material.FIRE);
            }
        }
    }
}
 
開發者ID:Samistine,項目名稱:BloodMoon,代碼行數:23,代碼來源:FireArrowsListener.java

示例2: onProjectileHitEvent

import org.bukkit.entity.Projectile; //導入方法依賴的package包/類
@EventHandler
public void onProjectileHitEvent(ProjectileHitEvent event) {
    final Projectile projectile = event.getEntity();
    final ProjectileDefinition projectileDefinition = Projectiles.getProjectileDefinition(projectile);
    if(projectileDefinition == null) return;

    final Filter filter = projectileDefinition.destroyFilter();
    if(filter == null) return;

    final BlockIterator blockIterator = new BlockIterator(projectile.getWorld(), projectile.getLocation().toVector(), projectile.getVelocity().normalize(), 0d, 2);
    Block hitBlock = null;
    while(blockIterator.hasNext()) {
        hitBlock = blockIterator.next();
        if(hitBlock.getType() != Material.AIR) break;
    }

    if(hitBlock != null) {
        final MatchPlayer shooter = projectile.getShooter() instanceof Player ? getMatch().getPlayer((Player) projectile.getShooter()) : null;
        final IQuery query = shooter != null ? new PlayerBlockEventQuery(shooter, event, hitBlock.getState())
                                             : new BlockEventQuery(event, hitBlock);

        if(filter.query(query).isAllowed()) {
            final BlockTransformEvent bte = new BlockTransformEvent(event, hitBlock, Material.AIR);
            match.callEvent(bte);

            if(!bte.isCancelled()) {
                hitBlock.setType(Material.AIR);
                projectile.remove();
            }
        }
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:33,代碼來源:ProjectileMatchModule.java

示例3: doEffect

import org.bukkit.entity.Projectile; //導入方法依賴的package包/類
private void doEffect(Projectile projectile, String effect) {
	World world = projectile.getWorld();
	Location location = projectile.getLocation();
	if (effect.equalsIgnoreCase("normal")) {
       } else if (effect.equalsIgnoreCase("flame")) {
           SkyWarsReloaded.getNMS().sendParticles(world, "FLAME", (float) location.getX(), (float) location.getY(), (float) location.getZ(), 0, 0, 0, 0, 2);
       }  else if (effect.equalsIgnoreCase("smoke")) {
           SkyWarsReloaded.getNMS().sendParticles(world, "SMOKE_LARGE", (float) location.getX(), (float) location.getY(), (float) location.getZ(), 0, 0, 0, 0, 2);
       } else if (effect.equalsIgnoreCase("portal")) {
           SkyWarsReloaded.getNMS().sendParticles(world, "PORTAL", (float) location.getX(), (float) location.getY(), (float) location.getZ(), 0, 0, 0, 0, 2);
       } else if (effect.equalsIgnoreCase("heart")) {
           SkyWarsReloaded.getNMS().sendParticles(world, "HEART", (float) location.getX(), (float) location.getY(), (float) location.getZ(), 0, 0, 0, 0, 2);
       } else if (effect.equalsIgnoreCase("critical")) {
           SkyWarsReloaded.getNMS().sendParticles(world, "CRIT", (float) location.getX(), (float) location.getY(), (float) location.getZ(), 0, 0, 0, 0, 2);
       }  else if (effect.equalsIgnoreCase("water")) {
           SkyWarsReloaded.getNMS().sendParticles(world, "WATER_SPLASH", (float) location.getX(), (float) location.getY(), (float) location.getZ(), 0, 0, 0, 0, 2);
       } else if (effect.equalsIgnoreCase("redstone")) {
           SkyWarsReloaded.getNMS().sendParticles(world, "REDSTONE", (float) location.getX(), (float) location.getY(), (float) location.getZ(), 0, 0, 0, 0, 2);
       } else if (effect.equalsIgnoreCase("sparks")) {
           SkyWarsReloaded.getNMS().sendParticles(world, "FIREWORKS_SPARK", (float) location.getX(), (float) location.getY(), (float) location.getZ(), 0, 0, 0, 0, 2);
       } else if (effect.equalsIgnoreCase("lava_drip")) {
           SkyWarsReloaded.getNMS().sendParticles(world, "DRIP_LAVA", (float) location.getX(), (float) location.getY(), (float) location.getZ(), 0, 0, 0, 0, 2);
       } else if (effect.equalsIgnoreCase("lava")) {
           SkyWarsReloaded.getNMS().sendParticles(world, "LAVA", (float) location.getX(), (float) location.getY(), (float) location.getZ(), 0, 0, 0, 0, 2);
       }  else if (effect.equalsIgnoreCase("alphabet")) {
           SkyWarsReloaded.getNMS().sendParticles(world, "ENCHANTMENT_TABLE", (float) location.getX(), (float) location.getY(), (float) location.getZ(), 0, 0, 0, 0, 2);
       } else if (effect.equalsIgnoreCase("happy")) {
           SkyWarsReloaded.getNMS().sendParticles(world, "VILLAGER_HAPPY", (float) location.getX(), (float) location.getY(), (float) location.getZ(), 0, 0, 0, 0, 2);
       } else if (effect.equalsIgnoreCase("magic")) {
           SkyWarsReloaded.getNMS().sendParticles(world, "SPELL_WITCH", (float) location.getX(), (float) location.getY(), (float) location.getZ(), 0, 0, 0, 0, 2);
      	} else if (effect.equalsIgnoreCase("music")) {
           SkyWarsReloaded.getNMS().sendParticles(world, "NOTE", (float) location.getX(), (float) location.getY(), (float) location.getZ(), 0, 0, 0, 0, 2);
      	} else if (effect.equalsIgnoreCase("angry")) {
           SkyWarsReloaded.getNMS().sendParticles(world, "VILLAGER_ANGRY", (float) location.getX(), (float) location.getY(), (float) location.getZ(), 0, 0, 0, 0, 2);
      	} else if (effect.equalsIgnoreCase("clouds")) {
           SkyWarsReloaded.getNMS().sendParticles(world, "CLOUD", (float) location.getX(), (float) location.getY(), (float) location.getZ(), 0, 0, 0, 0, 2);
      	} else if (effect.equalsIgnoreCase("potion")) {
           SkyWarsReloaded.getNMS().sendParticles(world, "SPELL", (float) location.getX(), (float) location.getY(), (float) location.getZ(), 0, 0, 0, 0, 2);
       } else if (effect.equalsIgnoreCase("poison")) {
           SkyWarsReloaded.getNMS().sendParticles(world, "SPELL_INSTANT", (float) location.getX(), (float) location.getY(), (float) location.getZ(), 0, 0, 0, 0, 2);
       } else if (effect.equalsIgnoreCase("snow")) {
           SkyWarsReloaded.getNMS().sendParticles(world, "SNOWBALL", (float) location.getX(), (float) location.getY(), (float) location.getZ(), 0, 0, 0, 0, 2);
       } else if (effect.equalsIgnoreCase("slime")) {
           SkyWarsReloaded.getNMS().sendParticles(world, "SLIME", (float) location.getX(), (float) location.getY(), (float) location.getZ(), 0, 0, 0, 0, 2);
       }
}
 
開發者ID:smessie,項目名稱:SkyWarsReloaded,代碼行數:47,代碼來源:ProjectileController.java


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