本文整理汇总了Java中org.bukkit.entity.Arrow.getShooter方法的典型用法代码示例。如果您正苦于以下问题:Java Arrow.getShooter方法的具体用法?Java Arrow.getShooter怎么用?Java Arrow.getShooter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Arrow
的用法示例。
在下文中一共展示了Arrow.getShooter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDamage
import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onDamage(EntityDamageByEntityEvent event)
{
Player player = null;
if(!(event.getDamager() instanceof Player))
{
if(event.getDamager() instanceof Arrow)
{
Arrow arrow = (Arrow) event.getDamager();
if(arrow.getShooter() instanceof Player)
{
player = (Player) arrow.getShooter();
}
}else return;
}else player = (Player) event.getDamager();
if(player != null && (userManager.get(player.getUniqueId()).isFrozen() || (!options.modeDamage && modeCoordinator.isInMode(player.getUniqueId()))))
{
event.setCancelled(true);
}
}
示例2: onDamage
import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler
public void onDamage(EntityDamageByEntityEvent event) {
if ((event.getEntity() instanceof Player)) {
if ((event.getDamager() instanceof Player)) {
playerAttacksPlayer((Player) event.getEntity(),
(Player) event.getDamager());
return;
}
if ((event.getDamager() instanceof Arrow)) {
Arrow a = (Arrow) event.getDamager();
if ((a.getShooter() instanceof Player)) {
playerAttacksPlayer((Player) event.getEntity(),
(Player) a.getShooter());
return;
}
}
this.n = null;
}
}
示例3: onPlayerShoot
import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerShoot(EntityDamageByEntityEvent evt) {
Player damager = null;
if (evt.getDamager() instanceof Arrow) {
Arrow arrow = (Arrow)evt.getDamager();
if (arrow.getShooter() instanceof Player) {
damager = (Player)arrow.getShooter();
}
} else if (evt.getDamager() instanceof Player) {
damager = (Player)evt.getDamager();
}
if (damager != null && perkService.playerHasPerk(damager, ArcherTree.FindWeaknessId)) {
if (evt.getEntity() instanceof LivingEntity) {
LivingEntity le = (LivingEntity)evt.getEntity();
le.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 5*20, 1));
}
}
}
示例4: onShoot
import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled=1, priority=EventPriority.MONITOR)
public void onShoot(ProjectileLaunchEvent e) {
Player player;
Arrow arrow;
if (e.getEntity() instanceof Arrow && (arrow = (Arrow)e.getEntity()).getShooter() != null && arrow.getShooter() instanceof Player && this.bowPull.containsKey((player = (Player)arrow.getShooter()).getUniqueId())) {
Long time = System.currentTimeMillis() - this.bowPull.get(player.getUniqueId());
double power = arrow.getVelocity().length();
Long timeLimit = 300;
int ping = this.getJanitor().lag.getPing(player);
if (ping > 400) {
timeLimit = 150;
}
if (power > 2.5 && time < timeLimit) {
this.getJanitor().logCheat(this, player, null, new String[0]);
}
}
}
示例5: onDefense
import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@Override
public void onDefense(EntityDamageByEntityEvent event) {
double damage = event.getDamage();
damage -= this.defense;
if (damage < 0.5) {
damage = 0.0;
Player player = null;
if (event.getDamager() instanceof Arrow) {
Arrow arrow = (Arrow)event.getDamager();
if (arrow.getShooter() instanceof Player) {
player = (Player)arrow.getShooter();
}
} else if (event.getDamager() instanceof Player){
player = (Player)event.getDamager();
}
if (player != null) {
CivMessage.send(player, CivColor.LightGray+"Our attack was ineffective");
}
}
event.setDamage(damage);
}
示例6: handleFriendlyFire
import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void handleFriendlyFire(EntityDamageByEntityEvent event) {
if(event.isCancelled() && event.getDamager() instanceof Arrow) {
Arrow arrow = (Arrow) event.getDamager();
if(arrow.getPickupRule() == Arrow.PickupRule.ALLOWED && arrow.getShooter() != null && arrow.getShooter() instanceof Player){
Player owner = (Player) arrow.getShooter();
owner.getInventory().addItem(new ItemStack(Material.ARROW));
arrow.remove();
}
}
}
示例7: onProjectileHit
import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void onProjectileHit(ProjectileHitEvent event) {
Entity entity = event.getEntity();
if (entity instanceof Arrow) {
Arrow arrow = (Arrow) entity;
if (!(arrow.getShooter() instanceof Player) || ((CraftArrow) arrow).getHandle().fromPlayer == 2) {
arrow.remove();
}
}
}
示例8: arrowFireEvent
import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler
public void arrowFireEvent(ProjectileLaunchEvent event){
if(event.getEntity() instanceof Arrow){
Arrow arrow = (Arrow) event.getEntity();
if(arrow.getShooter() instanceof Player){
Player player = (Player) arrow.getShooter();
ItemStack item = player.getInventory().getItemInMainHand();
if(new ItemType(item).getType().equals(ItemTypes.BOW)){
Bow detailItem = new Bow(item);
if(detailItem.getEnchantsAndLevel() != null){
HashMap<Enchantments, Integer> enchantments = detailItem.getEnchantsAndLevel();
if(enchantments.containsKey(Enchantments.VOLLEY)){
for(int i = 0; i < 10; i++){
Arrow newArrow = player.getWorld().spawnArrow(
player.getLocation().add(player.getLocation().getDirection()).add(0, 2, 0),
player.getLocation().getDirection().normalize().multiply(2),
(float) 2,
12);
if(arrow.isCritical()){
newArrow.setCritical(true);
}
}
}
return;
}
}
}
}
}
示例9: onPlayerShoot
import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerShoot(EntityDamageByEntityEvent evt) {
Player damager = null;
if (evt.getDamager() instanceof Arrow) {
Arrow arrow = (Arrow)evt.getDamager();
if (arrow.getShooter() instanceof Player) {
damager = (Player)arrow.getShooter();
}
}
if (damager != null) {// && perkService.playerHasPerk((Player)damager, ArcherTree.LeatherExpertId)) {
PlayerInventory inventory = damager.getInventory();
ItemStack[] armorContents = inventory.getArmorContents();
double damageBoost = 1;
for(ItemStack armor : armorContents) {
if (armor.getType().equals(Material.LEATHER_BOOTS)) {
damageBoost += 0.10;
} else if (armor.getType().equals(Material.LEATHER_CHESTPLATE)) {
damageBoost += 0.10;
} else if (armor.getType().equals(Material.LEATHER_HELMET)) {
damageBoost += 0.10;
} else if (armor.getType().equals(Material.LEATHER_LEGGINGS)) {
damageBoost += 0.10;
}
}
if (damageBoost == 0.4) {
damageBoost = 0.5;
}
int baseDamage = evt.getDamage();
int finalDamage = (int) (baseDamage * damageBoost);
evt.setDamage(finalDamage);
}
}
示例10: onPlayerShoot
import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerShoot(EntityDamageByEntityEvent evt) {
if (evt.getDamager() instanceof Arrow) {
Arrow arrow = (Arrow)evt.getDamager();
if (arrow.getShooter() instanceof Player && perkService.playerHasPerk((Player)arrow.getShooter(), ArcherTree.PoisonedArrowId)) {
if (evt.getEntity() instanceof LivingEntity) {
LivingEntity le = (LivingEntity)evt.getEntity();
le.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 5*20, 1));
}
}
}
}
示例11: onProjectileThrownEvent
import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler
public void onProjectileThrownEvent(ProjectileLaunchEvent e) {
if((e.getEntity() instanceof Snowball)){
Snowball snowball = (Snowball) e.getEntity();
if(!(snowball.getShooter() instanceof Player)) return;
snowballs.get(snowball.getShooter()).addSnowball(snowball);
}
else if (e.getEntity() instanceof Arrow) {
Arrow a = (Arrow) e.getEntity();
if(!(a.getShooter() instanceof Player)) return;
arrows.add(a);
}
return;
}
示例12: onEntityInteract
import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler
public void onEntityInteract(EntityInteractEvent event){
if(event.getBlock().getType() == Material.WOOD_BUTTON){
if(event.getEntity() instanceof Arrow){
Arrow a = (Arrow) event.getEntity();
if(a.getShooter() instanceof Player){
Player p = (Player) a.getShooter();
if(!canBuild(p, event.getBlock())){
event.setCancelled(true);
}
}
}
}
}
示例13: onArrowHit
import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler
public void onArrowHit(EntityDamageByEntityEvent event){
if(event.getDamager() instanceof Arrow){
Arrow a = (Arrow) event.getDamager();
if(a.getShooter() instanceof Skeleton && event.getEntity() instanceof Skeleton){
Skeleton s1 = (Skeleton) a.getShooter();
Skeleton s2 = (Skeleton) event.getEntity();
if(DroneShocktroop.isPossiblyShocktroop(s1) && DroneShocktroop.isPossiblyShocktroop(s2)){
event.setCancelled(true);
}
}
}
}
示例14: onEntityDamageByEntity
import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler
public void onEntityDamageByEntity(EntityDamageByEntityEvent e) { // Triggered whenever an entity damages another entity
if(!(e.getEntity() instanceof Player)) {
// Victim is not a player
return;
}
// Cast victim
Player victim = (Player) e.getEntity();
// Create an empty player object to store attacker
Player attacker = null;
if(e.getDamager() instanceof Player) {
// Attacker is a player (melee damage)
attacker = (Player) e.getDamager();
} else if(e.getDamager() instanceof Arrow) {
// Attacker is an arrow (projectile damage)
Arrow arrow = (Arrow) e.getDamager();
if(!(arrow.getShooter() instanceof Player)) {
// Arrow was not fired by a player
return;
}
// Cast attacker
attacker = (Player) arrow.getShooter();
}
// Check the teams
if(sameTeam(victim, attacker)) {
e.setCancelled(true);
}
}
示例15: antiArrowSpam
import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void antiArrowSpam(ProjectileHitEvent event) {
// Destroys the Arrows of the Minigun
if (event.getEntityType().equals(EntityType.ARROW)) {
Arrow arrow = (Arrow) event.getEntity();
ProjectileSource shooter = arrow.getShooter();
if (shooter instanceof Player)
if (arrow.hasMetadata("ce.minigunarrow"))
if (((Player) shooter).getGameMode().equals(GameMode.CREATIVE))
arrow.remove();
}
}