diff --git a/.classpath b/.classpath index 6b746735..02ede052 100644 --- a/.classpath +++ b/.classpath @@ -1,13 +1,13 @@ - - + + diff --git a/Dev Builds/Korra.jar b/Dev Builds/Korra.jar index 4cf3bf21..6db41a64 100644 Binary files a/Dev Builds/Korra.jar and b/Dev Builds/Korra.jar differ diff --git a/src/com/projectkorra/ProjectKorra/Ability/AvatarState.java b/src/com/projectkorra/ProjectKorra/Ability/AvatarState.java index 1bb7f505..0bc7c316 100644 --- a/src/com/projectkorra/ProjectKorra/Ability/AvatarState.java +++ b/src/com/projectkorra/ProjectKorra/Ability/AvatarState.java @@ -5,7 +5,6 @@ import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.bukkit.Bukkit; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffect; diff --git a/src/com/projectkorra/ProjectKorra/BendingManager.java b/src/com/projectkorra/ProjectKorra/BendingManager.java index 24627fb7..ee3bf10a 100644 --- a/src/com/projectkorra/ProjectKorra/BendingManager.java +++ b/src/com/projectkorra/ProjectKorra/BendingManager.java @@ -1,7 +1,6 @@ package com.projectkorra.ProjectKorra; -import java.util.ArrayList; -import java.util.concurrent.ConcurrentHashMap; +import java.util.HashMap; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -67,9 +66,7 @@ public class BendingManager implements Runnable { long time; long interval; - ArrayList worlds = new ArrayList(); - ConcurrentHashMap nights = new ConcurrentHashMap(); - ConcurrentHashMap days = new ConcurrentHashMap(); + private final HashMap dayNight = new HashMap<>(); static final String defaultsunrisemessage = "You feel the strength of the rising sun empowering your firebending."; static final String defaultsunsetmessage = "You feel the empowering of your firebending subside as the sun sets."; @@ -143,15 +140,15 @@ public class BendingManager implements Runnable { for (Player player : EarthArmor.instances.keySet()) { EarthArmor.moveArmor(player); } - for (int ID: AirSwipe.instances.keySet()) { + for (int ID : AirSwipe.instances.keySet()) { AirSwipe.progress(ID); } - for (int ID: Tornado.instances.keySet()) { + for (int ID : Tornado.instances.keySet()) { Tornado.progress(ID); } Tremorsense.manage(Bukkit.getServer()); - for (int id: FireStream.instances.keySet()) { + for (int id : FireStream.instances.keySet()) { FireStream.progress(id); } @@ -159,29 +156,29 @@ public class BendingManager implements Runnable { EarthBlast.progress(ID); } - for (Block block: FireStream.ignitedblocks.keySet()) { + for (Block block : FireStream.ignitedblocks.keySet()) { if (block.getType() != Material.FIRE) { FireStream.ignitedblocks.remove(block); } } - for (int ID: Catapult.instances.keySet()) { + for (int ID : Catapult.instances.keySet()) { Catapult.progress(ID); } - for (int ID: EarthColumn.instances.keySet()) { + for (int ID : EarthColumn.instances.keySet()) { EarthColumn.progress(ID); } - for (int ID: CompactColumn.instances.keySet()) { + for (int ID : CompactColumn.instances.keySet()) { CompactColumn.progress(ID); } - for (int ID: WaterManipulation.instances.keySet()) { + for (int ID : WaterManipulation.instances.keySet()) { WaterManipulation.progress(ID); } - for (int ID: WaterWall.instances.keySet()) { + for (int ID : WaterWall.instances.keySet()) { WaterWall.progress(ID); } @@ -209,65 +206,104 @@ public class BendingManager implements Runnable { } public void handleDayNight() { - for (World world: plugin.getServer().getWorlds()) { - if (world.getWorldType() == WorldType.NORMAL && !worlds.contains(world)) { - worlds.add(world); - nights.put(world, false); - days.put(world, false); - } - } - ArrayList removeworlds = new ArrayList(); - for (World world: worlds) { - if (!plugin.getServer().getWorlds().contains(world)) { - removeworlds.add(world); - continue; - } - boolean night = nights.get(world); - boolean day = days.get(world); - if (Methods.isDay(world) && !day) { - for (Player player: world.getPlayers()) { - if (Methods.isBender(player.getName(), Element.Fire) && player.hasPermission("bending.message.daymessage")) { - player.sendMessage(ChatColor.RED + defaultsunrisemessage); + /** + * This code is ran on startup, it adds all loaded worlds to the + * hashmap. + */ + if (dayNight.size() < 1) { + for (World world : plugin.getServer().getWorlds()) { + if (world.getWorldType() == WorldType.NORMAL) { + String worldName = world.getName(); + if (dayNight.containsKey(worldName)) + return; + if (Methods.isDay(world)) { + dayNight.put(worldName, Time.DAY); + } else { + dayNight.put(worldName, Time.NIGHT); } } - days.replace(world, true); - } - - if (!Methods.isDay(world) && day) { - for (Player player: world.getPlayers()) { - if (Methods.isBender(player.getName(), Element.Fire) && player.hasPermission("bending.message.daymessage")) { - player.sendMessage(ChatColor.RED + defaultsunsetmessage); - } - } - days.replace(world, false); - } - - if (Methods.isNight(world) && !night) { - for (Player player: world.getPlayers()) { - if (Methods.isBender(player.getName(), Element.Water) && player.hasPermission("bending.message.nightmessage")) { - if (Methods.isFullMoon(world)) { - player.sendMessage(ChatColor.AQUA + defaultfullmoonrisemessage); - } else { - player.sendMessage(ChatColor.AQUA + defaultmoonrisemessage); - } - } - } - nights.replace(world, true); - } - - if (!Methods.isNight(world) && night) { - for (Player player: world.getPlayers()) { - if (Methods.isBender(player.getName(), Element.Water) && player.hasPermission("bending.message.nightmessage")) { - player.sendMessage(ChatColor.AQUA + defaultmoonsetmessage); - } - } - nights.replace(world, false); } } - for (World world: removeworlds) { - worlds.remove(world); + for (World world : Bukkit.getWorlds()) { + final String worldName = world.getName(); + if (!dayNight.containsKey(worldName)) + return; + Time time = dayNight.get(worldName); + if (Methods.isDay(world) && time.equals(Time.NIGHT)) { + final Time newTime = Time.DAY; + sendFirebenderMessage(world, newTime); + dayNight.remove(worldName); + dayNight.put(worldName, newTime); + } + + if (!Methods.isDay(world) && time.equals(Time.DAY)) { + final Time newTime = Time.NIGHT; + sendFirebenderMessage(world, newTime); + dayNight.remove(worldName); + dayNight.put(worldName, newTime); + } + + if (Methods.isNight(world) && time.equals(Time.DAY)) { + final Time newTime = Time.NIGHT; + sendWaterbenderMessage(world, newTime); + dayNight.remove(worldName); + dayNight.put(worldName, newTime); + } + + if (!Methods.isNight(world) && time.equals(Time.NIGHT)) { + final Time newTime = Time.DAY; + sendWaterbenderMessage(world, Time.DAY); + dayNight.remove(worldName); + dayNight.put(worldName, newTime); + } } } + + private static enum Time { + DAY, NIGHT; + } + + private void sendFirebenderMessage(World world, Time time) { + if (time.equals(Time.DAY)) { + for (Player player : world.getPlayers()) { + if (Methods.isBender(player.getName(), Element.Fire) + && player.hasPermission("bending.message.daymessage")) { + player.sendMessage(ChatColor.RED + defaultsunrisemessage); + } + } + } else { + for (Player player : world.getPlayers()) { + if (Methods.isBender(player.getName(), Element.Fire) + && player.hasPermission("bending.message.daymessage")) { + player.sendMessage(ChatColor.RED + defaultsunsetmessage); + } + } + } + } + + private void sendWaterbenderMessage(World world, Time time) { + if (time.equals(Time.NIGHT)) { + for (Player player : world.getPlayers()) { + if (Methods.isBender(player.getName(), Element.Water) + && player.hasPermission("bending.message.nightmessage")) { + if (Methods.isFullMoon(world)) { + player.sendMessage(ChatColor.AQUA + + defaultfullmoonrisemessage); + } else { + player.sendMessage(ChatColor.AQUA + + defaultmoonrisemessage); + } + } + } + } else { + for (Player player : world.getPlayers()) { + if (Methods.isBender(player.getName(), Element.Water) + && player.hasPermission("bending.message.nightmessage")) { + player.sendMessage(ChatColor.AQUA + defaultmoonsetmessage); + } + } + } + } } diff --git a/src/com/projectkorra/ProjectKorra/Commands.java b/src/com/projectkorra/ProjectKorra/Commands.java index 4bf46d0d..778792b7 100644 --- a/src/com/projectkorra/ProjectKorra/Commands.java +++ b/src/com/projectkorra/ProjectKorra/Commands.java @@ -478,7 +478,7 @@ public class Commands { s.sendMessage(ChatColor.RED + "You don't have permission to do that."); return true; } - + if (isToggledForAll) { // Bending is toggled off for all players. isToggledForAll = false; for (Player player: Bukkit.getOnlinePlayers()) { @@ -521,6 +521,12 @@ public class Commands { } if (Methods.isBender(un, Element.Water)) { s.sendMessage(Methods.getWaterColor() + "- Waterbender"); + if (Methods.canPlantbend(p)) { + s.sendMessage(Methods.getWaterColor() + " Can Plantbend"); + } + if (Methods.canBloodbend(p)) { + s.sendMessage(Methods.getWaterColor() + " Can Bloodbend"); + } } if (Methods.isBender(un, Element.Earth)) { if (Methods.canMetalbend(p)) { @@ -540,9 +546,28 @@ public class Commands { s.sendMessage("Abilities: "); for (int i = 1; i <= 9; i++) { String ability = bPlayer.getAbilities().get(i); - if (ability != null) s.sendMessage(i + " - " + Methods.getAbilityColor(ability) + ability); + if (ability == null || ability.equalsIgnoreCase("null")) { + continue; + } else { + s.sendMessage(i + " - " + Methods.getAbilityColor(ability) + ability); + } } } + + if (p.getName().equalsIgnoreCase("MistPhizzle") || + p.getName().equalsIgnoreCase("runefist") + || p.getName().equalsIgnoreCase("Jacklin213") + || p.getName().equalsIgnoreCase("kingbirdy") + || p.getName().equalsIgnoreCase("cpdances") + || p.getName().equalsIgnoreCase("sampepere")) { + s.sendMessage(ChatColor.YELLOW + "ProjectKorra Developer"); + } + if (p.getName().equalsIgnoreCase("vidcom") + || p.getName().equalsIgnoreCase("Zolteex") + || p.getName().equalsIgnoreCase("zmeduna") + || p.getName().equalsIgnoreCase("ashe36")) { + s.sendMessage(ChatColor.YELLOW + "ProjectKorra Concept Designer"); + } return true; } if (args.length == 1) { diff --git a/src/com/projectkorra/ProjectKorra/ConfigManager.java b/src/com/projectkorra/ProjectKorra/ConfigManager.java index 205d7504..66aab8f7 100644 --- a/src/com/projectkorra/ProjectKorra/ConfigManager.java +++ b/src/com/projectkorra/ProjectKorra/ConfigManager.java @@ -68,6 +68,7 @@ public class ConfigManager { config.addDefault("Properties.Water.CanBendWithWeapons", true); config.addDefault("Properties.Water.NightFactor", 1.5); config.addDefault("Properties.Water.FullMoonFactor", 3.0); + config.addDefault("Properties.Water.CanBendPackedIce", true); config.addDefault("Properties.Earth.RevertEarthbending", true); config.addDefault("Properties.Earth.SafeRevert", true); diff --git a/src/com/projectkorra/ProjectKorra/Methods.java b/src/com/projectkorra/ProjectKorra/Methods.java index a626030b..f59ae918 100644 --- a/src/com/projectkorra/ProjectKorra/Methods.java +++ b/src/com/projectkorra/ProjectKorra/Methods.java @@ -113,197 +113,28 @@ public class Methods { static ProjectKorra plugin; - private static final ItemStack pickaxe = new ItemStack(Material.DIAMOND_PICKAXE); + public Methods(ProjectKorra plugin) { + Methods.plugin = plugin; + } + private static final ItemStack pickaxe = new ItemStack( + Material.DIAMOND_PICKAXE); public static ConcurrentHashMap movedearth = new ConcurrentHashMap(); public static ConcurrentHashMap tempair = new ConcurrentHashMap(); public static ArrayList tempnophysics = new ArrayList(); - private static Integer[] plantIds = { 6, 18, 31, 32, 37, 38, 39, 40, 59, 81, 83, 86, 99, 100, 103, 104, 105, 106, 111, 161, 175}; - public static Integer[] transparentToEarthbending = {0, 6, 8, 9, 10, 11, 30, 31, 32, 37, 38, 39, 40, 50, 51, 59, 78, 83, 106}; - - public static Integer[] nonOpaque = {0, 6, 8, 9, 10, 11, 27, 28, 30, 31, 32, 37, 38, 39, 40, 50, 51, 55, 59, 66, 68, 69, 70, 72, - 75, 76, 77, 78, 83, 90, 93, 94, 104, 105, 106, 111, 115, 119, 127, 131, 132}; - - /** - * Checks to see if an AbilityExists. Uses method {@link #getAbility(String)} to check if it exists. - * @param string Ability Name - * @return true if ability exists - */ - public static boolean abilityExists(String string) { - if (getAbility(string) == null) return false; - return true; - } - - public static void addTempAirBlock(Block block) { - if (movedearth.containsKey(block)) { - Information info = movedearth.get(block); - block.setType(Material.AIR); - info.setTime(System.currentTimeMillis()); - movedearth.remove(block); - tempair.put(info.getID(), info); - } else { - Information info = new Information(); - info.setBlock(block); - // info.setType(block.getType()); - // info.setData(block.getData()); - info.setState(block.getState()); - info.setTime(System.currentTimeMillis()); - block.setType(Material.AIR); - tempair.put(info.getID(), info); - } - - } - - /** - * Binds a Ability to the hotbar slot that the player is on. - * @param player The player to bind to - * @param ability The ability name to Bind - * @see {@link #bindAbility(Player, String, int)} - */ - public static void bindAbility(Player player, String ability) { - int slot = player.getInventory().getHeldItemSlot() + 1; - BendingPlayer bPlayer = getBendingPlayer(player.getName()); - bPlayer.abilities.put(slot, ability); - if (isAirAbility(ability)) { - player.sendMessage(getAirColor() + "Succesfully bound " + ability + " to slot " + slot); - } - else if (isWaterAbility(ability)) { - player.sendMessage(getWaterColor() + "Succesfully bound " + ability + " to slot " + slot); - } - else if (isEarthAbility(ability)) { - player.sendMessage(getEarthColor() + "Succesfully bound " + ability + " to slot " + slot); - } - else if (isFireAbility(ability)) { - player.sendMessage(getFireColor() + "Succesfully bound " + ability + " to slot " + slot); - } - else if (isChiAbility(ability)) { - player.sendMessage(getChiColor() + "Succesfully bound " + ability + " to slot " + slot); - } else { - player.sendMessage(getAvatarColor() + "Successfully bound " + ability + " to slot " + slot); - } - } - - /** - * Binds a Ability to a specific hotbar slot. - * @param player The player to bind to - * @param ability - * @param slot - * @see {@link #bindAbility(Player, String)} - */ - public static void bindAbility(Player player, String ability, int slot) { - BendingPlayer bPlayer = getBendingPlayer(player.getName()); - bPlayer.abilities.put(slot, ability); - if (isAirAbility(ability)) { - player.sendMessage(getAirColor() + "Succesfully bound " + ability + " to slot " + slot); - } - else if (isWaterAbility(ability)) { - player.sendMessage(getWaterColor() + "Succesfully bound " + ability + " to slot " + slot); - } - else if (isEarthAbility(ability)) { - player.sendMessage(getEarthColor() + "Succesfully bound " + ability + " to slot " + slot); - } - else if (isFireAbility(ability)) { - player.sendMessage(getFireColor() + "Succesfully bound " + ability + " to slot " + slot); - } - else if (isChiAbility(ability)) { - player.sendMessage(getChiColor() + "Succesfully bound " + ability + " to slot " + slot); - } else { - player.sendMessage(getAvatarColor() + "Successfully bound " + ability + " to slot " + slot); - } - } - - /** - * Breaks a block and sets it to {@link Material#AIR AIR}. - * @param block The block to break - */ - public static void breakBlock(Block block) { - block.breakNaturally(new ItemStack(Material.AIR)); - } - - /** - * Checks to see if a Player is effected by BloodBending. - * @param player The player to check - *

- * @return true If {@link #isChiBlocked(String)} is true - *
- * false If player is BloodBender and Bending is toggled on, or if player is in AvatarState - *

- */ - public static boolean canBeBloodbent(Player player) { - if (AvatarState.isAvatarState(player)) - return false; - if (isChiBlocked(player.getName())) - return true; - if (canBend(player.getName(), "Bloodbending") && Methods.getBendingPlayer(player.getName()).isToggled) - return false; - return true; - } - - /** - * Checks to see if a Player can bend a specific Ability. - * @param player The player name to check - * @param ability The Ability name to check - * @return true If player can bend specified ability and has the permissions to do so - */ - public static boolean canBend(String player, String ability) { + public static boolean isBender(String player, Element element) { BendingPlayer bPlayer = getBendingPlayer(player); - Player p = Bukkit.getPlayer(player); if (bPlayer == null) return false; - if (Commands.isToggledForAll) return false; - if (!bPlayer.isToggled) return false; - if (p == null) return false; - if (!p.hasPermission("bending.ability." + ability)) return false; - if (isAirAbility(ability) && !isBender(player, Element.Air)) return false; - if (isWaterAbility(ability) && !isBender(player, Element.Water)) return false; - if (isEarthAbility(ability) && !isBender(player, Element.Earth)) return false; - if (isFireAbility(ability) && !isBender(player, Element.Fire)) return false; - if (isChiAbility(ability) && !isBender(player, Element.Chi)) return false; - if (isRegionProtectedFromBuild(p, ability, p.getLocation())) return false; - return true; - } - - public static boolean canBendPassive(String player, Element element) { - BendingPlayer bPlayer = getBendingPlayer(player); - Player p = Bukkit.getPlayer(player); - if (bPlayer == null) return false; - if (p == null) return false; - if (!p.hasPermission("bending." + element.toString().toLowerCase() + ".passive")) return false; - if (!bPlayer.isToggled) return false; - if (!bPlayer.hasElement(element)) return false; - if (isRegionProtectedFromBuild(p, null, p.getLocation())) return false; - return true; - } - - /** - * Checks to see if a player can MetalBend. - * @param player The player to check - * @return true If player has permission node "bending.earth.metalbending" - */ - public static boolean canMetalbend(Player player) { - if (player.hasPermission("bending.earth.metalbending")) return true; + if (bPlayer.hasElement(element)) return true; return false; } - /** - * Checks to see if a player can PlantBend. - * @param player The player to check - * @return true If player has permission node "bending.ability.plantbending" - */ - public static boolean canPlantbend(Player player) { - return player.hasPermission("bending.ability.plantbending"); + public static BendingPlayer getBendingPlayer(String player) { + return BendingPlayer.players.get(player); } - - /** - * Creates a {@link BendingPlayer} with the data from the database. This runs when a player logs in. - * @param uuid The UUID of the player - * @param player The player name - * @throws SQLException - */ + public static void createBendingPlayer(UUID uuid, String player) { - /* - * This will run when the player logs in. - */ ResultSet rs2 = DBConnection.sql.readQuery("SELECT * FROM pk_players WHERE uuid = '" + uuid.toString() + "'"); try { if (!rs2.next()) { // Data doesn't exist, we want a completely new player. @@ -316,6 +147,15 @@ public class Methods { if (!player.equalsIgnoreCase(player2)) DBConnection.sql.modifyQuery("UPDATE pk_players SET player = '" + player2 + "' WHERE uuid = '" + uuid.toString() + "'"); // They have changed names. String element = rs2.getString("element"); String permaremoved = rs2.getString("permaremoved"); + String slot1 = rs2.getString("slot1"); + String slot2 = rs2.getString("slot2"); + String slot3 = rs2.getString("slot3"); + String slot4 = rs2.getString("slot4"); + String slot5 = rs2.getString("slot5"); + String slot6 = rs2.getString("slot6"); + String slot7 = rs2.getString("slot7"); + String slot8 = rs2.getString("slot8"); + String slot9 = rs2.getString("slot9"); boolean p = false; ArrayList elements = new ArrayList(); if (element != null) { // Player has an element. @@ -327,10 +167,15 @@ public class Methods { } HashMap abilities = new HashMap(); - for (int i = 1; i <= 9; i++) { - String slot = rs2.getString("slot" + i); - if (slot != null) abilities.put(i, slot); - } + if (slot1 != null) abilities.put(1, slot1); + if (slot2 != null) abilities.put(2, slot2); + if (slot3 != null) abilities.put(3, slot3); + if (slot4 != null) abilities.put(4, slot4); + if (slot5 != null) abilities.put(5, slot5); + if (slot6 != null) abilities.put(6, slot6); + if (slot7 != null) abilities.put(7, slot7); + if (slot8 != null) abilities.put(8, slot8); + if (slot9 != null) abilities.put(9, slot9); if (permaremoved == null) { p = false; @@ -348,30 +193,46 @@ public class Methods { ex.printStackTrace(); } } - - /** - * Damages an Entity by amount of damage specified. Starts a {@link EntityDamageByEntityEvent}. - * @param player The player dealing the damage - * @param entity The entity that is receiving the damage - * @param damage The amount of damage to deal - */ - public static void damageEntity(Player player, Entity entity, double damage) { - if (entity instanceof LivingEntity) { - ((LivingEntity) entity).damage(damage, player); - ((LivingEntity) entity).setLastDamageCause( - new EntityDamageByEntityEvent(player, entity, DamageCause.CUSTOM, damage)); + + public static boolean isFullMoon(World world) { + long days = world.getFullTime() / 24000; + long phase = days%8; + if (phase == 0) { + return true; } + return false; } - /** - * Deserializes the configuration file "bendingPlayers.yml" of the old BendingPlugin and creates a converted.yml ready for conversion. - * @throws IOException If the "bendingPlayers.yml" file is not found - */ + public static void saveBendingPlayer(String player) { + BendingPlayer bPlayer = BendingPlayer.players.get(player); + if (bPlayer == null) return; + String uuid = bPlayer.uuid.toString(); + + StringBuilder elements = new StringBuilder(); + if (bPlayer.hasElement(Element.Air)) elements.append("a"); + if (bPlayer.hasElement(Element.Water)) elements.append("w"); + if (bPlayer.hasElement(Element.Earth)) elements.append("e"); + if (bPlayer.hasElement(Element.Fire)) elements.append("f"); + if (bPlayer.hasElement(Element.Chi)) elements.append("c"); + + HashMap abilities = bPlayer.abilities; + + for (int i = 1; i <= 9; i++) { + DBConnection.sql.modifyQuery("UPDATE pk_players SET slot" + i +" = '" + (abilities.get(i) == null ? null : abilities.get(i)) + "' WHERE uuid = '" + uuid + "'"); + } + + DBConnection.sql.modifyQuery("UPDATE pk_players SET element = '" + elements + "' WHERE uuid = '" + uuid + "'"); + boolean permaRemoved = bPlayer.permaRemoved; + + DBConnection.sql.modifyQuery("UPDATE pk_players SET permaremoved = '" + (permaRemoved ? "true" : " false") +"' WHERE uuid = '" + uuid + "'"); + } + + + public static void deserializeFile() { File readFile = new File(".", "bendingPlayers.yml"); File writeFile = new File(".", "converted.yml"); if (readFile.exists()) { - // plugin.log.info("File exists"); try { DataInputStream input = new DataInputStream(new FileInputStream(readFile)); BufferedReader reader = new BufferedReader(new InputStreamReader(input)); @@ -395,24 +256,80 @@ public class Methods { } } - /** - * Drops a {@code Collection} of items on a specified block. - * @param block The block to drop items on. - * @param items The items to drop. - */ - public static void dropItems(Block block, Collection items) { - for (ItemStack item : items) - block.getWorld().dropItem(block.getLocation(), item); + public static void stopBending() { + List abilities = AbilityModuleManager.ability; + for (AbilityModule ab: abilities) { + ab.stop(); + } + AirBlast.removeAll(); + AirBubble.removeAll(); + AirShield.instances.clear(); + AirSuction.instances.clear(); + AirScooter.removeAll(); + AirSpout.removeAll(); + AirSwipe.instances.clear(); + Tornado.instances.clear(); + AirBurst.removeAll(); + + Catapult.removeAll(); + CompactColumn.removeAll(); + EarthBlast.removeAll(); + EarthColumn.removeAll(); + EarthPassive.removeAll(); + EarthArmor.removeAll(); + EarthTunnel.instances.clear(); + Shockwave.removeAll(); + Tremorsense.removeAll(); + + FreezeMelt.removeAll(); + IceSpike.removeAll(); + IceSpike2.removeAll(); + WaterManipulation.removeAll(); + WaterSpout.removeAll(); + WaterWall.removeAll(); + Wave.removeAll(); + Plantbending.regrowAll(); + OctopusForm.removeAll(); + Bloodbending.instances.clear(); + + FireStream.removeAll(); + Fireball.removeAll(); + WallOfFire.instances.clear(); + Lightning.instances.clear(); + FireShield.removeAll(); + FireBlast.removeAll(); + FireBurst.removeAll(); + FireJet.instances.clear(); + Cook.removeAll(); + Illumination.removeAll(); + + RapidPunch.instance.clear(); + + Flight.removeAll(); + WaterReturn.removeAll(); + TempBlock.removeAll(); + removeAllEarthbendedBlocks(); + + EarthPassive.removeAll(); + } + + public static void removeAllEarthbendedBlocks() { + for (Block block : movedearth.keySet()) { + revertBlock(block); + } + + for (Integer i : tempair.keySet()) { + revertAirBlock(i, true); + } + } + + + + public static boolean isSolid(Block block) { + if (Arrays.asList(nonOpaque).contains(block.getTypeId())) return false; + return true; } - /** - * Gets the ability from specified ability name. - * @param string The ability name - * @return Ability name if found in {@link AbilityModuleManager#abilities} - *

- * else null - *

- */ public static String getAbility(String string) { for (String st: AbilityModuleManager.abilities) { if (st.equalsIgnoreCase(string)) return st; @@ -420,19 +337,225 @@ public class Methods { return null; } - /** - * Gets the Element color from the Ability name specified. - * @param ability The ability name - *

- * @return - * {@link #getChiColor()}
- * {@link #getAirColor()}
- * {@link #getWaterColor()}
- * {@link #getEarthColor()}
- * {@link #getFireColor()}
- * else {@link #getAvatarColor()} - *

- */ + public static void bindAbility(Player player, String ability) { + int slot = player.getInventory().getHeldItemSlot() + 1; + BendingPlayer bPlayer = getBendingPlayer(player.getName()); + bPlayer.abilities.put(slot, ability); + if (isAirAbility(ability)) { + player.sendMessage(getAirColor() + "Succesfully bound " + ability + " to slot " + slot); + } + else if (isWaterAbility(ability)) { + player.sendMessage(getWaterColor() + "Succesfully bound " + ability + " to slot " + slot); + } + else if (isEarthAbility(ability)) { + player.sendMessage(getEarthColor() + "Succesfully bound " + ability + " to slot " + slot); + } + else if (isFireAbility(ability)) { + player.sendMessage(getFireColor() + "Succesfully bound " + ability + " to slot " + slot); + } + else if (isChiAbility(ability)) { + player.sendMessage(getChiColor() + "Succesfully bound " + ability + " to slot " + slot); + } else { + player.sendMessage(getAvatarColor() + "Successfully bound " + ability + " to slot " + slot); + } + } + + public static void bindAbility(Player player, String ability, int slot) { + BendingPlayer bPlayer = getBendingPlayer(player.getName()); + bPlayer.abilities.put(slot, ability); + if (isAirAbility(ability)) { + player.sendMessage(getAirColor() + "Succesfully bound " + ability + " to slot " + slot); + } + else if (isWaterAbility(ability)) { + player.sendMessage(getWaterColor() + "Succesfully bound " + ability + " to slot " + slot); + } + else if (isEarthAbility(ability)) { + player.sendMessage(getEarthColor() + "Succesfully bound " + ability + " to slot " + slot); + } + else if (isFireAbility(ability)) { + player.sendMessage(getFireColor() + "Succesfully bound " + ability + " to slot " + slot); + } + else if (isChiAbility(ability)) { + player.sendMessage(getChiColor() + "Succesfully bound " + ability + " to slot " + slot); + } else { + player.sendMessage(getAvatarColor() + "Successfully bound " + ability + " to slot " + slot); + } + } + public static boolean abilityExists(String string) { + if (getAbility(string) == null) return false; + return true; + } + public static List getEntitiesAroundPoint(Location location, + double radius) { + + List entities = location.getWorld().getEntities(); + List list = location.getWorld().getEntities(); + + for (Entity entity : entities) { + if (entity.getWorld() != location.getWorld()) { + list.remove(entity); + } else if (entity.getLocation().distance(location) > radius) { + list.remove(entity); + } + } + + return list; + + } + + public static Entity getTargetedEntity(Player player, double range, + List avoid) { + double longestr = range + 1; + Entity target = null; + Location origin = player.getEyeLocation(); + Vector direction = player.getEyeLocation().getDirection().normalize(); + for (Entity entity : origin.getWorld().getEntities()) { + if (avoid.contains(entity)) + continue; + if (entity.getLocation().distance(origin) < longestr + && getDistanceFromLine(direction, origin, + entity.getLocation()) < 2 + && (entity instanceof LivingEntity) + && entity.getEntityId() != player.getEntityId() + && entity.getLocation().distance( + origin.clone().add(direction)) < entity + .getLocation().distance( + origin.clone().add( + direction.clone().multiply(-1)))) { + target = entity; + longestr = entity.getLocation().distance(origin); + } + } + return target; + } + + public static boolean isAbilityInstalled(String name, String author) { + String ability = getAbility(name); + if (ability == null) return false; + if (AbilityModuleManager.authors.get(name).equalsIgnoreCase(author)) return true; + return false; + } + + public static double getDistanceFromLine(Vector line, Location pointonline, + Location point) { + + Vector AP = new Vector(); + double Ax, Ay, Az; + Ax = pointonline.getX(); + Ay = pointonline.getY(); + Az = pointonline.getZ(); + + double Px, Py, Pz; + Px = point.getX(); + Py = point.getY(); + Pz = point.getZ(); + + AP.setX(Px - Ax); + AP.setY(Py - Ay); + AP.setZ(Pz - Az); + + return (AP.crossProduct(line).length()) / (line.length()); + } + + public static boolean canBend(String player, String ability) { + BendingPlayer bPlayer = getBendingPlayer(player); + Player p = Bukkit.getPlayer(player); + if (bPlayer == null) return false; + if (Commands.isToggledForAll) return false; + if (!bPlayer.isToggled) return false; + if (p == null) return false; + if (!p.hasPermission("bending.ability." + ability)) return false; + if (isAirAbility(ability) && !isBender(player, Element.Air)) return false; + if (isWaterAbility(ability) && !isBender(player, Element.Water)) return false; + if (isEarthAbility(ability) && !isBender(player, Element.Earth)) return false; + if (isFireAbility(ability) && !isBender(player, Element.Fire)) return false; + if (isChiAbility(ability) && !isBender(player, Element.Chi)) return false; + if (isRegionProtectedFromBuild(p, ability, p.getLocation())) return false; + return true; + } + + public static void removeUnusableAbilities(String player) { + BendingPlayer bPlayer = getBendingPlayer(player); + HashMap slots = bPlayer.getAbilities(); + HashMap finalabilities = new HashMap(); + try { + for (int i: slots.keySet()) { + if (canBend(player, slots.get(i))) { + finalabilities.put(i, slots.get(i)); + } + } + bPlayer.abilities = finalabilities; + } catch (Exception ex) { + + } + + } + + public static boolean hasPermission(Player player, String ability) { + if (player.hasPermission("bending.ability." + ability)) return true; + return false; + } + + public static boolean canBendPassive(String player, Element element) { + BendingPlayer bPlayer = getBendingPlayer(player); + Player p = Bukkit.getPlayer(player); + if (bPlayer == null) return false; + if (p == null) return false; + if (!p.hasPermission("bending." + element.toString().toLowerCase() + ".passive")) return false; + if (!bPlayer.isToggled) return false; + if (!bPlayer.hasElement(element)) return false; + if (isRegionProtectedFromBuild(p, null, p.getLocation())) return false; + return true; + } + + public static boolean isAirAbility(String ability) { + return AbilityModuleManager.airbendingabilities.contains(ability); + } + + public static boolean isWaterAbility(String ability) { + return AbilityModuleManager.waterbendingabilities.contains(ability); + } + + public static boolean isEarthAbility(String ability) { + return AbilityModuleManager.earthbendingabilities.contains(ability); + } + + public static boolean isFireAbility(String ability) { + return AbilityModuleManager.firebendingabilities.contains(ability); + } + + public static boolean isChiAbility(String ability) { + return AbilityModuleManager.chiabilities.contains(ability); + } + + public static ChatColor getAirColor() { + return ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Air")); + } + + public static ChatColor getWaterColor() { + return ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Water")); + } + + public static ChatColor getEarthColor() { + return ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Earth")); + } + + public static ChatColor getMetalbendingColor() { + return ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Metalbending")); + } + + public static ChatColor getFireColor() { + return ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Fire")); + } + + public static ChatColor getChiColor() { + return ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Chi")); + } + + public static ChatColor getAvatarColor() { + return ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Avatar")); + } + public static ChatColor getAbilityColor(String ability) { if (AbilityModuleManager.chiabilities.contains(ability)) return getChiColor(); if (AbilityModuleManager.airbendingabilities.contains(ability)) return getAirColor(); @@ -442,37 +565,63 @@ public class Methods { else return getAvatarColor(); } - /** - * Gets the AirColor from the config. - * @return Config specified ChatColor - */ - public static ChatColor getAirColor() { - return ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Air")); + public static boolean isWater(Block block) { + if (block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER) return true; + return false; } - /** - * Gets the AvatarColor from the config. - * @return Config specified ChatColor - */ - public static ChatColor getAvatarColor() { - return ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Avatar")); + public static String getBoundAbility(Player player) { + BendingPlayer bPlayer = getBendingPlayer(player.getName()); + if (bPlayer == null) return null; + + int slot = player.getInventory().getHeldItemSlot() + 1; + return bPlayer.abilities.get(slot); } - /** - * Gets a {@link BendingPlayer} from specified player name. - * @param player The name of the Player - * @return The BendingPlayer object if {@link BendingPlayer#players} contains the player name - */ - public static BendingPlayer getBendingPlayer(String player) { - return BendingPlayer.players.get(player); + public static boolean isWaterbendable(Block block, Player player) { + byte full = 0x0; + if (TempBlock.isTempBlock(block)) return false; + if ((block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER) && block.getData() == full) return true; + if (block.getType() == Material.ICE || block.getType() == Material.SNOW) return true; + if (block.getType() == Material.PACKED_ICE && plugin.getConfig().getBoolean("Properties.Water.CanBendPackedIce")) return true; + if (canPlantbend(player) && isPlant(block)) return true; + return false; + } + + public static boolean canPlantbend(Player player) { + return player.hasPermission("bending.ability.plantbending"); + } + + public static boolean isPlant(Block block) { + if (Arrays.asList(plantIds).contains(block.getTypeId())) return true; + return false; + } + + public static boolean isAdjacentToThreeOrMoreSources(Block block) { + if (TempBlock.isTempBlock(block)) + return false; + int sources = 0; + byte full = 0x0; + BlockFace[] faces = { BlockFace.EAST, BlockFace.WEST, BlockFace.NORTH, + BlockFace.SOUTH }; + for (BlockFace face : faces) { + Block blocki = block.getRelative(face); + if ((blocki.getType() == Material.WATER || blocki.getType() == Material.STATIONARY_WATER) + && blocki.getData() == full + && WaterManipulation.canPhysicsChange(blocki)) + sources++; + if (FreezeMelt.frozenblocks.containsKey(blocki)) { + if (FreezeMelt.frozenblocks.get(blocki) == full) + sources++; + } else if (blocki.getType() == Material.ICE) { + sources++; + } + } + if (sources >= 2) + return true; + return false; } - /** - * Gets a {@code List} within the specified radius around the specified location. - * @param location The base location - * @param radius The block radius from location to include within the list of blocks - * @return The list of Blocks - */ public static List getBlocksAroundPoint(Location location, double radius) { List blocks = new ArrayList(); @@ -486,9 +635,6 @@ public class Methods { for (int y = yorg - r; y <= yorg + r; y++) { for (int z = zorg - r; z <= zorg + r; z++) { Block block = location.getWorld().getBlockAt(x, y, z); - // if - // (block.getLocation().distance(originblock.getLocation()) - // <= radius) { if (block.getLocation().distance(location) <= radius) { blocks.add(block); } @@ -499,20 +645,689 @@ public class Methods { return blocks; } - /** - * Gets the Ability bound to the slot that the player is in. - * @param player The player to check - * @return The Ability name bounded to the slot - *

- * else null - *

- */ - public static String getBoundAbility(Player player) { - BendingPlayer bPlayer = getBendingPlayer(player.getName()); - if (bPlayer == null) return null; + public static boolean isEarthbendable(Player player, Block block) { + return isEarthbendable(player, "RaiseEarth", block); + } - int slot = player.getInventory().getHeldItemSlot() + 1; - return bPlayer.abilities.get(slot); + public static boolean isEarthbendable(Player player, String ability, + Block block) { + if (isRegionProtectedFromBuild(player, ability, + block.getLocation())) + return false; + Material material = block.getType(); + + for (String s : ProjectKorra.plugin.getConfig().getStringList("Properties.Earth.EarthbendableBlocks")) { + + if (material == Material.getMaterial(s)) { + + return true; + + } + + } + return false; + } + + public static boolean isChiBlocked(String player) { + return Methods.getBendingPlayer(player).isChiBlocked(); + } + + public static Vector rotateVectorAroundVector(Vector axis, Vector rotator, + double degrees) { + double angle = Math.toRadians(degrees); + Vector rotation = axis.clone(); + Vector rotate = rotator.clone(); + rotation = rotation.normalize(); + + Vector thirdaxis = rotation.crossProduct(rotate).normalize() + .multiply(rotate.length()); + + return rotate.multiply(Math.cos(angle)).add( + thirdaxis.multiply(Math.sin(angle))); + } + + public static Vector getOrthogonalVector(Vector axis, double degrees, + double length) { + + Vector ortho = new Vector(axis.getY(), -axis.getX(), 0); + ortho = ortho.normalize(); + ortho = ortho.multiply(length); + + return rotateVectorAroundVector(axis, ortho, degrees); + + } + + public static boolean isWeapon(Material mat) { + if (mat == null) return false; + if (mat == Material.WOOD_AXE || mat == Material.WOOD_PICKAXE + || mat == Material.WOOD_SPADE || mat == Material.WOOD_SWORD + + || mat == Material.STONE_AXE || mat == Material.STONE_PICKAXE + || mat == Material.STONE_SPADE || mat == Material.STONE_SWORD + + || mat == Material.IRON_AXE || mat == Material.IRON_PICKAXE + || mat == Material.IRON_SWORD || mat == Material.IRON_SPADE + + || mat == Material.DIAMOND_AXE || mat == Material.DIAMOND_PICKAXE + || mat == Material.DIAMOND_SWORD || mat == Material.DIAMOND_SPADE) + return true; + return false; + } + + public static boolean isTransparentToEarthbending(Player player, Block block) { + return isTransparentToEarthbending(player, "RaiseEarth", block); + } + + public static boolean isTransparentToEarthbending(Player player, + String ability, Block block) { + if (isRegionProtectedFromBuild(player, ability, + block.getLocation())) + return false; + if (Arrays.asList(transparentToEarthbending).contains(block.getTypeId())) + return true; + return false; + } + + public static void removeSpouts(Location location, double radius, + Player sourceplayer) { + WaterSpout.removeSpouts(location, radius, sourceplayer); + AirSpout.removeSpouts(location, radius, sourceplayer); + } + + public static void removeSpouts(Location location, Player sourceplayer) { + removeSpouts(location, 1.5, sourceplayer); + } + + public static double firebendingDayAugment(double value, World world) { + if (isDay(world)) { + return plugin.getConfig().getDouble("Properties.Fire.DayFactor") * value; + } + return value; + } + + public static double getFirebendingDayAugment(World world) { + if (isDay(world)) return plugin.getConfig().getDouble("Properties.Fire.DayFactor"); + return 1; + } + + public static Block getEarthSourceBlock(Player player, double range) { + Block testblock = player.getTargetBlock(getTransparentEarthbending(), + (int) range); + if (isEarthbendable(player, testblock)) + return testblock; + Location location = player.getEyeLocation(); + Vector vector = location.getDirection().clone().normalize(); + for (double i = 0; i <= range; i++) { + Block block = location.clone().add(vector.clone().multiply(i)) + .getBlock(); + if (isRegionProtectedFromBuild(player, "RaiseEarth", + location)) + continue; + if (isEarthbendable(player, block)) { + return block; + } + } + return null; + } + + public static int getEarthbendableBlocksLength(Player player, Block block, + Vector direction, int maxlength) { + Location location = block.getLocation(); + direction = direction.normalize(); + double j; + for (int i = 0; i <= maxlength; i++) { + j = (double) i; + if (!isEarthbendable(player, + location.clone().add(direction.clone().multiply(j)) + .getBlock())) { + return i; + } + } + return maxlength; + } + + public static boolean isMeltable(Block block) { + if (block.getType() == Material.ICE || block.getType() == Material.SNOW || block.getType() == Material.PACKED_ICE) { + return true; + } + return false; + } + + public static Block getWaterSourceBlock(Player player, double range, + boolean plantbending) { + Location location = player.getEyeLocation(); + Vector vector = location.getDirection().clone().normalize(); + for (double i = 0; i <= range; i++) { + Block block = location.clone().add(vector.clone().multiply(i)) + .getBlock(); + if (isRegionProtectedFromBuild(player, "WaterManipulation", + location)) + continue; + if (isWaterbendable(block, player) + && (!isPlant(block) || plantbending)) { + if (TempBlock.isTempBlock(block)) { + TempBlock tb = TempBlock.get(block); + byte full = 0x0; + if (tb.state.getRawData() != full + && (tb.state.getType() != Material.WATER || tb.state + .getType() != Material.STATIONARY_WATER)) { + continue; + } + } + return block; + } + } + return null; + } + + public static boolean isObstructed(Location location1, Location location2) { + Vector loc1 = location1.toVector(); + Vector loc2 = location2.toVector(); + + Vector direction = loc2.subtract(loc1); + direction.normalize(); + + Location loc; + + double max = location1.distance(location2); + + for (double i = 0; i <= max; i++) { + loc = location1.clone().add(direction.clone().multiply(i)); + Material type = loc.getBlock().getType(); + if (type != Material.AIR + && !Arrays.asList(transparentToEarthbending).contains( + type.getId())) + return true; + } + + return false; + } + + public static boolean isAdjacentToFrozenBlock(Block block) { + BlockFace[] faces = { BlockFace.DOWN, BlockFace.UP, BlockFace.NORTH, + BlockFace.EAST, BlockFace.WEST, BlockFace.SOUTH }; + boolean adjacent = false; + for (BlockFace face : faces) { + if (FreezeMelt.frozenblocks.containsKey((block.getRelative(face)))) + adjacent = true; + } + + return adjacent; + } + + public static void removeBlock(Block block) { + if (isAdjacentToThreeOrMoreSources(block)) { + block.setType(Material.WATER); + block.setData((byte) 0x0); + } else { + block.setType(Material.AIR); + } + } + + public static void revertAirBlock(int i) { + revertAirBlock(i, false); + } + + public static void revertAirBlock(int i, boolean force) { + if (!tempair.containsKey(i)) + return; + Information info = tempair.get(i); + Block block = info.getState().getBlock(); + if (block.getType() != Material.AIR && !block.isLiquid()) { + if (force || !movedearth.containsKey(block)) { + dropItems( + block, + getDrops(block, info.getState().getType(), info + .getState().getRawData(), pickaxe)); + tempair.remove(i); + } else { + info.setTime(info.getTime() + 10000); + } + return; + } else { + info.getState().update(true); + tempair.remove(i); + } + } + + public static boolean revertBlock(Block block) { + byte full = 0x0; + if (movedearth.containsKey(block)) { + Information info = movedearth.get(block); + Block sourceblock = info.getState().getBlock(); + + if (info.getState().getType() == Material.AIR) { + movedearth.remove(block); + return true; + } + + if (block.equals(sourceblock)) { + info.getState().update(true); + if (EarthColumn.blockInAllAffectedBlocks(sourceblock)) + EarthColumn.revertBlock(sourceblock); + if (EarthColumn.blockInAllAffectedBlocks(block)) + EarthColumn.revertBlock(block); + EarthColumn.resetBlock(sourceblock); + EarthColumn.resetBlock(block); + movedearth.remove(block); + return true; + } + + if (movedearth.containsKey(sourceblock)) { + addTempAirBlock(block); + movedearth.remove(block); + return true; + } + + if (sourceblock.getType() == Material.AIR || sourceblock.isLiquid()) { + info.getState().update(true); + } else { + dropItems( + block, + getDrops(block, info.getState().getType(), info + .getState().getRawData(), pickaxe)); + } + + if (isAdjacentToThreeOrMoreSources(block)) { + block.setType(Material.WATER); + block.setData(full); + } else { + block.setType(Material.AIR); + } + + if (EarthColumn.blockInAllAffectedBlocks(sourceblock)) + EarthColumn.revertBlock(sourceblock); + if (EarthColumn.blockInAllAffectedBlocks(block)) + EarthColumn.revertBlock(block); + EarthColumn.resetBlock(sourceblock); + EarthColumn.resetBlock(block); + movedearth.remove(block); + } + return true; + } + + + public static void playFocusWaterEffect(Block block) { + block.getWorld().playEffect(block.getLocation(), Effect.SMOKE, 4, 20); + } + + public static void removeRevertIndex(Block block) { + if (movedearth.containsKey(block)) { + Information info = movedearth.get(block); + if (block.getType() == Material.SANDSTONE + && info.getType() == Material.SAND) + block.setType(Material.SAND); + if (EarthColumn.blockInAllAffectedBlocks(block)) + EarthColumn.revertBlock(block); + + EarthColumn.resetBlock(block); + + movedearth.remove(block); + } + } + + public static double waterbendingNightAugment(double value, World world) { + if (isNight(world)) { + if (isFullMoon(world)) { + return plugin.getConfig().getDouble("Properties.Water.FullMoonFactor") * value; + } else { + return plugin.getConfig().getDouble("Properties.Water.NightFactor") * value; + } + } + return value; + } + + public static double getWaterbendingNightAugment(World world) { + if (isNight(world) && isFullMoon(world)) return plugin.getConfig().getDouble("Properties.Water.FullMoonFactor"); + if (isNight(world)) return plugin.getConfig().getDouble("Properties.Water.NightFactor"); + return 1; + } + + public static void playAirbendingParticles(Location loc) { + for (int i = 0; i < 20; i++) { + ParticleEffect.CLOUD.display(loc, (float) Math.random(), (float) Math.random(), (float) Math.random(), 0, 1); + } + } + + public static boolean isNight(World world) { + if (world.getEnvironment() == Environment.NETHER || world.getEnvironment() == Environment.THE_END) { + return false; + } + + long time = world.getTime(); + if (time >= 12950 && time <= 23050) { + return true; + } + return false; + } + + public static Location getPointOnLine(Location origin, Location target, + double distance) { + return origin.clone().add( + getDirection(origin, target).normalize().multiply(distance)); + + } + + public static void breakBlock(Block block) { + block.breakNaturally(new ItemStack(Material.AIR)); + } + + public static boolean canBeBloodbent(Player player) { + if (AvatarState.isAvatarState(player)) + return false; + if ((isChiBlocked(player.getName()))) + return true; + if (canBend(player.getName(), "Bloodbending") && Methods.getBendingPlayer(player.getName()).isToggled) + return false; + return true; + } + + public static void moveEarth(Player player, Location location, + Vector direction, int chainlength) { + moveEarth(player, location, direction, chainlength, true); + } + + public static void moveEarth(Player player, Location location, + Vector direction, int chainlength, boolean throwplayer) { + Block block = location.getBlock(); + moveEarth(player, block, direction, chainlength, throwplayer); + } + + public static void moveEarth(Player player, Block block, Vector direction, + int chainlength) { + moveEarth(player, block, direction, chainlength, true); + } + + public static boolean moveEarth(Player player, Block block, + Vector direction, int chainlength, boolean throwplayer) { + if (isEarthbendable(player, block) + && !isRegionProtectedFromBuild(player, "RaiseEarth", + block.getLocation())) { + + boolean up = false; + boolean down = false; + Vector norm = direction.clone().normalize(); + if (norm.dot(new Vector(0, 1, 0)) == 1) { + up = true; + } else if (norm.dot(new Vector(0, -1, 0)) == 1) { + down = true; + } + Vector negnorm = norm.clone().multiply(-1); + + Location location = block.getLocation(); + + ArrayList blocks = new ArrayList(); + for (double j = -2; j <= chainlength; j++) { + Block checkblock = location.clone() + .add(negnorm.clone().multiply(j)).getBlock(); + if (!tempnophysics.contains(checkblock)) { + blocks.add(checkblock); + tempnophysics.add(checkblock); + } + } + + Block affectedblock = location.clone().add(norm).getBlock(); + if (EarthPassive.isPassiveSand(block)) { + EarthPassive.revertSand(block); + } + + if (affectedblock == null) + return false; + if (isTransparentToEarthbending(player, affectedblock)) { + if (throwplayer) { + for (Entity entity : getEntitiesAroundPoint( + affectedblock.getLocation(), 1.75)) { + if (entity instanceof LivingEntity) { + LivingEntity lentity = (LivingEntity) entity; + if (lentity.getEyeLocation().getBlockX() == affectedblock + .getX() + && lentity.getEyeLocation().getBlockZ() == affectedblock + .getZ()) + if (!(entity instanceof FallingBlock)) + entity.setVelocity(norm.clone().multiply( + .75)); + } else { + if (entity.getLocation().getBlockX() == affectedblock + .getX() + && entity.getLocation().getBlockZ() == affectedblock + .getZ()) + if (!(entity instanceof FallingBlock)) + entity.setVelocity(norm.clone().multiply( + .75)); + } + } + + } + + if (up) { + Block topblock = affectedblock.getRelative(BlockFace.UP); + if (topblock.getType() != Material.AIR) { + breakBlock(affectedblock); + } else if (!affectedblock.isLiquid() + && affectedblock.getType() != Material.AIR) { + moveEarthBlock(affectedblock, topblock); + } + } else { + breakBlock(affectedblock); + } + + moveEarthBlock(block, affectedblock); + block.getWorld().playEffect(block.getLocation(), + Effect.GHAST_SHOOT, 0, 4); + + for (double i = 1; i < chainlength; i++) { + affectedblock = location + .clone() + .add(negnorm.getX() * i, negnorm.getY() * i, + negnorm.getZ() * i).getBlock(); + if (!isEarthbendable(player, affectedblock)) { + if (down) { + if (isTransparentToEarthbending(player, + affectedblock) + && !affectedblock.isLiquid() + && affectedblock.getType() != Material.AIR) { + moveEarthBlock(affectedblock, block); + } + } + break; + } + if (EarthPassive.isPassiveSand(affectedblock)) { + EarthPassive.revertSand(affectedblock); + } + if (block == null) { + for (Block checkblock : blocks) { + tempnophysics.remove(checkblock); + } + return false; + } + moveEarthBlock(affectedblock, block); + block = affectedblock; + } + + int i = chainlength; + affectedblock = location + .clone() + .add(negnorm.getX() * i, negnorm.getY() * i, + negnorm.getZ() * i).getBlock(); + if (!isEarthbendable(player, affectedblock)) { + if (down) { + if (isTransparentToEarthbending(player, affectedblock) + && !affectedblock.isLiquid()) { + moveEarthBlock(affectedblock, block); + } + } + } + + } else { + for (Block checkblock : blocks) { + tempnophysics.remove(checkblock); + } + return false; + } + for (Block checkblock : blocks) { + tempnophysics.remove(checkblock); + } + return true; + } + return false; + } + + + public static void moveEarthBlock(Block source, Block target) { + byte full = 0x0; + Information info; + if (movedearth.containsKey(source)) { + info = movedearth.get(source); + info.setTime(System.currentTimeMillis()); + movedearth.remove(source); + movedearth.put(target, info); + } else { + info = new Information(); + info.setBlock(source); + info.setTime(System.currentTimeMillis()); + info.setState(source.getState()); + movedearth.put(target, info); + } + + if (isAdjacentToThreeOrMoreSources(source)) { + source.setType(Material.WATER); + source.setData(full); + } else { + source.setType(Material.AIR); + } + if (info.getState().getType() == Material.SAND) { + target.setType(Material.SANDSTONE); + } else { + target.setType(info.getState().getType()); + target.setData(info.getState().getRawData()); + } + } + + public static void addTempAirBlock(Block block) { + if (movedearth.containsKey(block)) { + Information info = movedearth.get(block); + block.setType(Material.AIR); + info.setTime(System.currentTimeMillis()); + movedearth.remove(block); + tempair.put(info.getID(), info); + } else { + Information info = new Information(); + info.setBlock(block); + info.setState(block.getState()); + info.setTime(System.currentTimeMillis()); + block.setType(Material.AIR); + tempair.put(info.getID(), info); + } + + } + + public static Vector getDirection(Location location, Location destination) { + double x1, y1, z1; + double x0, y0, z0; + + x1 = destination.getX(); + y1 = destination.getY(); + z1 = destination.getZ(); + + x0 = location.getX(); + y0 = location.getY(); + z0 = location.getZ(); + + return new Vector(x1 - x0, y1 - y0, z1 - z0); + + } + + public static HashSet getTransparentEarthbending() { + HashSet set = new HashSet(); + for (int i : transparentToEarthbending) { + set.add((byte) i); + } + return set; + } + + public static void damageEntity(Player player, Entity entity, double damage) { + if (entity instanceof LivingEntity) { + ((LivingEntity) entity).damage(damage, player); + ((LivingEntity) entity) + .setLastDamageCause(new EntityDamageByEntityEvent(player, + entity, DamageCause.CUSTOM, damage)); + } + } + + public static boolean isDay(World world) { + long time = world.getTime(); + if (time >= 23500 || time <= 12500) { + return true; + } + return false; + } + + public static int getIntCardinalDirection(Vector vector) { + BlockFace face = getCardinalDirection(vector); + + switch (face) { + case SOUTH: + return 7; + case SOUTH_WEST: + return 6; + case WEST: + return 3; + case NORTH_WEST: + return 0; + case NORTH: + return 1; + case NORTH_EAST: + return 2; + case EAST: + return 5; + case SOUTH_EAST: + return 8; + } + + return 4; + + } + + public static Collection getDrops(Block block, Material type, + byte data, ItemStack breakitem) { + BlockState tempstate = block.getState(); + block.setType(type); + block.setData(data); + Collection item = block.getDrops(); + tempstate.update(true); + return item; + } + + public static void dropItems(Block block, Collection items) { + for (ItemStack item : items) + block.getWorld().dropItem(block.getLocation(), item); + } + + public static Location getTargetedLocation(Player player, int range) { + return getTargetedLocation(player, range, 0); + } + + public static Location getTargetedLocation(Player player, + double originselectrange, Integer... nonOpaque2) { + Location origin = player.getEyeLocation(); + Vector direction = origin.getDirection(); + + HashSet trans = new HashSet(); + trans.add((byte) 0); + + if (nonOpaque2 == null) { + trans = null; + } else { + for (int i : nonOpaque2) { + trans.add((byte) i); + } + } + + Block block = player.getTargetBlock(trans, (int) originselectrange + 1); + double distance = block.getLocation().distance(origin) - 1.5; + Location location = origin.add(direction.multiply(distance)); + + return location; } public static BlockFace getCardinalDirection(Vector vector) { @@ -545,552 +1360,8 @@ public class Methods { } - /** - * Gets the ChiColor from the config. - * @return Config specified ChatColor - */ - public static ChatColor getChiColor() { - return ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Chi")); - } - - public static List getCircle(Location loc, int radius, int height, boolean hollow, boolean sphere, int plusY){ - List circleblocks = new ArrayList(); - int cx = loc.getBlockX(); - int cy = loc.getBlockY(); - int cz = loc.getBlockZ(); - - for(int x = cx - radius; x <= cx + radius; x++){ - for (int z = cz - radius; z <= cz + radius; z++){ - for(int y = (sphere ? cy - radius : cy); y < (sphere ? cy + radius : cy + height); y++){ - double dist = (cx - x) * (cx - x) + (cz - z) * (cz - z) + (sphere ? (cy - y) * (cy - y) : 0); - - if(dist < radius * radius && !(hollow && dist < (radius - 1) * (radius - 1))){ - Location l = new Location(loc.getWorld(), x, y + plusY, z); - circleblocks.add(l); - } - } - } - } - - return circleblocks; - } - - public static Vector getDirection(Location location, Location destination) { - double x1, y1, z1; - double x0, y0, z0; - - x1 = destination.getX(); - y1 = destination.getY(); - z1 = destination.getZ(); - - x0 = location.getX(); - y0 = location.getY(); - z0 = location.getZ(); - - return new Vector(x1 - x0, y1 - y0, z1 - z0); - - } - - public static double getDistanceFromLine(Vector line, Location pointonline, - Location point) { - - Vector AP = new Vector(); - double Ax, Ay, Az; - Ax = pointonline.getX(); - Ay = pointonline.getY(); - Az = pointonline.getZ(); - - double Px, Py, Pz; - Px = point.getX(); - Py = point.getY(); - Pz = point.getZ(); - - AP.setX(Px - Ax); - AP.setY(Py - Ay); - AP.setZ(Pz - Az); - - return (AP.crossProduct(line).length()) / (line.length()); - } - - /** - * Gets a {@code Collection} of item drops from a single block. - * @param block The single block - * @param type The Material type to change the block into - * @param data The block data to change the block into - * @param breakitem Unused - * @return The item drops fromt the specified block - */ - public static Collection getDrops(Block block, Material type, byte data, ItemStack breakitem) { - BlockState tempstate = block.getState(); - block.setType(type); - block.setData(data); - Collection item = block.getDrops(); - tempstate.update(true); - return item; - } - - public static int getEarthbendableBlocksLength(Player player, Block block, Vector direction, int maxlength) { - Location location = block.getLocation(); - direction = direction.normalize(); - double j; - for (int i = 0; i <= maxlength; i++) { - j = (double) i; - if (!isEarthbendable(player, location.clone().add(direction.clone().multiply(j)).getBlock())) { - return i; - } - } - return maxlength; - } - - /** - * Gets the EarthColor from the config. - * @return Config specified ChatColor - */ - public static ChatColor getEarthColor() { - return ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Earth")); - } - - public static Block getEarthSourceBlock(Player player, double range) { - Block testblock = player.getTargetBlock(getTransparentEarthbending(), (int) range); - if (isEarthbendable(player, testblock)) - return testblock; - Location location = player.getEyeLocation(); - Vector vector = location.getDirection().clone().normalize(); - for (double i = 0; i <= range; i++) { - Block block = location.clone().add(vector.clone().multiply(i)).getBlock(); - if (isRegionProtectedFromBuild(player, "RaiseEarth", location)) - continue; - if (isEarthbendable(player, block)) { - return block; - } - } - return null; - } - - /** - * Gets a {@code List} of entities around a specified radius from the specified area - * @param location The base location - * @param radius The radius of blocks to look for entities from the location - * @return A list of entities around a point - */ - public static List getEntitiesAroundPoint(Location location, double radius) { - - List entities = location.getWorld().getEntities(); - List list = location.getWorld().getEntities(); - - for (Entity entity : entities) { - if (entity.getWorld() != location.getWorld()) { - list.remove(entity); - } else if (entity.getLocation().distance(location) > radius) { - list.remove(entity); - } - } - - return list; - - } - - /** - * Gets the firebending dayfactor from the config multiplied by a specific value if it is day. - * @param value The value - * @param world The world to pass into {@link #isDay(World)} - *

- * @return value DayFactor multiplied by specified value when {@link #isDay(World)} is true - *
else
- * value The specified value in the parameters - *

- * @see {@link #getFirebendingDayAugment(World)} - */ - public static double getFirebendingDayAugment(double value, World world) { - if (isDay(world)) { - return plugin.getConfig().getDouble("Properties.Fire.DayFactor") * value; - } - return value; - } - - /** - * Gets the firebending dayfactor from the config if it is day. - * @param world The world to pass into {@link #isDay(World)} - *

- * @return value DayFactor multiplied by specified value when {@link #isDay(World)} is true - *
else
- * value The value of 1 - *

- * @see {@link #getFirebendingDayAugment(double, World)} - */ - public static double getFirebendingDayAugment(World world) { - if (isDay(world)) return plugin.getConfig().getDouble("Properties.Fire.DayFactor"); - return 1; - } - - /** - * Gets the FireColor from the config. - * @return Config specified ChatColor - */ - public static ChatColor getFireColor() { - return ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Fire")); - } - - public static int getIntCardinalDirection(Vector vector) { - BlockFace face = getCardinalDirection(vector); - - switch (face) { - case SOUTH: - return 7; - case SOUTH_WEST: - return 6; - case WEST: - return 3; - case NORTH_WEST: - return 0; - case NORTH: - return 1; - case NORTH_EAST: - return 2; - case EAST: - return 5; - case SOUTH_EAST: - return 8; - } - - return 4; - - } - - /** - * Gets the MetalBendingColor from the config. - * @return Config specified ChatColor - */ - public static ChatColor getMetalbendingColor() { - return ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Metalbending")); - } - - public static Vector getOrthogonalVector(Vector axis, double degrees, double length) { - - Vector ortho = new Vector(axis.getY(), -axis.getX(), 0); - ortho = ortho.normalize(); - ortho = ortho.multiply(length); - - return rotateVectorAroundVector(axis, ortho, degrees); - - } - - public static Location getPointOnLine(Location origin, Location target, double distance) { - return origin.clone().add( - getDirection(origin, target).normalize().multiply(distance)); - - } - - public static Entity getTargetedEntity(Player player, double range, List avoid) { - double longestr = range + 1; - Entity target = null; - Location origin = player.getEyeLocation(); - Vector direction = player.getEyeLocation().getDirection().normalize(); - for (Entity entity : origin.getWorld().getEntities()) { - if (avoid.contains(entity)) - continue; - if (entity.getLocation().distance(origin) < longestr - && getDistanceFromLine(direction, origin, entity.getLocation()) < 2 - && (entity instanceof LivingEntity) - && entity.getEntityId() != player.getEntityId() - && entity.getLocation().distance(origin.clone().add(direction)) < - entity.getLocation().distance(origin.clone().add(direction.clone().multiply(-1)))) { - target = entity; - longestr = entity.getLocation().distance(origin); - } - } - return target; - } - - public static Location getTargetedLocation(Player player, double originselectrange, Integer... nonOpaque2) { - Location origin = player.getEyeLocation(); - Vector direction = origin.getDirection(); - - HashSet trans = new HashSet(); - trans.add((byte) 0); - - if (nonOpaque2 == null) { - trans = null; - } else { - for (int i : nonOpaque2) { - trans.add((byte) i); - } - } - - Block block = player.getTargetBlock(trans, (int) originselectrange + 1); - double distance = block.getLocation().distance(origin) - 1.5; - Location location = origin.add(direction.multiply(distance)); - - return location; - } - - public static Location getTargetedLocation(Player player, int range) { - return getTargetedLocation(player, range, 0); - } - - public static HashSet getTransparentEarthbending() { - HashSet set = new HashSet(); - for (int i : transparentToEarthbending) { - set.add((byte) i); - } - return set; - } - - public static double getWaterbendingNightAugment(World world) { - if (isNight(world) && isFullMoon(world)) return plugin.getConfig().getDouble("Properties.Water.FullMoonFactor"); - if (isNight(world)) return plugin.getConfig().getDouble("Properties.Water.NightFactor"); - return 1; - } - - /** - * Gets the WaterColor from the config. - * @return Config specified ChatColor - */ - public static ChatColor getWaterColor() { - return ChatColor.valueOf(plugin.getConfig().getString("Properties.Chat.Colors.Water")); - } - - public static Block getWaterSourceBlock(Player player, double range, - boolean plantbending) { - Location location = player.getEyeLocation(); - Vector vector = location.getDirection().clone().normalize(); - for (double i = 0; i <= range; i++) { - Block block = location.clone().add(vector.clone().multiply(i)) - .getBlock(); - if (isRegionProtectedFromBuild(player, "WaterManipulation", - location)) - continue; - if (isWaterbendable(block, player) - && (!isPlant(block) || plantbending)) { - if (TempBlock.isTempBlock(block)) { - TempBlock tb = TempBlock.get(block); - byte full = 0x0; - if (tb.state.getRawData() != full - && (tb.state.getType() != Material.WATER || tb.state - .getType() != Material.STATIONARY_WATER)) { - continue; - } - } - return block; - } - } - return null; - } - - public static boolean hasPermission(Player player, String ability) { - if (player.hasPermission("bending.ability." + ability)) return true; - return false; - } - - public static boolean isAbilityInstalled(String name, String author) { - String ability = getAbility(name); - if (ability == null) return false; - if (AbilityModuleManager.authors.get(name).equalsIgnoreCase(author)) return true; - return false; - } - - public static boolean isAdjacentToFrozenBlock(Block block) { - BlockFace[] faces = { BlockFace.DOWN, BlockFace.UP, BlockFace.NORTH, - BlockFace.EAST, BlockFace.WEST, BlockFace.SOUTH }; - boolean adjacent = false; - for (BlockFace face : faces) { - if (FreezeMelt.frozenblocks.containsKey((block.getRelative(face)))) - adjacent = true; - } - - return adjacent; - } - - public static boolean isAdjacentToThreeOrMoreSources(Block block) { - if (TempBlock.isTempBlock(block)) - return false; - int sources = 0; - byte full = 0x0; - BlockFace[] faces = { BlockFace.EAST, BlockFace.WEST, BlockFace.NORTH, - BlockFace.SOUTH }; - for (BlockFace face : faces) { - Block blocki = block.getRelative(face); - if ((blocki.getType() == Material.WATER || blocki.getType() == Material.STATIONARY_WATER) - && blocki.getData() == full - && WaterManipulation.canPhysicsChange(blocki)) - sources++; - if (FreezeMelt.frozenblocks.containsKey(blocki)) { - if (FreezeMelt.frozenblocks.get(blocki) == full) - sources++; - } else if (blocki.getType() == Material.ICE) { - sources++; - } - } - if (sources >= 2) - return true; - return false; - } - - public static boolean isAirAbility(String ability) { - return AbilityModuleManager.airbendingabilities.contains(ability); - } - - public static boolean isBender(String player, Element element) { - BendingPlayer bPlayer = getBendingPlayer(player); - if (bPlayer == null) return false; - if (bPlayer.hasElement(element)) return true; - return false; - } - - public static boolean isChiAbility(String ability) { - return AbilityModuleManager.chiabilities.contains(ability); - } - - public static boolean isChiBlocked(String player) { - return Methods.getBendingPlayer(player).isChiBlocked(); - // long currTime = System.currentTimeMillis(); - // long duration = ProjectKorra.plugin.getConfig().getLong("Abilities.Chi.Passive.BlockChi.Duration"); - // if (BendingPlayer.blockedChi.contains(player)) { - // if (BendingPlayer.blockedChi.get(player) + ChiPassive.duration >= System.currentTimeMillis()) { - // return true; - // } else { - // BendingPlayer.blockedChi.remove(player); - // return false; - // } - // } else { - // Bukkit.getServer().broadcastMessage("test"); - // return false; - // } - } - - public static boolean isDay(World world) { - long time = world.getTime(); - if (time >= 23500 || time <= 12500) { - return true; - } - return false; - } - - public static boolean isEarthAbility(String ability) { - return AbilityModuleManager.earthbendingabilities.contains(ability); - } - - public static boolean isEarthbendable(Player player, Block block) { - return isEarthbendable(player, "RaiseEarth", block); - } - - public static boolean isEarthbendable(Player player, String ability, - Block block) { - if (isRegionProtectedFromBuild(player, ability, - block.getLocation())) - return false; - Material material = block.getType(); - - // if ((material == Material.STONE) || (material == Material.CLAY) - // || (material == Material.COAL_ORE) - // || (material == Material.DIAMOND_ORE) - // || (material == Material.DIRT) - // || (material == Material.GOLD_ORE) - // || (material == Material.GRASS) - // || (material == Material.GRAVEL) - // || (material == Material.IRON_ORE) - // || (material == Material.LAPIS_ORE) - // || (material == Material.NETHERRACK) - // || (material == Material.REDSTONE_ORE) - // || (material == Material.SAND) - // || (material == Material.SANDSTONE)) { - // return true; - // } - for (String s : ProjectKorra.plugin.getConfig().getStringList("Properties.Earth.EarthbendableBlocks")) { - - if (material == Material.getMaterial(s)) { - - return true; - - } - - } - return false; - } - - public static boolean isFireAbility(String ability) { - return AbilityModuleManager.firebendingabilities.contains(ability); - } - - public static boolean isFullMoon(World world) { - long days = world.getFullTime() / 24000; - long phase = days%8; - if (phase == 0) { - return true; - } - return false; - } - public static boolean isHarmlessAbility(String ability) { - return AbilityModuleManager.harmlessabilities.contains(ability); - } - - public static boolean isImportEnabled() { - return plugin.getConfig().getBoolean("Properties.ImportEnabled"); - } - - - public static boolean isMeltable(Block block) { - if (block.getType() == Material.ICE || block.getType() == Material.SNOW || block.getType() == Material.PACKED_ICE) { - return true; - } - return false; - } - - public static boolean isMetalbendingAbility(String ability) { - if (AbilityModuleManager.metalbendingabilities.contains(ability)) return true; - return false; - } - - public static boolean isMetalBlock(Block block) { - if (block.getType() == Material.GOLD_BLOCK - || block.getType() == Material.IRON_BLOCK - || block.getType() == Material.IRON_ORE - || block.getType() == Material.GOLD_ORE - || block.getType() == Material.QUARTZ_BLOCK - || block.getType() == Material.QUARTZ_ORE) - return true; - return false; - } - - public static boolean isNight(World world) { - if (world.getEnvironment() == Environment.NETHER || world.getEnvironment() == Environment.THE_END) { - return false; - } - - long time = world.getTime(); - if (time >= 12950 && time <= 23050) { - return true; - } - return false; - } - - public static boolean isObstructed(Location location1, Location location2) { - Vector loc1 = location1.toVector(); - Vector loc2 = location2.toVector(); - - Vector direction = loc2.subtract(loc1); - direction.normalize(); - - Location loc; - - double max = location1.distance(location2); - - for (double i = 0; i <= max; i++) { - loc = location1.clone().add(direction.clone().multiply(i)); - Material type = loc.getBlock().getType(); - if (type != Material.AIR - && !Arrays.asList(transparentToEarthbending).contains( - type.getId())) - return true; - } - - return false; - } - - public static boolean isPlant(Block block) { - if (Arrays.asList(plantIds).contains(block.getTypeId())) return true; - return false; + return Arrays.asList(AbilityModuleManager.harmlessabilities).contains(ability); } public static boolean isRegionProtectedFromBuild(Player player, @@ -1105,26 +1376,12 @@ public class Methods { Set ignite = AbilityModuleManager.igniteabilities; Set explode = AbilityModuleManager.explodeabilities; - // List ignite = new ArrayList(); - // ignite.add(Abilities.Blaze); - // List explode = new ArrayList(); - // explode.add(Abilities.FireBlast); - // explode.add(Abilities.Lightning); if (ability == null && allowharmless) return false; if (isHarmlessAbility(ability) && allowharmless) return false; - // if (ignite.contains(ability)) { - // BlockIgniteEvent event = new BlockIgniteEvent(location.getBlock(), - // IgniteCause.FLINT_AND_STEEL, player); - // Bending.plugin.getServer().getPluginManager().callEvent(event); - // if (event.isCancelled()) - // return false; - // event.setCancelled(true); - // } - PluginManager pm = Bukkit.getPluginManager(); Plugin wgp = pm.getPlugin("WorldGuard"); @@ -1193,23 +1450,11 @@ public class Methods { } if (fcp != null && mcore != null && respectFactions) { - if (ignite.contains(ability)) { - - } - - if (explode.contains(ability)) { - - } - - if (!FactionsListenerMain.canPlayerBuildAt(player, - PS.valueOf(loc.getBlock()), false)) { + if (!FactionsListenerMain.canPlayerBuildAt(player, PS.valueOf(loc.getBlock()), false)) { return true; + }else{ + return false; } - - // if (!FactionsBlockListener.playerCanBuildDestroyBlock(player, - // location, "build", true)) { - // return true; - // } } if (twnp != null && respectTowny) { @@ -1289,278 +1534,63 @@ public class Methods { return false; } - public static boolean isSolid(Block block) { - if (Arrays.asList(nonOpaque).contains(block.getTypeId())) return false; - return true; + public static boolean canMetalbend(Player player) { + if (player.hasPermission("bending.earth.metalbending")) return true; + return false; } - public static boolean isTransparentToEarthbending(Player player, Block block) { - return isTransparentToEarthbending(player, "RaiseEarth", block); - } - - public static boolean isTransparentToEarthbending(Player player, - String ability, Block block) { - if (isRegionProtectedFromBuild(player, ability, - block.getLocation())) - return false; - if (Arrays.asList(transparentToEarthbending).contains(block.getTypeId())) + public static boolean isMetalBlock(Block block) { + if (block.getType() == Material.GOLD_BLOCK + || block.getType() == Material.IRON_BLOCK + || block.getType() == Material.IRON_ORE + || block.getType() == Material.GOLD_ORE + || block.getType() == Material.QUARTZ_BLOCK + || block.getType() == Material.QUARTZ_ORE) return true; return false; } - public static boolean isWater(Block block) { - if (block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER) return true; + private static Integer[] plantIds = { 6, 18, 31, 32, 37, 38, 39, 40, 59, 81, 83, 86, 99, 100, 103, 104, 105, 106, 111, 161, 175}; + public static Integer[] transparentToEarthbending = {0, 6, 8, 9, 10, 11, 30, 31, 32, 37, 38, 39, 40, 50, 51, 59, 78, 83, 106}; + public static Integer[] nonOpaque = {0, 6, 8, 9, 10, 11, 27, 28, 30, 31, 32, 37, 38, 39, 40, 50, 51, 55, 59, 66, 68, 69, 70, 72, + 75, 76, 77, 78, 83, 90, 93, 94, 104, 105, 106, 111, 115, 119, 127, 131, 132}; + + public static boolean isMetalbendingAbility(String ability) { + if (AbilityModuleManager.metalbendingabilities.contains(ability)) return true; return false; } - public static boolean isWaterAbility(String ability) { - return AbilityModuleManager.waterbendingabilities.contains(ability); + public static boolean isImportEnabled() { + return plugin.getConfig().getBoolean("Properties.ImportEnabled"); } - public static boolean isWaterbendable(Block block, Player player) { - byte full = 0x0; - if (TempBlock.isTempBlock(block)) return false; - if ((block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER) && block.getData() == full) return true; - if (block.getType() == Material.ICE || block.getType() == Material.SNOW || block.getType() == Material.PACKED_ICE) return true; - if (canPlantbend(player) && isPlant(block)) return true; + public static List getCircle(Location loc, int radius, int height, boolean hollow, boolean sphere, int plusY){ + List circleblocks = new ArrayList(); + int cx = loc.getBlockX(); + int cy = loc.getBlockY(); + int cz = loc.getBlockZ(); + + for(int x = cx - radius; x <= cx + radius; x++){ + for (int z = cz - radius; z <= cz + radius; z++){ + for(int y = (sphere ? cy - radius : cy); y < (sphere ? cy + radius : cy + height); y++){ + double dist = (cx - x) * (cx - x) + (cz - z) * (cz - z) + (sphere ? (cy - y) * (cy - y) : 0); + + if(dist < radius * radius && !(hollow && dist < (radius - 1) * (radius - 1))){ + Location l = new Location(loc.getWorld(), x, y + plusY, z); + circleblocks.add(l); + } + } + } + } + + return circleblocks; + } + + public static boolean canBloodbend(Player player) { + if (player.hasPermission("bending.ability.bloodbending")) return true; return false; } - - public static boolean isWeapon(Material mat) { - if (mat == null) return false; - if (mat == Material.WOOD_AXE || mat == Material.WOOD_PICKAXE - || mat == Material.WOOD_SPADE || mat == Material.WOOD_SWORD - - || mat == Material.STONE_AXE || mat == Material.STONE_PICKAXE - || mat == Material.STONE_SPADE || mat == Material.STONE_SWORD - - || mat == Material.IRON_AXE || mat == Material.IRON_PICKAXE - || mat == Material.IRON_SWORD || mat == Material.IRON_SPADE - - || mat == Material.DIAMOND_AXE || mat == Material.DIAMOND_PICKAXE - || mat == Material.DIAMOND_SWORD || mat == Material.DIAMOND_SPADE) - return true; - return false; - } - - public static void moveEarth(Player player, Block block, Vector direction, - int chainlength) { - moveEarth(player, block, direction, chainlength, true); - } - - public static boolean moveEarth(Player player, Block block, - Vector direction, int chainlength, boolean throwplayer) { - if (isEarthbendable(player, block) - && !isRegionProtectedFromBuild(player, "RaiseEarth", - block.getLocation())) { - - boolean up = false; - boolean down = false; - Vector norm = direction.clone().normalize(); - if (norm.dot(new Vector(0, 1, 0)) == 1) { - up = true; - } else if (norm.dot(new Vector(0, -1, 0)) == 1) { - down = true; - } - Vector negnorm = norm.clone().multiply(-1); - - Location location = block.getLocation(); - - ArrayList blocks = new ArrayList(); - for (double j = -2; j <= chainlength; j++) { - Block checkblock = location.clone() - .add(negnorm.clone().multiply(j)).getBlock(); - if (!tempnophysics.contains(checkblock)) { - blocks.add(checkblock); - tempnophysics.add(checkblock); - } - } - - Block affectedblock = location.clone().add(norm).getBlock(); - if (EarthPassive.isPassiveSand(block)) { - EarthPassive.revertSand(block); - } - // if (block.getType() == Material.SAND) { - // block.setType(Material.SANDSTONE); - // } - - if (affectedblock == null) - return false; - if (isTransparentToEarthbending(player, affectedblock)) { - if (throwplayer) { - for (Entity entity : getEntitiesAroundPoint( - affectedblock.getLocation(), 1.75)) { - if (entity instanceof LivingEntity) { - LivingEntity lentity = (LivingEntity) entity; - if (lentity.getEyeLocation().getBlockX() == affectedblock - .getX() - && lentity.getEyeLocation().getBlockZ() == affectedblock - .getZ()) - if (!(entity instanceof FallingBlock)) - entity.setVelocity(norm.clone().multiply( - .75)); - } else { - if (entity.getLocation().getBlockX() == affectedblock - .getX() - && entity.getLocation().getBlockZ() == affectedblock - .getZ()) - if (!(entity instanceof FallingBlock)) - entity.setVelocity(norm.clone().multiply( - .75)); - } - } - - } - - if (up) { - Block topblock = affectedblock.getRelative(BlockFace.UP); - if (topblock.getType() != Material.AIR) { - breakBlock(affectedblock); - } else if (!affectedblock.isLiquid() - && affectedblock.getType() != Material.AIR) { - // affectedblock.setType(Material.GLASS); - moveEarthBlock(affectedblock, topblock); - } - } else { - breakBlock(affectedblock); - } - - // affectedblock.setType(block.getType()); - // affectedblock.setData(block.getData()); - // - // addTempEarthBlock(block, affectedblock); - moveEarthBlock(block, affectedblock); - block.getWorld().playEffect(block.getLocation(), - Effect.GHAST_SHOOT, 0, 4); - - for (double i = 1; i < chainlength; i++) { - affectedblock = location - .clone() - .add(negnorm.getX() * i, negnorm.getY() * i, - negnorm.getZ() * i).getBlock(); - if (!isEarthbendable(player, affectedblock)) { - // verbose(affectedblock.getType()); - if (down) { - if (isTransparentToEarthbending(player, - affectedblock) - && !affectedblock.isLiquid() - && affectedblock.getType() != Material.AIR) { - moveEarthBlock(affectedblock, block); - } - } - // if (!Tools.adjacentToThreeOrMoreSources(block) - // && Tools.isWater(block)) { - // block.setType(Material.AIR); - // } else { - // byte full = 0x0; - // block.setType(Material.WATER); - // block.setData(full); - // } - break; - } - if (EarthPassive.isPassiveSand(affectedblock)) { - EarthPassive.revertSand(affectedblock); - } - // if (affectedblock.getType() == Material.SAND) { - // affectedblock.setType(Material.SANDSTONE); - // } - if (block == null) { - for (Block checkblock : blocks) { - tempnophysics.remove(checkblock); - } - return false; - } - // block.setType(affectedblock.getType()); - // block.setData(affectedblock.getData()); - // addTempEarthBlock(affectedblock, block); - moveEarthBlock(affectedblock, block); - block = affectedblock; - } - - int i = chainlength; - affectedblock = location - .clone() - .add(negnorm.getX() * i, negnorm.getY() * i, - negnorm.getZ() * i).getBlock(); - if (!isEarthbendable(player, affectedblock)) { - if (down) { - if (isTransparentToEarthbending(player, affectedblock) - && !affectedblock.isLiquid()) { - moveEarthBlock(affectedblock, block); - } - } - } - - } else { - for (Block checkblock : blocks) { - tempnophysics.remove(checkblock); - } - return false; - } - for (Block checkblock : blocks) { - tempnophysics.remove(checkblock); - } - return true; - } - return false; - } - - public static void moveEarth(Player player, Location location, - Vector direction, int chainlength) { - moveEarth(player, location, direction, chainlength, true); - } - - public static void moveEarth(Player player, Location location, - Vector direction, int chainlength, boolean throwplayer) { - Block block = location.getBlock(); - moveEarth(player, block, direction, chainlength, throwplayer); - } - - public static void moveEarthBlock(Block source, Block target) { - byte full = 0x0; - Information info; - if (movedearth.containsKey(source)) { - // verbose("Moving something already moved."); - info = movedearth.get(source); - info.setTime(System.currentTimeMillis()); - movedearth.remove(source); - movedearth.put(target, info); - } else { - // verbose("Moving something for the first time."); - info = new Information(); - info.setBlock(source); - // info.setType(source.getType()); - // info.setData(source.getData()); - info.setTime(System.currentTimeMillis()); - info.setState(source.getState()); - movedearth.put(target, info); - } - - if (isAdjacentToThreeOrMoreSources(source)) { - source.setType(Material.WATER); - source.setData(full); - } else { - source.setType(Material.AIR); - } - if (info.getState().getType() == Material.SAND) { - target.setType(Material.SANDSTONE); - } else { - target.setType(info.getState().getType()); - target.setData(info.getState().getRawData()); - } - } - - public static void playAirbendingParticles(Location loc) { - for (int i = 0; i < 20; i++) { - ParticleEffect.CLOUD.display(loc, (float) Math.random(), (float) Math.random(), (float) Math.random(), 0, 1); - } - } - - public static void playFocusWaterEffect(Block block) { - block.getWorld().playEffect(block.getLocation(), Effect.SMOKE, 4, 20); - } - public static void reloadPlugin() { for (Player player: Bukkit.getOnlinePlayers()) { Methods.saveBendingPlayer(player.getName()); @@ -1579,306 +1609,4 @@ public class Methods { } } - public static void removeAllEarthbendedBlocks() { - for (Block block : movedearth.keySet()) { - revertBlock(block); - } - - for (Integer i : tempair.keySet()) { - revertAirBlock(i, true); - } - } - - public static void removeBlock(Block block) { - if (isAdjacentToThreeOrMoreSources(block)) { - block.setType(Material.WATER); - block.setData((byte) 0x0); - } else { - block.setType(Material.AIR); - } - } - - public static void removeRevertIndex(Block block) { - if (movedearth.containsKey(block)) { - Information info = movedearth.get(block); - if (block.getType() == Material.SANDSTONE - && info.getType() == Material.SAND) - block.setType(Material.SAND); - if (EarthColumn.blockInAllAffectedBlocks(block)) - EarthColumn.revertBlock(block); - - EarthColumn.resetBlock(block); - - movedearth.remove(block); - } - } - - public static void removeSpouts(Location location, double radius, - Player sourceplayer) { - WaterSpout.removeSpouts(location, radius, sourceplayer); - AirSpout.removeSpouts(location, radius, sourceplayer); - } - - public static void removeSpouts(Location location, Player sourceplayer) { - removeSpouts(location, 1.5, sourceplayer); - } - - public static void removeUnusableAbilities(String player) { - BendingPlayer bPlayer = getBendingPlayer(player); - HashMap slots = bPlayer.getAbilities(); - HashMap finalabilities = new HashMap(); - try { - for (int i: slots.keySet()) { - if (canBend(player, slots.get(i))) { - finalabilities.put(i, slots.get(i)); - } - } - bPlayer.abilities = finalabilities; - } catch (Exception ex) { - - } - - } - - public static void revertAirBlock(int i) { - revertAirBlock(i, false); - } - - public static void revertAirBlock(int i, boolean force) { - if (!tempair.containsKey(i)) - return; - Information info = tempair.get(i); - Block block = info.getState().getBlock(); - if (block.getType() != Material.AIR && !block.isLiquid()) { - if (force || !movedearth.containsKey(block)) { - dropItems( - block, - getDrops(block, info.getState().getType(), info - .getState().getRawData(), pickaxe)); - // ItemStack item = new ItemStack(info.getType()); - // item.setData(new MaterialData(info.getType(), - // info.getData())); - // block.getWorld().dropItem(block.getLocation(), item); - tempair.remove(i); - } else { - info.setTime(info.getTime() + 10000); - } - return; - } else { - // block.setType(info.getType()); - // block.setData(info.getData()); - info.getState().update(true); - tempair.remove(i); - } - } - public static boolean revertBlock(Block block) { - byte full = 0x0; - if (movedearth.containsKey(block)) { - Information info = movedearth.get(block); - Block sourceblock = info.getState().getBlock(); - - if (info.getState().getType() == Material.AIR) { - movedearth.remove(block); - return true; - } - - if (block.equals(sourceblock)) { - // verbose("Equals!"); - // if (block.getType() == Material.SANDSTONE - // && info.getState().getType() == Material.SAND) - // block.setType(Material.SAND); - info.getState().update(true); - if (EarthColumn.blockInAllAffectedBlocks(sourceblock)) - EarthColumn.revertBlock(sourceblock); - if (EarthColumn.blockInAllAffectedBlocks(block)) - EarthColumn.revertBlock(block); - EarthColumn.resetBlock(sourceblock); - EarthColumn.resetBlock(block); - movedearth.remove(block); - return true; - } - - if (movedearth.containsKey(sourceblock)) { - addTempAirBlock(block); - movedearth.remove(block); - return true; - // verbose("Block: " + block); - // verbose("Sourceblock: " + sourceblock); - // verbose("StartBlock: " + startblock); - // if (startblock != null) { - // if (startblock.equals(sourceblock)) { - // sourceblock.setType(info.getType()); - // sourceblock.setData(info.getData()); - // if (adjacentToThreeOrMoreSources(block)) { - // block.setType(Material.WATER); - // block.setData(full); - // } else { - // block.setType(Material.AIR); - // } - // movedearth.get(startblock).setInteger(10); - // if (EarthColumn - // .blockInAllAffectedBlocks(sourceblock)) - // EarthColumn.revertBlock(sourceblock); - // if (EarthColumn.blockInAllAffectedBlocks(block)) - // EarthColumn.revertBlock(block); - // EarthColumn.resetBlock(sourceblock); - // EarthColumn.resetBlock(block); - // movedearth.remove(block); - // return true; - // } - // - // } else { - // startblock = block; - // } - // revertBlock(sourceblock, startblock, true); - } - - if (sourceblock.getType() == Material.AIR || sourceblock.isLiquid()) { - // sourceblock.setType(info.getType()); - // sourceblock.setData(info.getData()); - info.getState().update(true); - } else { - // if (info.getType() != Material.AIR) { - // ItemStack item = new ItemStack(info.getType()); - // item.setData(new MaterialData(info.getType(), info - // .getData())); - // block.getWorld().dropItem(block.getLocation(), item); - dropItems( - block, - getDrops(block, info.getState().getType(), info - .getState().getRawData(), pickaxe)); - // } - } - - // if (info.getInteger() != 10) { - if (isAdjacentToThreeOrMoreSources(block)) { - block.setType(Material.WATER); - block.setData(full); - } else { - block.setType(Material.AIR); - } - // } - - if (EarthColumn.blockInAllAffectedBlocks(sourceblock)) - EarthColumn.revertBlock(sourceblock); - if (EarthColumn.blockInAllAffectedBlocks(block)) - EarthColumn.revertBlock(block); - EarthColumn.resetBlock(sourceblock); - EarthColumn.resetBlock(block); - movedearth.remove(block); - } - return true; - } - public static Vector rotateVectorAroundVector(Vector axis, Vector rotator, - double degrees) { - double angle = Math.toRadians(degrees); - Vector rotation = axis.clone(); - Vector rotate = rotator.clone(); - rotation = rotation.normalize(); - - Vector thirdaxis = rotation.crossProduct(rotate).normalize() - .multiply(rotate.length()); - - return rotate.multiply(Math.cos(angle)).add( - thirdaxis.multiply(Math.sin(angle))); - - // return new Vector(x, z, y); - } - - public static void saveBendingPlayer(String player) { - BendingPlayer bPlayer = BendingPlayer.players.get(player); - if (bPlayer == null) return; - String uuid = bPlayer.uuid.toString(); - - StringBuilder elements = new StringBuilder(); - if (bPlayer.hasElement(Element.Air)) elements.append("a"); - if (bPlayer.hasElement(Element.Water)) elements.append("w"); - if (bPlayer.hasElement(Element.Earth)) elements.append("e"); - if (bPlayer.hasElement(Element.Fire)) elements.append("f"); - if (bPlayer.hasElement(Element.Chi)) elements.append("c"); - - HashMap abilities = bPlayer.abilities; - - for (int i = 1; i <= 9; i++) { - DBConnection.sql.modifyQuery("UPDATE pk_players SET slot" + i +" = '" + (abilities.get(i) == null ? null : abilities.get(i)) + "' WHERE uuid = '" + uuid + "'"); - } - - DBConnection.sql.modifyQuery("UPDATE pk_players SET element = '" + elements + "' WHERE uuid = '" + uuid + "'"); - boolean permaRemoved = bPlayer.permaRemoved; - - DBConnection.sql.modifyQuery("UPDATE pk_players SET permaremoved = '" + (permaRemoved ? "true" : " false") +"' WHERE uuid = '" + uuid + "'"); - } - - public static void stopBending() { - List abilities = AbilityModuleManager.ability; - for (AbilityModule ab: abilities) { - ab.stop(); - } - AirBlast.removeAll(); - AirBubble.removeAll(); - AirShield.instances.clear(); - AirSuction.instances.clear(); - AirScooter.removeAll(); - AirSpout.removeAll(); - AirSwipe.instances.clear(); - Tornado.instances.clear(); - AirBurst.removeAll(); - - Catapult.removeAll(); - CompactColumn.removeAll(); - EarthBlast.removeAll(); - EarthColumn.removeAll(); - EarthPassive.removeAll(); - EarthArmor.removeAll(); - EarthTunnel.instances.clear(); - Shockwave.removeAll(); - Tremorsense.removeAll(); - - FreezeMelt.removeAll(); - IceSpike.removeAll(); - IceSpike2.removeAll(); - WaterManipulation.removeAll(); - WaterSpout.removeAll(); - WaterWall.removeAll(); - Wave.removeAll(); - Plantbending.regrowAll(); - OctopusForm.removeAll(); - Bloodbending.instances.clear(); - - FireStream.removeAll(); - Fireball.removeAll(); - WallOfFire.instances.clear(); - Lightning.instances.clear(); - FireShield.removeAll(); - FireBlast.removeAll(); - FireBurst.removeAll(); - FireJet.instances.clear(); - Cook.removeAll(); - Illumination.removeAll(); - - RapidPunch.instance.clear(); - - Flight.removeAll(); - WaterReturn.removeAll(); - TempBlock.removeAll(); - removeAllEarthbendedBlocks(); - - EarthPassive.removeAll(); - } - - public static double waterbendingNightAugment(double value, World world) { - if (isNight(world)) { - if (isFullMoon(world)) { - return plugin.getConfig().getDouble("Properties.Water.FullMoonFactor") * value; - } else { - return plugin.getConfig().getDouble("Properties.Water.NightFactor") * value; - } - } - return value; - } - - public Methods(ProjectKorra plugin) { - Methods.plugin = plugin; - } - } diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirBlast.java b/src/com/projectkorra/ProjectKorra/airbending/AirBlast.java index df51b4f1..2ba7bca7 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirBlast.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirBlast.java @@ -16,7 +16,6 @@ import com.projectkorra.ProjectKorra.Flight; import com.projectkorra.ProjectKorra.Methods; import com.projectkorra.ProjectKorra.ProjectKorra; import com.projectkorra.ProjectKorra.Ability.AvatarState; -import com.projectkorra.ProjectKorra.Utilities.ParticleEffect; public class AirBlast { diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirBurst.java b/src/com/projectkorra/ProjectKorra/airbending/AirBurst.java index d56e36c3..f4005c52 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirBurst.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirBurst.java @@ -3,7 +3,6 @@ package com.projectkorra.ProjectKorra.airbending; import java.util.ArrayList; import java.util.concurrent.ConcurrentHashMap; -import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirScooter.java b/src/com/projectkorra/ProjectKorra/airbending/AirScooter.java index 3cad18c1..63db200f 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirScooter.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirScooter.java @@ -3,7 +3,6 @@ package com.projectkorra.ProjectKorra.airbending; import java.util.ArrayList; import java.util.concurrent.ConcurrentHashMap; -import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirShield.java b/src/com/projectkorra/ProjectKorra/airbending/AirShield.java index 30ada07d..7ef7b9aa 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirShield.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirShield.java @@ -4,7 +4,6 @@ import java.util.HashMap; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirSpout.java b/src/com/projectkorra/ProjectKorra/airbending/AirSpout.java index f6afc8ea..9c20a294 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirSpout.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirSpout.java @@ -3,7 +3,6 @@ package com.projectkorra.ProjectKorra.airbending; import java.util.ArrayList; import java.util.concurrent.ConcurrentHashMap; -import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirSuction.java b/src/com/projectkorra/ProjectKorra/airbending/AirSuction.java index dc01c0f1..8636428b 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirSuction.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirSuction.java @@ -23,8 +23,7 @@ public class AirSuction { public static ConcurrentHashMap instances = new ConcurrentHashMap(); private static ConcurrentHashMap cooldowns = new ConcurrentHashMap(); private static ConcurrentHashMap origins = new ConcurrentHashMap(); - // private static ConcurrentHashMap timers = new - // ConcurrentHashMap(); + static final long soonesttime = config.getLong("Properties.GlobalCooldown"); static final double maxspeed = AirBlast.maxspeed; @@ -36,7 +35,6 @@ public class AirSuction { private static double affectingradius = config.getDouble("Abilities.Air.AirSuction.Radius"); private static double pushfactor = config.getDouble("Abilities.Air.AirSuction.Push"); private static double originselectrange = 10; - // private static long interval = AirBlast.interval; private Location location; private Location origin; diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirSwipe.java b/src/com/projectkorra/ProjectKorra/airbending/AirSwipe.java index 3f5e73b3..a103df60 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirSwipe.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirSwipe.java @@ -6,7 +6,6 @@ import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; diff --git a/src/com/projectkorra/ProjectKorra/airbending/Tornado.java b/src/com/projectkorra/ProjectKorra/airbending/Tornado.java index ffa19a0e..1631cbe7 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/Tornado.java +++ b/src/com/projectkorra/ProjectKorra/airbending/Tornado.java @@ -3,7 +3,6 @@ package com.projectkorra.ProjectKorra.airbending; import java.util.ArrayList; import java.util.concurrent.ConcurrentHashMap; -import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; diff --git a/src/com/projectkorra/ProjectKorra/firebending/FireBurst.java b/src/com/projectkorra/ProjectKorra/firebending/FireBurst.java index ed3f7a40..1dea9de3 100644 --- a/src/com/projectkorra/ProjectKorra/firebending/FireBurst.java +++ b/src/com/projectkorra/ProjectKorra/firebending/FireBurst.java @@ -11,7 +11,6 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import com.projectkorra.ProjectKorra.BendingPlayer; import com.projectkorra.ProjectKorra.Methods; import com.projectkorra.ProjectKorra.ProjectKorra; import com.projectkorra.ProjectKorra.Ability.AvatarState; diff --git a/src/config.yml b/src/config.yml index 83872fdf..1d2d61a7 100644 --- a/src/config.yml +++ b/src/config.yml @@ -38,6 +38,7 @@ Properties: CanBendWithWeapons: false NightFactor: 1.5 FullMoonFactor: 3.0 + CanBendPackedIce: true Earth: RevertEarthbending: true SafeRevert: true diff --git a/src/plugin.yml b/src/plugin.yml index cbbeba51..0244b5db 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: ProjectKorra author: ProjectKorra -version: 1.3.0 BETA 6 +version: 1.3.0 BETA 8 main: com.projectkorra.ProjectKorra.ProjectKorra commands: projectkorra: