当前位置: 首页>>代码示例>>Java>>正文


Java Player.launchProjectile方法代码示例

本文整理汇总了Java中org.bukkit.entity.Player.launchProjectile方法的典型用法代码示例。如果您正苦于以下问题:Java Player.launchProjectile方法的具体用法?Java Player.launchProjectile怎么用?Java Player.launchProjectile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.entity.Player的用法示例。


在下文中一共展示了Player.launchProjectile方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: cast

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public boolean cast(Player p, PlayerDataRPG pd, int level) {
    SmallFireball fireball = (SmallFireball) p.launchProjectile(SmallFireball.class);
    fireball.setIsIncendiary(false);
    fireball.setShooter(p);
    int damage = pd.getDamage(true);
    damage *= functions[0].applyAsDouble(level) / 100.0;
    fireball.setMetadata(RMetadata.META_DAMAGE, new FixedMetadataValue(Spell.plugin, damage));
    Spell.notify(p, "You shoot off a fireball.");
    return true;
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:12,代码来源:Fireball.java

示例2: launch

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void launch(Player player) {
	this.entity = player.launchProjectile(this.projectileClass);
	if (entity instanceof Arrow)
		((Arrow)entity).setPickupStatus(PickupStatus.DISALLOWED);
	super.launch(player);
}
 
开发者ID:mcardy,项目名称:MystiCraft,代码行数:8,代码来源:TargetedProjectile.java

示例3: on

import org.bukkit.entity.Player; //导入方法依赖的package包/类
private void on(Player player, Spell.MouseClick click){
    if(!validate(player)) return;
    ItemStack handItem = player.getInventory().getItemInMainHand();
    RPGClass rpgClass = playerManager.getPlayerClass(player);
    if(handItem != null && handItem.getType() == rpgClass.getWeaponMaterial()) {
        List<Spell.MouseClick> clicks = casts.get(player, k -> new LinkedList<>());
        casts.put(player, clicks);

        int size = clicks.size();
        if(size == 0 && rpgClass.getSpellStartClick() != click){
            if (rpgClass.getProjectile() != null) {
                player.launchProjectile(rpgClass.getProjectile());
            }
        } else if(size == 0 && rpgClass.getSpellStartClick() == click){
            clicks.add(rpgClass.getSpellStartClick());
            casts.put(player, clicks);
            title.sendTitle(player, 0, 20, 20, "", formatSpells(clicks));
        } else if(size < 2 && size > 0){
            clicks.add(click);
            casts.put(player, clicks);
            title.sendTitle(player, 0, 20, 20, "", formatSpells(clicks));
        } else if(size == 2){
            /* Should cast a spell */
            clicks.add(click);
            title.sendTitle(player, 0, 10, 10, "", formatSpells(clicks));
            Spell spell = itemFactory.getSpell(clicks);
            if (spell != null) {
                log.debug("Player {} is casting spell {}", player.getName(), spell);
                spell.cast(player);
            } else {
                log.warn("Player casted unknown spell! {}", clicks);
            }
            clicks.clear();
        }
    }
}
 
开发者ID:mikroskeem,项目名称:MiniWynn,代码行数:37,代码来源:SpellListener.java

示例4: launch

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void launch(Player p, Vector vector) {
    Fireball fb = p.launchProjectile(Fireball.class);
    if (vector == null) {
        fb.setVelocity(p.getEyeLocation().getDirection().multiply(2));
    } else {
        fb.setVelocity(vector.multiply(2));
    }
    fb.setMetadata("skill_type", new FixedMetadataValue(Main.getInstance(), getName()));
    CooldownManager.getInstance().add(p);
}
 
开发者ID:Soldier233,项目名称:ArchersBattle,代码行数:12,代码来源:FireBall.java

示例5: launchList

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void launchList(Player p, List<Vector> vectors) {
    p.sendMessage(String.valueOf(vectors.size()));
    for(Vector v:vectors){
        Fireball fb = p.launchProjectile(Fireball.class);
        fb.setDirection(v.multiply(2));
        fb.setMetadata("skill_type", new FixedMetadataValue(Main.getInstance(), getName()));
    }

    CooldownManager.getInstance().add(p);
}
 
开发者ID:Soldier233,项目名称:ArchersBattle,代码行数:12,代码来源:FireBall.java

示例6: launch

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void launch(Player p, Vector vector) {
    Arrow arrow = p.launchProjectile(Arrow.class);
    if (vector == null) {
        arrow.setVelocity(p.getEyeLocation().getDirection().multiply(2));
    } else {
        arrow.setVelocity(vector);
    }
    arrow.setShooter(p);
    arrow.setMetadata("skill_type", new FixedMetadataValue(Main.getInstance(), getName()));
    CooldownManager.getInstance().add(p);
}
 
开发者ID:Soldier233,项目名称:ArchersBattle,代码行数:13,代码来源:Archer.java

示例7: shootArrow

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public Projectile shootArrow() {
    //attempted fix for arrows crashing
    Player p = getPlayer();
    return p.launchProjectile(Arrow.class, p.getLocation().getDirection().normalize().multiply(1.5));
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:6,代码来源:PlayerDataRPG.java


注:本文中的org.bukkit.entity.Player.launchProjectile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。