當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。