diff --git a/.classpath b/.classpath
index 218bab53..80c599da 100644
--- a/.classpath
+++ b/.classpath
@@ -2,16 +2,22 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.gitignore b/.gitignore
index 52f6878b..9cf427c9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,4 +37,10 @@ Icon
.Spotlight-V100
.Trashes
-bin/
\ No newline at end of file
+bin/
+*.classpath
+.idea/.name
+*.xml
+*.class
+*.class
+ProjectKorra.iml
\ No newline at end of file
diff --git a/Dev Builds/Korra.jar b/Dev Builds/Korra.jar
index 578d2b9b..b4837c31 100644
Binary files a/Dev Builds/Korra.jar and b/Dev Builds/Korra.jar differ
diff --git a/out/production/ProjectKorra/plugin.yml b/out/production/ProjectKorra/plugin.yml
new file mode 100644
index 00000000..37e8afeb
--- /dev/null
+++ b/out/production/ProjectKorra/plugin.yml
@@ -0,0 +1,156 @@
+name: ProjectKorra
+author: ProjectKorra
+version: 1.6.0 BETA 14
+main: com.projectkorra.ProjectKorra.ProjectKorra
+softdepend: [PreciousStones, WorldGuard, WorldEdit, Factions, MassiveCore, GriefPrevention, Towny, NoCheatPlus, LWC]
+commands:
+ projectkorra:
+ aliases: [b,bending,mtla,tla,korra,pk,bend]
+ usage: /
+permissions:
+ bending.admin:
+ default: op
+ description: Grants access to all commands and abilities.
+ children:
+ bending.player: true
+ bending.command.reload: true
+ bending.admin.permaremove: true
+ bending.command.avatar: true
+ bending.command.add.others: true
+ bending.command.add: true
+ bending.command.rechoose: true
+ bending.admin.choose: true
+ bending.ability.AvatarState: true
+ bending.ability.Bloodbending: true
+ bending.ability.Flight: true
+ bending.command.import: true
+ bending.command.toggle.all: true
+ bending.command.give: true
+ bending.command.invincible: true
+ bending.admin.debug: true
+ bending.admin.remove: true
+ bending.player:
+ default: true
+ description: Grants access to most abilities and basic commands.
+ children:
+ bending.command.bind: true
+ bending.command.display: true
+ bending.command.toggle: true
+ bending.command.choose: true
+ bending.command.version: true
+ bending.command.help: true
+ bending.command.clear: true
+ bending.command.who: true
+ bending.command.preset.list: true
+ bending.command.preset.create.2: true
+ bending.command.preset.create: true
+ bending.command.preset.bind: true
+ bending.command.preset.delete: true
+ bending.air: true
+ bending.water: true
+ bending.earth: true
+ bending.fire: true
+ bending.chi: true
+ bending.air:
+ default: true
+ description: Grants access to all airbending abilities.
+ children:
+ bending.ability.AirBlast: true
+ bending.ability.AirBubble: true
+ bending.ability.AirBurst: true
+ bending.ability.AirScooter: true
+ bending.ability.AirShield: true
+ bending.ability.AirSpout: true
+ bending.ability.AirSuction: true
+ bending.ability.AirSwipe: true
+ bending.ability.Suffocate: true
+ bending.ability.Tornado: true
+ bending.ability.AirCombo: true
+ bending.air.passive: true
+ bending.air.flight: true
+ bending.water:
+ default: true
+ description: Grants access to most waterbending abilities.
+ children:
+ bending.ability.HealingWaters: true
+ bending.ability.IceBlast: true
+ bending.ability.IceSpike: true
+ bending.ability.OctopusForm: true
+ bending.ability.PhaseChange: true
+ bending.ability.Surge: true
+ bending.ability.Torrent: true
+ bending.ability.WaterBubble: true
+ bending.ability.WaterManipulation: true
+ bending.ability.WaterSpout: true
+ bending.ability.WaterSpout.Wave: true
+ bending.ability.WaterCombo: true
+ bending.water.plantbending: true
+ bending.message.nightmessage: true
+ bending.water.passive: true
+ bending.water.icebending: true
+ bending.water.healing: true
+ bending.earth:
+ default: true
+ description: Grants access to all Earthbending abilities.
+ children:
+ bending.ability.Catapult: true
+ bending.ability.Collapse: true
+ bending.ability.EarthArmor: true
+ bending.ability.EarthBlast: true
+ bending.ability.EarthGrab: true
+ bending.ability.EarthTunnel: true
+ bending.ability.RaiseEarth: true
+ bending.ability.Shockwave: true
+ bending.ability.Tremorsense: true
+ bending.ability.Extraction: true
+ bending.ability.MetalClips: true
+ bending.ability.MetalClips.loot: false
+ bending.ability.MetalClips.4clips: false
+ bending.earth.passive: true
+ bending.earth.metalbending: true
+ bending.earth.lavabending: true
+ bending.earth.sandbending: true
+ bending.earth.grapplinghook: true
+ bending.ability.LavaSurge: true
+ bending.ability.LavaFlow: true
+ bending.ability.EarthSmash: true
+ bending.fire:
+ default: true
+ description: Grants access to all firebending abilities.
+ children:
+ bending.ability.Blaze: true
+ bending.ability.FireBlast: true
+ bending.ability.FireBurst: true
+ bending.ability.FireJet: true
+ bending.ability.FireShield: true
+ bending.ability.HeatControl: true
+ bending.ability.Illumination: true
+ bending.ability.Lightning: true
+ bending.ability.WallOfFire: true
+ bending.ability.Combustion: true
+ bending.ability.FireCombo: true
+ bending.message.daymessage: true
+ bending.fire.passive: true
+ bending.fire.lightningbending: true
+ bending.fire.combustionbending: true
+ bending.chi:
+ default: true
+ description: Grants access to all ChiBlocking abilities.
+ children:
+ bending.ability.HighJump: true
+ bending.ability.Paralyze: true
+ bending.ability.RapidPunch: true
+ bending.ability.Smokescreen: true
+ bending.ability.WarriorStance: true
+ bending.ability.AcrobatStance: true
+ bending.ability.QuickStrike: true
+ bending.ability.SwiftKick: true
+ bending.ability.ChiCombo: true
+ bending.chi.passive: true
+ bending.chi.grapplinghook: true
+ bending.avatar:
+ default: false
+ description: Grants the Avatar Color.
+ bending.ability.MetalClips.loot:
+ default: false
+ description: Lets a Metalbender loot a player's inventory of its iron.
\ No newline at end of file
diff --git a/src/com/projectkorra/ProjectKorra/Ability/AbilityModuleManager.java b/src/com/projectkorra/ProjectKorra/Ability/AbilityModuleManager.java
index 4f635198..e2e9f7d4 100644
--- a/src/com/projectkorra/ProjectKorra/Ability/AbilityModuleManager.java
+++ b/src/com/projectkorra/ProjectKorra/Ability/AbilityModuleManager.java
@@ -207,74 +207,89 @@ public class AbilityModuleManager {
}
}
for (AbilityModule ab: ability) {
- //To check if EarthBlast == Earthblast or for example, EarthBlast == EARTHBLAST
- boolean succes = true;
- for(String enabledAbility : abilities){
- if(enabledAbility.equalsIgnoreCase(ab.getName())){
- succes = false;
- }
- }
- if (!succes)
- continue;
- ab.onThisLoad();
- abilities.add(ab.getName());
- for (StockAbilities a: StockAbilities.values()) {
- if (a.name().equalsIgnoreCase(ab.getName())){
- disabledStockAbilities.add(a.name());
- }
- }
- if (ab.getElement() == Element.Air.toString()) airbendingabilities.add(ab.getName());
- if (ab.getElement() == Element.Water.toString()) waterbendingabilities.add(ab.getName());
- if (ab.getElement() == Element.Earth.toString()) earthbendingabilities.add(ab.getName());
- if (ab.getElement() == Element.Fire.toString()) firebendingabilities.add(ab.getName());
- if (ab.getElement() == Element.Chi.toString()) chiabilities.add(ab.getName());
- if (ab.isShiftAbility()) shiftabilities.add(ab.getName());
- if (ab.isHarmlessAbility()) harmlessabilities.add(ab.getName());
-
- if (ab.getSubElement() != null)
- {
- subabilities.add(ab.getName());
- switch(ab.getSubElement())
- {
- case Bloodbending:
- bloodabilities.add(ab.getName());
- break;
- case Combustion:
- combustionabilities.add(ab.getName());
- break;
- case Flight:
- flightabilities.add(ab.getName());
- break;
- case Healing:
- healingabilities.add(ab.getName());
- break;
- case Icebending:
- iceabilities.add(ab.getName());
- break;
- case Lavabending:
- lavaabilities.add(ab.getName());
- break;
- case Lightning:
- lightningabilities.add(ab.getName());
- break;
- case Metalbending:
- metalabilities.add(ab.getName());
- break;
- case Plantbending:
- plantabilities.add(ab.getName());
- break;
- case Sandbending:
- sandabilities.add(ab.getName());
- break;
- case SpiritualProjection:
- spiritualprojectionabilities.add(ab.getName());
- break;
+ try {
+ //To check if EarthBlast == Earthblast or for example, EarthBlast == EARTHBLAST
+ boolean succes = true;
+ for(String enabledAbility : abilities){
+ if(enabledAbility.equalsIgnoreCase(ab.getName())){
+ succes = false;
+ }
}
+ if (!succes)
+ continue;
+ ab.onThisLoad();
+ abilities.add(ab.getName());
+ for (StockAbilities a: StockAbilities.values()) {
+ if (a.name().equalsIgnoreCase(ab.getName())){
+ disabledStockAbilities.add(a.name());
+ }
+ }
+ if (ab.getElement() == Element.Air.toString()) airbendingabilities.add(ab.getName());
+ if (ab.getElement() == Element.Water.toString()) waterbendingabilities.add(ab.getName());
+ if (ab.getElement() == Element.Earth.toString()) earthbendingabilities.add(ab.getName());
+ if (ab.getElement() == Element.Fire.toString()) firebendingabilities.add(ab.getName());
+ if (ab.getElement() == Element.Chi.toString()) chiabilities.add(ab.getName());
+ if (ab.isShiftAbility()) shiftabilities.add(ab.getName());
+ if (ab.isHarmlessAbility()) harmlessabilities.add(ab.getName());
+
+ if (ab.getSubElement() != null)
+ {
+ subabilities.add(ab.getName());
+ switch(ab.getSubElement())
+ {
+ case Bloodbending:
+ bloodabilities.add(ab.getName());
+ break;
+ case Combustion:
+ combustionabilities.add(ab.getName());
+ break;
+ case Flight:
+ flightabilities.add(ab.getName());
+ break;
+ case Healing:
+ healingabilities.add(ab.getName());
+ break;
+ case Icebending:
+ iceabilities.add(ab.getName());
+ break;
+ case Lavabending:
+ lavaabilities.add(ab.getName());
+ break;
+ case Lightning:
+ lightningabilities.add(ab.getName());
+ break;
+ case Metalbending:
+ metalabilities.add(ab.getName());
+ break;
+ case Plantbending:
+ plantabilities.add(ab.getName());
+ break;
+ case Sandbending:
+ sandabilities.add(ab.getName());
+ break;
+ case SpiritualProjection:
+ spiritualprojectionabilities.add(ab.getName());
+ break;
+ }
+ }
+
+ // if (ab.isMetalbendingAbility()) metalbendingabilities.add(ab.getName());
+ descriptions.put(ab.getName(), ab.getDescription());
+ authors.put(ab.getName(), ab.getAuthor());
+ } catch (AbstractMethodError e) { //If triggered means ability was made pre 1.6 BETA 8
+ ProjectKorra.log.warning("The ability " + ab.getName() + " is either broken or outdated. Please remove it!");
+ //e.printStackTrace();
+ ab.stop();
+ abilities.remove(ab.getName());
+ final AbilityModule skill = ab;
+ //Bellow to avoid ConcurrentModificationException
+ plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
+ public void run() {
+ ability.remove(skill);
+ }
+ }, 10);
+ continue;
}
-
- // if (ab.isMetalbendingAbility()) metalbendingabilities.add(ab.getName());
- descriptions.put(ab.getName(), ab.getDescription());
- authors.put(ab.getName(), ab.getAuthor());
}
Collections.sort(airbendingabilities);
diff --git a/src/com/projectkorra/ProjectKorra/Ability/Combo/ComboAbilityModule.java b/src/com/projectkorra/ProjectKorra/Ability/Combo/ComboAbilityModule.java
new file mode 100644
index 00000000..046ebf9f
--- /dev/null
+++ b/src/com/projectkorra/ProjectKorra/Ability/Combo/ComboAbilityModule.java
@@ -0,0 +1,127 @@
+package com.projectkorra.ProjectKorra.Ability.Combo;
+
+import com.projectkorra.ProjectKorra.ComboManager;
+import com.projectkorra.ProjectKorra.SubElement;
+import com.projectkorra.ProjectKorra.Utilities.AbilityLoadable;
+import org.bukkit.entity.Player;
+
+import java.util.ArrayList;
+
+/**
+ * Created by Carbogen on 2/7/2015.
+ */
+public abstract class ComboAbilityModule extends AbilityLoadable implements Cloneable
+{
+ /**
+ * AbilityModule Constructor.
+ *
+ * @param name The name of the ability.
+ */
+ public ComboAbilityModule(final String name)
+ {
+ super(name);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * Called when the ability is loaded by PK. This is where the developer registers Listeners and Permissions.
+ */
+ public abstract void onThisLoad();
+
+ // Must be overridden
+
+ /**
+ * Accessor Method to get the version of the ability.
+ *
+ * @return The version of the ability as a String.
+ */
+ public abstract String getVersion();
+
+ /**
+ * Accessor Method to get the Element of the ability.
+ * It is recommended to use the Element ENUM to get the returned String.
+ * This can be an empty String, in which case the ability will not belong to any element (such as AvatarState).
+ *
+ * @return The Element the ability belongs to.
+ */
+ public abstract String getElement();
+
+ /**
+ * Accessor Method to get the name of the author.
+ *
+ * @return The name of the author.
+ */
+ public abstract String getAuthor();
+
+ /**
+ * Accessor Method to get the description of the ability.
+ * This String is sent to any player who runs /pk display ability.
+ *
+ * @return The Description of the ability.
+ */
+ public abstract String getDescription();
+
+ /**
+ * Accessor Method to get the instructions for using this combo.
+ *
+ * @return The steps for the combo.
+ */
+ public abstract String getInstructions();
+
+ /**
+ * Creates a new instance of the combo from a specific player.
+ * ProjectKorra's ComboModuleManager will use this method once the combo steps have been used by the player.
+ *
+ * @return A new instance of the ability.
+ * @param player The player using the combo.
+ */
+ public abstract Object createNewComboInstance(Player player);
+
+ /**
+ * Returns the list of abilities which constitute the combo.
+ *
+ * @return An ArrayList containing the combo's steps.
+ */
+ public abstract ArrayList getCombination();
+
+ /**
+ * Void Method called whenever ProjectKorra stops and the ability is unloaded.
+ *
+ */
+ public void stop()
+ {
+
+ }
+
+ /**
+ * Accessor Method to get which SubElement the ability belongs to.
+ * If isSubAbility() returns true, the developer absolutely must implement this as well.
+ *
+ * List of sub-elements:
+ *
+ * Water:
+ * Icebending.
+ * Bloodbending.
+ * Plantbending.
+ * Healing.
+ *
+ * Earth:
+ * Sandbending.
+ * Metalbending.
+ * Lavabending.
+ *
+ * Fire:
+ * Combustion.
+ * Lightning.
+ *
+ * Air:
+ * Flight.
+ * SpiritualProjection.
+ *
+ * @return The SubElement the ability belongs to.
+ */
+ public SubElement getSubElement()
+ {
+ return null;
+ }
+}
diff --git a/src/com/projectkorra/ProjectKorra/Ability/Combo/ComboModuleManager.java b/src/com/projectkorra/ProjectKorra/Ability/Combo/ComboModuleManager.java
new file mode 100644
index 00000000..6b52ad87
--- /dev/null
+++ b/src/com/projectkorra/ProjectKorra/Ability/Combo/ComboModuleManager.java
@@ -0,0 +1,41 @@
+package com.projectkorra.ProjectKorra.Ability.Combo;
+
+import com.projectkorra.ProjectKorra.ComboManager;
+import com.projectkorra.ProjectKorra.ProjectKorra;
+import com.projectkorra.ProjectKorra.Utilities.AbilityLoader;
+
+import java.io.File;
+import java.util.List;
+
+public class ComboModuleManager
+{
+ private final AbilityLoader loader;
+ public static List combo;
+
+ public ComboModuleManager()
+ {
+ final File path = new File(ProjectKorra.plugin.getDataFolder().toString() + "/Combos/");
+ if (!path.exists())
+ {
+ path.mkdir();
+ }
+
+ loader = new AbilityLoader(ProjectKorra.plugin, path, new Object[] {});
+
+ combo = loader.load(ComboAbilityModule.class);
+
+ loadComboModules();
+ }
+
+ private void loadComboModules()
+ {
+ for(ComboAbilityModule cm : combo)
+ {
+ cm.onThisLoad();
+ ComboManager.comboAbilityList.add(new ComboManager.ComboAbility(cm.getName(), cm.getCombination(), cm));
+ ComboManager.descriptions.put(cm.getName(), cm.getDescription());
+ ComboManager.instructions.put(cm.getName(), cm.getInstructions());
+ ComboManager.authors.put(cm.getName(), cm.getAuthor());
+ }
+ }
+}
diff --git a/src/com/projectkorra/ProjectKorra/BendingManager.java b/src/com/projectkorra/ProjectKorra/BendingManager.java
index a713b05c..1ecc1516 100644
--- a/src/com/projectkorra/ProjectKorra/BendingManager.java
+++ b/src/com/projectkorra/ProjectKorra/BendingManager.java
@@ -1,16 +1,16 @@
package com.projectkorra.ProjectKorra;
-import java.util.HashMap;
-
-import org.bukkit.Bukkit;
-import org.bukkit.World;
-import org.bukkit.entity.Player;
-
import com.projectkorra.ProjectKorra.Ability.AvatarState;
+import com.projectkorra.ProjectKorra.Objects.HorizontalVelocityTracker;
import com.projectkorra.ProjectKorra.chiblocking.ChiComboManager;
import com.projectkorra.ProjectKorra.chiblocking.RapidPunch;
import com.projectkorra.rpg.RPGMethods;
import com.projectkorra.rpg.WorldEvents;
+import org.bukkit.Bukkit;
+import org.bukkit.World;
+import org.bukkit.entity.Player;
+
+import java.util.HashMap;
public class BendingManager implements Runnable {
@@ -49,6 +49,7 @@ public class BendingManager implements Runnable {
RapidPunch.startPunchAll();
RevertChecker.revertAirBlocks();
ChiComboManager.handleParalysis();
+ HorizontalVelocityTracker.updateAll();
handleCooldowns();
} catch (Exception e) {
Methods.stopBending();
diff --git a/src/com/projectkorra/ProjectKorra/ComboManager.java b/src/com/projectkorra/ProjectKorra/ComboManager.java
index bd51d4d8..82e84cd2 100644
--- a/src/com/projectkorra/ProjectKorra/ComboManager.java
+++ b/src/com/projectkorra/ProjectKorra/ComboManager.java
@@ -1,15 +1,16 @@
package com.projectkorra.ProjectKorra;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.bukkit.entity.Player;
-import org.bukkit.scheduler.BukkitRunnable;
-
+import com.projectkorra.ProjectKorra.Ability.Combo.ComboAbilityModule;
import com.projectkorra.ProjectKorra.airbending.AirCombo;
import com.projectkorra.ProjectKorra.firebending.FireCombo;
import com.projectkorra.ProjectKorra.waterbending.WaterCombo;
+import org.bukkit.entity.Player;
+import org.bukkit.scheduler.BukkitRunnable;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.concurrent.ConcurrentHashMap;
public class ComboManager
{
@@ -19,6 +20,9 @@ public class ComboManager
private static final long CLEANUP_DELAY = 10000;
public static ConcurrentHashMap> recentlyUsedAbilities = new ConcurrentHashMap>();
public static ArrayList comboAbilityList = new ArrayList();
+ public static HashMap descriptions = new HashMap();
+ public static HashMap instructions = new HashMap();
+ public static HashMap authors = new HashMap();
public ComboManager()
{
@@ -120,24 +124,38 @@ public class ComboManager
public static void addComboAbility(Player player, ClickType type)
{
String abilityName = Methods.getBoundAbility(player);
- if(abilityName == null)
+ if (abilityName == null)
return;
-
- AbilityInformation info = new AbilityInformation(abilityName,type,System.currentTimeMillis());
- addRecentAbility(player,info);
-
+
+ AbilityInformation info = new AbilityInformation(abilityName, type, System.currentTimeMillis());
+ addRecentAbility(player, info);
+
ComboAbility comboAbil = checkForValidCombo(player);
- if(comboAbil == null)
+ if (comboAbil == null)
return;
-
- if(comboAbil.getComboType().equals(FireCombo.class))
+
+ if (comboAbil.getComboType().equals(FireCombo.class))
new FireCombo(player, comboAbil.getName());
- else if(comboAbil.getComboType().equals(AirCombo.class))
+ else if (comboAbil.getComboType().equals(AirCombo.class))
new AirCombo(player, comboAbil.getName());
- else if(comboAbil.getComboType().equals(WaterCombo.class))
+ else if (comboAbil.getComboType().equals(WaterCombo.class))
new WaterCombo(player, comboAbil.getName());
+ else
+ {
+ for (ComboAbility ca : comboAbilityList)
+ {
+ if (comboAbil.getName().equals(ca.getName()))
+ {
+ if (ca.getComboType() instanceof ComboAbilityModule)
+ {
+ ((ComboAbilityModule) ca.getComboType()).createNewComboInstance(player);
+ return;
+ }
+ }
+ }
+ }
}
-
+
public static class AbilityInformation
{
private String abilityName;
diff --git a/src/com/projectkorra/ProjectKorra/Commands.java b/src/com/projectkorra/ProjectKorra/Commands.java
index ec8c1ce6..3b94dc3a 100644
--- a/src/com/projectkorra/ProjectKorra/Commands.java
+++ b/src/com/projectkorra/ProjectKorra/Commands.java
@@ -1,17 +1,12 @@
package com.projectkorra.ProjectKorra;
-import java.io.File;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
+import com.projectkorra.ProjectKorra.Ability.AbilityModuleManager;
+import com.projectkorra.ProjectKorra.Ability.Combo.ComboAbilityModule;
+import com.projectkorra.ProjectKorra.Ability.Combo.ComboModuleManager;
+import com.projectkorra.ProjectKorra.Ability.StockAbilities;
+import com.projectkorra.ProjectKorra.Objects.Preset;
+import com.projectkorra.ProjectKorra.Utilities.GrapplingHookAPI;
+import com.projectkorra.rpg.RPGMethods;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@@ -24,11 +19,10 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitTask;
-import com.projectkorra.ProjectKorra.Ability.AbilityModuleManager;
-import com.projectkorra.ProjectKorra.Ability.StockAbilities;
-import com.projectkorra.ProjectKorra.Objects.Preset;
-import com.projectkorra.ProjectKorra.Utilities.GrapplingHookAPI;
-import com.projectkorra.rpg.RPGMethods;
+import java.io.File;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.*;
public class Commands {
@@ -851,7 +845,10 @@ public class Commands {
s.sendMessage(Methods.getSubBendingColor(Element.Water) + " Can Plantbend");
}
if (Methods.canBloodbend(p)) {
- s.sendMessage(Methods.getSubBendingColor(Element.Water) + " Can Bloodbend");
+ if(Methods.canBloodbendAtAnytime(p))
+ s.sendMessage(Methods.getSubBendingColor(Element.Water) + " Can Bloodbend anytime, on any day");
+ else
+ s.sendMessage(Methods.getSubBendingColor(Element.Water) + " Can Bloodbend");
}
if (Methods.canIcebend(p)) {
s.sendMessage(Methods.getSubBendingColor(Element.Water) + " Can Icebend");
@@ -1453,6 +1450,18 @@ public class Commands {
s.sendMessage(ChatColor.GOLD + "FireJet (Tap Shift) > FireJet (Tap Shift) > FireShield (Tap Shift) > FireJet. ");
s.sendMessage(Methods.getFireColor() + "JetBlaze" + ChatColor.WHITE + ": Damages and burns all enemies in the proximity of your FireJet.");
s.sendMessage(ChatColor.GOLD + "FireJet (Tap Shift) > FireJet (Tap Shift) > Blaze (Tap Shift) > FireJet. ");
+ for(ComboAbilityModule cam : ComboModuleManager.combo)
+ {
+ if(cam.getElement().equals(Element.Fire.toString()))
+ {
+ ChatColor color = Methods.getAvatarColor();
+ if(cam.getSubElement() == null)
+ color = Methods.getFireColor();
+ else color = Methods.getSubBendingColor(Element.Fire);
+ s.sendMessage(color + cam.getName() + ChatColor.WHITE + ": " + cam.getDescription());
+ s.sendMessage(ChatColor.GOLD + cam.getInstructions());
+ }
+ }
}
if (args[1].equalsIgnoreCase("AirCombo")) {
s.sendMessage(ChatColor.GOLD + "AirCombo:");
@@ -1462,19 +1471,70 @@ public class Commands {
s.sendMessage(ChatColor.GOLD + "AirShield (Hold Shift) > AirSuction (Left Click) > AirBlast (Left Click)");
s.sendMessage(Methods.getAirColor() + "AirSweep" + ChatColor.WHITE + ": Sweep the air in front of you hitting multiple enemies, causing moderate damage and a large knockback. The radius and direction of AirSweep is controlled by moving your mouse in a sweeping motion. For example, if you want to AirSweep upward, then move your mouse upward right after you left click AirBurst");
s.sendMessage(ChatColor.GOLD + "AirSwipe (Left Click) > AirSwipe (Left Click) > AirBurst (Hold Shift) > AirBurst (Left Click)");
+ for(ComboAbilityModule cam : ComboModuleManager.combo)
+ {
+ if(cam.getElement().equals(Element.Air.toString()))
+ {
+ ChatColor color = Methods.getAvatarColor();
+ if(cam.getSubElement() == null)
+ color = Methods.getAirColor();
+ else color = Methods.getSubBendingColor(Element.valueOf(cam.getElement()));
+ s.sendMessage(color + cam.getName() + ChatColor.WHITE + ": " + cam.getDescription());
+ s.sendMessage(ChatColor.GOLD + cam.getInstructions());
+ }
+ }
}
if (args[1].equalsIgnoreCase("WaterCombo")) {
s.sendMessage(ChatColor.GOLD + "WaterCombos:");
- s.sendMessage(Methods.getAirColor() + "IceWave" + ChatColor.WHITE + ": PhaseChange your WaterWave into an IceWave that freezes and damages enemies.");
+ s.sendMessage(Methods.getWaterColor() + "IceWave" + ChatColor.WHITE + ": PhaseChange your WaterWave into an IceWave that freezes and damages enemies.");
s.sendMessage(ChatColor.GOLD + "Create a WaterSpout Wave > PhaseChange (Left Click)");
- s.sendMessage(Methods.getAirColor() + "IceBullet" + ChatColor.WHITE + ": Using a large cavern of ice, you can punch ice shards at your opponent causing moderate damage. To rapid fire, you must alternate between Left clicking and right clicking with IceBlast.");
+ s.sendMessage(Methods.getWaterColor() + "IceBullet" + ChatColor.WHITE + ": Using a large cavern of ice, you can punch ice shards at your opponent causing moderate damage. To rapid fire, you must alternate between Left clicking and right clicking with IceBlast.");
s.sendMessage(ChatColor.GOLD + "WaterBubble (Tap Shift) > IceBlast (Hold Shift) > IceBlast (Left Click) > Wait for ice to Form > Then alternate between Left and Right click with IceBlast");
+ for(ComboAbilityModule cam : ComboModuleManager.combo)
+ {
+ if(cam.getElement().equals(Element.Water.toString()))
+ {
+ ChatColor color = Methods.getAvatarColor();
+ if(cam.getSubElement() == null)
+ color = Methods.getWaterColor();
+ else color = Methods.getSubBendingColor(Element.valueOf(cam.getElement()));
+ s.sendMessage(color + cam.getName() + ChatColor.WHITE + ": " + cam.getDescription());
+ s.sendMessage(ChatColor.GOLD + cam.getInstructions());
+ }
+ }
+ }
+ if (args[1].equalsIgnoreCase("EarthCombo")) {
+ s.sendMessage(ChatColor.GOLD + "EarthCombos:");
+ for(ComboAbilityModule cam : ComboModuleManager.combo)
+ {
+ if(cam.getElement().equals(Element.Earth.toString()))
+ {
+ ChatColor color = Methods.getAvatarColor();
+ if(cam.getSubElement() == null)
+ color = Methods.getEarthColor();
+ else color = Methods.getSubBendingColor(Element.valueOf(cam.getElement()));
+ s.sendMessage(color + cam.getName() + ChatColor.WHITE + ": " + cam.getDescription());
+ s.sendMessage(ChatColor.GOLD + cam.getInstructions());
+ }
+ }
}
if (args[1].equalsIgnoreCase("ChiCombo"))
{
s.sendMessage(ChatColor.GOLD + "ChiCombos:");
s.sendMessage(Methods.getChiColor() + "Immobilize" + ChatColor.WHITE + ": Deliver a series of strikes to an enemy to temporarely immobilize them.");
s.sendMessage(ChatColor.GOLD + "QuickStrike > SwiftKick > QuickStrike > QuickStrike");
+ for(ComboAbilityModule cam : ComboModuleManager.combo)
+ {
+ if(cam.getElement().equals(Element.Chi.toString()))
+ {
+ ChatColor color = Methods.getAvatarColor();
+ if(cam.getSubElement() == null)
+ color = Methods.getChiColor();
+ else color = Methods.getSubBendingColor(Element.valueOf(cam.getElement()));
+ s.sendMessage(color + cam.getName() + ChatColor.WHITE + ": " + cam.getDescription());
+ s.sendMessage(ChatColor.GOLD + cam.getInstructions());
+ }
+ }
}
if (Methods.abilityExists(args[1])) {
String ability = Methods.getAbility(args[1]);
diff --git a/src/com/projectkorra/ProjectKorra/ConfigManager.java b/src/com/projectkorra/ProjectKorra/ConfigManager.java
index 7d30bc07..c61fbeb6 100644
--- a/src/com/projectkorra/ProjectKorra/ConfigManager.java
+++ b/src/com/projectkorra/ProjectKorra/ConfigManager.java
@@ -1,9 +1,9 @@
package com.projectkorra.ProjectKorra;
-import java.util.ArrayList;
-
import org.bukkit.configuration.file.FileConfiguration;
+import java.util.ArrayList;
+
public class ConfigManager {
static ProjectKorra plugin;
@@ -66,6 +66,9 @@ public class ConfigManager {
config.addDefault("Properties.GlobalCooldown", 500);
config.addDefault("Properties.SeaLevel", 62);
+ config.addDefault("Properties.HorizontalCollisionPhysics.Enabled", true);
+ config.addDefault("Properties.HorizontalCollisionPhysics.WallDamageMinimumDistance", 5.0);
+
config.addDefault("Properties.CustomItems.GrapplingHook.Enable", true);
config.addDefault("Properties.CustomItems.GrapplingHook.IronUses", 25);
config.addDefault("Properties.CustomItems.GrapplingHook.GoldUses", 50);
@@ -377,6 +380,7 @@ public class ConfigManager {
config.addDefault("Abilities.Water.WaterSpout.Enabled", true);
config.addDefault("Abilities.Water.WaterSpout.Description", "This ability provides a Waterbender with a means of transportation. To use, simply left click while in or over water to spout water up beneath you, experiencing controlled levitation. Left clicking again while the spout is active will cause it to disappear. Alternatively, tapping a Waterbendable block while not in Water will select a water block as a source, from there, you can tap sneak (Default:Shift) to channel the Water around you. Releasing the sneak will create a wave allowing you a quick burst of controlled transportation. While riding the wave you may press sneak to cause the wave to disappear.");
config.addDefault("Abilities.Water.WaterSpout.Height", 20);
+ config.addDefault("Abilities.Water.WaterSpout.Wave.Particles", false);
config.addDefault("Abilities.Water.WaterSpout.Wave.Enabled", true);
config.addDefault("Abilities.Water.WaterSpout.Wave.Range", 6);
config.addDefault("Abilities.Water.WaterSpout.Wave.ChargeTime", 1000);
diff --git a/src/com/projectkorra/ProjectKorra/Methods.java b/src/com/projectkorra/ProjectKorra/Methods.java
index a18f37c5..12174af0 100644
--- a/src/com/projectkorra/ProjectKorra/Methods.java
+++ b/src/com/projectkorra/ProjectKorra/Methods.java
@@ -1,65 +1,5 @@
package com.projectkorra.ProjectKorra;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Random;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-
-import me.ryanhamshire.GriefPrevention.GriefPrevention;
-import net.sacredlabyrinth.Phaed.PreciousStones.FieldFlag;
-import net.sacredlabyrinth.Phaed.PreciousStones.PreciousStones;
-
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.Effect;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.Sound;
-import org.bukkit.World;
-import org.bukkit.World.Environment;
-import org.bukkit.block.Block;
-import org.bukkit.block.BlockFace;
-import org.bukkit.block.BlockState;
-import org.bukkit.configuration.file.FileConfiguration;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.FallingBlock;
-import org.bukkit.entity.FallingSand;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.TNTPrimed;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.plugin.Plugin;
-import org.bukkit.plugin.PluginManager;
-import org.bukkit.potion.PotionEffectType;
-import org.bukkit.scheduler.BukkitRunnable;
-import org.bukkit.util.Vector;
import com.griefcraft.lwc.LWC;
import com.griefcraft.lwc.LWCPlugin;
@@ -69,80 +9,59 @@ import com.massivecraft.massivecore.ps.PS;
import com.palmergames.bukkit.towny.Towny;
import com.palmergames.bukkit.towny.TownyMessaging;
import com.palmergames.bukkit.towny.TownySettings;
-import com.palmergames.bukkit.towny.object.Coord;
-import com.palmergames.bukkit.towny.object.PlayerCache;
+import com.palmergames.bukkit.towny.object.*;
import com.palmergames.bukkit.towny.object.PlayerCache.TownBlockStatus;
-import com.palmergames.bukkit.towny.object.TownyPermission;
-import com.palmergames.bukkit.towny.object.TownyUniverse;
-import com.palmergames.bukkit.towny.object.TownyWorld;
-import com.palmergames.bukkit.towny.object.WorldCoord;
import com.palmergames.bukkit.towny.utils.PlayerCacheUtil;
import com.palmergames.bukkit.towny.war.flagwar.TownyWar;
import com.palmergames.bukkit.towny.war.flagwar.TownyWarConfig;
import com.projectkorra.ProjectKorra.Ability.AbilityModule;
import com.projectkorra.ProjectKorra.Ability.AbilityModuleManager;
import com.projectkorra.ProjectKorra.Ability.AvatarState;
+import com.projectkorra.ProjectKorra.Ability.Combo.ComboAbilityModule;
+import com.projectkorra.ProjectKorra.Ability.Combo.ComboModuleManager;
import com.projectkorra.ProjectKorra.Ability.StockAbilities;
import com.projectkorra.ProjectKorra.Utilities.ParticleEffect;
-import com.projectkorra.ProjectKorra.airbending.AirBlast;
-import com.projectkorra.ProjectKorra.airbending.AirBubble;
-import com.projectkorra.ProjectKorra.airbending.AirBurst;
-import com.projectkorra.ProjectKorra.airbending.AirCombo;
-import com.projectkorra.ProjectKorra.airbending.AirScooter;
-import com.projectkorra.ProjectKorra.airbending.AirShield;
-import com.projectkorra.ProjectKorra.airbending.AirSpout;
-import com.projectkorra.ProjectKorra.airbending.AirSuction;
-import com.projectkorra.ProjectKorra.airbending.AirSwipe;
-import com.projectkorra.ProjectKorra.airbending.Suffocate;
-import com.projectkorra.ProjectKorra.airbending.Tornado;
+import com.projectkorra.ProjectKorra.airbending.*;
import com.projectkorra.ProjectKorra.chiblocking.AcrobatStance;
import com.projectkorra.ProjectKorra.chiblocking.Paralyze;
import com.projectkorra.ProjectKorra.chiblocking.RapidPunch;
import com.projectkorra.ProjectKorra.chiblocking.WarriorStance;
-import com.projectkorra.ProjectKorra.earthbending.Catapult;
-import com.projectkorra.ProjectKorra.earthbending.CompactColumn;
-import com.projectkorra.ProjectKorra.earthbending.EarthArmor;
-import com.projectkorra.ProjectKorra.earthbending.EarthBlast;
-import com.projectkorra.ProjectKorra.earthbending.EarthColumn;
-import com.projectkorra.ProjectKorra.earthbending.EarthPassive;
-import com.projectkorra.ProjectKorra.earthbending.EarthSmash;
-import com.projectkorra.ProjectKorra.earthbending.EarthTunnel;
-import com.projectkorra.ProjectKorra.earthbending.LavaFlow;
-import com.projectkorra.ProjectKorra.earthbending.MetalClips;
-import com.projectkorra.ProjectKorra.earthbending.Shockwave;
-import com.projectkorra.ProjectKorra.earthbending.Tremorsense;
-import com.projectkorra.ProjectKorra.firebending.Combustion;
-import com.projectkorra.ProjectKorra.firebending.Cook;
-import com.projectkorra.ProjectKorra.firebending.FireBlast;
-import com.projectkorra.ProjectKorra.firebending.FireBurst;
-import com.projectkorra.ProjectKorra.firebending.FireCombo;
-import com.projectkorra.ProjectKorra.firebending.FireJet;
-import com.projectkorra.ProjectKorra.firebending.FireShield;
-import com.projectkorra.ProjectKorra.firebending.FireStream;
+import com.projectkorra.ProjectKorra.earthbending.*;
+import com.projectkorra.ProjectKorra.firebending.*;
import com.projectkorra.ProjectKorra.firebending.Fireball;
-import com.projectkorra.ProjectKorra.firebending.Illumination;
-import com.projectkorra.ProjectKorra.firebending.Lightning;
-import com.projectkorra.ProjectKorra.firebending.WallOfFire;
-import com.projectkorra.ProjectKorra.waterbending.Bloodbending;
-import com.projectkorra.ProjectKorra.waterbending.FreezeMelt;
-import com.projectkorra.ProjectKorra.waterbending.IceSpike;
-import com.projectkorra.ProjectKorra.waterbending.IceSpike2;
-import com.projectkorra.ProjectKorra.waterbending.OctopusForm;
-import com.projectkorra.ProjectKorra.waterbending.Plantbending;
-import com.projectkorra.ProjectKorra.waterbending.WaterCombo;
-import com.projectkorra.ProjectKorra.waterbending.WaterManipulation;
-import com.projectkorra.ProjectKorra.waterbending.WaterReturn;
-import com.projectkorra.ProjectKorra.waterbending.WaterSpout;
-import com.projectkorra.ProjectKorra.waterbending.WaterWall;
-import com.projectkorra.ProjectKorra.waterbending.WaterWave;
-import com.projectkorra.ProjectKorra.waterbending.Wave;
+import com.projectkorra.ProjectKorra.waterbending.*;
import com.projectkorra.rpg.RPGMethods;
import com.projectkorra.rpg.WorldEvents;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.protection.flags.DefaultFlag;
-
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager;
+import me.ryanhamshire.GriefPrevention.GriefPrevention;
+import net.sacredlabyrinth.Phaed.PreciousStones.FieldFlag;
+import net.sacredlabyrinth.Phaed.PreciousStones.PreciousStones;
+import org.bukkit.*;
+import org.bukkit.World.Environment;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.block.BlockState;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.entity.*;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
+import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.plugin.Plugin;
+import org.bukkit.plugin.PluginManager;
+import org.bukkit.potion.PotionEffectType;
+import org.bukkit.scheduler.BukkitRunnable;
+import org.bukkit.util.Vector;
+
+import java.io.*;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
public class Methods {
@@ -181,6 +100,24 @@ public class Methods {
return false;
}
+ public static boolean comboExists(String string)
+ {
+ for(ComboAbilityModule c : ComboModuleManager.combo)
+ if(string.equalsIgnoreCase(c.getName()))
+ return true;
+
+ return false;
+ }
+
+ public ComboAbilityModule getCombo(String name)
+ {
+ for(ComboAbilityModule c : ComboModuleManager.combo)
+ if(name.equalsIgnoreCase(c.getName()))
+ return c;
+
+ return null;
+ }
+
public static boolean isDisabledStockAbility(String string){
for (String st : AbilityModuleManager.disabledStockAbilities){
if (string.equalsIgnoreCase(st))
@@ -270,7 +207,7 @@ public class Methods {
if (AvatarState.isAvatarState(player))
if (isChiBlocked(player.getName()))
return true;
- if (canBend(player.getName(), "Bloodbending") && Methods.getBendingPlayer(player.getName()).isToggled)
+ if (canBend(player.getName(), "Bloodbending") && !Methods.getBendingPlayer(player.getName()).isToggled)
return false;
return true;
}
@@ -361,6 +298,12 @@ public class Methods {
if (player.hasPermission("bending.water.bloodbending")) return true;
return false;
}
+
+ public static boolean canBloodbendAtAnytime(Player player)
+ {
+ if(canBloodbend(player) && player.hasPermission("bending.water.bloodbending.anytime")) return true;
+ return false;
+ }
public static boolean canIcebend(Player player)
{
@@ -448,7 +391,10 @@ public class Methods {
} else {
// The player has at least played before.
String player2 = rs2.getString("player");
- if (!player.equalsIgnoreCase(player2)) DBConnection.sql.modifyQuery("UPDATE pk_players SET player = '" + player2 + "' WHERE uuid = '" + uuid.toString() + "'"); // They have changed names.
+ if (!player.equalsIgnoreCase(player2)){
+ DBConnection.sql.modifyQuery("UPDATE pk_players SET player = '" + player + "' WHERE uuid = '" + uuid.toString() + "'"); // They have changed names.
+ ProjectKorra.log.info("Updating Player Name for " + player);
+ }
String element = rs2.getString("element");
String permaremoved = rs2.getString("permaremoved");
boolean p = false;
@@ -477,7 +423,7 @@ public class Methods {
p = false;
}
- new BendingPlayer(uuid, player2, elements, abilities, p);
+ new BendingPlayer(uuid, player, elements, abilities, p);
}
} catch (SQLException ex) {
ex.printStackTrace();
@@ -1189,7 +1135,7 @@ public class Methods {
}
public static boolean hasPermission(Player player, String ability) {
- if (player.hasPermission("bending.ability." + ability)) return true;
+ if (player.hasPermission("bending.ability." + ability) && canBind(player.getName(), ability)) return true;
return false;
}
@@ -1626,7 +1572,9 @@ public class Methods {
if (gpp != null && respectGriefPrevention) {
Material type = player.getWorld().getBlockAt(location).getType();
if (type == null) type = Material.AIR;
- String reason = GriefPrevention.instance.allowBuild(player, location);
+// String reason = GriefPrevention.instance.allowBuild(player, location, null); // NOT WORKING with WorldGuard 6.0 BETA 4
+ String reason = GriefPrevention.instance.allowBuild(player, location); // WORKING with WorldGuard 6.0 BETA 4
+
if (ignite.contains(ability)) {
diff --git a/src/com/projectkorra/ProjectKorra/Objects/HorizontalVelocityTracker.java b/src/com/projectkorra/ProjectKorra/Objects/HorizontalVelocityTracker.java
new file mode 100644
index 00000000..7d558f29
--- /dev/null
+++ b/src/com/projectkorra/ProjectKorra/Objects/HorizontalVelocityTracker.java
@@ -0,0 +1,108 @@
+package com.projectkorra.ProjectKorra.Objects;
+
+import com.projectkorra.ProjectKorra.Methods;
+import com.projectkorra.ProjectKorra.ProjectKorra;
+import com.projectkorra.ProjectKorra.Utilities.HorizontalVelocityChangeEvent;
+import org.bukkit.Location;
+import org.bukkit.block.Block;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+import org.bukkit.util.Vector;
+
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Created by Carbogen on 2/2/2015.
+ */
+public class HorizontalVelocityTracker
+{
+ public static ConcurrentHashMap instances = new ConcurrentHashMap();
+
+ private long delay;
+ private long fireTime;
+ private Entity entity;
+ private Player instigator;
+ private Vector lastVelocity;
+ private Vector thisVelocity;
+ private Location launchLocation;
+ private Location impactLocation;
+
+ public HorizontalVelocityTracker(Entity e, Player instigator, long delay)
+ {
+ remove(e);
+ entity = e;
+ this.instigator = instigator;
+ fireTime = System.currentTimeMillis();
+ this.delay = delay;
+ thisVelocity = e.getVelocity().clone();
+ launchLocation = e.getLocation().clone();
+ impactLocation = launchLocation.clone();
+ this.delay = delay;
+ update();
+ instances.put(entity, this);
+ }
+
+ public void update()
+ {
+ if(System.currentTimeMillis() < fireTime + delay)
+ return;
+
+ lastVelocity = thisVelocity.clone();
+ thisVelocity = entity.getVelocity().clone();
+
+ Vector diff = thisVelocity.subtract(lastVelocity);
+
+ List blocks = Methods.getBlocksAroundPoint(entity.getLocation(), 1.5);
+
+ if(entity.isOnGround())
+ {
+ remove();
+ return;
+ }
+
+ for(Block b : blocks)
+ {
+ if(Methods.isWater(b))
+ {
+ remove();
+ return;
+ }
+ }
+
+ if(thisVelocity.length() < lastVelocity.length())
+ {
+ if((diff.getX() > 1 || diff.getX() < -1)
+ || (diff.getZ() > 1 || diff.getZ() < -1))
+ {
+ impactLocation = entity.getLocation();
+ for (Block b : blocks)
+ {
+ if (!Methods.isTransparentToEarthbending(instigator, b))
+ {
+ ProjectKorra.plugin.getServer().getPluginManager().callEvent(new HorizontalVelocityChangeEvent(entity, instigator, lastVelocity, thisVelocity, diff, launchLocation, impactLocation));
+ remove();
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ public static void updateAll()
+ {
+ for(Entity e : instances.keySet())
+ instances.get(e).update();
+ }
+
+ public void remove()
+ {
+ instances.remove(entity);
+ }
+
+ public static void remove(Entity e)
+ {
+ if(instances.containsKey(e))
+ instances.remove(e);
+ }
+}
diff --git a/src/com/projectkorra/ProjectKorra/PKListener.java b/src/com/projectkorra/ProjectKorra/PKListener.java
index 276c1f94..ca11ba8e 100644
--- a/src/com/projectkorra/ProjectKorra/PKListener.java
+++ b/src/com/projectkorra/ProjectKorra/PKListener.java
@@ -1,136 +1,38 @@
package com.projectkorra.ProjectKorra;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.bukkit.ChatColor;
-import org.bukkit.GameMode;
-import org.bukkit.Location;
-import org.bukkit.Material;
+import com.projectkorra.ProjectKorra.Ability.AvatarState;
+import com.projectkorra.ProjectKorra.ComboManager.ClickType;
+import com.projectkorra.ProjectKorra.CustomEvents.PlayerGrappleEvent;
+import com.projectkorra.ProjectKorra.Objects.Preset;
+import com.projectkorra.ProjectKorra.Utilities.GrapplingHookAPI;
+import com.projectkorra.ProjectKorra.Utilities.HorizontalVelocityChangeEvent;
+import com.projectkorra.ProjectKorra.airbending.*;
+import com.projectkorra.ProjectKorra.chiblocking.*;
+import com.projectkorra.ProjectKorra.earthbending.*;
+import com.projectkorra.ProjectKorra.earthbending.LavaFlow.AbilityType;
+import com.projectkorra.ProjectKorra.firebending.*;
+import com.projectkorra.ProjectKorra.firebending.Fireball;
+import com.projectkorra.ProjectKorra.waterbending.*;
+import org.bukkit.*;
import org.bukkit.block.Block;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.Item;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
+import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
-import org.bukkit.event.block.Action;
-import org.bukkit.event.block.BlockBreakEvent;
-import org.bukkit.event.block.BlockFadeEvent;
-import org.bukkit.event.block.BlockFormEvent;
-import org.bukkit.event.block.BlockFromToEvent;
-import org.bukkit.event.block.BlockIgniteEvent;
-import org.bukkit.event.block.BlockPhysicsEvent;
-import org.bukkit.event.block.BlockPlaceEvent;
-import org.bukkit.event.entity.EntityChangeBlockEvent;
-import org.bukkit.event.entity.EntityCombustEvent;
-import org.bukkit.event.entity.EntityDamageByBlockEvent;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.entity.EntityDamageEvent;
+import org.bukkit.event.block.*;
+import org.bukkit.event.entity.*;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
-import org.bukkit.event.entity.EntityExplodeEvent;
-import org.bukkit.event.entity.EntityInteractEvent;
-import org.bukkit.event.entity.EntityShootBowEvent;
-import org.bukkit.event.entity.EntityTargetEvent;
-import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
-import org.bukkit.event.entity.EntityTeleportEvent;
-import org.bukkit.event.entity.PlayerDeathEvent;
-import org.bukkit.event.entity.ProjectileHitEvent;
-import org.bukkit.event.entity.ProjectileLaunchEvent;
-import org.bukkit.event.entity.SlimeSplitEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType.SlotType;
-import org.bukkit.event.player.AsyncPlayerChatEvent;
-import org.bukkit.event.player.PlayerAnimationEvent;
-import org.bukkit.event.player.PlayerFishEvent;
-import org.bukkit.event.player.PlayerInteractEvent;
-import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerKickEvent;
-import org.bukkit.event.player.PlayerMoveEvent;
-import org.bukkit.event.player.PlayerQuitEvent;
-import org.bukkit.event.player.PlayerToggleFlightEvent;
-import org.bukkit.event.player.PlayerToggleSneakEvent;
+import org.bukkit.event.player.*;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
-import com.projectkorra.ProjectKorra.ComboManager.ClickType;
-import com.projectkorra.ProjectKorra.Ability.AvatarState;
-import com.projectkorra.ProjectKorra.CustomEvents.PlayerGrappleEvent;
-import com.projectkorra.ProjectKorra.Objects.Preset;
-import com.projectkorra.ProjectKorra.Utilities.GrapplingHookAPI;
-import com.projectkorra.ProjectKorra.airbending.AirBlast;
-import com.projectkorra.ProjectKorra.airbending.AirBubble;
-import com.projectkorra.ProjectKorra.airbending.AirBurst;
-import com.projectkorra.ProjectKorra.airbending.AirScooter;
-import com.projectkorra.ProjectKorra.airbending.AirShield;
-import com.projectkorra.ProjectKorra.airbending.AirSpout;
-import com.projectkorra.ProjectKorra.airbending.AirSuction;
-import com.projectkorra.ProjectKorra.airbending.AirSwipe;
-import com.projectkorra.ProjectKorra.airbending.FlightAbility;
-import com.projectkorra.ProjectKorra.airbending.Suffocate;
-import com.projectkorra.ProjectKorra.airbending.Tornado;
-import com.projectkorra.ProjectKorra.chiblocking.AcrobatStance;
-import com.projectkorra.ProjectKorra.chiblocking.ChiComboManager;
-import com.projectkorra.ProjectKorra.chiblocking.ChiPassive;
-import com.projectkorra.ProjectKorra.chiblocking.HighJump;
-import com.projectkorra.ProjectKorra.chiblocking.Paralyze;
-import com.projectkorra.ProjectKorra.chiblocking.QuickStrike;
-import com.projectkorra.ProjectKorra.chiblocking.RapidPunch;
-import com.projectkorra.ProjectKorra.chiblocking.Smokescreen;
-import com.projectkorra.ProjectKorra.chiblocking.SwiftKick;
-import com.projectkorra.ProjectKorra.chiblocking.WarriorStance;
-import com.projectkorra.ProjectKorra.earthbending.Catapult;
-import com.projectkorra.ProjectKorra.earthbending.Collapse;
-import com.projectkorra.ProjectKorra.earthbending.CompactColumn;
-import com.projectkorra.ProjectKorra.earthbending.EarthArmor;
-import com.projectkorra.ProjectKorra.earthbending.EarthBlast;
-import com.projectkorra.ProjectKorra.earthbending.EarthColumn;
-import com.projectkorra.ProjectKorra.earthbending.EarthGrab;
-import com.projectkorra.ProjectKorra.earthbending.EarthPassive;
-import com.projectkorra.ProjectKorra.earthbending.EarthSmash;
-import com.projectkorra.ProjectKorra.earthbending.EarthTunnel;
-import com.projectkorra.ProjectKorra.earthbending.EarthWall;
-import com.projectkorra.ProjectKorra.earthbending.Extraction;
-import com.projectkorra.ProjectKorra.earthbending.LavaFlow;
-import com.projectkorra.ProjectKorra.earthbending.LavaFlow.AbilityType;
-import com.projectkorra.ProjectKorra.earthbending.LavaSurge;
-import com.projectkorra.ProjectKorra.earthbending.LavaWave;
-import com.projectkorra.ProjectKorra.earthbending.MetalClips;
-import com.projectkorra.ProjectKorra.earthbending.Shockwave;
-import com.projectkorra.ProjectKorra.earthbending.Tremorsense;
-import com.projectkorra.ProjectKorra.firebending.ArcOfFire;
-import com.projectkorra.ProjectKorra.firebending.Combustion;
-import com.projectkorra.ProjectKorra.firebending.Cook;
-import com.projectkorra.ProjectKorra.firebending.Enflamed;
-import com.projectkorra.ProjectKorra.firebending.Extinguish;
-import com.projectkorra.ProjectKorra.firebending.FireBlast;
-import com.projectkorra.ProjectKorra.firebending.FireBurst;
-import com.projectkorra.ProjectKorra.firebending.FireJet;
-import com.projectkorra.ProjectKorra.firebending.FireShield;
-import com.projectkorra.ProjectKorra.firebending.FireStream;
-import com.projectkorra.ProjectKorra.firebending.Fireball;
-import com.projectkorra.ProjectKorra.firebending.Illumination;
-import com.projectkorra.ProjectKorra.firebending.Lightning;
-import com.projectkorra.ProjectKorra.firebending.RingOfFire;
-import com.projectkorra.ProjectKorra.firebending.WallOfFire;
-import com.projectkorra.ProjectKorra.waterbending.Bloodbending;
-import com.projectkorra.ProjectKorra.waterbending.FreezeMelt;
-import com.projectkorra.ProjectKorra.waterbending.IceBlast;
-import com.projectkorra.ProjectKorra.waterbending.IceSpike2;
-import com.projectkorra.ProjectKorra.waterbending.Melt;
-import com.projectkorra.ProjectKorra.waterbending.OctopusForm;
-import com.projectkorra.ProjectKorra.waterbending.Torrent;
-import com.projectkorra.ProjectKorra.waterbending.WaterManipulation;
-import com.projectkorra.ProjectKorra.waterbending.WaterPassive;
-import com.projectkorra.ProjectKorra.waterbending.WaterSpout;
-import com.projectkorra.ProjectKorra.waterbending.WaterWall;
-import com.projectkorra.ProjectKorra.waterbending.WaterWave;
-import com.projectkorra.ProjectKorra.waterbending.Wave;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
public class PKListener implements Listener {
@@ -159,6 +61,24 @@ public class PKListener implements Listener {
}
+ @EventHandler
+ public void onHorizontalCollision(HorizontalVelocityChangeEvent e)
+ {
+ if(!plugin.getConfig().getBoolean("Properties.HorizontalCollisionPhysics.Enabled"))
+ return;
+
+ if(e.getEntity() instanceof LivingEntity)
+ {
+ if(e.getEntity().getEntityId() != e.getInstigator().getEntityId())
+ {
+ double minimumDistance = plugin.getConfig().getDouble("Properties.HorizontalCollisionPhysics.WallDamageMinimumDistance");
+ double damage = ((e.getDistanceTraveled() - minimumDistance) < 0 ? 0 : e.getDistanceTraveled() - minimumDistance) / (e.getDifference().length());
+ if(damage > 0)
+ Methods.damageEntity(e.getInstigator(), e.getEntity(), damage);
+ }
+ }
+ }
+
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerGrapple(PlayerGrappleEvent event) {
if (event.isCancelled()) return;
diff --git a/src/com/projectkorra/ProjectKorra/ProjectKorra.java b/src/com/projectkorra/ProjectKorra/ProjectKorra.java
index 1a731017..3e902187 100644
--- a/src/com/projectkorra/ProjectKorra/ProjectKorra.java
+++ b/src/com/projectkorra/ProjectKorra/ProjectKorra.java
@@ -1,13 +1,7 @@
package com.projectkorra.ProjectKorra;
-import java.io.IOException;
-import java.util.logging.Logger;
-
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-import org.bukkit.plugin.java.JavaPlugin;
-
import com.projectkorra.ProjectKorra.Ability.AbilityModuleManager;
+import com.projectkorra.ProjectKorra.Ability.Combo.ComboModuleManager;
import com.projectkorra.ProjectKorra.Objects.Preset;
import com.projectkorra.ProjectKorra.Utilities.CraftingRecipes;
import com.projectkorra.ProjectKorra.airbending.AirbendingManager;
@@ -16,6 +10,12 @@ import com.projectkorra.ProjectKorra.chiblocking.ChiblockingManager;
import com.projectkorra.ProjectKorra.earthbending.EarthbendingManager;
import com.projectkorra.ProjectKorra.firebending.FirebendingManager;
import com.projectkorra.ProjectKorra.waterbending.WaterbendingManager;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.java.JavaPlugin;
+
+import java.io.IOException;
+import java.util.logging.Logger;
public class ProjectKorra extends JavaPlugin {
@@ -32,6 +32,7 @@ public class ProjectKorra extends JavaPlugin {
new Methods(this);
new Commands(this);
new AbilityModuleManager(this);
+ new ComboModuleManager();
new ComboManager();
new ChiComboManager();
diff --git a/src/com/projectkorra/ProjectKorra/Utilities/HorizontalVelocityChangeEvent.java b/src/com/projectkorra/ProjectKorra/Utilities/HorizontalVelocityChangeEvent.java
new file mode 100644
index 00000000..b000a4ea
--- /dev/null
+++ b/src/com/projectkorra/ProjectKorra/Utilities/HorizontalVelocityChangeEvent.java
@@ -0,0 +1,111 @@
+package com.projectkorra.ProjectKorra.Utilities;
+
+import org.bukkit.Location;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.util.Vector;
+
+/**
+ * Created by Carbogen on 2/2/2015.
+ */
+public class HorizontalVelocityChangeEvent extends Event implements Cancellable
+{
+ private static final HandlerList handlers = new HandlerList();
+
+ private boolean isCancelled;
+
+ private Entity entity;
+ private Player instigator;
+ private Vector from;
+ private Vector to;
+ private Vector difference;
+ private Location start;
+ private Location end;
+
+ @Deprecated
+ public HorizontalVelocityChangeEvent(Entity entity, Player instigator, Vector from, Vector to, Vector difference)
+ {
+ this.entity = entity;
+ this.instigator = instigator;
+ this.from = from;
+ this.to = to;
+ this.difference = difference;
+ }
+
+ public HorizontalVelocityChangeEvent(Entity entity, Player instigator, Vector from, Vector to, Vector difference, Location start, Location end)
+ {
+ this.entity = entity;
+ this.instigator = instigator;
+ this.from = from;
+ this.to = to;
+ this.difference = difference;
+ this.start = start;
+ this.end = end;
+ }
+
+ public Entity getEntity()
+ {
+ return entity;
+ }
+
+ public Player getInstigator()
+ {
+ return instigator;
+ }
+
+ public Vector getFrom()
+ {
+ return from;
+ }
+
+ public Vector getTo()
+ {
+ return to;
+ }
+
+ public Location getStartPoint()
+ {
+ return start;
+ }
+
+ public Location getEndPoint()
+ {
+ return end;
+ }
+
+ public double getDistanceTraveled()
+ {
+ return start.distance(end);
+ }
+
+ public Vector getDifference()
+ {
+ return difference;
+ }
+
+ @Override
+ public HandlerList getHandlers()
+ {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList()
+ {
+ return handlers;
+ }
+
+ @Override
+ public boolean isCancelled()
+ {
+ return isCancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean value)
+ {
+ this.isCancelled = value;
+ }
+}
diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirBlast.java b/src/com/projectkorra/ProjectKorra/airbending/AirBlast.java
index 8c13cd93..b05eeaaf 100644
--- a/src/com/projectkorra/ProjectKorra/airbending/AirBlast.java
+++ b/src/com/projectkorra/ProjectKorra/airbending/AirBlast.java
@@ -1,10 +1,8 @@
package com.projectkorra.ProjectKorra.airbending;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.bukkit.Bukkit;
+import com.projectkorra.ProjectKorra.Ability.AvatarState;
+import com.projectkorra.ProjectKorra.*;
+import com.projectkorra.ProjectKorra.Objects.HorizontalVelocityTracker;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -15,12 +13,8 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
-import com.projectkorra.ProjectKorra.BendingPlayer;
-import com.projectkorra.ProjectKorra.Commands;
-import com.projectkorra.ProjectKorra.Flight;
-import com.projectkorra.ProjectKorra.Methods;
-import com.projectkorra.ProjectKorra.ProjectKorra;
-import com.projectkorra.ProjectKorra.Ability.AvatarState;
+import java.util.ArrayList;
+import java.util.concurrent.ConcurrentHashMap;
public class AirBlast {
@@ -41,7 +35,7 @@ public class AirBlast {
// public static long interval = 2000;
public static byte full = 0x0;
- private Location location;
+ public Location location;
private Location origin;
private Vector direction;
private Player player;
@@ -268,6 +262,7 @@ public class AirBlast {
return;
Methods.setVelocity(entity, velocity);
+ new HorizontalVelocityTracker(entity, player, 200l);
entity.setFallDistance(0);
if (!isUser && entity instanceof Player) {
new Flight((Player) entity, player);
diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirBurst.java b/src/com/projectkorra/ProjectKorra/airbending/AirBurst.java
index aec25ea0..0a40de80 100644
--- a/src/com/projectkorra/ProjectKorra/airbending/AirBurst.java
+++ b/src/com/projectkorra/ProjectKorra/airbending/AirBurst.java
@@ -1,8 +1,9 @@
package com.projectkorra.ProjectKorra.airbending;
-import java.util.ArrayList;
-import java.util.concurrent.ConcurrentHashMap;
-
+import com.projectkorra.ProjectKorra.Ability.AvatarState;
+import com.projectkorra.ProjectKorra.BendingPlayer;
+import com.projectkorra.ProjectKorra.Methods;
+import com.projectkorra.ProjectKorra.ProjectKorra;
import org.bukkit.Location;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Entity;
@@ -10,10 +11,8 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
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;
+import java.util.ArrayList;
+import java.util.concurrent.ConcurrentHashMap;
public class AirBurst {
@@ -32,7 +31,7 @@ public class AirBurst {
private long starttime;
private long chargetime = config.getLong("Abilities.Air.AirBurst.ChargeTime");
private boolean charged = false;
- private ArrayList blasts = new ArrayList();
+ public ArrayList blasts = new ArrayList();
private ArrayList affectedentities = new ArrayList();
public AirBurst(Player player) {
diff --git a/src/com/projectkorra/ProjectKorra/earthbending/EarthSmash.java b/src/com/projectkorra/ProjectKorra/earthbending/EarthSmash.java
index ed07ffd5..ccc3645b 100644
--- a/src/com/projectkorra/ProjectKorra/earthbending/EarthSmash.java
+++ b/src/com/projectkorra/ProjectKorra/earthbending/EarthSmash.java
@@ -1,9 +1,11 @@
package com.projectkorra.ProjectKorra.earthbending;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-
+import com.projectkorra.ProjectKorra.Ability.AvatarState;
+import com.projectkorra.ProjectKorra.BendingPlayer;
+import com.projectkorra.ProjectKorra.Methods;
+import com.projectkorra.ProjectKorra.ProjectKorra;
+import com.projectkorra.ProjectKorra.TempBlock;
+import com.projectkorra.ProjectKorra.Utilities.ParticleEffect;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -13,12 +15,9 @@ import org.bukkit.entity.LivingEntity;
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.TempBlock;
-import com.projectkorra.ProjectKorra.Ability.AvatarState;
-import com.projectkorra.ProjectKorra.Utilities.ParticleEffect;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
public class EarthSmash {
public static enum ClickType {
@@ -56,7 +55,7 @@ public class EarthSmash {
private BendingPlayer bplayer;
private Block origin;
private Location loc, destination;
- private State state = State.START;
+ public State state = State.START;
private int animCounter, progressCounter;
private long time, delay, cooldown, flightRemove, flightStart;
private double grabbedRange;
@@ -442,7 +441,8 @@ public class EarthSmash {
for(int y = -1; y <= 1; y++)
for(int z = -1; z <= 1; z++)
if((Math.abs(x) + Math.abs(y) + Math.abs(z)) % 2 == 0) //Give it the cool shape
- blocks.add(loc.getWorld().getBlockAt(loc.clone().add(x,y,z)));
+ if(loc != null)
+ blocks.add(loc.getWorld().getBlockAt(loc.clone().add(x,y,z)));
return blocks;
}
@@ -455,6 +455,7 @@ public class EarthSmash {
for(int x = -1; x <= 1; x++)
for(int y = -1; y <= 1; y++)
for(int z = -1; z <= 1; z++)
+ if(loc != null)
blocks.add(loc.getWorld().getBlockAt(loc.clone().add(x,y,z)));
return blocks;
}
diff --git a/src/com/projectkorra/ProjectKorra/firebending/Combustion.java b/src/com/projectkorra/ProjectKorra/firebending/Combustion.java
index a621341e..fc312f29 100644
--- a/src/com/projectkorra/ProjectKorra/firebending/Combustion.java
+++ b/src/com/projectkorra/ProjectKorra/firebending/Combustion.java
@@ -1,7 +1,10 @@
package com.projectkorra.ProjectKorra.firebending;
-import java.util.concurrent.ConcurrentHashMap;
-
+import com.projectkorra.ProjectKorra.Ability.AvatarState;
+import com.projectkorra.ProjectKorra.BendingPlayer;
+import com.projectkorra.ProjectKorra.Methods;
+import com.projectkorra.ProjectKorra.ProjectKorra;
+import com.projectkorra.ProjectKorra.Utilities.ParticleEffect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -11,11 +14,7 @@ import org.bukkit.entity.LivingEntity;
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;
-import com.projectkorra.ProjectKorra.Utilities.ParticleEffect;
+import java.util.concurrent.ConcurrentHashMap;
public class Combustion {
@@ -31,7 +30,7 @@ public class Combustion {
public static double radius = config.getDouble("Abilities.Fire.Combustion.Radius");
public static double defaultdamage = config.getDouble("Abilities.Fire.Combustion.Damage");
- private Location location;
+ public Location location;
private Location origin;
private Vector direction;
private double range = defaultrange;
@@ -41,7 +40,7 @@ public class Combustion {
private float power;
private double damage;
- private Player player;
+ public Player player;
private long starttime;
private boolean charged = false;
public static ConcurrentHashMap instances = new ConcurrentHashMap();
diff --git a/src/com/projectkorra/ProjectKorra/firebending/FireBlast.java b/src/com/projectkorra/ProjectKorra/firebending/FireBlast.java
index 7d42adb9..0fbb0d66 100644
--- a/src/com/projectkorra/ProjectKorra/firebending/FireBlast.java
+++ b/src/com/projectkorra/ProjectKorra/firebending/FireBlast.java
@@ -9,6 +9,7 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
+import org.bukkit.block.Furnace;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@@ -43,7 +44,7 @@ public class FireBlast {
private static boolean canPowerFurnace = true;
static final int maxticks = 10000;
- private Location location;
+ public Location location;
private List safe = new ArrayList();
private Location origin;
private Vector direction;
@@ -125,7 +126,10 @@ public class FireBlast {
if (Methods.isSolid(block) || block.isLiquid()) {
if (block.getType() == Material.FURNACE && canPowerFurnace) {
-
+ Furnace furnace = (Furnace) block.getState();
+ furnace.setBurnTime((short) 800);
+ furnace.setCookTime((short) 800);
+ furnace.update();
} else if (FireStream.isIgnitable(player, block.getRelative(BlockFace.UP))) {
ignite(location);
}
diff --git a/src/com/projectkorra/ProjectKorra/firebending/FireBurst.java b/src/com/projectkorra/ProjectKorra/firebending/FireBurst.java
index a4845a59..c95d17c8 100644
--- a/src/com/projectkorra/ProjectKorra/firebending/FireBurst.java
+++ b/src/com/projectkorra/ProjectKorra/firebending/FireBurst.java
@@ -44,7 +44,9 @@ public class FireBurst {
}
if (AvatarState.isAvatarState(player))
chargetime = 0;
- if (BendingManager.events.get(player.getWorld()).equalsIgnoreCase("SozinsComet")) chargetime = 0;
+ if (BendingManager.events.containsKey(player.getWorld())) {
+ if(BendingManager.events.get(player.getWorld()).equalsIgnoreCase("SozinsComet")) chargetime = 0;
+ }
this.player = player;
instances.put(player, this);
}
diff --git a/src/com/projectkorra/ProjectKorra/firebending/FireCombo.java b/src/com/projectkorra/ProjectKorra/firebending/FireCombo.java
index f85bcd47..8de62ad9 100644
--- a/src/com/projectkorra/ProjectKorra/firebending/FireCombo.java
+++ b/src/com/projectkorra/ProjectKorra/firebending/FireCombo.java
@@ -1,8 +1,11 @@
package com.projectkorra.ProjectKorra.firebending;
-import java.util.ArrayList;
-import java.util.List;
-
+import com.projectkorra.ProjectKorra.Ability.AvatarState;
+import com.projectkorra.ProjectKorra.*;
+import com.projectkorra.ProjectKorra.ComboManager.ClickType;
+import com.projectkorra.ProjectKorra.Utilities.ParticleEffect;
+import com.projectkorra.ProjectKorra.chiblocking.Paralyze;
+import com.projectkorra.ProjectKorra.waterbending.Bloodbending;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -15,16 +18,8 @@ import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
-import com.projectkorra.ProjectKorra.BendingPlayer;
-import com.projectkorra.ProjectKorra.ComboManager.ClickType;
-import com.projectkorra.ProjectKorra.Commands;
-import com.projectkorra.ProjectKorra.Element;
-import com.projectkorra.ProjectKorra.Methods;
-import com.projectkorra.ProjectKorra.ProjectKorra;
-import com.projectkorra.ProjectKorra.Ability.AvatarState;
-import com.projectkorra.ProjectKorra.Utilities.ParticleEffect;
-import com.projectkorra.ProjectKorra.chiblocking.Paralyze;
-import com.projectkorra.ProjectKorra.waterbending.Bloodbending;
+import java.util.ArrayList;
+import java.util.List;
public class FireCombo {
public static final List abilitiesToBlock = new ArrayList() {
diff --git a/src/com/projectkorra/ProjectKorra/firebending/Fireball.java b/src/com/projectkorra/ProjectKorra/firebending/Fireball.java
index 7c9b9ce5..a4c323e9 100644
--- a/src/com/projectkorra/ProjectKorra/firebending/Fireball.java
+++ b/src/com/projectkorra/ProjectKorra/firebending/Fireball.java
@@ -1,7 +1,9 @@
package com.projectkorra.ProjectKorra.firebending;
-import java.util.concurrent.ConcurrentHashMap;
-
+import com.projectkorra.ProjectKorra.Ability.AvatarState;
+import com.projectkorra.ProjectKorra.Methods;
+import com.projectkorra.ProjectKorra.ProjectKorra;
+import com.projectkorra.ProjectKorra.Utilities.ParticleEffect;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -12,10 +14,7 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.util.Vector;
-import com.projectkorra.ProjectKorra.Methods;
-import com.projectkorra.ProjectKorra.ProjectKorra;
-import com.projectkorra.ProjectKorra.Ability.AvatarState;
-import com.projectkorra.ProjectKorra.Utilities.ParticleEffect;
+import java.util.concurrent.ConcurrentHashMap;
public class Fireball {
@@ -45,7 +44,7 @@ public class Fireball {
private boolean launched = false;
private Player player;
private Location origin;
- private Location location;
+ public Location location;
private Vector direction;
private TNTPrimed explosion = null;
@@ -199,7 +198,7 @@ public class Fireball {
return false;
}
- private void explode() {
+ public void explode() {
// List blocks = Methods.getBlocksAroundPoint(location, 3);
// List blocks2 = new ArrayList();
diff --git a/src/com/projectkorra/ProjectKorra/firebending/Lightning.java b/src/com/projectkorra/ProjectKorra/firebending/Lightning.java
index c9b6d6a1..5ab784db 100644
--- a/src/com/projectkorra/ProjectKorra/firebending/Lightning.java
+++ b/src/com/projectkorra/ProjectKorra/firebending/Lightning.java
@@ -2,14 +2,11 @@ package com.projectkorra.ProjectKorra.firebending;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashMap;
-import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
-import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
diff --git a/src/com/projectkorra/ProjectKorra/waterbending/Bloodbending.java b/src/com/projectkorra/ProjectKorra/waterbending/Bloodbending.java
index 07077bb6..6525cbb3 100644
--- a/src/com/projectkorra/ProjectKorra/waterbending/Bloodbending.java
+++ b/src/com/projectkorra/ProjectKorra/waterbending/Bloodbending.java
@@ -1,23 +1,19 @@
package com.projectkorra.ProjectKorra.waterbending;
-import java.util.ArrayList;
-import java.util.concurrent.ConcurrentHashMap;
-
+import com.projectkorra.ProjectKorra.Ability.AvatarState;
+import com.projectkorra.ProjectKorra.BendingPlayer;
+import com.projectkorra.ProjectKorra.Methods;
+import com.projectkorra.ProjectKorra.Objects.HorizontalVelocityTracker;
+import com.projectkorra.ProjectKorra.ProjectKorra;
+import com.projectkorra.ProjectKorra.TempPotionEffect;
import org.bukkit.Location;
-import org.bukkit.entity.Creature;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
+import org.bukkit.entity.*;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
-import com.projectkorra.ProjectKorra.BendingPlayer;
-import com.projectkorra.ProjectKorra.Methods;
-import com.projectkorra.ProjectKorra.ProjectKorra;
-import com.projectkorra.ProjectKorra.TempPotionEffect;
-import com.projectkorra.ProjectKorra.Ability.AvatarState;
+import java.util.ArrayList;
+import java.util.concurrent.ConcurrentHashMap;
public class Bloodbending {
@@ -48,11 +44,11 @@ public class Bloodbending {
}
- if (onlyUsableAtNight && !Methods.isNight(player.getWorld())) {
+ if (onlyUsableAtNight && !Methods.isNight(player.getWorld()) && !Methods.canBloodbendAtAnytime(player)) {
return;
}
- if (onlyUsableDuringMoon && !Methods.isFullMoon(player.getWorld())) {
+ if (onlyUsableDuringMoon && !Methods.isFullMoon(player.getWorld()) && !Methods.canBloodbendAtAnytime(player)) {
return;
}
@@ -88,12 +84,14 @@ public class Bloodbending {
if (target instanceof Player) {
if (Methods.canBend(((Player) target).getName(), "Bloodbending")
|| AvatarState.isAvatarState((Player) target))
- return;
+ if(!Methods.isDay(target.getWorld()) || Methods.canBloodbendAtAnytime((Player) target))
+ return;
}
if (!canBeUsedOnUndead && isUndead(target)) {
return;
}
Methods.damageEntity(player, target, 0);
+ HorizontalVelocityTracker.remove(target);
Methods.breakBreathbendingHold(target);
targetentities.put(target, target.getLocation().clone());
}
@@ -115,12 +113,14 @@ public class Bloodbending {
for (Entity entity : targetentities.keySet()) {
double dx, dy, dz;
Location target = entity.getLocation().clone();
- dx = target.getX() - location.getX();
- dy = target.getY() - location.getY();
- dz = target.getZ() - location.getZ();
- Vector vector = new Vector(dx, dy, dz);
+// dx = target.getX() - location.getX();
+// dy = target.getY() - location.getY();
+// dz = target.getZ() - location.getZ();
+// Vector vector = new Vector(dx, dy, dz);
+ Vector vector = Methods.getDirection(location, Methods.getTargetedLocation(player, location.distance(target)));
vector.normalize();
entity.setVelocity(vector.multiply(factor));
+ new HorizontalVelocityTracker(entity, player, 200);
}
remove(player);
}
@@ -223,7 +223,7 @@ public class Bloodbending {
continue;
}
Location location = Methods.getTargetedLocation(player,
- (int) targetentities.get(entity).distance(player.getLocation()));
+ 6 /*(int) targetentities.get(entity).distance(player.getLocation())*/);
double distance = location.distance(newlocation);
double dx, dy, dz;
dx = location.getX() - newlocation.getX();
diff --git a/src/com/projectkorra/ProjectKorra/waterbending/IceBlast.java b/src/com/projectkorra/ProjectKorra/waterbending/IceBlast.java
index c7da62b1..e12ac375 100644
--- a/src/com/projectkorra/ProjectKorra/waterbending/IceBlast.java
+++ b/src/com/projectkorra/ProjectKorra/waterbending/IceBlast.java
@@ -43,7 +43,7 @@ public class IceBlast {
private Location destination;
private Block sourceblock;
private Player player;
- private TempBlock source;
+ public TempBlock source;
private double defaultdamage = DAMAGE;
public IceBlast(Player player) {
diff --git a/src/com/projectkorra/ProjectKorra/waterbending/Torrent.java b/src/com/projectkorra/ProjectKorra/waterbending/Torrent.java
index 5767eab6..1d84841c 100644
--- a/src/com/projectkorra/ProjectKorra/waterbending/Torrent.java
+++ b/src/com/projectkorra/ProjectKorra/waterbending/Torrent.java
@@ -1,9 +1,9 @@
package com.projectkorra.ProjectKorra.waterbending;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
-
+import com.projectkorra.ProjectKorra.Ability.AvatarState;
+import com.projectkorra.ProjectKorra.Methods;
+import com.projectkorra.ProjectKorra.ProjectKorra;
+import com.projectkorra.ProjectKorra.TempBlock;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
@@ -14,10 +14,9 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
-import com.projectkorra.ProjectKorra.Methods;
-import com.projectkorra.ProjectKorra.ProjectKorra;
-import com.projectkorra.ProjectKorra.TempBlock;
-import com.projectkorra.ProjectKorra.Ability.AvatarState;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
public class Torrent {
@@ -53,13 +52,13 @@ public class Torrent {
private boolean formed = false;
private boolean launch = false;
private boolean launching = false;
- private boolean freeze = false;
+ public boolean freeze = false;
private double range = RANGE;
private int damage = DAMAGE;
private int deflectdamage = DEFLECT_DAMAGE;
private ArrayList blocks = new ArrayList();
- private ArrayList launchblocks = new ArrayList();
+ public ArrayList launchblocks = new ArrayList();
private ArrayList hurtentities = new ArrayList();
public Torrent(Player player) {
@@ -434,7 +433,7 @@ public class Torrent {
blocks.clear();
}
- private void remove() {
+ public void remove() {
clearRing();
for (TempBlock block : launchblocks)
block.revertBlock();
diff --git a/src/com/projectkorra/ProjectKorra/waterbending/WaterSpout.java b/src/com/projectkorra/ProjectKorra/waterbending/WaterSpout.java
index 2ddf4815..2c7f19d5 100644
--- a/src/com/projectkorra/ProjectKorra/waterbending/WaterSpout.java
+++ b/src/com/projectkorra/ProjectKorra/waterbending/WaterSpout.java
@@ -1,21 +1,20 @@
package com.projectkorra.ProjectKorra.waterbending;
-import java.util.ArrayList;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.Server;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.potion.PotionEffectType;
-
import com.projectkorra.ProjectKorra.Flight;
import com.projectkorra.ProjectKorra.Methods;
import com.projectkorra.ProjectKorra.ProjectKorra;
import com.projectkorra.ProjectKorra.TempBlock;
import com.projectkorra.ProjectKorra.Utilities.ParticleEffect;
import com.projectkorra.ProjectKorra.chiblocking.Paralyze;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.Server;
+import org.bukkit.block.Block;
+import org.bukkit.entity.Player;
+import org.bukkit.potion.PotionEffectType;
+
+import java.util.ArrayList;
+import java.util.concurrent.ConcurrentHashMap;
public class WaterSpout {
@@ -25,6 +24,7 @@ public class WaterSpout {
public static ConcurrentHashMap baseblocks = new ConcurrentHashMap();
private static final int HEIGHT = ProjectKorra.plugin.getConfig().getInt("Abilities.Water.WaterSpout.Height");
+ private static final boolean PARTICLES = ProjectKorra.plugin.getConfig().getBoolean("Abilities.Water.WaterSpout.Particles");
// private static final double threshold = .05;
// private static final byte half = 0x4;
@@ -172,6 +172,9 @@ public class WaterSpout {
public void rotateParticles(Block block)
{
+ if(!PARTICLES)
+ return;
+
if (System.currentTimeMillis() >= time + interval)
{
time = System.currentTimeMillis();
diff --git a/src/plugin.yml b/src/plugin.yml
index afb6af09..5140c40c 100644
--- a/src/plugin.yml
+++ b/src/plugin.yml
@@ -1,6 +1,6 @@
name: ProjectKorra
author: ProjectKorra
-version: 1.6.0 BETA 11
+version: 1.6.0 BETA 15
main: com.projectkorra.ProjectKorra.ProjectKorra
softdepend: [PreciousStones, WorldGuard, WorldEdit, Factions, MassiveCore, GriefPrevention, Towny, NoCheatPlus, LWC]
commands: