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