@EventHandler public void fall(EntityDamageEvent e) { if (e.getEntity() instanceof Player) { Player p = (Player) e.getEntity(); if (Util.getKit(p) instanceof Poseidon) { if (e.getCause() == DamageCause.FALL) e.setCancelled(true); } } }
/*private void WaterSprite(Player p) { // TODO Auto-generated method stub p.setVelocity(new Vector(p.getLocation().getDirection().multiply(2.7) .getX(), p.getLocation().getDirection().multiply(1.5).getY() + .7, p .getLocation().getDirection().multiply(2.7).getZ())); p.playSound(p.getLocation(), Sound.ZOMBIE_REMEDY, 1F, 1F); p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 20*5, 0)); p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 20*5, 1)); p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 20*5, 0)); p.sendMessage(ChatColor.BLUE + "Poseidon pounce!"); }*/ @EventHandler public void move(PlayerMoveEvent e) { if (Util.getKit(e.getPlayer()) instanceof Poseidon) { if (e.getPlayer().getAllowFlight() == true) { final Player p = e.getPlayer(); final Block b = p.getLocation().getBlock(); if (b.getType() == Material.AIR) { b.setType(Material.STATIONARY_WATER, false); ParticleEffect effect = new ParticleEffect(ParticleEffect.ParticleType.WATER_BUBBLE, 0.02, 10, .5); ParticleEffect effect2 = new ParticleEffect(ParticleEffect.ParticleType.WATER_DROP, 0.02, 10, .5); ParticleEffect effect3 = new ParticleEffect(ParticleEffect.ParticleType.DRIP_WATER, 0.02, 10, .5); ParticleEffect effect4 = new ParticleEffect(ParticleEffect.ParticleType.WATER_WAKE, 0.02, 10, .5); effect.sendToLocation(p.getLocation()); effect2.sendToLocation(p.getLocation()); effect3.sendToLocation(p.getLocation()); effect4.sendToLocation(p.getLocation()); BukkitScheduler scheduler = Bukkit.getScheduler(); scheduler.scheduleSyncDelayedTask( plugin, new Runnable() { public void run() { // TODO Auto-generated method stub if (b.getType() == Material.STATIONARY_WATER) { b.setType(Material.AIR, false); } } }, 20L * 2); } } } }
@EventHandler public void crouch(PlayerToggleSneakEvent e) { if (e.isSneaking()) { final Player p = e.getPlayer(); if (Util.getKit(p) instanceof Poseidon) { if (p.getLevel() >= 1) { if (p.getLocation().getBlock().getType() == Material.WATER || p.getLocation().getBlock().getType() == Material.STATIONARY_WATER) { p.setLevel(0); Vector v = p.getLocation().getDirection(); p.setVelocity(new Vector(0, v.getY() + 4, 0)); p.setAllowFlight(true); p.setFlying(true); p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 20 * 5, 0)); p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 20 * 5, 1)); p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 20 * 5, 0)); p.playSound(p.getLocation(), Sound.ZOMBIE_REMEDY, 1F, 1F); p.sendMessage(ChatColor.GREEN + "Poseidon pounce!"); BukkitScheduler scheduler = Bukkit.getScheduler(); scheduler.scheduleSyncDelayedTask( plugin, new Runnable() { public void run() { // TODO Auto-generated method stub if (Util.getKit(p) instanceof Poseidon) { p.setFlying(false); p.setAllowFlight(false); } } }, 20 * 3L); scheduler.scheduleSyncDelayedTask( plugin, new Runnable() { public void run() { // TODO Auto-generated method stub if (Util.getKit(p) instanceof Poseidon) { p.setLevel(1); } } }, 20 * 10); /*p.setLevel(0); WaterSprite(p); BukkitScheduler scheduler = Bukkit.getScheduler(); scheduler.scheduleSyncDelayedTask(plugin, new Runnable() { public void run() { // TODO Auto-generated method stub if(Util.getKit(p) instanceof Poseidon) { p.setLevel(1); } } }, 20* 7);*/ } } else { p.sendMessage(ChatColor.GRAY + "Poseidon pounce is recharging please wait 10 seconds."); } } } }