public static void attemptFirst(Player p) { if (cooldown1.containsKey(p.getName())) { p.sendMessage( ChatColor.RED + "Cooldown: " + ChatColor.YELLOW + cooldown1.get(p.getName()) + ChatColor.RED + "."); return; } cooldown1.put(p.getName(), 5.0); ParticleEffect.EXPLOSION_LARGE.display(0.5f, 2f, 0.5f, 0.1f, 10, p.getLocation(), 100); ParticleEffect.LAVA.display(0.2f, 0.5f, 0.3f, 0.1f, 10, p.getLocation(), 100); Game.playSound(Sound.EXPLODE, p.getLocation(), 1f, 0.2f); p.setVelocity(p.getLocation().getDirection().multiply(0.9).setY(1.1)); }
public static void checkThird() { for (Player p : Bukkit.getOnlinePlayers()) { if (Game.playerInGame(p) && ultimate.contains(p.getName())) { if (p.getLocation().clone().subtract(0, 1, 0).getBlock().getType() != Material.AIR) { int radius = 4; int bX = p.getLocation().getBlockX(); int bY = p.getLocation().getBlockY(); int bZ = p.getLocation().getBlockZ(); for (int x = bX - radius; x <= bX + radius; x++) { for (int y = bY - radius; y <= bY + radius; y++) { for (int z = bZ - radius; z <= bZ + radius; z++) { double distance = ((bX - x) * (bX - x) + ((bZ - z) * (bZ - z)) + ((bY - y) * (bY - y))); if (distance < radius * radius && !(distance < ((radius - 1) * (radius - 1)))) { Location loc = new Location(p.getWorld(), x, y, z); if (Game.isBreakable(loc.getBlock().getType())) { ParticleEffect.EXPLOSION_LARGE.display( 0.1f, 0.1f, 0.1f, 0.1f, 3, loc.clone().add(0, 0.2, 0), 100); } } } } } for (Entity e : p.getNearbyEntities(3, 2, 3)) { if (e instanceof Player) { Location midPoint = p.getLocation(); Vector direction = e.getLocation().toVector().subtract(midPoint.toVector()).normalize(); direction.multiply(0.5).setY(0.3); e.setVelocity(direction); ((Player) e).damage(0.0); } } } } } }