From af0cf17b0b495818d9b98a25bc0711875e18423f Mon Sep 17 00:00:00 2001 From: jayoevans Date: Thu, 24 Oct 2019 21:11:15 +1000 Subject: [PATCH] Initial rework --- .../projectkorra/BendingManager.java | 2 +- .../projectkorra/BendingPlayer.java | 4 +- .../projectkorra/GeneralMethods.java | 12 +- .../projectkorra/projectkorra/PKListener.java | 17 +- .../projectkorra/ability/Ability.java | 724 ++++++++++-- .../projectkorra/ability/AbilityData.java | 43 + .../projectkorra/ability/AbilityManager.java | 310 +++-- .../projectkorra/ability/ComboManager.java | 128 ++ .../projectkorra/ability/CoreAbility.java | 1053 ----------------- .../ability/{ => api}/AddonAbility.java | 2 +- .../ability/{ => api}/AirAbility.java | 2 +- .../ability/{ => api}/AvatarAbility.java | 2 +- .../ability/{ => api}/BloodAbility.java | 2 +- .../ability/{ => api}/ChiAbility.java | 2 +- .../ability/{ => api}/ComboAbility.java | 2 +- .../ability/{ => api}/CombustionAbility.java | 2 +- .../ability/{ => api}/EarthAbility.java | 2 +- .../ability/{ => api}/ElementalAbility.java | 2 +- .../ability/{ => api}/FireAbility.java | 2 +- .../ability/{ => api}/FlightAbility.java | 2 +- .../ability/{ => api}/HealingAbility.java | 2 +- .../ability/{ => api}/IceAbility.java | 2 +- .../ability/{ => api}/LavaAbility.java | 2 +- .../ability/{ => api}/LightningAbility.java | 2 +- .../ability/{ => api}/MetalAbility.java | 2 +- .../ability/{ => api}/MultiAbility.java | 2 +- .../ability/{ => api}/PassiveAbility.java | 2 +- .../ability/{ => api}/PlantAbility.java | 2 +- .../{ => api}/PlayerBindAbilityEvent.java | 2 +- .../ability/{ => api}/SandAbility.java | 2 +- .../ability/{ => api}/SpiritualAbility.java | 2 +- .../ability/{ => api}/SubAbility.java | 2 +- .../ability/{ => api}/WaterAbility.java | 2 +- .../ability/bind/AbilityBindManager.java | 117 ++ .../AbilityBindRepository.java} | 4 +- .../ability/loader/AbilityLoader.java | 4 + .../ability/loader/AddonAbilityLoader.java | 20 + .../ability/loader/ComboAbilityLoader.java | 15 + .../ability/loader/MultiAbilityLoader.java | 18 + .../ability/loader/PassiveAbilityLoader.java | 21 + .../ability/util/CollisionManager.java | 2 +- .../ability/util/ComboManager.java | 2 +- .../ability/util/MultiAbilityManager.java | 2 +- .../ability/util/PassiveManager.java | 2 +- .../projectkorra/airbending/AirBlast.java | 2 +- .../projectkorra/airbending/AirBurst.java | 2 +- .../projectkorra/airbending/AirScooter.java | 4 +- .../projectkorra/airbending/AirShield.java | 2 +- .../projectkorra/airbending/AirSpout.java | 4 +- .../projectkorra/airbending/AirSuction.java | 2 +- .../projectkorra/airbending/AirSwipe.java | 4 +- .../projectkorra/airbending/Suffocate.java | 2 +- .../projectkorra/airbending/Tornado.java | 4 +- .../airbending/combo/AirStream.java | 4 +- .../airbending/combo/AirSweep.java | 4 +- .../airbending/combo/Twister.java | 4 +- .../airbending/flight/FlightMultiAbility.java | 4 +- .../airbending/passive/AirAgility.java | 4 +- .../airbending/passive/AirSaturation.java | 4 +- .../airbending/passive/GracefulDescent.java | 4 +- .../projectkorra/avatar/AvatarState.java | 2 +- .../chiblocking/AcrobatStance.java | 2 +- .../projectkorra/chiblocking/HighJump.java | 2 +- .../projectkorra/chiblocking/Paralyze.java | 2 +- .../projectkorra/chiblocking/QuickStrike.java | 2 +- .../projectkorra/chiblocking/RapidPunch.java | 2 +- .../projectkorra/chiblocking/Smokescreen.java | 2 +- .../projectkorra/chiblocking/SwiftKick.java | 4 +- .../chiblocking/WarriorStance.java | 2 +- .../chiblocking/combo/Immobilize.java | 4 +- .../chiblocking/passive/Acrobatics.java | 4 +- .../chiblocking/passive/ChiAgility.java | 4 +- .../chiblocking/passive/ChiPassive.java | 2 +- .../chiblocking/passive/ChiSaturation.java | 4 +- .../projectkorra/command/BindCommand.java | 4 +- .../projectkorra/command/DisplayCommand.java | 6 +- .../projectkorra/command/HelpCommand.java | 6 +- .../projectkorra/earthbending/Catapult.java | 2 +- .../projectkorra/earthbending/Collapse.java | 2 +- .../earthbending/CollapseWall.java | 2 +- .../projectkorra/earthbending/EarthArmor.java | 4 +- .../projectkorra/earthbending/EarthBlast.java | 4 +- .../projectkorra/earthbending/EarthDome.java | 2 +- .../projectkorra/earthbending/EarthGrab.java | 4 +- .../projectkorra/earthbending/EarthSmash.java | 4 +- .../earthbending/EarthTunnel.java | 4 +- .../projectkorra/earthbending/RaiseEarth.java | 2 +- .../earthbending/RaiseEarthWall.java | 2 +- .../projectkorra/earthbending/Ripple.java | 4 +- .../projectkorra/earthbending/Shockwave.java | 2 +- .../earthbending/Tremorsense.java | 4 +- .../earthbending/combo/EarthDomeOthers.java | 2 +- .../earthbending/combo/EarthDomeSelf.java | 4 +- .../earthbending/combo/EarthPillars.java | 4 +- .../earthbending/lava/LavaFlow.java | 4 +- .../earthbending/metal/Extraction.java | 2 +- .../earthbending/metal/MetalClips.java | 2 +- .../earthbending/passive/DensityShift.java | 6 +- .../earthbending/passive/FerroControl.java | 4 +- .../projectkorra/firebending/Blaze.java | 2 +- .../projectkorra/firebending/BlazeArc.java | 2 +- .../projectkorra/firebending/BlazeRing.java | 2 +- .../projectkorra/firebending/FireBlast.java | 4 +- .../firebending/FireBlastCharged.java | 4 +- .../projectkorra/firebending/FireBurst.java | 2 +- .../projectkorra/firebending/FireJet.java | 4 +- .../firebending/FireManipulation.java | 2 +- .../projectkorra/firebending/FireShield.java | 2 +- .../projectkorra/firebending/HeatControl.java | 2 +- .../firebending/Illumination.java | 2 +- .../projectkorra/firebending/WallOfFire.java | 4 +- .../firebending/combo/FireComboStream.java | 2 +- .../firebending/combo/FireKick.java | 4 +- .../firebending/combo/FireSpin.java | 4 +- .../firebending/combo/FireWheel.java | 6 +- .../firebending/combo/JetBlast.java | 4 +- .../firebending/combo/JetBlaze.java | 4 +- .../firebending/combustion/Combustion.java | 6 +- .../firebending/lightning/Lightning.java | 2 +- .../firebending/util/FirebendingManager.java | 2 +- .../projectkorra/module/ModuleManager.java | 3 + .../object/HorizontalVelocityTracker.java | 2 +- .../projectkorra/player/BendingPlayer.java | 13 +- .../projectkorra/util/BlockSource.java | 6 +- .../projectkorra/util/RevertChecker.java | 2 +- .../waterbending/OctopusForm.java | 4 +- .../projectkorra/waterbending/SurgeWall.java | 4 +- .../projectkorra/waterbending/SurgeWave.java | 6 +- .../projectkorra/waterbending/Torrent.java | 4 +- .../waterbending/TorrentWave.java | 2 +- .../waterbending/WaterBubble.java | 4 +- .../waterbending/WaterManipulation.java | 4 +- .../projectkorra/waterbending/WaterSpout.java | 4 +- .../waterbending/WaterSpoutWave.java | 4 +- .../waterbending/blood/Bloodbending.java | 4 +- .../waterbending/combo/IceBullet.java | 6 +- .../waterbending/combo/IceWave.java | 4 +- .../waterbending/healing/HealingWaters.java | 6 +- .../waterbending/ice/IceBlast.java | 4 +- .../waterbending/ice/IceSpikeBlast.java | 4 +- .../waterbending/ice/IceSpikePillar.java | 8 +- .../waterbending/ice/IceSpikePillarField.java | 6 +- .../waterbending/ice/PhaseChange.java | 4 +- .../multiabilities/WaterArms.java | 6 +- .../multiabilities/WaterArmsFreeze.java | 2 +- .../multiabilities/WaterArmsSpear.java | 2 +- .../multiabilities/WaterArmsWhip.java | 2 +- .../waterbending/passive/FastSwim.java | 4 +- .../waterbending/passive/HydroSink.java | 6 +- .../waterbending/plant/PlantRegrowth.java | 4 +- .../waterbending/util/WaterReturn.java | 2 +- .../waterbending/util/WaterSourceGrabber.java | 4 +- 152 files changed, 1435 insertions(+), 1497 deletions(-) create mode 100644 src/com/projectkorra/projectkorra/ability/AbilityData.java create mode 100644 src/com/projectkorra/projectkorra/ability/ComboManager.java delete mode 100644 src/com/projectkorra/projectkorra/ability/CoreAbility.java rename src/com/projectkorra/projectkorra/ability/{ => api}/AddonAbility.java (93%) rename src/com/projectkorra/projectkorra/ability/{ => api}/AirAbility.java (98%) rename src/com/projectkorra/projectkorra/ability/{ => api}/AvatarAbility.java (96%) rename src/com/projectkorra/projectkorra/ability/{ => api}/BloodAbility.java (91%) rename src/com/projectkorra/projectkorra/ability/{ => api}/ChiAbility.java (91%) rename src/com/projectkorra/projectkorra/ability/{ => api}/ComboAbility.java (91%) rename src/com/projectkorra/projectkorra/ability/{ => api}/CombustionAbility.java (91%) rename src/com/projectkorra/projectkorra/ability/{ => api}/EarthAbility.java (99%) rename src/com/projectkorra/projectkorra/ability/{ => api}/ElementalAbility.java (99%) rename src/com/projectkorra/projectkorra/ability/{ => api}/FireAbility.java (99%) rename src/com/projectkorra/projectkorra/ability/{ => api}/FlightAbility.java (91%) rename src/com/projectkorra/projectkorra/ability/{ => api}/HealingAbility.java (91%) rename src/com/projectkorra/projectkorra/ability/{ => api}/IceAbility.java (91%) rename src/com/projectkorra/projectkorra/ability/{ => api}/LavaAbility.java (91%) rename src/com/projectkorra/projectkorra/ability/{ => api}/LightningAbility.java (91%) rename src/com/projectkorra/projectkorra/ability/{ => api}/MetalAbility.java (91%) rename src/com/projectkorra/projectkorra/ability/{ => api}/MultiAbility.java (89%) rename src/com/projectkorra/projectkorra/ability/{ => api}/PassiveAbility.java (90%) rename src/com/projectkorra/projectkorra/ability/{ => api}/PlantAbility.java (91%) rename src/com/projectkorra/projectkorra/ability/{ => api}/PlayerBindAbilityEvent.java (95%) rename src/com/projectkorra/projectkorra/ability/{ => api}/SandAbility.java (91%) rename src/com/projectkorra/projectkorra/ability/{ => api}/SpiritualAbility.java (91%) rename src/com/projectkorra/projectkorra/ability/{ => api}/SubAbility.java (83%) rename src/com/projectkorra/projectkorra/ability/{ => api}/WaterAbility.java (99%) create mode 100644 src/com/projectkorra/projectkorra/ability/bind/AbilityBindManager.java rename src/com/projectkorra/projectkorra/ability/{AbilityRepository.java => bind/AbilityBindRepository.java} (96%) create mode 100644 src/com/projectkorra/projectkorra/ability/loader/AbilityLoader.java create mode 100644 src/com/projectkorra/projectkorra/ability/loader/AddonAbilityLoader.java create mode 100644 src/com/projectkorra/projectkorra/ability/loader/ComboAbilityLoader.java create mode 100644 src/com/projectkorra/projectkorra/ability/loader/MultiAbilityLoader.java create mode 100644 src/com/projectkorra/projectkorra/ability/loader/PassiveAbilityLoader.java diff --git a/src/com/projectkorra/projectkorra/BendingManager.java b/src/com/projectkorra/projectkorra/BendingManager.java index 62e8b3ac..5a018cf5 100644 --- a/src/com/projectkorra/projectkorra/BendingManager.java +++ b/src/com/projectkorra/projectkorra/BendingManager.java @@ -2,7 +2,7 @@ package com.projectkorra.projectkorra; import co.aikar.timings.lib.MCTiming; import com.projectkorra.projectkorra.ability.CoreAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.configs.properties.FirePropertiesConfig; import com.projectkorra.projectkorra.configuration.configs.properties.WaterPropertiesConfig; diff --git a/src/com/projectkorra/projectkorra/BendingPlayer.java b/src/com/projectkorra/projectkorra/BendingPlayer.java index 95a3351f..1057e923 100644 --- a/src/com/projectkorra/projectkorra/BendingPlayer.java +++ b/src/com/projectkorra/projectkorra/BendingPlayer.java @@ -2,8 +2,8 @@ package com.projectkorra.projectkorra; import com.projectkorra.projectkorra.Element.SubElement; import com.projectkorra.projectkorra.ability.Ability; -import com.projectkorra.projectkorra.ability.AvatarAbility; -import com.projectkorra.projectkorra.ability.ChiAbility; +import com.projectkorra.projectkorra.ability.api.AvatarAbility; +import com.projectkorra.projectkorra.ability.api.ChiAbility; import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.ability.util.PassiveManager; import com.projectkorra.projectkorra.avatar.AvatarState; diff --git a/src/com/projectkorra/projectkorra/GeneralMethods.java b/src/com/projectkorra/projectkorra/GeneralMethods.java index bc3f8f16..be3c62ce 100644 --- a/src/com/projectkorra/projectkorra/GeneralMethods.java +++ b/src/com/projectkorra/projectkorra/GeneralMethods.java @@ -26,13 +26,13 @@ import com.palmergames.bukkit.towny.war.flagwar.TownyWar; import com.palmergames.bukkit.towny.war.flagwar.TownyWarConfig; import com.projectkorra.projectkorra.Element.SubElement; import com.projectkorra.projectkorra.ability.Ability; -import com.projectkorra.projectkorra.ability.AddonAbility; +import com.projectkorra.projectkorra.ability.api.AddonAbility; import com.projectkorra.projectkorra.ability.CoreAbility; -import com.projectkorra.projectkorra.ability.EarthAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; -import com.projectkorra.projectkorra.ability.FireAbility; -import com.projectkorra.projectkorra.ability.PassiveAbility; -import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.FireAbility; +import com.projectkorra.projectkorra.ability.api.PassiveAbility; +import com.projectkorra.projectkorra.ability.api.WaterAbility; import com.projectkorra.projectkorra.ability.util.Collision; import com.projectkorra.projectkorra.ability.util.CollisionInitializer; import com.projectkorra.projectkorra.ability.util.CollisionManager; diff --git a/src/com/projectkorra/projectkorra/PKListener.java b/src/com/projectkorra/projectkorra/PKListener.java index d98db3d4..a328d6ba 100644 --- a/src/com/projectkorra/projectkorra/PKListener.java +++ b/src/com/projectkorra/projectkorra/PKListener.java @@ -75,17 +75,16 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; -import com.projectkorra.projectkorra.Element.SubElement; import com.projectkorra.projectkorra.ability.Ability; -import com.projectkorra.projectkorra.ability.AddonAbility; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.AvatarAbility; -import com.projectkorra.projectkorra.ability.ChiAbility; +import com.projectkorra.projectkorra.ability.api.AddonAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.AvatarAbility; +import com.projectkorra.projectkorra.ability.api.ChiAbility; import com.projectkorra.projectkorra.ability.CoreAbility; -import com.projectkorra.projectkorra.ability.EarthAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; -import com.projectkorra.projectkorra.ability.FireAbility; -import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.FireAbility; +import com.projectkorra.projectkorra.ability.api.WaterAbility; import com.projectkorra.projectkorra.ability.util.ComboManager; import com.projectkorra.projectkorra.ability.util.MultiAbilityManager; import com.projectkorra.projectkorra.ability.util.PassiveManager; diff --git a/src/com/projectkorra/projectkorra/ability/Ability.java b/src/com/projectkorra/projectkorra/ability/Ability.java index 7e70fbd9..df92b88e 100644 --- a/src/com/projectkorra/projectkorra/ability/Ability.java +++ b/src/com/projectkorra/projectkorra/ability/Ability.java @@ -1,156 +1,658 @@ package com.projectkorra.projectkorra.ability; +import com.projectkorra.projectkorra.BendingPlayer; +import com.projectkorra.projectkorra.Manager; +import com.projectkorra.projectkorra.ProjectKorra; +import com.projectkorra.projectkorra.ability.api.AddonAbility; +import com.projectkorra.projectkorra.ability.api.ComboAbility; +import com.projectkorra.projectkorra.ability.api.MultiAbility; +import com.projectkorra.projectkorra.ability.api.PassiveAbility; +import com.projectkorra.projectkorra.ability.loader.AddonAbilityLoader; +import com.projectkorra.projectkorra.ability.util.*; +import com.projectkorra.projectkorra.ability.util.MultiAbilityManager.MultiAbilityInfo; +import com.projectkorra.projectkorra.attribute.Attribute; +import com.projectkorra.projectkorra.attribute.AttributeModifier; +import com.projectkorra.projectkorra.attribute.AttributePriority; +import com.projectkorra.projectkorra.configuration.ConfigManager; +import com.projectkorra.projectkorra.configuration.configs.abilities.AbilityConfig; +import com.projectkorra.projectkorra.element.Element; +import com.projectkorra.projectkorra.event.AbilityEndEvent; +import com.projectkorra.projectkorra.event.AbilityStartEvent; +import com.projectkorra.projectkorra.module.ModuleManager; +import com.projectkorra.projectkorra.util.FlightHandler; +import com.projectkorra.projectkorra.util.TimeUtil; +import org.apache.commons.lang3.Validate; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import org.apache.commons.lang3.tuple.Pair; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.Player; -import org.bukkit.event.player.PlayerToggleSneakEvent; +import org.bukkit.plugin.java.JavaPlugin; -import com.projectkorra.projectkorra.BendingPlayer; -import com.projectkorra.projectkorra.Element; -import com.projectkorra.projectkorra.Element.SubElement; -import com.projectkorra.projectkorra.command.HelpCommand; -import com.projectkorra.projectkorra.earthbending.EarthBlast; -import com.projectkorra.projectkorra.firebending.Blaze; -import com.projectkorra.projectkorra.firebending.FireBlast; -import com.projectkorra.projectkorra.firebending.FireBlastCharged; -import com.projectkorra.projectkorra.firebending.FireBurst; -import com.projectkorra.projectkorra.waterbending.TorrentWave; +import java.io.File; +import java.lang.reflect.Field; +import java.lang.reflect.ParameterizedType; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.jar.JarFile; /** - * The Ability interface defines the set of methods that any CoreAbility, - * AddonAbility, ComboAbility, or MultiAbility should implement. - * {@link CoreAbility} provides a default implementation for a few of these - * methods, but most will need to be specified by each Ability individually. + * Ability provides default implementation of an Ability, including methods + * to control the life cycle of a specific instance. Ability also provides a + * system to load CoreAbilities within a {@link JavaPlugin}, or located in an + * external {@link JarFile}. + *

+ * For {@link CollisionManager} and {@link Collision}, a Ability may need to + * override {@link #isCollidable()}, {@link #getCollisionRadius()}, + * {@link #handleCollision(Collision)}, and {@link #getLocations()}. + * + * @see #start() + * @see #progress() + * @see #remove() + * @see #registerAddonAbilities(String) + * @see #registerPluginAbilities(JavaPlugin, String) */ -public interface Ability { - /** - * Causes the ability to be updated. - */ - public void progress(); +public abstract class Ability { + + private static final double DEFAULT_COLLISION_RADIUS = 0.3; + private static final List ADDON_PLUGINS = new ArrayList<>(); + private static final Map, Map> ATTRIBUTE_FIELDS = new HashMap<>(); + + private static int idCounter; + + protected final AbilityManager manager = ModuleManager.getModule(AbilityManager.class); + protected final Config config = ConfigManager.getConfig(((Class) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0])); + + protected Player player; + protected BendingPlayer bPlayer; + protected FlightHandler flightHandler; + + private final Map>>> attributeModifiers = new HashMap<>(); + private final Map attributeValues = new HashMap<>(); + private boolean started; + private boolean removed; + private boolean hidden; + private int id; + private long startTime; + private long startTick; + private boolean attributesModified; + + static { + idCounter = Integer.MIN_VALUE; + } /** - * Causes the ability to be removed from existence. - */ - public void remove(); - - /** - * Determines if this ability uses the {@link PlayerToggleSneakEvent} as a - * controlling mechanism. Currently {@link WaterPassive} will not work while - * the player has a sneak ability bound. + * The default constructor is needed to create a fake instance of each + * Ability via reflection in {@link #registerAbilities()}. More + * specifically, {@link #registerPluginAbilities} calls + * getDeclaredConstructor which is only usable with a public default + * constructor. Reflection lets us create a list of all of the plugin's + * abilities when the plugin first loads. * - * @return true if the ability uses sneak as a controlling mechanism + * @see #ABILITIES_BY_NAME + * @see #getAbility(String) */ - public boolean isSneakAbility(); + public Ability() { + for (final Field field : this.getClass().getDeclaredFields()) { + if (field.isAnnotationPresent(Attribute.class)) { + final Attribute attribute = field.getAnnotation(Attribute.class); + if (!ATTRIBUTE_FIELDS.containsKey(this.getClass())) { + ATTRIBUTE_FIELDS.put(this.getClass(), new HashMap<>()); + } + ATTRIBUTE_FIELDS.get(this.getClass()).put(attribute.value(), field); + } + } + } /** - * Determines if this ability is considered harmless against other players. - * A harmless ability cannot manipulate another player. For example: - * AirPassive, WaterSpout, AirSpout, and FireJet. + * Creates a new Ability instance but does not start it. * - * @return true if the ability is harmless and should be allowed in both PvP - * and non-PvP zones + * @param player the non-null player that created this instance + * @see #start() */ - public boolean isHarmlessAbility(); + public Ability(final Config config, final Player player) { + if (player == null || !this.isEnabled()) { + return; + } + + this.player = player; + this.bPlayer = BendingPlayer.getBendingPlayer(player); + this.flightHandler = Manager.getManager(FlightHandler.class); + this.startTime = System.currentTimeMillis(); + this.started = false; + this.id = Ability.idCounter; + this.startTick = this.getCurrentTick(); + + if (idCounter == Integer.MAX_VALUE) { + idCounter = Integer.MIN_VALUE; + } else { + idCounter++; + } + } /** - * Determines if this ability can ignite blocks. For example: {@link Blaze}, - * {@link FireBlast}, and {@link FireBurst}. - */ - public boolean isIgniteAbility(); - - /** - * Determines if this ability can cause explosions. For example: - * {@link FireBlastCharged} - */ - public boolean isExplosiveAbility(); - - /** - * A hidden ability is an ability that should not be shown by commands such - * as /bending display and /bending help. For example: Combos, - * MultiAbility sub abilities, and helper abilities. + * Causes the ability to begin updating every tick by calling + * {@link #progress()} until {@link #remove()} is called. This method cannot + * be overridden, and any code that needs to be performed before start + * should be handled in the constructor. * - * @return true if the ability should not be displayed to the players + * @see #getStartTime() + * @see #isStarted() + * @see #isRemoved() */ - public boolean isHiddenAbility(); + public final void start() { + if (this.player == null || !this.isEnabled()) { + return; + } + final AbilityStartEvent event = new AbilityStartEvent(this); + Bukkit.getServer().getPluginManager().callEvent(event); + if (event.isCancelled()) { + this.remove(); + return; + } + + this.started = true; + this.startTime = System.currentTimeMillis(); + final Class clazz = this.getClass(); + final UUID uuid = this.player.getUniqueId(); + + this.manager.startAbility(this); + } /** - * Returns true if the ability is enabled through the config.yml. Usually - * the Enabled option follows the format - * Abilities.ElementName.AbilityName.Enabled. - */ - public boolean isEnabled(); - - /** - * @return the cooldown for the ability - */ - public long getCooldown(); - - /** - * Returns the player that caused this ability to be initiated. The player - * can be null in certain circumstances, for example when calling - * {@link CoreAbility#getAbility(String)}, or if an ability decided to set - * player to null. + * Causes this Ability instance to be removed, and {@link #progress} + * will no longer be called every tick. If this method is overridden then + * the new method must call super.remove(). * - * @return the player that this ability belongs to + * {@inheritDoc} + * + * @see #isRemoved() */ - public Player getPlayer(); + public void remove() { + if (this.player == null) { + return; + } + + Bukkit.getServer().getPluginManager().callEvent(new AbilityEndEvent(this)); + this.removed = true; + + this.manager.removeAbility(this); + } + + protected void tryModifyAttributes() { + if (!this.attributesModified) { + modifyAttributes(); + this.attributesModified = true; + } + } /** - * The name of the ability is used for commands such as /bending - * display and /bending help. The name is also used for - * determining the tag for cooldowns - * {@link BendingPlayer#addCooldown(Ability)}, therefore if two abilities - * have the same name they will also share cooldowns. If two classes share - * the same name (SurgeWall/SurgeWave) but need to have independent - * cooldowns, then {@link BendingPlayer#addCooldown(String, long)} should be - * called explicitly. + * Ability keeps track of plugins that have registered abilities to use + * for bending reload purposes
+ * This isn't a simple list, external use isn't recommended * - * @return Returns the name of the ability + * @return a list of entrys with the plugin name and path abilities can be + * found at */ - public String getName(); + public static List getAddonPlugins() { + return ADDON_PLUGINS; + } /** - * Return's the instructions of an ability. ProjectKorra's help command will - * then use this method to display the instructions of an ability when the - * command is run. + * Scans a JavaPlugin and registers Ability class files. * - * @return the instructions for this ability - * @see HelpCommand - * @see CoreAbility#getInstructions() + * @param plugin a JavaPlugin containing Ability class files + * @param packageBase a prefix of the package name, used to increase + * performance + * @see #getAbilities() + * @see #getAbility(String) */ - public String getInstructions(); + public static void registerPluginAbilities(final JavaPlugin plugin, final String packageBase) { + final com.projectkorra.projectkorra.ability.loader.AbilityLoader abilityLoader = new com.projectkorra.projectkorra.ability.loader.AbilityLoader(plugin, packageBase); + final List loadedAbilities = abilityLoader.load(Ability.class, Ability.class); + final String entry = plugin.getName() + "::" + packageBase; + if (!ADDON_PLUGINS.contains(entry)) { + ADDON_PLUGINS.add(entry); + } + + for (final Ability coreAbil : loadedAbilities) { + if (!coreAbil.isEnabled()) { + plugin.getLogger().info(coreAbil.getName() + " is disabled"); + continue; + } + + final String name = coreAbil.getName(); + + if (name == null) { + plugin.getLogger().warning("Ability " + coreAbil.getClass().getName() + " has no name?"); + continue; + } + + try { + ABILITIES_BY_NAME.put(name.toLowerCase(), coreAbil); + ABILITIES_BY_CLASS.put(coreAbil.getClass(), coreAbil); + + if (coreAbil instanceof ComboAbility) { + final ComboAbility combo = (ComboAbility) coreAbil; + if (combo.getCombination() != null) { + ComboManager.getComboAbilities().put(name, new ComboManager.ComboAbilityInfo(name, combo.getCombination(), combo)); + ComboManager.getDescriptions().put(name, coreAbil.getDescription()); + ComboManager.getInstructions().put(name, coreAbil.getInstructions()); + } + } + + if (coreAbil instanceof MultiAbility) { + final MultiAbility multiAbil = (MultiAbility) coreAbil; + MultiAbilityManager.multiAbilityList.add(new MultiAbilityInfo(name, multiAbil.getMultiAbilities())); + } + + if (coreAbil instanceof PassiveAbility) { + PassiveAbility passive = (PassiveAbility) coreAbil; + coreAbil.setHiddenAbility(true); + PassiveManager.getPassives().put(name, coreAbil); + if (!PassiveManager.getPassiveClasses().containsKey(passive)) { + PassiveManager.getPassiveClasses().put(passive, coreAbil.getClass()); + } + } + } catch (Exception | Error e) { + plugin.getLogger().warning("The ability " + coreAbil.getName() + " was not able to load, if this message shows again please remove it!"); + e.printStackTrace(); + ABILITIES_BY_NAME.remove(name.toLowerCase()); + ABILITIES_BY_CLASS.remove(coreAbil.getClass()); + } + } + } /** - * The description of an ability is a few sentences used to describe how the - * player can fully utilize the ability. In most cases the description will - * be specified in the config.yml file and will be retrieved by accessing - * the FileConfiguration via {@link CoreAbility#getConfig}. + * Scans all of the Jar files inside of /ProjectKorra/folder and registers + * all of the Ability class files that were found. * - * @return the description for this ability - * @see HelpCommand - * @see CoreAbility#getDescription() + * @param folder the name of the folder to scan + * @see #getAbilities() + * @see #getAbility(String) */ - public String getDescription(); + public static void registerAddonAbilities(final String folder) { + final ProjectKorra plugin = ProjectKorra.plugin; + final File path = new File(plugin.getDataFolder().toString() + folder); + if (!path.exists()) { + path.mkdir(); + return; + } + + final com.projectkorra.projectkorra.ability.loader.AddonAbilityLoader abilityLoader = new AddonAbilityLoader(plugin, path); + final List loadedAbilities = abilityLoader.load(Ability.class, Ability.class); + + for (final Ability coreAbil : loadedAbilities) { + if (!(coreAbil instanceof AddonAbility)) { + plugin.getLogger().warning(coreAbil.getName() + " is an addon ability and must implement the AddonAbility interface"); + continue; + } else if (!coreAbil.isEnabled()) { + plugin.getLogger().info(coreAbil.getName() + " is disabled"); + continue; + } + + final AddonAbility addon = (AddonAbility) coreAbil; + final String name = coreAbil.getName(); + + try { + addon.load(); + ABILITIES_BY_NAME.put(name.toLowerCase(), coreAbil); + ABILITIES_BY_CLASS.put(coreAbil.getClass(), coreAbil); + + if (coreAbil instanceof ComboAbility) { + final ComboAbility combo = (ComboAbility) coreAbil; + if (combo.getCombination() != null) { + ComboManager.getComboAbilities().put(name, new ComboManager.ComboAbilityInfo(name, combo.getCombination(), combo)); + ComboManager.getDescriptions().put(name, coreAbil.getDescription()); + ComboManager.getInstructions().put(name, coreAbil.getInstructions()); + ComboManager.getAuthors().put(name, addon.getAuthor()); + } + } + + if (coreAbil instanceof MultiAbility) { + final MultiAbility multiAbil = (MultiAbility) coreAbil; + MultiAbilityManager.multiAbilityList.add(new MultiAbilityInfo(name, multiAbil.getMultiAbilities())); + } + + if (coreAbil instanceof PassiveAbility) { + PassiveAbility passive = (PassiveAbility) coreAbil; + coreAbil.setHiddenAbility(true); + PassiveManager.getPassives().put(name, coreAbil); + if (!PassiveManager.getPassiveClasses().containsKey(passive)) { + PassiveManager.getPassiveClasses().put(passive, coreAbil.getClass()); + } + } + } catch (Exception | Error e) { + plugin.getLogger().warning("The ability " + coreAbil.getName() + " was not able to load, if this message shows again please remove it!"); + e.printStackTrace(); + addon.stop(); + ABILITIES_BY_NAME.remove(name.toLowerCase()); + ABILITIES_BY_CLASS.remove(coreAbil.getClass()); + } + } + } + + public long getStartTime() { + return this.startTime; + } + + public long getStartTick() { + return this.startTick; + } + + public long getCurrentTick() { + return this.player.getWorld().getFullTime(); + } + + public boolean isStarted() { + return this.started; + } + + public boolean isRemoved() { + return this.removed; + } + + public BendingPlayer getBendingPlayer() { + return this.bPlayer; + } + + public int getId() { + return this.id; + } + + public abstract Class getConfigType(); + + public boolean isHiddenAbility() { + return this.hidden; + } + + public void setHiddenAbility(final boolean hidden) { + this.hidden = hidden; + } + + public String getInstructions() { + return config.Instructions; + } + + public String getDescription() { + return config.Description; + } + + public String getMovePreview(final Player player) { + final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); + String displayedMessage = ""; + if (bPlayer.isOnCooldown(this)) { + final long cooldown = bPlayer.getCooldown(this.getName()) - System.currentTimeMillis(); + displayedMessage = this.getElement().getColor() + "" + ChatColor.STRIKETHROUGH + this.getName() + "" + this.getElement().getColor() + " - " + TimeUtil.formatTime(cooldown); + } else { + if (bPlayer.getStance() != null && bPlayer.getStance().getName().equals(this.getName())) { + displayedMessage = this.getElement().getColor() + "" + ChatColor.UNDERLINE + this.getName(); + } else { + displayedMessage = this.getElement().getColor() + this.getName(); + } + } + return displayedMessage; + } + + public Player getPlayer() { + return this.player; + } /** - * Specifies the Element used to represent this type of ability, favoring - * SubElements over Elements. For example, a LightningAbility would return - * {@link Element#LIGHTNING} instead of {@link Element#FIRE}. + * Changes the player that owns this ability instance. Used for redirection + * and other abilities that change the player object. * - * @return the most accurate Element that this ability belongs to - * @see SubElement#getParentElement + * @param target The player who now controls the ability */ - public Element getElement(); + public void setPlayer(final Player target) { + if (target == this.player) { + return; + } + + final Class clazz = this.getClass(); + + // The mapping from player UUID to a map of the player's instances. + Map> classMap = INSTANCES_BY_PLAYER.get(clazz); + + if (classMap != null) { + // The map of AbilityId to Ability for the current player. + final Map playerMap = classMap.get(this.player.getUniqueId()); + + if (playerMap != null) { + // Remove the ability from the current player's map. + playerMap.remove(this.id); + + if (playerMap.isEmpty()) { + // Remove the player's empty ability map from global instances map. + classMap.remove(this.player.getUniqueId()); + } + } + + if (classMap.isEmpty()) { + INSTANCES_BY_PLAYER.remove(this.getClass()); + } + } + + // Add a new map for the current ability if it doesn't exist in the global map. + if (!INSTANCES_BY_PLAYER.containsKey(clazz)) { + INSTANCES_BY_PLAYER.put(clazz, new ConcurrentHashMap<>()); + } + + classMap = INSTANCES_BY_PLAYER.get(clazz); + + // Create an AbilityId to Ability map for the target player if it doesn't exist. + if (!classMap.containsKey(target.getUniqueId())) { + classMap.put(target.getUniqueId(), new ConcurrentHashMap<>()); + } + + // Add the current instance to the target player's ability map. + classMap.get(target.getUniqueId()).put(this.getId(), this); + + this.player = target; + + final BendingPlayer newBendingPlayer = BendingPlayer.getBendingPlayer(target); + if (newBendingPlayer != null) { + this.bPlayer = newBendingPlayer; + } + } /** - * Specifies the Location of the ability, which may be slightly inaccurate - * depending on the Ability implementation. For example, a - * {@link TorrentWave} could not be fully specified by a single location, - * while it is possible for an {@link EarthBlast}. The location is useful - * for making sure that the player is currently in the same world as the - * ability. + * Used by the CollisionManager to check if two instances can collide with + * each other. For example, an EarthBlast is not collidable right when the + * person selects a source block, but it is collidable once the block begins + * traveling. * - * @return the location of the Ability - * @see BendingPlayer#canBend(CoreAbility) + * @return true if the instance is currently collidable + * @see CollisionManager */ - public Location getLocation(); + public boolean isCollidable() { + return true; + } + + /** + * The radius for collision of the ability instance. Some circular abilities + * are better represented with 1 single Location with a small or large + * radius, such as AirShield, FireShield, EarthSmash, WaterManipulation, + * EarthBlast, etc. Some abilities consist of multiple Locations with small + * radiuses, such as AirSpout, WaterSpout, Torrent, RaiseEarth, AirSwipe, + * FireKick, etc. + * + * @return the radius for a location returned by {@link #getLocations()} + * @see CollisionManager + */ + public double getCollisionRadius() { + return DEFAULT_COLLISION_RADIUS; + } + + /** + * Called when this ability instance collides with another. Some abilities + * may want advanced behavior on a Collision; e.g. FireCombos only remove + * the stream that was hit rather than the entire ability. + *

+ * collision.getAbilitySecond() - the ability that we are colliding with + * collision.isRemovingFirst() - if this ability should be removed + *

+ * This ability should only worry about itself because handleCollision will + * be called for the other ability instance as well. + * + * @param collision with data about the other ability instance + * @see CollisionManager + */ + public void handleCollision(final Collision collision) { + if (collision.isRemovingFirst()) { + this.remove(); + } + } + + /** + * A List of Locations used to represent the ability. Some abilities might + * just be 1 Location with a radius, while some might be multiple Locations + * with small radiuses. + * + * @return a List of the ability's locations + * @see CollisionManager + */ + public List getLocations() { + final ArrayList locations = new ArrayList<>(); + locations.add(this.getLocation()); + return locations; + } + + public Ability addAttributeModifier(final String attribute, final Number value, final AttributeModifier modification) { + return this.addAttributeModifier(attribute, value, modification, AttributePriority.MEDIUM); + } + + public Ability addAttributeModifier(final String attribute, final Number value, final AttributeModifier modificationType, final AttributePriority priority) { + Validate.notNull(attribute, "attribute cannot be null"); + Validate.notNull(value, "value cannot be null"); + Validate.notNull(modificationType, "modifierMethod cannot be null"); + Validate.notNull(priority, "priority cannot be null"); + Validate.isTrue(ATTRIBUTE_FIELDS.containsKey(this.getClass()) && ATTRIBUTE_FIELDS.get(this.getClass()).containsKey(attribute), "Attribute " + attribute + " is not a defined Attribute for " + this.getName()); + if (!this.attributeModifiers.containsKey(attribute)) { + this.attributeModifiers.put(attribute, new HashMap<>()); + } + if (!this.attributeModifiers.get(attribute).containsKey(priority)) { + this.attributeModifiers.get(attribute).put(priority, new HashSet<>()); + } + this.attributeModifiers.get(attribute).get(priority).add(Pair.of(value, modificationType)); + return this; + } + + public Ability setAttribute(final String attribute, final Object value) { + Validate.notNull(attribute, "attribute cannot be null"); + Validate.notNull(value, "value cannot be null"); + Validate.isTrue(ATTRIBUTE_FIELDS.containsKey(this.getClass()) && ATTRIBUTE_FIELDS.get(this.getClass()).containsKey(attribute), "Attribute " + attribute + " is not a defined Attribute for " + this.getName()); + this.attributeValues.put(attribute, value); + return this; + } + + private void modifyAttributes() { + for (final String attribute : this.attributeModifiers.keySet()) { + final Field field = ATTRIBUTE_FIELDS.get(this.getClass()).get(attribute); + final boolean accessibility = field.isAccessible(); + field.setAccessible(true); + try { + for (final AttributePriority priority : AttributePriority.values()) { + if (this.attributeModifiers.get(attribute).containsKey(priority)) { + for (final Pair pair : this.attributeModifiers.get(attribute).get(priority)) { + final Object get = field.get(this); + Validate.isTrue(get instanceof Number, "The field " + field.getName() + " cannot algebraically be modified."); + final Number oldValue = (Number) field.get(this); + final Number newValue = pair.getRight().performModification(oldValue, pair.getLeft()); + field.set(this, newValue); + } + } + } + } catch (IllegalArgumentException | IllegalAccessException e) { + e.printStackTrace(); + } finally { + field.setAccessible(accessibility); + } + } + this.attributeValues.forEach((attribute, value) -> { + final Field field = ATTRIBUTE_FIELDS.get(this.getClass()).get(attribute); + final boolean accessibility = field.isAccessible(); + field.setAccessible(true); + try { + field.set(this, value); + } catch (IllegalArgumentException | IllegalAccessException e) { + e.printStackTrace(); + } finally { + field.setAccessible(accessibility); + } + }); + } + + /** + * Returns a String used to debug potential Ability memory that can be + * caused by a developer forgetting to call {@link #remove()} + */ + public static String getDebugString() { + final StringBuilder sb = new StringBuilder(); + int playerCounter = 0; + final HashMap classCounter = new HashMap<>(); + + for (final Map> map1 : INSTANCES_BY_PLAYER.values()) { + playerCounter++; + for (final Map map2 : map1.values()) { + for (final Ability coreAbil : map2.values()) { + final String simpleName = coreAbil.getClass().getSimpleName(); + + if (classCounter.containsKey(simpleName)) { + classCounter.put(simpleName, classCounter.get(simpleName) + 1); + } else { + classCounter.put(simpleName, 1); + } + } + } + } + + for (final Set set : INSTANCES_BY_CLASS.values()) { + for (final Ability coreAbil : set) { + final String simpleName = coreAbil.getClass().getSimpleName(); + if (classCounter.containsKey(simpleName)) { + classCounter.put(simpleName, classCounter.get(simpleName) + 1); + } else { + classCounter.put(simpleName, 1); + } + } + } + + sb.append("Class->UUID's in memory: " + playerCounter + "\n"); + sb.append("Abilities in memory:\n"); + for (final String className : classCounter.keySet()) { + sb.append(className + ": " + classCounter.get(className) + "\n"); + } + return sb.toString(); + } + + public abstract void progress(); + + public abstract boolean isSneakAbility(); + + public abstract boolean isHarmlessAbility(); + + public abstract boolean isIgniteAbility(); + + public abstract boolean isExplosiveAbility(); + + public abstract long getCooldown(); + + public abstract String getName(); + + public abstract Element getElement(); + + public abstract Location getLocation(); + + public static double getDefaultCollisionRadius() { + return DEFAULT_COLLISION_RADIUS; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); + } + } diff --git a/src/com/projectkorra/projectkorra/ability/AbilityData.java b/src/com/projectkorra/projectkorra/ability/AbilityData.java new file mode 100644 index 00000000..09ea4b1f --- /dev/null +++ b/src/com/projectkorra/projectkorra/ability/AbilityData.java @@ -0,0 +1,43 @@ +package com.projectkorra.projectkorra.ability; + +import com.projectkorra.projectkorra.ability.loader.AbilityLoader; +import com.projectkorra.projectkorra.player.BendingPlayer; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface AbilityData { + + /** + * The name of the ability is used for commands such as /bending + * display and /bending help. The name is also used for + * determining the tag for cooldowns + * {@link BendingPlayer#addCooldown(Ability)}, therefore if two abilities + * have the same name they will also share cooldowns. If two classes share + * the same name (SurgeWall/SurgeWave) but need to have independent + * cooldowns, then {@link BendingPlayer#addCooldown(String, long)} should be + * called explicitly. + * + * @return Returns the name of the ability + */ + String name(); + + /** + * @return the name of the author of this AddonAbility + */ + String author() default "ProjectKorra"; + + /** + * @return The version of the ability as a String. + */ + String version() default "1.0"; + + /** + * @return The class used to register this ability. + */ + Class abilityLoader(); +} diff --git a/src/com/projectkorra/projectkorra/ability/AbilityManager.java b/src/com/projectkorra/projectkorra/ability/AbilityManager.java index 4e43601c..5f7e5c2a 100644 --- a/src/com/projectkorra/projectkorra/ability/AbilityManager.java +++ b/src/com/projectkorra/projectkorra/ability/AbilityManager.java @@ -1,129 +1,251 @@ package com.projectkorra.projectkorra.ability; -import com.projectkorra.projectkorra.GeneralMethods; +import co.aikar.timings.lib.MCTiming; +import com.projectkorra.projectkorra.ProjectKorra; +import com.projectkorra.projectkorra.ability.api.PassiveAbility; +import com.projectkorra.projectkorra.ability.loader.*; +import com.projectkorra.projectkorra.ability.util.ComboManager; import com.projectkorra.projectkorra.ability.util.MultiAbilityManager; +import com.projectkorra.projectkorra.configuration.ConfigManager; +import com.projectkorra.projectkorra.configuration.configs.abilities.AbilityConfig; +import com.projectkorra.projectkorra.element.Element; +import com.projectkorra.projectkorra.element.SubElement; +import com.projectkorra.projectkorra.event.AbilityProgressEvent; import com.projectkorra.projectkorra.firebending.FireBlast; -import com.projectkorra.projectkorra.module.DatabaseModule; -import com.projectkorra.projectkorra.module.ModuleManager; -import com.projectkorra.projectkorra.player.BendingPlayer; -import com.projectkorra.projectkorra.player.BendingPlayerLoadedEvent; -import com.projectkorra.projectkorra.player.BendingPlayerManager; +import com.projectkorra.projectkorra.module.Module; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import java.sql.SQLException; +import java.lang.reflect.ParameterizedType; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; -public class AbilityManager extends DatabaseModule { +public class AbilityManager extends Module { - private final BendingPlayerManager bendingPlayerManager; + private final Set abilitySet = new HashSet<>(); + private final Map, LinkedList>> abilityMap = new HashMap<>(); - private AbilityManager() { - super("Ability", new AbilityRepository()); + public AbilityManager() { + super("Ability"); - this.bendingPlayerManager = ModuleManager.getModule(BendingPlayerManager.class); + runTimer(() -> { + for (Ability ability : abilitySet) { + if (ability instanceof PassiveAbility) { + if (!((PassiveAbility) ability).isProgressable()) { + return; + } - runAsync(() -> { - try { - getRepository().createTables(); - } catch (SQLException e) { - e.printStackTrace(); + // This has to be before isDead as isDead will return true if they are offline. + if (!ability.getPlayer().isOnline()) { + ability.remove(); + return; + } + + if (ability.getPlayer().isDead()) { + return; + } + } else if (ability.getPlayer().isDead()) { + ability.remove(); + continue; + } else if (!ability.getPlayer().isOnline()) { + ability.remove(); + continue; + } + + try { + ability.tryModifyAttributes(); + + try (MCTiming timing = ProjectKorra.timing(ability.getName()).startTiming()) { + ability.progress(); + } + + getPlugin().getServer().getPluginManager().callEvent(new AbilityProgressEvent(ability)); + } catch (Exception e) { + e.printStackTrace(); + getPlugin().getLogger().severe(ability.toString()); + + try { + ability.getPlayer().sendMessage(ChatColor.YELLOW + "[" + new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(new Date()) + "] " + ChatColor.RED + "There was an error running " + ability.getName() + ". please notify the server owner describing exactly what you were doing at this moment"); + } catch (final Exception me) { + Bukkit.getLogger().severe("unable to notify ability user of error"); + } + try { + ability.remove(); + } catch (final Exception re) { + Bukkit.getLogger().severe("unable to fully remove ability of above error"); + } + } } - - runSync(() -> { - log("Created database tables."); - }); - }); + // TODO progress abilities + }, 1L, 1L); registerAbilities(); } - private void registerAbilities() { + /** + * Scans and loads plugin CoreAbilities, and Addon CoreAbilities that are + * located in a Jar file inside of the /ProjectKorra/Abilities/ folder. + */ + public void registerAbilities() { + this.abilitySet.clear(); + this.abilityMap.clear(); + + Ability.registerPluginAbilities(getPlugin(), "com.projectkorra"); + Ability.registerAddonAbilities("/Abilities/"); + registerAbility(FireBlast.class); } - private void registerAbility(Class abilityClass) { - // TODO - } + private void registerAbility(Class abilityClass) throws IllegalAccessException, InstantiationException { + AbilityData abilityData = abilityClass.getDeclaredAnnotation(AbilityData.class); - @EventHandler - public void onBendingPlayerLoaded(BendingPlayerLoadedEvent event) { - BendingPlayer bendingPlayer = event.getBendingPlayer(); - - runAsync(() -> { - try { - String[] abilities = getRepository().selectPlayerAbilities(bendingPlayer.getId()); - - bendingPlayer.setAbilities(abilities); - } catch (SQLException e) { - e.printStackTrace(); - } - }); - } - - public boolean bindAbility(Player player, String abilityName, int slot) { - PlayerBindAbilityEvent playerBindAbilityEvent = new PlayerBindAbilityEvent(player, abilityName); - getPlugin().getServer().getPluginManager().callEvent(playerBindAbilityEvent); - - if (playerBindAbilityEvent.isCancelled()) { - String cancelMessage = playerBindAbilityEvent.getCancelMessage(); - - if (cancelMessage != null) { - GeneralMethods.sendBrandingMessage(player, cancelMessage); - } - - return false; + if (abilityData == null) { + getPlugin().getLogger().warning("Ability " + abilityClass.getName() + " has no AbilityData annotation"); + return; } - BendingPlayer bendingPlayer = this.bendingPlayerManager.getBendingPlayer(player); - - bendingPlayer.setAbility(slot, abilityName); - - runAsync(() -> { - try { - getRepository().insertPlayerAbility(bendingPlayer.getId(), abilityName, slot); - } catch (SQLException e) { - e.printStackTrace(); - } - }); - - return true; - } - - public boolean unbindAbility(Player player, int slot) { - BendingPlayer bendingPlayer = this.bendingPlayerManager.getBendingPlayer(player); - - String abilityName = bendingPlayer.getAbility(slot); + String abilityName = abilityData.name(); if (abilityName == null) { - player.sendMessage("No ability bound"); + getPlugin().getLogger().warning("Ability " + abilityClass.getName() + " has no name?"); + return; + } + + AbilityLoader abilityLoader = abilityData.abilityLoader().newInstance(); + AbilityConfig abilityConfig = ConfigManager.getConfig(((Class) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0])); + + if (!abilityConfig.Enabled) { + getPlugin().getLogger().info(abilityName + " is disabled"); + return; + } + + if (abilityLoader instanceof AddonAbilityLoader) { + ((AddonAbilityLoader) abilityLoader).load(); + } + + if (abilityLoader instanceof ComboAbilityLoader) { + ComboAbilityLoader comboAbilityLoader = (ComboAbilityLoader) abilityLoader; + + if (comboAbilityLoader.getCombination() == null) { + getPlugin().getLogger().info(abilityName + " has no combination"); + return; + } + + // TODO Register Combo Ability +// ComboManager.getComboAbilities().put(abilityName, new ComboManager.ComboAbilityInfo(abilityName, comboAbilityLoader.getCombination(), )); + ComboManager.getDescriptions().put(abilityName, abilityConfig.Description); + ComboManager.getInstructions().put(abilityName, abilityConfig.Instructions); + } + + if (abilityLoader instanceof MultiAbilityLoader) { + MultiAbilityLoader multiAbilityLoader = (MultiAbilityLoader) abilityLoader; + + MultiAbilityManager.multiAbilityList.add(new MultiAbilityManager.MultiAbilityInfo(abilityName, multiAbilityLoader.getMultiAbilities())); + } + + if (abilityLoader instanceof PassiveAbilityLoader) { + PassiveAbilityLoader passiveAbilityLoader = (PassiveAbilityLoader) abilityLoader; + + // TODO Set Hidden Ability + // TODO Register Passive Ability +// PassiveManager.getPassives().put(abilityName, ability???) + } + } + + public void startAbility(Ability ability) { + if (ability.isStarted()) { + return; + } + + this.abilitySet.add(ability); + this.abilityMap.computeIfAbsent(ability.getPlayer().getUniqueId(), k -> new HashMap<>()) + .computeIfAbsent(ability.getClass(), k -> new LinkedList<>()) + .add(ability); + } + + protected void removeAbility(Ability ability) { + if (ability.isRemoved()) { + return; + } + + this.abilitySet.remove(ability); + this.abilityMap.values().removeIf(abilityMap -> + { + abilityMap.values().removeIf(abilityList -> + { + abilityList.remove(ability); + + return abilityList.isEmpty(); + }); + + return abilityMap.isEmpty(); + }); + } + + /** + * Removes every {@link Ability} instance that has been started but not yet + * removed. + */ + public void removeAll() { + new HashSet<>(this.abilitySet).forEach(Ability::remove); + } + + public boolean hasAbility(Player player, Class ability) { + Map, LinkedList> abilities = this.abilityMap.get(player.getUniqueId()); + + if (abilities == null || !abilities.containsKey(ability)) { return false; } - bendingPlayer.setAbility(slot, null); - - runAsync(() -> { - try { - getRepository().deletePlayerAbility(bendingPlayer.getId(), abilityName); - } catch (SQLException e) { - e.printStackTrace(); - } - }); - - return true; + return !abilities.get(abilities).isEmpty(); } - public void clearBinds(Player player) { - BendingPlayer bendingPlayer = this.bendingPlayerManager.getBendingPlayer(player); + public T getAbility(Player player, Class ability) { + Map, LinkedList> abilities = this.abilityMap.get(player.getUniqueId()); - bendingPlayer.setAbilities(new String[9]); + if (abilities == null || !abilities.containsKey(ability)) { + return null; + } - runAsync(() -> { - try { - getRepository().deletePlayerAbilities(bendingPlayer.getId()); - } catch (SQLException e) { - e.printStackTrace(); - } + return ability.cast(abilities.get(ability).getFirst()); + } + + public Collection getAbilities(Player player, Class ability) { + Map, LinkedList> abilities = this.abilityMap.get(player.getUniqueId()); + + if (abilities == null || !abilities.containsKey(ability)) { + return null; + } + + return abilities.get(abilities).stream().map(ability::cast).collect(Collectors.toList()); + } + + public LinkedList getAbilities(Class abilityClass) { + LinkedList abilities = new LinkedList<>(); + + this.abilityMap.values().forEach(a -> { + a.values().forEach(ability -> abilities.add(abilityClass.cast(ability))); }); + + return abilities; + } + + public List getAbilities(Element element) { + this.abilitySet.stream() + .filter(ability -> + { + if (ability.getElement().equals(element)) { + return true; + } + + if (ability.getElement() instanceof SubElement) { + return ((SubElement) ability.getElement()).getParent().equals(element); + } + + return false; + }) + .collect(Collectors.toList()); } } diff --git a/src/com/projectkorra/projectkorra/ability/ComboManager.java b/src/com/projectkorra/projectkorra/ability/ComboManager.java new file mode 100644 index 00000000..ff91b132 --- /dev/null +++ b/src/com/projectkorra/projectkorra/ability/ComboManager.java @@ -0,0 +1,128 @@ +package com.projectkorra.projectkorra.ability; + +import com.projectkorra.projectkorra.module.Module; +import com.projectkorra.projectkorra.util.ClickType; + +import java.util.*; + +public class ComboManager extends Module { + + private final Map> recentlyUsed = new HashMap<>(); + + private ComboManager() { + super("Combo Ability"); + } + + /** + * Contains information on an ability used in a combo. + * + * @author kingbirdy + * + */ + public static class AbilityInformation { + private String abilityName; + private ClickType clickType; + private long time; + + public AbilityInformation(final String name, final ClickType type) { + this(name, type, 0); + } + + public AbilityInformation(final String name, final ClickType type, final long time) { + this.abilityName = name; + this.clickType = type; + this.time = time; + } + + /** + * Compares if two {@link com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation}'s are equal without + * respect to {@link com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation#time time}. + * + * @param info The AbilityInformation to compare against + * @return True if they are equal without respect to time + */ + public boolean equalsWithoutTime(final com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation info) { + return this.getAbilityName().equals(info.getAbilityName()) && this.getClickType().equals(info.getClickType()); + } + + /** + * Gets the name of the ability. + * + * @return The name of the ability. + */ + public String getAbilityName() { + return this.abilityName; + } + + /** + * Gets the {@link ClickType} of the {@link com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation}. + * + * @return The ClickType + */ + public ClickType getClickType() { + return this.clickType; + } + + public long getTime() { + return this.time; + } + + public void setAbilityName(final String abilityName) { + this.abilityName = abilityName; + } + + public void setClickType(final ClickType clickType) { + this.clickType = clickType; + } + + public void setTime(final long time) { + this.time = time; + } + + @Override + public String toString() { + return this.abilityName + " " + this.clickType + " " + this.time; + } + } + + public static class ComboAbilityInfo { + private String name; + private ArrayList abilities; + private Object comboType; + + public ComboAbilityInfo(final String name, final ArrayList abilities, final Object comboType) { + this.name = name; + this.abilities = abilities; + this.comboType = comboType; + } + + public ArrayList getAbilities() { + return this.abilities; + } + + public Object getComboType() { + return this.comboType; + } + + public String getName() { + return this.name; + } + + public void setAbilities(final ArrayList abilities) { + this.abilities = abilities; + } + + public void setComboType(final Object comboType) { + this.comboType = comboType; + } + + public void setName(final String name) { + this.name = name; + } + + @Override + public String toString() { + return this.name; + } + } +} diff --git a/src/com/projectkorra/projectkorra/ability/CoreAbility.java b/src/com/projectkorra/projectkorra/ability/CoreAbility.java deleted file mode 100644 index 226a6193..00000000 --- a/src/com/projectkorra/projectkorra/ability/CoreAbility.java +++ /dev/null @@ -1,1053 +0,0 @@ -package com.projectkorra.projectkorra.ability; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentSkipListMap; -import java.util.jar.JarFile; - -import org.apache.commons.lang3.Validate; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import org.apache.commons.lang3.tuple.Pair; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; - -import com.google.common.reflect.ClassPath; -import com.google.common.reflect.ClassPath.ClassInfo; -import com.projectkorra.projectkorra.BendingPlayer; -import com.projectkorra.projectkorra.Element; -import com.projectkorra.projectkorra.Element.SubElement; -import com.projectkorra.projectkorra.Manager; -import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.util.AbilityLoader; -import com.projectkorra.projectkorra.ability.util.AddonAbilityLoader; -import com.projectkorra.projectkorra.ability.util.Collision; -import com.projectkorra.projectkorra.ability.util.CollisionManager; -import com.projectkorra.projectkorra.ability.util.ComboManager; -import com.projectkorra.projectkorra.ability.util.MultiAbilityManager; -import com.projectkorra.projectkorra.ability.util.MultiAbilityManager.MultiAbilityInfo; -import com.projectkorra.projectkorra.ability.util.PassiveManager; -import com.projectkorra.projectkorra.attribute.Attribute; -import com.projectkorra.projectkorra.attribute.AttributeModifier; -import com.projectkorra.projectkorra.attribute.AttributePriority; -import com.projectkorra.projectkorra.configuration.configs.abilities.AbilityConfig; -import com.projectkorra.projectkorra.event.AbilityEndEvent; -import com.projectkorra.projectkorra.event.AbilityProgressEvent; -import com.projectkorra.projectkorra.event.AbilityStartEvent; -import com.projectkorra.projectkorra.util.FlightHandler; -import com.projectkorra.projectkorra.util.TimeUtil; - -import co.aikar.timings.lib.MCTiming; -import sun.reflect.ReflectionFactory; - -/** - * CoreAbility provides default implementation of an Ability, including methods - * to control the life cycle of a specific instance. CoreAbility also provides a - * system to load CoreAbilities within a {@link JavaPlugin}, or located in an - * external {@link JarFile}. - *

- * For {@link CollisionManager} and {@link Collision}, a CoreAbility may need to - * override {@link #isCollidable()}, {@link #getCollisionRadius()}, - * {@link #handleCollision(Collision)}, and {@link #getLocations()}. - * - * @see #start() - * @see #progress() - * @see #remove() - * @see #registerAddonAbilities(String) - * @see #registerPluginAbilities(JavaPlugin, String) - */ -@SuppressWarnings({ "rawtypes", "unchecked", "unlikely-arg-type", "restriction" }) -public abstract class CoreAbility implements Ability { - - private static final Set INSTANCES = Collections.newSetFromMap(new ConcurrentHashMap()); - private static final Map, Map>> INSTANCES_BY_PLAYER = new ConcurrentHashMap<>(); - private static final Map, Set> INSTANCES_BY_CLASS = new ConcurrentHashMap<>(); - private static final Map ABILITIES_BY_NAME = new ConcurrentSkipListMap<>(); // preserves ordering. - private static final Map, CoreAbility> ABILITIES_BY_CLASS = new ConcurrentHashMap<>(); - private static final double DEFAULT_COLLISION_RADIUS = 0.3; - private static final List ADDON_PLUGINS = new ArrayList<>(); - private static final Map, Map> ATTRIBUTE_FIELDS = new HashMap<>(); - - private static int idCounter; - - protected final C config; - protected Player player; - protected BendingPlayer bPlayer; - protected FlightHandler flightHandler; - - private final Map>>> attributeModifiers = new HashMap<>(); - private final Map attributeValues = new HashMap<>(); - private boolean started; - private boolean removed; - private boolean hidden; - private int id; - private long startTime; - private long startTick; - private boolean attributesModified; - - static { - idCounter = Integer.MIN_VALUE; - } - - /** - * The default constructor is needed to create a fake instance of each - * CoreAbility via reflection in {@link #registerAbilities()}. More - * specifically, {@link #registerPluginAbilities} calls - * getDeclaredConstructor which is only usable with a public default - * constructor. Reflection lets us create a list of all of the plugin's - * abilities when the plugin first loads. - * - * @see #ABILITIES_BY_NAME - * @see #getAbility(String) - */ - public CoreAbility() { - this.config = null; - for (final Field field : this.getClass().getDeclaredFields()) { - if (field.isAnnotationPresent(Attribute.class)) { - final Attribute attribute = field.getAnnotation(Attribute.class); - if (!ATTRIBUTE_FIELDS.containsKey(this.getClass())) { - ATTRIBUTE_FIELDS.put(this.getClass(), new HashMap<>()); - } - ATTRIBUTE_FIELDS.get(this.getClass()).put(attribute.value(), field); - } - } - } - - /** - * Creates a new CoreAbility instance but does not start it. - * - * @param player the non-null player that created this instance - * @see #start() - */ - public CoreAbility(final C config, final Player player) { - if (player == null || !this.isEnabled()) { - this.config = config; - return; - } - - this.config = config; - this.player = player; - this.bPlayer = BendingPlayer.getBendingPlayer(player); - this.flightHandler = Manager.getManager(FlightHandler.class); - this.startTime = System.currentTimeMillis(); - this.started = false; - this.id = CoreAbility.idCounter; - this.startTick = this.getCurrentTick(); - - if (idCounter == Integer.MAX_VALUE) { - idCounter = Integer.MIN_VALUE; - } else { - idCounter++; - } - } - - /** - * Causes the ability to begin updating every tick by calling - * {@link #progress()} until {@link #remove()} is called. This method cannot - * be overridden, and any code that needs to be performed before start - * should be handled in the constructor. - * - * @see #getStartTime() - * @see #isStarted() - * @see #isRemoved() - */ - public void start() { - if (this.player == null || !this.isEnabled()) { - return; - } - final AbilityStartEvent event = new AbilityStartEvent(this); - Bukkit.getServer().getPluginManager().callEvent(event); - if (event.isCancelled()) { - this.remove(); - return; - } - - this.started = true; - this.startTime = System.currentTimeMillis(); - final Class clazz = this.getClass(); - final UUID uuid = this.player.getUniqueId(); - - if (!INSTANCES_BY_PLAYER.containsKey(clazz)) { - INSTANCES_BY_PLAYER.put(clazz, new ConcurrentHashMap>()); - } - if (!INSTANCES_BY_PLAYER.get(clazz).containsKey(uuid)) { - INSTANCES_BY_PLAYER.get(clazz).put(uuid, new ConcurrentHashMap()); - } - if (!INSTANCES_BY_CLASS.containsKey(clazz)) { - INSTANCES_BY_CLASS.put(clazz, Collections.newSetFromMap(new ConcurrentHashMap())); - } - - INSTANCES_BY_PLAYER.get(clazz).get(uuid).put(this.id, this); - INSTANCES_BY_CLASS.get(clazz).add(this); - INSTANCES.add(this); - } - - /** - * Causes this CoreAbility instance to be removed, and {@link #progress} - * will no longer be called every tick. If this method is overridden then - * the new method must call super.remove(). - * - * {@inheritDoc} - * - * @see #isRemoved() - */ - @Override - public void remove() { - if (this.player == null) { - return; - } - - Bukkit.getServer().getPluginManager().callEvent(new AbilityEndEvent(this)); - this.removed = true; - - final Map> classMap = INSTANCES_BY_PLAYER.get(this.getClass()); - if (classMap != null) { - final Map playerMap = classMap.get(this.player.getUniqueId()); - if (playerMap != null) { - playerMap.remove(this.id); - if (playerMap.size() == 0) { - classMap.remove(this.player.getUniqueId()); - } - } - - if (classMap.size() == 0) { - INSTANCES_BY_PLAYER.remove(this.getClass()); - } - } - - if (INSTANCES_BY_CLASS.containsKey(this.getClass())) { - INSTANCES_BY_CLASS.get(this.getClass()).remove(this); - } - INSTANCES.remove(this); - } - - /** - * Causes {@link #progress()} to be called on every CoreAbility instance - * that has been started and has not been removed. - */ - public static void progressAll() { - for (final Set setAbils : INSTANCES_BY_CLASS.values()) { - for (final CoreAbility abil : setAbils) { - if (abil instanceof PassiveAbility) { - if (!((PassiveAbility) abil).isProgressable()) { - continue; - } - - if (!abil.getPlayer().isOnline()) { // This has to be before isDead as isDead. - abil.remove(); // will return true if they are offline. - continue; - } else if (abil.getPlayer().isDead()) { - continue; - } - } else if (abil.getPlayer().isDead()) { - abil.remove(); - continue; - } else if (!abil.getPlayer().isOnline()) { - abil.remove(); - continue; - } - - try { - if (!abil.attributesModified) { - abil.modifyAttributes(); - abil.attributesModified = true; - } - - try (MCTiming timing = ProjectKorra.timing(abil.getName()).startTiming()) { - abil.progress(); - } - - Bukkit.getServer().getPluginManager().callEvent(new AbilityProgressEvent(abil)); - } catch (final Exception e) { - e.printStackTrace(); - Bukkit.getLogger().severe(abil.toString()); - try { - abil.getPlayer().sendMessage(ChatColor.YELLOW + "[" + new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(new Date()) + "] " + ChatColor.RED + "There was an error running " + abil.getName() + ". please notify the server owner describing exactly what you were doing at this moment"); - } catch (final Exception me) { - Bukkit.getLogger().severe("unable to notify ability user of error"); - } - try { - abil.remove(); - } catch (final Exception re) { - Bukkit.getLogger().severe("unable to fully remove ability of above error"); - } - } - } - } - } - - /** - * Removes every CoreAbility instance that has been started but not yet - * removed. - */ - public static void removeAll() { - for (final Set setAbils : INSTANCES_BY_CLASS.values()) { - for (final CoreAbility abil : setAbils) { - abil.remove(); - } - } - - for (final CoreAbility coreAbility : ABILITIES_BY_NAME.values()) { - if (coreAbility instanceof AddonAbility) { - final AddonAbility addon = (AddonAbility) coreAbility; - addon.stop(); - } - } - } - - /** - * Returns any T CoreAbility that has been started and not yet removed. May - * return null if no such ability exists. - * - * @param player the player that created the CoreAbility instance - * @param clazz the class of the type of CoreAbility - * @return a CoreAbility instance or null - */ - public static T getAbility(final Player player, final Class clazz) { - final Collection abils = getAbilities(player, clazz); - if (abils.iterator().hasNext()) { - return abils.iterator().next(); - } - return null; - } - - /** - * Returns a "fake" instance for the CoreAbility represented by abilityName. - * This method does not look into CoreAbility instances that were created by - * Players, instead this method looks at the CoreAbilities that were created - * via Reflection by {@link #registerAbilities()} when the plugin was first - * loaded. - * - *

- * These "fake" instances have a null player, but methods such as - * {@link Ability#getName()}, and {@link Ability#getElement()} will still - * work, as will checking the type of the ability with instanceof. - * - *

- * CoreAbility coreAbil = getAbility(someString);
- * if (coreAbil instanceof FireAbility && coreAbil.isSneakAbility()) - * - * @param abilityName the name of a loaded CoreAbility - * @return a "fake" CoreAbility instance, or null if no such ability exists - */ - public static CoreAbility getAbility(final String abilityName) { - return abilityName != null ? ABILITIES_BY_NAME.get(abilityName.toLowerCase()) : null; - } - - /** - * Returns a "fake" instance for a CoreAbility with the specific class. - * - * @param clazz the class for the type of CoreAbility to be returned - * @return a "fake" CoreAbility instance or null if the ability doesn't exist or isn't enabled - */ - public static CoreAbility getAbility(final Class clazz) { - return clazz != null ? ABILITIES_BY_CLASS.get(clazz) : null; - } - - /** - * @return a list of "fake" instances for each ability that was loaded by - * {@link #registerAbilities()} - */ - public static ArrayList getAbilities() { - return new ArrayList(ABILITIES_BY_CLASS.values()); - } - - /** - * @return a list of "fake" instances for each ability that was loaded by - * {@link #registerAbilities()} - */ - public static ArrayList getAbilitiesByName() { - return new ArrayList(ABILITIES_BY_NAME.values()); - } - - /** - * Returns a Collection of all of the player created instances for a - * specific type of CoreAbility. - * - * @param clazz the class for the type of CoreAbilities - * @return a Collection of real instances - */ - public static Collection getAbilities(final Class clazz) { - if (clazz == null || INSTANCES_BY_CLASS.get(clazz) == null || INSTANCES_BY_CLASS.get(clazz).size() == 0) { - return Collections.emptySet(); - } - return (Collection) CoreAbility.INSTANCES_BY_CLASS.get(clazz); - } - - /** - * Returns a Collection of specific CoreAbility instances that were created - * by the specified player. - * - * @param player the player that created the instances - * @param clazz the class for the type of CoreAbilities - * @return a Collection of real instances - */ - public static Collection getAbilities(final Player player, final Class clazz) { - if (player == null || clazz == null || INSTANCES_BY_PLAYER.get(clazz) == null || INSTANCES_BY_PLAYER.get(clazz).get(player.getUniqueId()) == null) { - return Collections.emptySet(); - } - return (Collection) INSTANCES_BY_PLAYER.get(clazz).get(player.getUniqueId()).values(); - } - - /** - * @return a Collection of all of the CoreAbilities that are currently - * alive. Do not modify this Collection. - */ - public static Collection getAbilitiesByInstances() { - return INSTANCES; - } - - /** - * Returns an List of fake instances that were loaded by - * {@link #registerAbilities()} filtered by Element. - * - * @param element the Element of the loaded abilities - * @return a list of fake CoreAbility instances - */ - public static List getAbilitiesByElement(final Element element) { - final ArrayList abilities = new ArrayList(); - if (element != null) { - for (final CoreAbility ability : getAbilities()) { - if (ability.getElement() == element) { - abilities.add(ability); - } else if (ability.getElement() instanceof SubElement) { - final Element parentElement = ((SubElement) ability.getElement()).getParentElement(); - if (parentElement == element) { - abilities.add(ability); - } - } - } - } - return abilities; - } - - /** - * CoreAbility keeps track of plugins that have registered abilities to use - * for bending reload purposes
- * This isn't a simple list, external use isn't recommended - * - * @return a list of entrys with the plugin name and path abilities can be - * found at - */ - public static List getAddonPlugins() { - return ADDON_PLUGINS; - } - - /** - * Returns true if the player has an active CoreAbility instance of type T. - * - * @param player the player that created the T instance - * @param clazz the class for the type of CoreAbility - */ - public static boolean hasAbility(final Player player, final Class clazz) { - return getAbility(player, clazz) != null; - } - - /** - * Unloads the ability - * - * @param clazz Ability class to unload - */ - public static void unloadAbility(final Class clazz) { - if (!ABILITIES_BY_CLASS.containsKey(clazz)) { - return; - } - final String name = ABILITIES_BY_CLASS.get(clazz).getName(); - for (final CoreAbility abil : INSTANCES) { - if (abil.getName() == name) { - abil.remove(); - } - } - ABILITIES_BY_CLASS.remove(clazz); - ABILITIES_BY_NAME.remove(name); - ProjectKorra.log.info("Unloaded ability: " + name); - } - - /** - * Returns a Set of all of the players that currently have an active - * instance of clazz. - * - * @param clazz the clazz for the type of CoreAbility - */ - public static Set getPlayers(final Class clazz) { - final HashSet players = new HashSet<>(); - if (clazz != null) { - final Map> uuidMap = INSTANCES_BY_PLAYER.get(clazz); - if (uuidMap != null) { - for (final UUID uuid : uuidMap.keySet()) { - final Player uuidPlayer = Bukkit.getPlayer(uuid); - if (uuidPlayer != null) { - players.add(uuidPlayer); - } - } - } - } - return players; - } - - /** - * Scans and loads plugin CoreAbilities, and Addon CoreAbilities that are - * located in a Jar file inside of the /ProjectKorra/Abilities/ folder. - */ - public static void registerAbilities() { - ABILITIES_BY_NAME.clear(); - ABILITIES_BY_CLASS.clear(); - registerPluginAbilities(ProjectKorra.plugin, "com.projectkorra"); - registerAddonAbilities("/Abilities/"); - } - - /** - * Scans a JavaPlugin and registers CoreAbility class files. Does not work. - * Use {@link CoreAbility.registerPluginAbilities} instead! - * - * @param plugin a JavaPlugin containing CoreAbility class files - * @param packagePrefix a prefix of the package name, used to increase - * performance - * @see #getAbilities() - * @see #getAbility(String) - */ - @Deprecated - public static void legacyRegisterPluginAbilities(final JavaPlugin plugin, final String packagePrefix) { - final List disabled = new ArrayList(); // this way multiple classes with the same name only show once. - if (plugin == null) { - return; - } - - final Class pluginClass = plugin.getClass(); - final ClassLoader loader = pluginClass.getClassLoader(); - - final ReflectionFactory rf = ReflectionFactory.getReflectionFactory(); - - try { - for (final ClassInfo info : ClassPath.from(loader).getAllClasses()) { - if (!info.getPackageName().startsWith(packagePrefix)) { - continue; - } - - Class clazz = null; - try { - clazz = info.load(); - if (!CoreAbility.class.isAssignableFrom(clazz) || clazz.isInterface() || Modifier.isAbstract(clazz.getModifiers())) { - continue; - } - - final Constructor objDef = CoreAbility.class.getDeclaredConstructor(); - final Constructor intConstr = rf.newConstructorForSerialization(clazz, objDef); - final CoreAbility ability = (CoreAbility) clazz.cast(intConstr.newInstance()); - - if (ability == null || ability.getName() == null) { - continue; - } else if (!ability.isEnabled() && !disabled.contains(ability.getName())) { - plugin.getLogger().info(ability.getName() + " is disabled"); - disabled.add(ability.getName()); - continue; - } - - final String name = ability.getName(); - ABILITIES_BY_NAME.put(ability.getName().toLowerCase(), ability); - ABILITIES_BY_CLASS.put(ability.getClass(), ability); - - if (ability instanceof ComboAbility) { - final ComboAbility combo = (ComboAbility) ability; - if (combo.getCombination() != null) { - ComboManager.getComboAbilities().put(name, new ComboManager.ComboAbilityInfo(name, combo.getCombination(), combo)); - ComboManager.getDescriptions().put(name, ability.getDescription()); - ComboManager.getInstructions().put(name, ability.getInstructions()); - String author = ""; - if (ability instanceof AddonAbility) { - author = ((AddonAbility) ability).getAuthor(); - } - ComboManager.getAuthors().put(name, author); - } - } - - if (ability instanceof MultiAbility) { - final MultiAbility multiAbil = (MultiAbility) ability; - MultiAbilityManager.multiAbilityList.add(new MultiAbilityInfo(name, multiAbil.getMultiAbilities())); - } - - if (ability instanceof PassiveAbility) { - ability.setHiddenAbility(true); - PassiveManager.getPassives().put(name, ability); - } - - if (ability instanceof AddonAbility) { - final AddonAbility addon = (AddonAbility) ability; - addon.load(); - } - } catch (final Exception e) { - e.printStackTrace(); - } catch (final Error e) { - e.printStackTrace(); - } - } - } catch (final IOException e) { - e.printStackTrace(); - } - } - - /** - * Scans a JavaPlugin and registers CoreAbility class files. - * - * @param plugin a JavaPlugin containing CoreAbility class files - * @param packageBase a prefix of the package name, used to increase - * performance - * @see #getAbilities() - * @see #getAbility(String) - */ - public static void registerPluginAbilities(final JavaPlugin plugin, final String packageBase) { - final AbilityLoader abilityLoader = new AbilityLoader(plugin, packageBase); - final List loadedAbilities = abilityLoader.load(CoreAbility.class, CoreAbility.class); - final String entry = plugin.getName() + "::" + packageBase; - if (!ADDON_PLUGINS.contains(entry)) { - ADDON_PLUGINS.add(entry); - } - - for (final CoreAbility coreAbil : loadedAbilities) { - if (!coreAbil.isEnabled()) { - plugin.getLogger().info(coreAbil.getName() + " is disabled"); - continue; - } - - final String name = coreAbil.getName(); - - if (name == null) { - plugin.getLogger().warning("Ability " + coreAbil.getClass().getName() + " has no name?"); - continue; - } - - try { - ABILITIES_BY_NAME.put(name.toLowerCase(), coreAbil); - ABILITIES_BY_CLASS.put(coreAbil.getClass(), coreAbil); - - if (coreAbil instanceof ComboAbility) { - final ComboAbility combo = (ComboAbility) coreAbil; - if (combo.getCombination() != null) { - ComboManager.getComboAbilities().put(name, new ComboManager.ComboAbilityInfo(name, combo.getCombination(), combo)); - ComboManager.getDescriptions().put(name, coreAbil.getDescription()); - ComboManager.getInstructions().put(name, coreAbil.getInstructions()); - } - } - - if (coreAbil instanceof MultiAbility) { - final MultiAbility multiAbil = (MultiAbility) coreAbil; - MultiAbilityManager.multiAbilityList.add(new MultiAbilityInfo(name, multiAbil.getMultiAbilities())); - } - - if (coreAbil instanceof PassiveAbility) { - PassiveAbility passive = (PassiveAbility) coreAbil; - coreAbil.setHiddenAbility(true); - PassiveManager.getPassives().put(name, coreAbil); - if (!PassiveManager.getPassiveClasses().containsKey(passive)) { - PassiveManager.getPassiveClasses().put(passive, coreAbil.getClass()); - } - } - } catch (Exception | Error e) { - plugin.getLogger().warning("The ability " + coreAbil.getName() + " was not able to load, if this message shows again please remove it!"); - e.printStackTrace(); - ABILITIES_BY_NAME.remove(name.toLowerCase()); - ABILITIES_BY_CLASS.remove(coreAbil.getClass()); - } - } - } - - /** - * Scans all of the Jar files inside of /ProjectKorra/folder and registers - * all of the CoreAbility class files that were found. - * - * @param folder the name of the folder to scan - * @see #getAbilities() - * @see #getAbility(String) - */ - public static void registerAddonAbilities(final String folder) { - final ProjectKorra plugin = ProjectKorra.plugin; - final File path = new File(plugin.getDataFolder().toString() + folder); - if (!path.exists()) { - path.mkdir(); - return; - } - - final AddonAbilityLoader abilityLoader = new AddonAbilityLoader(plugin, path); - final List loadedAbilities = abilityLoader.load(CoreAbility.class, CoreAbility.class); - - for (final CoreAbility coreAbil : loadedAbilities) { - if (!(coreAbil instanceof AddonAbility)) { - plugin.getLogger().warning(coreAbil.getName() + " is an addon ability and must implement the AddonAbility interface"); - continue; - } else if (!coreAbil.isEnabled()) { - plugin.getLogger().info(coreAbil.getName() + " is disabled"); - continue; - } - - final AddonAbility addon = (AddonAbility) coreAbil; - final String name = coreAbil.getName(); - - try { - addon.load(); - ABILITIES_BY_NAME.put(name.toLowerCase(), coreAbil); - ABILITIES_BY_CLASS.put(coreAbil.getClass(), coreAbil); - - if (coreAbil instanceof ComboAbility) { - final ComboAbility combo = (ComboAbility) coreAbil; - if (combo.getCombination() != null) { - ComboManager.getComboAbilities().put(name, new ComboManager.ComboAbilityInfo(name, combo.getCombination(), combo)); - ComboManager.getDescriptions().put(name, coreAbil.getDescription()); - ComboManager.getInstructions().put(name, coreAbil.getInstructions()); - ComboManager.getAuthors().put(name, addon.getAuthor()); - } - } - - if (coreAbil instanceof MultiAbility) { - final MultiAbility multiAbil = (MultiAbility) coreAbil; - MultiAbilityManager.multiAbilityList.add(new MultiAbilityInfo(name, multiAbil.getMultiAbilities())); - } - - if (coreAbil instanceof PassiveAbility) { - PassiveAbility passive = (PassiveAbility) coreAbil; - coreAbil.setHiddenAbility(true); - PassiveManager.getPassives().put(name, coreAbil); - if (!PassiveManager.getPassiveClasses().containsKey(passive)) { - PassiveManager.getPassiveClasses().put(passive, coreAbil.getClass()); - } - } - } catch (Exception | Error e) { - plugin.getLogger().warning("The ability " + coreAbil.getName() + " was not able to load, if this message shows again please remove it!"); - e.printStackTrace(); - addon.stop(); - ABILITIES_BY_NAME.remove(name.toLowerCase()); - ABILITIES_BY_CLASS.remove(coreAbil.getClass()); - } - } - } - - public long getStartTime() { - return this.startTime; - } - - public long getStartTick() { - return this.startTick; - } - - public long getCurrentTick() { - return this.player.getWorld().getFullTime(); - } - - public boolean isStarted() { - return this.started; - } - - public boolean isRemoved() { - return this.removed; - } - - public BendingPlayer getBendingPlayer() { - return this.bPlayer; - } - - public int getId() { - return this.id; - } - - public abstract Class getConfigType(); - - @Override - public boolean isHiddenAbility() { - return this.hidden; - } - - public void setHiddenAbility(final boolean hidden) { - this.hidden = hidden; - } - - @Override - public boolean isEnabled() { - return config.Enabled; - } - - @Override - public String getInstructions() { - return config.Instructions; - } - - @Override - public String getDescription() { - return config.Description; - } - - public String getMovePreview(final Player player) { - final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); - String displayedMessage = ""; - if (bPlayer.isOnCooldown(this)) { - final long cooldown = bPlayer.getCooldown(this.getName()) - System.currentTimeMillis(); - displayedMessage = this.getElement().getColor() + "" + ChatColor.STRIKETHROUGH + this.getName() + "" + this.getElement().getColor() + " - " + TimeUtil.formatTime(cooldown); - } else { - if (bPlayer.getStance() != null && bPlayer.getStance().getName().equals(this.getName())) { - displayedMessage = this.getElement().getColor() + "" + ChatColor.UNDERLINE + this.getName(); - } else { - displayedMessage = this.getElement().getColor() + this.getName(); - } - } - return displayedMessage; - } - - @Override - public Player getPlayer() { - return this.player; - } - - /** - * Changes the player that owns this ability instance. Used for redirection - * and other abilities that change the player object. - * - * @param target The player who now controls the ability - */ - public void setPlayer(final Player target) { - if (target == this.player) { - return; - } - - final Class clazz = this.getClass(); - - // The mapping from player UUID to a map of the player's instances. - Map> classMap = INSTANCES_BY_PLAYER.get(clazz); - - if (classMap != null) { - // The map of AbilityId to Ability for the current player. - final Map playerMap = classMap.get(this.player.getUniqueId()); - - if (playerMap != null) { - // Remove the ability from the current player's map. - playerMap.remove(this.id); - - if (playerMap.isEmpty()) { - // Remove the player's empty ability map from global instances map. - classMap.remove(this.player.getUniqueId()); - } - } - - if (classMap.isEmpty()) { - INSTANCES_BY_PLAYER.remove(this.getClass()); - } - } - - // Add a new map for the current ability if it doesn't exist in the global map. - if (!INSTANCES_BY_PLAYER.containsKey(clazz)) { - INSTANCES_BY_PLAYER.put(clazz, new ConcurrentHashMap<>()); - } - - classMap = INSTANCES_BY_PLAYER.get(clazz); - - // Create an AbilityId to Ability map for the target player if it doesn't exist. - if (!classMap.containsKey(target.getUniqueId())) { - classMap.put(target.getUniqueId(), new ConcurrentHashMap<>()); - } - - // Add the current instance to the target player's ability map. - classMap.get(target.getUniqueId()).put(this.getId(), this); - - this.player = target; - - final BendingPlayer newBendingPlayer = BendingPlayer.getBendingPlayer(target); - if (newBendingPlayer != null) { - this.bPlayer = newBendingPlayer; - } - } - - /** - * Used by the CollisionManager to check if two instances can collide with - * each other. For example, an EarthBlast is not collidable right when the - * person selects a source block, but it is collidable once the block begins - * traveling. - * - * @return true if the instance is currently collidable - * @see CollisionManager - */ - public boolean isCollidable() { - return true; - } - - /** - * The radius for collision of the ability instance. Some circular abilities - * are better represented with 1 single Location with a small or large - * radius, such as AirShield, FireShield, EarthSmash, WaterManipulation, - * EarthBlast, etc. Some abilities consist of multiple Locations with small - * radiuses, such as AirSpout, WaterSpout, Torrent, RaiseEarth, AirSwipe, - * FireKick, etc. - * - * @return the radius for a location returned by {@link #getLocations()} - * @see CollisionManager - */ - public double getCollisionRadius() { - return DEFAULT_COLLISION_RADIUS; - } - - /** - * Called when this ability instance collides with another. Some abilities - * may want advanced behavior on a Collision; e.g. FireCombos only remove - * the stream that was hit rather than the entire ability. - *

- * collision.getAbilitySecond() - the ability that we are colliding with - * collision.isRemovingFirst() - if this ability should be removed - *

- * This ability should only worry about itself because handleCollision will - * be called for the other ability instance as well. - * - * @param collision with data about the other ability instance - * @see CollisionManager - */ - public void handleCollision(final Collision collision) { - if (collision.isRemovingFirst()) { - this.remove(); - } - } - - /** - * A List of Locations used to represent the ability. Some abilities might - * just be 1 Location with a radius, while some might be multiple Locations - * with small radiuses. - * - * @return a List of the ability's locations - * @see CollisionManager - */ - public List getLocations() { - final ArrayList locations = new ArrayList<>(); - locations.add(this.getLocation()); - return locations; - } - - public CoreAbility addAttributeModifier(final String attribute, final Number value, final AttributeModifier modification) { - return this.addAttributeModifier(attribute, value, modification, AttributePriority.MEDIUM); - } - - public CoreAbility addAttributeModifier(final String attribute, final Number value, final AttributeModifier modificationType, final AttributePriority priority) { - Validate.notNull(attribute, "attribute cannot be null"); - Validate.notNull(value, "value cannot be null"); - Validate.notNull(modificationType, "modifierMethod cannot be null"); - Validate.notNull(priority, "priority cannot be null"); - Validate.isTrue(ATTRIBUTE_FIELDS.containsKey(this.getClass()) && ATTRIBUTE_FIELDS.get(this.getClass()).containsKey(attribute), "Attribute " + attribute + " is not a defined Attribute for " + this.getName()); - if (!this.attributeModifiers.containsKey(attribute)) { - this.attributeModifiers.put(attribute, new HashMap<>()); - } - if (!this.attributeModifiers.get(attribute).containsKey(priority)) { - this.attributeModifiers.get(attribute).put(priority, new HashSet<>()); - } - this.attributeModifiers.get(attribute).get(priority).add(Pair.of(value, modificationType)); - return this; - } - - public CoreAbility setAttribute(final String attribute, final Object value) { - Validate.notNull(attribute, "attribute cannot be null"); - Validate.notNull(value, "value cannot be null"); - Validate.isTrue(ATTRIBUTE_FIELDS.containsKey(this.getClass()) && ATTRIBUTE_FIELDS.get(this.getClass()).containsKey(attribute), "Attribute " + attribute + " is not a defined Attribute for " + this.getName()); - this.attributeValues.put(attribute, value); - return this; - } - - private void modifyAttributes() { - for (final String attribute : this.attributeModifiers.keySet()) { - final Field field = ATTRIBUTE_FIELDS.get(this.getClass()).get(attribute); - final boolean accessibility = field.isAccessible(); - field.setAccessible(true); - try { - for (final AttributePriority priority : AttributePriority.values()) { - if (this.attributeModifiers.get(attribute).containsKey(priority)) { - for (final Pair pair : this.attributeModifiers.get(attribute).get(priority)) { - final Object get = field.get(this); - Validate.isTrue(get instanceof Number, "The field " + field.getName() + " cannot algebraically be modified."); - final Number oldValue = (Number) field.get(this); - final Number newValue = pair.getRight().performModification(oldValue, pair.getLeft()); - field.set(this, newValue); - } - } - } - } catch (IllegalArgumentException | IllegalAccessException e) { - e.printStackTrace(); - } finally { - field.setAccessible(accessibility); - } - } - this.attributeValues.forEach((attribute, value) -> { - final Field field = ATTRIBUTE_FIELDS.get(this.getClass()).get(attribute); - final boolean accessibility = field.isAccessible(); - field.setAccessible(true); - try { - field.set(this, value); - } catch (IllegalArgumentException | IllegalAccessException e) { - e.printStackTrace(); - } finally { - field.setAccessible(accessibility); - } - }); - } - - /** - * Returns a String used to debug potential CoreAbility memory that can be - * caused by a developer forgetting to call {@link #remove()} - */ - public static String getDebugString() { - final StringBuilder sb = new StringBuilder(); - int playerCounter = 0; - final HashMap classCounter = new HashMap<>(); - - for (final Map> map1 : INSTANCES_BY_PLAYER.values()) { - playerCounter++; - for (final Map map2 : map1.values()) { - for (final CoreAbility coreAbil : map2.values()) { - final String simpleName = coreAbil.getClass().getSimpleName(); - - if (classCounter.containsKey(simpleName)) { - classCounter.put(simpleName, classCounter.get(simpleName) + 1); - } else { - classCounter.put(simpleName, 1); - } - } - } - } - - for (final Set set : INSTANCES_BY_CLASS.values()) { - for (final CoreAbility coreAbil : set) { - final String simpleName = coreAbil.getClass().getSimpleName(); - if (classCounter.containsKey(simpleName)) { - classCounter.put(simpleName, classCounter.get(simpleName) + 1); - } else { - classCounter.put(simpleName, 1); - } - } - } - - sb.append("Class->UUID's in memory: " + playerCounter + "\n"); - sb.append("Abilities in memory:\n"); - for (final String className : classCounter.keySet()) { - sb.append(className + ": " + classCounter.get(className) + "\n"); - } - return sb.toString(); - } - - public static double getDefaultCollisionRadius() { - return DEFAULT_COLLISION_RADIUS; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); - } - -} diff --git a/src/com/projectkorra/projectkorra/ability/AddonAbility.java b/src/com/projectkorra/projectkorra/ability/api/AddonAbility.java similarity index 93% rename from src/com/projectkorra/projectkorra/ability/AddonAbility.java rename to src/com/projectkorra/projectkorra/ability/api/AddonAbility.java index d49225c7..3f2c4dd9 100644 --- a/src/com/projectkorra/projectkorra/ability/AddonAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/AddonAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; public interface AddonAbility { diff --git a/src/com/projectkorra/projectkorra/ability/AirAbility.java b/src/com/projectkorra/projectkorra/ability/api/AirAbility.java similarity index 98% rename from src/com/projectkorra/projectkorra/ability/AirAbility.java rename to src/com/projectkorra/projectkorra/ability/api/AirAbility.java index 8cd1c1ac..b765d563 100644 --- a/src/com/projectkorra/projectkorra/ability/AirAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/AirAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; import java.util.ArrayList; import java.util.List; diff --git a/src/com/projectkorra/projectkorra/ability/AvatarAbility.java b/src/com/projectkorra/projectkorra/ability/api/AvatarAbility.java similarity index 96% rename from src/com/projectkorra/projectkorra/ability/AvatarAbility.java rename to src/com/projectkorra/projectkorra/ability/api/AvatarAbility.java index b97f6e4b..48c6a24b 100644 --- a/src/com/projectkorra/projectkorra/ability/AvatarAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/AvatarAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; import org.bukkit.Location; import org.bukkit.entity.Player; diff --git a/src/com/projectkorra/projectkorra/ability/BloodAbility.java b/src/com/projectkorra/projectkorra/ability/api/BloodAbility.java similarity index 91% rename from src/com/projectkorra/projectkorra/ability/BloodAbility.java rename to src/com/projectkorra/projectkorra/ability/api/BloodAbility.java index f44ce158..5dc197b8 100644 --- a/src/com/projectkorra/projectkorra/ability/BloodAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/BloodAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; import org.bukkit.entity.Player; diff --git a/src/com/projectkorra/projectkorra/ability/ChiAbility.java b/src/com/projectkorra/projectkorra/ability/api/ChiAbility.java similarity index 91% rename from src/com/projectkorra/projectkorra/ability/ChiAbility.java rename to src/com/projectkorra/projectkorra/ability/api/ChiAbility.java index 9217274a..09ffe1d4 100644 --- a/src/com/projectkorra/projectkorra/ability/ChiAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/ChiAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; import org.bukkit.entity.Player; diff --git a/src/com/projectkorra/projectkorra/ability/ComboAbility.java b/src/com/projectkorra/projectkorra/ability/api/ComboAbility.java similarity index 91% rename from src/com/projectkorra/projectkorra/ability/ComboAbility.java rename to src/com/projectkorra/projectkorra/ability/api/ComboAbility.java index bbce5e02..21b690a9 100644 --- a/src/com/projectkorra/projectkorra/ability/ComboAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/ComboAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; import java.util.ArrayList; diff --git a/src/com/projectkorra/projectkorra/ability/CombustionAbility.java b/src/com/projectkorra/projectkorra/ability/api/CombustionAbility.java similarity index 91% rename from src/com/projectkorra/projectkorra/ability/CombustionAbility.java rename to src/com/projectkorra/projectkorra/ability/api/CombustionAbility.java index 1ad9ed68..458397c7 100644 --- a/src/com/projectkorra/projectkorra/ability/CombustionAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/CombustionAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; import org.bukkit.entity.Player; diff --git a/src/com/projectkorra/projectkorra/ability/EarthAbility.java b/src/com/projectkorra/projectkorra/ability/api/EarthAbility.java similarity index 99% rename from src/com/projectkorra/projectkorra/ability/EarthAbility.java rename to src/com/projectkorra/projectkorra/ability/api/EarthAbility.java index 1617ebaf..52480c6f 100644 --- a/src/com/projectkorra/projectkorra/ability/EarthAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/EarthAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; import java.util.ArrayList; import java.util.HashSet; diff --git a/src/com/projectkorra/projectkorra/ability/ElementalAbility.java b/src/com/projectkorra/projectkorra/ability/api/ElementalAbility.java similarity index 99% rename from src/com/projectkorra/projectkorra/ability/ElementalAbility.java rename to src/com/projectkorra/projectkorra/ability/api/ElementalAbility.java index 75e41c80..8435b6f6 100644 --- a/src/com/projectkorra/projectkorra/ability/ElementalAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/ElementalAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; import java.util.Arrays; import java.util.HashSet; diff --git a/src/com/projectkorra/projectkorra/ability/FireAbility.java b/src/com/projectkorra/projectkorra/ability/api/FireAbility.java similarity index 99% rename from src/com/projectkorra/projectkorra/ability/FireAbility.java rename to src/com/projectkorra/projectkorra/ability/api/FireAbility.java index e1cbd8fc..c24f61ed 100644 --- a/src/com/projectkorra/projectkorra/ability/FireAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/FireAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; import java.util.ArrayList; import java.util.Iterator; diff --git a/src/com/projectkorra/projectkorra/ability/FlightAbility.java b/src/com/projectkorra/projectkorra/ability/api/FlightAbility.java similarity index 91% rename from src/com/projectkorra/projectkorra/ability/FlightAbility.java rename to src/com/projectkorra/projectkorra/ability/api/FlightAbility.java index 64931191..e4305e1e 100644 --- a/src/com/projectkorra/projectkorra/ability/FlightAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/FlightAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; import org.bukkit.entity.Player; diff --git a/src/com/projectkorra/projectkorra/ability/HealingAbility.java b/src/com/projectkorra/projectkorra/ability/api/HealingAbility.java similarity index 91% rename from src/com/projectkorra/projectkorra/ability/HealingAbility.java rename to src/com/projectkorra/projectkorra/ability/api/HealingAbility.java index b2beec73..a01c447f 100644 --- a/src/com/projectkorra/projectkorra/ability/HealingAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/HealingAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; import org.bukkit.entity.Player; diff --git a/src/com/projectkorra/projectkorra/ability/IceAbility.java b/src/com/projectkorra/projectkorra/ability/api/IceAbility.java similarity index 91% rename from src/com/projectkorra/projectkorra/ability/IceAbility.java rename to src/com/projectkorra/projectkorra/ability/api/IceAbility.java index 6d467012..f11819a9 100644 --- a/src/com/projectkorra/projectkorra/ability/IceAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/IceAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; import org.bukkit.entity.Player; diff --git a/src/com/projectkorra/projectkorra/ability/LavaAbility.java b/src/com/projectkorra/projectkorra/ability/api/LavaAbility.java similarity index 91% rename from src/com/projectkorra/projectkorra/ability/LavaAbility.java rename to src/com/projectkorra/projectkorra/ability/api/LavaAbility.java index 18b52402..c8de01bd 100644 --- a/src/com/projectkorra/projectkorra/ability/LavaAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/LavaAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; import org.bukkit.entity.Player; diff --git a/src/com/projectkorra/projectkorra/ability/LightningAbility.java b/src/com/projectkorra/projectkorra/ability/api/LightningAbility.java similarity index 91% rename from src/com/projectkorra/projectkorra/ability/LightningAbility.java rename to src/com/projectkorra/projectkorra/ability/api/LightningAbility.java index 0e60eca8..54bf8fc2 100644 --- a/src/com/projectkorra/projectkorra/ability/LightningAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/LightningAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; import org.bukkit.entity.Player; diff --git a/src/com/projectkorra/projectkorra/ability/MetalAbility.java b/src/com/projectkorra/projectkorra/ability/api/MetalAbility.java similarity index 91% rename from src/com/projectkorra/projectkorra/ability/MetalAbility.java rename to src/com/projectkorra/projectkorra/ability/api/MetalAbility.java index 913c12d9..77556c6f 100644 --- a/src/com/projectkorra/projectkorra/ability/MetalAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/MetalAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; import org.bukkit.entity.Player; diff --git a/src/com/projectkorra/projectkorra/ability/MultiAbility.java b/src/com/projectkorra/projectkorra/ability/api/MultiAbility.java similarity index 89% rename from src/com/projectkorra/projectkorra/ability/MultiAbility.java rename to src/com/projectkorra/projectkorra/ability/api/MultiAbility.java index a73e6bf2..e684f93b 100644 --- a/src/com/projectkorra/projectkorra/ability/MultiAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/MultiAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; import java.util.ArrayList; diff --git a/src/com/projectkorra/projectkorra/ability/PassiveAbility.java b/src/com/projectkorra/projectkorra/ability/api/PassiveAbility.java similarity index 90% rename from src/com/projectkorra/projectkorra/ability/PassiveAbility.java rename to src/com/projectkorra/projectkorra/ability/api/PassiveAbility.java index f664f5e5..9f96e092 100644 --- a/src/com/projectkorra/projectkorra/ability/PassiveAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/PassiveAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; public interface PassiveAbility { diff --git a/src/com/projectkorra/projectkorra/ability/PlantAbility.java b/src/com/projectkorra/projectkorra/ability/api/PlantAbility.java similarity index 91% rename from src/com/projectkorra/projectkorra/ability/PlantAbility.java rename to src/com/projectkorra/projectkorra/ability/api/PlantAbility.java index fd68942a..905efc3a 100644 --- a/src/com/projectkorra/projectkorra/ability/PlantAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/PlantAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; import org.bukkit.entity.Player; diff --git a/src/com/projectkorra/projectkorra/ability/PlayerBindAbilityEvent.java b/src/com/projectkorra/projectkorra/ability/api/PlayerBindAbilityEvent.java similarity index 95% rename from src/com/projectkorra/projectkorra/ability/PlayerBindAbilityEvent.java rename to src/com/projectkorra/projectkorra/ability/api/PlayerBindAbilityEvent.java index 0317ee46..3b208dcb 100644 --- a/src/com/projectkorra/projectkorra/ability/PlayerBindAbilityEvent.java +++ b/src/com/projectkorra/projectkorra/ability/api/PlayerBindAbilityEvent.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; diff --git a/src/com/projectkorra/projectkorra/ability/SandAbility.java b/src/com/projectkorra/projectkorra/ability/api/SandAbility.java similarity index 91% rename from src/com/projectkorra/projectkorra/ability/SandAbility.java rename to src/com/projectkorra/projectkorra/ability/api/SandAbility.java index 306f1783..f8933d6b 100644 --- a/src/com/projectkorra/projectkorra/ability/SandAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/SandAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; import org.bukkit.entity.Player; diff --git a/src/com/projectkorra/projectkorra/ability/SpiritualAbility.java b/src/com/projectkorra/projectkorra/ability/api/SpiritualAbility.java similarity index 91% rename from src/com/projectkorra/projectkorra/ability/SpiritualAbility.java rename to src/com/projectkorra/projectkorra/ability/api/SpiritualAbility.java index 3631ce2c..4da3d568 100644 --- a/src/com/projectkorra/projectkorra/ability/SpiritualAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/SpiritualAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; import org.bukkit.entity.Player; diff --git a/src/com/projectkorra/projectkorra/ability/SubAbility.java b/src/com/projectkorra/projectkorra/ability/api/SubAbility.java similarity index 83% rename from src/com/projectkorra/projectkorra/ability/SubAbility.java rename to src/com/projectkorra/projectkorra/ability/api/SubAbility.java index b52cc099..249a68ac 100644 --- a/src/com/projectkorra/projectkorra/ability/SubAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/SubAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; public interface SubAbility { diff --git a/src/com/projectkorra/projectkorra/ability/WaterAbility.java b/src/com/projectkorra/projectkorra/ability/api/WaterAbility.java similarity index 99% rename from src/com/projectkorra/projectkorra/ability/WaterAbility.java rename to src/com/projectkorra/projectkorra/ability/api/WaterAbility.java index 63c7d760..01d1824d 100644 --- a/src/com/projectkorra/projectkorra/ability/WaterAbility.java +++ b/src/com/projectkorra/projectkorra/ability/api/WaterAbility.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.api; import java.util.HashSet; import java.util.Set; diff --git a/src/com/projectkorra/projectkorra/ability/bind/AbilityBindManager.java b/src/com/projectkorra/projectkorra/ability/bind/AbilityBindManager.java new file mode 100644 index 00000000..e0dbfbc3 --- /dev/null +++ b/src/com/projectkorra/projectkorra/ability/bind/AbilityBindManager.java @@ -0,0 +1,117 @@ +package com.projectkorra.projectkorra.ability.bind; + +import com.projectkorra.projectkorra.GeneralMethods; +import com.projectkorra.projectkorra.ability.api.PlayerBindAbilityEvent; +import com.projectkorra.projectkorra.module.DatabaseModule; +import com.projectkorra.projectkorra.module.ModuleManager; +import com.projectkorra.projectkorra.player.BendingPlayer; +import com.projectkorra.projectkorra.player.BendingPlayerLoadedEvent; +import com.projectkorra.projectkorra.player.BendingPlayerManager; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import java.sql.SQLException; + +public class AbilityBindManager extends DatabaseModule { + + private final BendingPlayerManager bendingPlayerManager; + + private AbilityBindManager() { + super("Ability Binds", new AbilityBindRepository()); + + this.bendingPlayerManager = ModuleManager.getModule(BendingPlayerManager.class); + + runAsync(() -> { + try { + getRepository().createTables(); + } catch (SQLException e) { + e.printStackTrace(); + } + + runSync(() -> { + log("Created database tables."); + }); + }); + } + + @EventHandler + public void onBendingPlayerLoaded(BendingPlayerLoadedEvent event) { + BendingPlayer bendingPlayer = event.getBendingPlayer(); + + runAsync(() -> { + try { + String[] abilities = getRepository().selectPlayerAbilities(bendingPlayer.getId()); + + bendingPlayer.setAbilities(abilities); + } catch (SQLException e) { + e.printStackTrace(); + } + }); + } + + public boolean bindAbility(Player player, String abilityName, int slot) { + PlayerBindAbilityEvent playerBindAbilityEvent = new PlayerBindAbilityEvent(player, abilityName); + getPlugin().getServer().getPluginManager().callEvent(playerBindAbilityEvent); + + if (playerBindAbilityEvent.isCancelled()) { + String cancelMessage = playerBindAbilityEvent.getCancelMessage(); + + if (cancelMessage != null) { + GeneralMethods.sendBrandingMessage(player, cancelMessage); + } + + return false; + } + + BendingPlayer bendingPlayer = this.bendingPlayerManager.getBendingPlayer(player); + + bendingPlayer.setAbility(slot, abilityName); + + runAsync(() -> { + try { + getRepository().insertPlayerAbility(bendingPlayer.getId(), abilityName, slot); + } catch (SQLException e) { + e.printStackTrace(); + } + }); + + return true; + } + + public boolean unbindAbility(Player player, int slot) { + BendingPlayer bendingPlayer = this.bendingPlayerManager.getBendingPlayer(player); + + String abilityName = bendingPlayer.getAbility(slot); + + if (abilityName == null) { + player.sendMessage("No ability bound"); + return false; + } + + bendingPlayer.setAbility(slot, null); + + runAsync(() -> { + try { + getRepository().deletePlayerAbility(bendingPlayer.getId(), abilityName); + } catch (SQLException e) { + e.printStackTrace(); + } + }); + + return true; + } + + public void clearBinds(Player player) { + BendingPlayer bendingPlayer = this.bendingPlayerManager.getBendingPlayer(player); + + bendingPlayer.setAbilities(new String[9]); + + runAsync(() -> { + try { + getRepository().deletePlayerAbilities(bendingPlayer.getId()); + } catch (SQLException e) { + e.printStackTrace(); + } + }); + } +} diff --git a/src/com/projectkorra/projectkorra/ability/AbilityRepository.java b/src/com/projectkorra/projectkorra/ability/bind/AbilityBindRepository.java similarity index 96% rename from src/com/projectkorra/projectkorra/ability/AbilityRepository.java rename to src/com/projectkorra/projectkorra/ability/bind/AbilityBindRepository.java index ad4ca5b2..42304c39 100644 --- a/src/com/projectkorra/projectkorra/ability/AbilityRepository.java +++ b/src/com/projectkorra/projectkorra/ability/bind/AbilityBindRepository.java @@ -1,4 +1,4 @@ -package com.projectkorra.projectkorra.ability; +package com.projectkorra.projectkorra.ability.bind; import com.projectkorra.projectkorra.database.DatabaseQuery; import com.projectkorra.projectkorra.database.DatabaseRepository; @@ -8,7 +8,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -public class AbilityRepository extends DatabaseRepository { +public class AbilityBindRepository extends DatabaseRepository { private static final DatabaseQuery CREATE_TABLE_PLAYER_ABILITIES = DatabaseQuery.newBuilder() .mysql("CREATE TABLE IF NOT EXISTS pk_player_abilities (player_id INTEGER REFERENCES pk_bending_players (player_id), ability_name VARCHAR(50) NOT NULL, slot TINYINT NOT NULL, PRIMARY KEY (player_id, ability_name), INDEX player_index (player_id), INDEX ability_index (ability_name));") diff --git a/src/com/projectkorra/projectkorra/ability/loader/AbilityLoader.java b/src/com/projectkorra/projectkorra/ability/loader/AbilityLoader.java new file mode 100644 index 00000000..0f22563b --- /dev/null +++ b/src/com/projectkorra/projectkorra/ability/loader/AbilityLoader.java @@ -0,0 +1,4 @@ +package com.projectkorra.projectkorra.ability.loader; + +public abstract class AbilityLoader { +} diff --git a/src/com/projectkorra/projectkorra/ability/loader/AddonAbilityLoader.java b/src/com/projectkorra/projectkorra/ability/loader/AddonAbilityLoader.java new file mode 100644 index 00000000..d3811b85 --- /dev/null +++ b/src/com/projectkorra/projectkorra/ability/loader/AddonAbilityLoader.java @@ -0,0 +1,20 @@ +package com.projectkorra.projectkorra.ability.loader; + +import com.projectkorra.projectkorra.ability.AbilityManager; + +public abstract class AddonAbilityLoader extends AbilityLoader { + + /** + * Called when the ability is loaded by PK. This is where the developer + * registers Listeners and Permissions. + */ + public abstract void load(); + + /** + * Called whenever ProjectKorra stops and the ability is unloaded. This + * method is useful for cleaning up leftover objects such as frozen blocks. + * Any CoreAbility instances do not need to be cleaned up by stop method, as + * they will be cleaned up by {@link AbilityManager#removeAll()}. + */ + public abstract void stop(); +} diff --git a/src/com/projectkorra/projectkorra/ability/loader/ComboAbilityLoader.java b/src/com/projectkorra/projectkorra/ability/loader/ComboAbilityLoader.java new file mode 100644 index 00000000..3656b80f --- /dev/null +++ b/src/com/projectkorra/projectkorra/ability/loader/ComboAbilityLoader.java @@ -0,0 +1,15 @@ +package com.projectkorra.projectkorra.ability.loader; + +import com.projectkorra.projectkorra.ability.util.ComboManager; + +import java.util.ArrayList; + +public abstract class ComboAbilityLoader extends AbilityLoader { + + /** + * Returns the list of abilities which constitute the combo. + * + * @return An ArrayList containing the combo's steps. + */ + public abstract ArrayList getCombination(); +} diff --git a/src/com/projectkorra/projectkorra/ability/loader/MultiAbilityLoader.java b/src/com/projectkorra/projectkorra/ability/loader/MultiAbilityLoader.java new file mode 100644 index 00000000..0dc54aa9 --- /dev/null +++ b/src/com/projectkorra/projectkorra/ability/loader/MultiAbilityLoader.java @@ -0,0 +1,18 @@ +package com.projectkorra.projectkorra.ability.loader; + +import com.projectkorra.projectkorra.ability.util.MultiAbilityManager; + +import java.util.ArrayList; + +public abstract class MultiAbilityLoader extends AbilityLoader { + + /** + * Returns the sub abilities of a MultiAbility. For example: + *

+ * {@code new + * MultiAbilitySub("SubAbility", Element.LIGHTNING);} + * + * @return a list of sub MultiAbilities + */ + public abstract ArrayList getMultiAbilities(); +} diff --git a/src/com/projectkorra/projectkorra/ability/loader/PassiveAbilityLoader.java b/src/com/projectkorra/projectkorra/ability/loader/PassiveAbilityLoader.java new file mode 100644 index 00000000..a2007248 --- /dev/null +++ b/src/com/projectkorra/projectkorra/ability/loader/PassiveAbilityLoader.java @@ -0,0 +1,21 @@ +package com.projectkorra.projectkorra.ability.loader; + +public abstract class PassiveAbilityLoader extends AbilityLoader { + + /** + * This is a check to see if the passive requires some form of activation, + * such as sneaking, clicking, etc.
+ * If false, the passive should not call start! + * + * @return false if this passive should always be on + */ + public abstract boolean isInstantiable(); + + /** + * This is used if the passive should progress + * + * @return false if progress() shouldn't be called; + */ + public abstract boolean isProgressable(); + +} diff --git a/src/com/projectkorra/projectkorra/ability/util/CollisionManager.java b/src/com/projectkorra/projectkorra/ability/util/CollisionManager.java index 25182558..281980a4 100644 --- a/src/com/projectkorra/projectkorra/ability/util/CollisionManager.java +++ b/src/com/projectkorra/projectkorra/ability/util/CollisionManager.java @@ -12,7 +12,7 @@ import org.bukkit.scheduler.BukkitRunnable; import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ability.CoreAbility; -import com.projectkorra.projectkorra.ability.PassiveAbility; +import com.projectkorra.projectkorra.ability.api.PassiveAbility; import com.projectkorra.projectkorra.event.AbilityCollisionEvent; /** diff --git a/src/com/projectkorra/projectkorra/ability/util/ComboManager.java b/src/com/projectkorra/projectkorra/ability/util/ComboManager.java index 0c178cce..f50d344d 100644 --- a/src/com/projectkorra/projectkorra/ability/util/ComboManager.java +++ b/src/com/projectkorra/projectkorra/ability/util/ComboManager.java @@ -13,7 +13,7 @@ import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.Element.SubElement; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.ComboAbility; +import com.projectkorra.projectkorra.ability.api.ComboAbility; import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.configs.abilities.earth.EarthDomeConfig; diff --git a/src/com/projectkorra/projectkorra/ability/util/MultiAbilityManager.java b/src/com/projectkorra/projectkorra/ability/util/MultiAbilityManager.java index 38943ff7..cce5e031 100644 --- a/src/com/projectkorra/projectkorra/ability/util/MultiAbilityManager.java +++ b/src/com/projectkorra/projectkorra/ability/util/MultiAbilityManager.java @@ -6,7 +6,7 @@ import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import com.projectkorra.projectkorra.ability.PlayerBindAbilityEvent; +import com.projectkorra.projectkorra.ability.api.PlayerBindAbilityEvent; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; diff --git a/src/com/projectkorra/projectkorra/ability/util/PassiveManager.java b/src/com/projectkorra/projectkorra/ability/util/PassiveManager.java index 02cde4dd..797eb5ff 100644 --- a/src/com/projectkorra/projectkorra/ability/util/PassiveManager.java +++ b/src/com/projectkorra/projectkorra/ability/util/PassiveManager.java @@ -13,7 +13,7 @@ import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.Element.SubElement; import com.projectkorra.projectkorra.ability.CoreAbility; -import com.projectkorra.projectkorra.ability.PassiveAbility; +import com.projectkorra.projectkorra.ability.api.PassiveAbility; @SuppressWarnings({ "rawtypes", "unlikely-arg-type" }) public class PassiveManager { diff --git a/src/com/projectkorra/projectkorra/airbending/AirBlast.java b/src/com/projectkorra/projectkorra/airbending/AirBlast.java index 13ff8fca..4ba4a34b 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirBlast.java +++ b/src/com/projectkorra/projectkorra/airbending/AirBlast.java @@ -25,7 +25,7 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.AirAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; import com.projectkorra.projectkorra.ability.util.Collision; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.command.Commands; diff --git a/src/com/projectkorra/projectkorra/airbending/AirBurst.java b/src/com/projectkorra/projectkorra/airbending/AirBurst.java index 31832346..c342492d 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirBurst.java +++ b/src/com/projectkorra/projectkorra/airbending/AirBurst.java @@ -10,7 +10,7 @@ import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.AirAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.configs.abilities.air.AirBlastConfig; diff --git a/src/com/projectkorra/projectkorra/airbending/AirScooter.java b/src/com/projectkorra/projectkorra/airbending/AirScooter.java index 713c7893..aa6ca6d7 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirScooter.java +++ b/src/com/projectkorra/projectkorra/airbending/AirScooter.java @@ -15,8 +15,8 @@ import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.air.AirScooterConfig; diff --git a/src/com/projectkorra/projectkorra/airbending/AirShield.java b/src/com/projectkorra/projectkorra/airbending/AirShield.java index 58d7bc82..c51b7a6a 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirShield.java +++ b/src/com/projectkorra/projectkorra/airbending/AirShield.java @@ -13,7 +13,7 @@ import org.bukkit.entity.Player; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.AirAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; import com.projectkorra.projectkorra.ability.util.Collision; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.avatar.AvatarState; diff --git a/src/com/projectkorra/projectkorra/airbending/AirSpout.java b/src/com/projectkorra/projectkorra/airbending/AirSpout.java index c474bf2e..b2286515 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirSpout.java +++ b/src/com/projectkorra/projectkorra/airbending/AirSpout.java @@ -10,8 +10,8 @@ import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; import com.projectkorra.projectkorra.ability.util.Collision; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.air.AirSpoutConfig; diff --git a/src/com/projectkorra/projectkorra/airbending/AirSuction.java b/src/com/projectkorra/projectkorra/airbending/AirSuction.java index 1a1d40f1..da68a16c 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirSuction.java +++ b/src/com/projectkorra/projectkorra/airbending/AirSuction.java @@ -18,7 +18,7 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.AirAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.ability.util.Collision; import com.projectkorra.projectkorra.attribute.Attribute; diff --git a/src/com/projectkorra/projectkorra/airbending/AirSwipe.java b/src/com/projectkorra/projectkorra/airbending/AirSwipe.java index c10a88fb..5dee27f9 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirSwipe.java +++ b/src/com/projectkorra/projectkorra/airbending/AirSwipe.java @@ -18,9 +18,9 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.AirAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; import com.projectkorra.projectkorra.ability.CoreAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; import com.projectkorra.projectkorra.ability.util.Collision; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.command.Commands; diff --git a/src/com/projectkorra/projectkorra/airbending/Suffocate.java b/src/com/projectkorra/projectkorra/airbending/Suffocate.java index 04cdbe6e..41be9954 100644 --- a/src/com/projectkorra/projectkorra/airbending/Suffocate.java +++ b/src/com/projectkorra/projectkorra/airbending/Suffocate.java @@ -13,7 +13,7 @@ import org.bukkit.scheduler.BukkitRunnable; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.AirAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.air.SuffocateConfig; import com.projectkorra.projectkorra.util.DamageHandler; diff --git a/src/com/projectkorra/projectkorra/airbending/Tornado.java b/src/com/projectkorra/projectkorra/airbending/Tornado.java index ca869fb4..df31410f 100644 --- a/src/com/projectkorra/projectkorra/airbending/Tornado.java +++ b/src/com/projectkorra/projectkorra/airbending/Tornado.java @@ -12,8 +12,8 @@ import org.bukkit.entity.Player; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.configuration.configs.abilities.air.TornadoConfig; diff --git a/src/com/projectkorra/projectkorra/airbending/combo/AirStream.java b/src/com/projectkorra/projectkorra/airbending/combo/AirStream.java index 29732b75..50f5147e 100644 --- a/src/com/projectkorra/projectkorra/airbending/combo/AirStream.java +++ b/src/com/projectkorra/projectkorra/airbending/combo/AirStream.java @@ -10,8 +10,8 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.ComboAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.ComboAbility; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.command.Commands; diff --git a/src/com/projectkorra/projectkorra/airbending/combo/AirSweep.java b/src/com/projectkorra/projectkorra/airbending/combo/AirSweep.java index 29f9e70d..4fb29b71 100644 --- a/src/com/projectkorra/projectkorra/airbending/combo/AirSweep.java +++ b/src/com/projectkorra/projectkorra/airbending/combo/AirSweep.java @@ -13,8 +13,8 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.ComboAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.ComboAbility; import com.projectkorra.projectkorra.ability.util.Collision; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; import com.projectkorra.projectkorra.attribute.Attribute; diff --git a/src/com/projectkorra/projectkorra/airbending/combo/Twister.java b/src/com/projectkorra/projectkorra/airbending/combo/Twister.java index 30d12d78..13635a25 100644 --- a/src/com/projectkorra/projectkorra/airbending/combo/Twister.java +++ b/src/com/projectkorra/projectkorra/airbending/combo/Twister.java @@ -9,8 +9,8 @@ import org.bukkit.entity.Player; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.ComboAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.ComboAbility; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.command.Commands; diff --git a/src/com/projectkorra/projectkorra/airbending/flight/FlightMultiAbility.java b/src/com/projectkorra/projectkorra/airbending/flight/FlightMultiAbility.java index eea8086a..be5d95bc 100644 --- a/src/com/projectkorra/projectkorra/airbending/flight/FlightMultiAbility.java +++ b/src/com/projectkorra/projectkorra/airbending/flight/FlightMultiAbility.java @@ -20,8 +20,8 @@ import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ability.CoreAbility; -import com.projectkorra.projectkorra.ability.FlightAbility; -import com.projectkorra.projectkorra.ability.MultiAbility; +import com.projectkorra.projectkorra.ability.api.FlightAbility; +import com.projectkorra.projectkorra.ability.api.MultiAbility; import com.projectkorra.projectkorra.ability.util.MultiAbilityManager; import com.projectkorra.projectkorra.ability.util.MultiAbilityManager.MultiAbilityInfoSub; import com.projectkorra.projectkorra.airbending.AirScooter; diff --git a/src/com/projectkorra/projectkorra/airbending/passive/AirAgility.java b/src/com/projectkorra/projectkorra/airbending/passive/AirAgility.java index 37470dce..4e4c68e3 100644 --- a/src/com/projectkorra/projectkorra/airbending/passive/AirAgility.java +++ b/src/com/projectkorra/projectkorra/airbending/passive/AirAgility.java @@ -5,8 +5,8 @@ import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.PassiveAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.PassiveAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.air.AirAgilityConfig; diff --git a/src/com/projectkorra/projectkorra/airbending/passive/AirSaturation.java b/src/com/projectkorra/projectkorra/airbending/passive/AirSaturation.java index 1410848f..dfc1ebf4 100644 --- a/src/com/projectkorra/projectkorra/airbending/passive/AirSaturation.java +++ b/src/com/projectkorra/projectkorra/airbending/passive/AirSaturation.java @@ -3,8 +3,8 @@ package com.projectkorra.projectkorra.airbending.passive; import org.bukkit.Location; import org.bukkit.entity.Player; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.PassiveAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.PassiveAbility; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.configs.abilities.air.AirSaturationConfig; diff --git a/src/com/projectkorra/projectkorra/airbending/passive/GracefulDescent.java b/src/com/projectkorra/projectkorra/airbending/passive/GracefulDescent.java index da23c057..ad0811b0 100644 --- a/src/com/projectkorra/projectkorra/airbending/passive/GracefulDescent.java +++ b/src/com/projectkorra/projectkorra/airbending/passive/GracefulDescent.java @@ -3,8 +3,8 @@ package com.projectkorra.projectkorra.airbending.passive; import org.bukkit.Location; import org.bukkit.entity.Player; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.PassiveAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.PassiveAbility; import com.projectkorra.projectkorra.configuration.configs.abilities.air.GracefulDescentConfig; public class GracefulDescent extends AirAbility implements PassiveAbility { diff --git a/src/com/projectkorra/projectkorra/avatar/AvatarState.java b/src/com/projectkorra/projectkorra/avatar/AvatarState.java index 9b31c51c..3f194300 100644 --- a/src/com/projectkorra/projectkorra/avatar/AvatarState.java +++ b/src/com/projectkorra/projectkorra/avatar/AvatarState.java @@ -7,7 +7,7 @@ import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import com.projectkorra.projectkorra.ability.AvatarAbility; +import com.projectkorra.projectkorra.ability.api.AvatarAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.configs.abilities.avatar.AvatarStateConfig; diff --git a/src/com/projectkorra/projectkorra/chiblocking/AcrobatStance.java b/src/com/projectkorra/projectkorra/chiblocking/AcrobatStance.java index a45cfe68..277ddf28 100644 --- a/src/com/projectkorra/projectkorra/chiblocking/AcrobatStance.java +++ b/src/com/projectkorra/projectkorra/chiblocking/AcrobatStance.java @@ -8,7 +8,7 @@ import org.bukkit.potion.PotionEffectType; import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.ChiAbility; +import com.projectkorra.projectkorra.ability.api.ChiAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.chi.AcrobatStanceConfig; diff --git a/src/com/projectkorra/projectkorra/chiblocking/HighJump.java b/src/com/projectkorra/projectkorra/chiblocking/HighJump.java index 4c18dd4d..ee4dad96 100644 --- a/src/com/projectkorra/projectkorra/chiblocking/HighJump.java +++ b/src/com/projectkorra/projectkorra/chiblocking/HighJump.java @@ -6,7 +6,7 @@ import org.bukkit.entity.Player; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.ChiAbility; +import com.projectkorra.projectkorra.ability.api.ChiAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.chi.HighJumpConfig; import com.projectkorra.projectkorra.waterbending.multiabilities.WaterArmsWhip; diff --git a/src/com/projectkorra/projectkorra/chiblocking/Paralyze.java b/src/com/projectkorra/projectkorra/chiblocking/Paralyze.java index 61c396b2..52ea75a9 100644 --- a/src/com/projectkorra/projectkorra/chiblocking/Paralyze.java +++ b/src/com/projectkorra/projectkorra/chiblocking/Paralyze.java @@ -8,7 +8,7 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import com.projectkorra.projectkorra.Element; -import com.projectkorra.projectkorra.ability.ChiAbility; +import com.projectkorra.projectkorra.ability.api.ChiAbility; import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.airbending.Suffocate; import com.projectkorra.projectkorra.attribute.Attribute; diff --git a/src/com/projectkorra/projectkorra/chiblocking/QuickStrike.java b/src/com/projectkorra/projectkorra/chiblocking/QuickStrike.java index bf8ff952..c95ed859 100644 --- a/src/com/projectkorra/projectkorra/chiblocking/QuickStrike.java +++ b/src/com/projectkorra/projectkorra/chiblocking/QuickStrike.java @@ -4,7 +4,7 @@ import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; -import com.projectkorra.projectkorra.ability.ChiAbility; +import com.projectkorra.projectkorra.ability.api.ChiAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.chiblocking.passive.ChiPassive; import com.projectkorra.projectkorra.configuration.configs.abilities.chi.QuickStrikeConfig; diff --git a/src/com/projectkorra/projectkorra/chiblocking/RapidPunch.java b/src/com/projectkorra/projectkorra/chiblocking/RapidPunch.java index 8d547e21..5b060fd2 100644 --- a/src/com/projectkorra/projectkorra/chiblocking/RapidPunch.java +++ b/src/com/projectkorra/projectkorra/chiblocking/RapidPunch.java @@ -5,7 +5,7 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import com.projectkorra.projectkorra.ability.ChiAbility; +import com.projectkorra.projectkorra.ability.api.ChiAbility; import com.projectkorra.projectkorra.airbending.Suffocate; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.chiblocking.passive.ChiPassive; diff --git a/src/com/projectkorra/projectkorra/chiblocking/Smokescreen.java b/src/com/projectkorra/projectkorra/chiblocking/Smokescreen.java index 1ad7bc6b..54a98f80 100644 --- a/src/com/projectkorra/projectkorra/chiblocking/Smokescreen.java +++ b/src/com/projectkorra/projectkorra/chiblocking/Smokescreen.java @@ -11,7 +11,7 @@ import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.ChiAbility; +import com.projectkorra.projectkorra.ability.api.ChiAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.configuration.configs.abilities.chi.SmokescreenConfig; diff --git a/src/com/projectkorra/projectkorra/chiblocking/SwiftKick.java b/src/com/projectkorra/projectkorra/chiblocking/SwiftKick.java index 0e0c2a5b..6ee2aafc 100644 --- a/src/com/projectkorra/projectkorra/chiblocking/SwiftKick.java +++ b/src/com/projectkorra/projectkorra/chiblocking/SwiftKick.java @@ -4,8 +4,8 @@ import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; -import com.projectkorra.projectkorra.ability.ChiAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.ChiAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.chiblocking.passive.ChiPassive; import com.projectkorra.projectkorra.configuration.configs.abilities.chi.SwiftKickConfig; diff --git a/src/com/projectkorra/projectkorra/chiblocking/WarriorStance.java b/src/com/projectkorra/projectkorra/chiblocking/WarriorStance.java index 27cd0ca8..d9f2d796 100644 --- a/src/com/projectkorra/projectkorra/chiblocking/WarriorStance.java +++ b/src/com/projectkorra/projectkorra/chiblocking/WarriorStance.java @@ -8,7 +8,7 @@ import org.bukkit.potion.PotionEffectType; import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.ChiAbility; +import com.projectkorra.projectkorra.ability.api.ChiAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.chi.WarriorStanceConfig; diff --git a/src/com/projectkorra/projectkorra/chiblocking/combo/Immobilize.java b/src/com/projectkorra/projectkorra/chiblocking/combo/Immobilize.java index 5c753271..d9c7dd89 100644 --- a/src/com/projectkorra/projectkorra/chiblocking/combo/Immobilize.java +++ b/src/com/projectkorra/projectkorra/chiblocking/combo/Immobilize.java @@ -9,8 +9,8 @@ import org.bukkit.entity.Player; import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.ChiAbility; -import com.projectkorra.projectkorra.ability.ComboAbility; +import com.projectkorra.projectkorra.ability.api.ChiAbility; +import com.projectkorra.projectkorra.ability.api.ComboAbility; import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; import com.projectkorra.projectkorra.attribute.Attribute; diff --git a/src/com/projectkorra/projectkorra/chiblocking/passive/Acrobatics.java b/src/com/projectkorra/projectkorra/chiblocking/passive/Acrobatics.java index fe1c0869..80b76e5b 100644 --- a/src/com/projectkorra/projectkorra/chiblocking/passive/Acrobatics.java +++ b/src/com/projectkorra/projectkorra/chiblocking/passive/Acrobatics.java @@ -3,8 +3,8 @@ package com.projectkorra.projectkorra.chiblocking.passive; import org.bukkit.Location; import org.bukkit.entity.Player; -import com.projectkorra.projectkorra.ability.ChiAbility; -import com.projectkorra.projectkorra.ability.PassiveAbility; +import com.projectkorra.projectkorra.ability.api.ChiAbility; +import com.projectkorra.projectkorra.ability.api.PassiveAbility; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.configs.abilities.chi.AcrobaticsConfig; diff --git a/src/com/projectkorra/projectkorra/chiblocking/passive/ChiAgility.java b/src/com/projectkorra/projectkorra/chiblocking/passive/ChiAgility.java index dfe115b9..ad1911ba 100644 --- a/src/com/projectkorra/projectkorra/chiblocking/passive/ChiAgility.java +++ b/src/com/projectkorra/projectkorra/chiblocking/passive/ChiAgility.java @@ -5,8 +5,8 @@ import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import com.projectkorra.projectkorra.ability.ChiAbility; -import com.projectkorra.projectkorra.ability.PassiveAbility; +import com.projectkorra.projectkorra.ability.api.ChiAbility; +import com.projectkorra.projectkorra.ability.api.PassiveAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.chi.ChiAgilityConfig; diff --git a/src/com/projectkorra/projectkorra/chiblocking/passive/ChiPassive.java b/src/com/projectkorra/projectkorra/chiblocking/passive/ChiPassive.java index 0844960a..e2446d12 100644 --- a/src/com/projectkorra/projectkorra/chiblocking/passive/ChiPassive.java +++ b/src/com/projectkorra/projectkorra/chiblocking/passive/ChiPassive.java @@ -7,7 +7,7 @@ import org.bukkit.scheduler.BukkitRunnable; import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.ChiAbility; +import com.projectkorra.projectkorra.ability.api.ChiAbility; import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.airbending.Suffocate; import com.projectkorra.projectkorra.chiblocking.AcrobatStance; diff --git a/src/com/projectkorra/projectkorra/chiblocking/passive/ChiSaturation.java b/src/com/projectkorra/projectkorra/chiblocking/passive/ChiSaturation.java index 156ba90a..b3dac390 100644 --- a/src/com/projectkorra/projectkorra/chiblocking/passive/ChiSaturation.java +++ b/src/com/projectkorra/projectkorra/chiblocking/passive/ChiSaturation.java @@ -3,8 +3,8 @@ package com.projectkorra.projectkorra.chiblocking.passive; import org.bukkit.Location; import org.bukkit.entity.Player; -import com.projectkorra.projectkorra.ability.ChiAbility; -import com.projectkorra.projectkorra.ability.PassiveAbility; +import com.projectkorra.projectkorra.ability.api.ChiAbility; +import com.projectkorra.projectkorra.ability.api.PassiveAbility; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.configs.abilities.chi.ChiSaturationConfig; diff --git a/src/com/projectkorra/projectkorra/command/BindCommand.java b/src/com/projectkorra/projectkorra/command/BindCommand.java index da3ab46a..70ec7f26 100644 --- a/src/com/projectkorra/projectkorra/command/BindCommand.java +++ b/src/com/projectkorra/projectkorra/command/BindCommand.java @@ -13,9 +13,9 @@ import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.Element.SubElement; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.ComboAbility; +import com.projectkorra.projectkorra.ability.api.ComboAbility; import com.projectkorra.projectkorra.ability.CoreAbility; -import com.projectkorra.projectkorra.ability.PassiveAbility; +import com.projectkorra.projectkorra.ability.api.PassiveAbility; import com.projectkorra.projectkorra.configuration.configs.commands.BindCommandConfig; /** diff --git a/src/com/projectkorra/projectkorra/command/DisplayCommand.java b/src/com/projectkorra/projectkorra/command/DisplayCommand.java index edd2e2ba..bb5a6589 100644 --- a/src/com/projectkorra/projectkorra/command/DisplayCommand.java +++ b/src/com/projectkorra/projectkorra/command/DisplayCommand.java @@ -15,10 +15,10 @@ import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.Element.SubElement; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.AddonAbility; -import com.projectkorra.projectkorra.ability.ComboAbility; +import com.projectkorra.projectkorra.ability.api.AddonAbility; +import com.projectkorra.projectkorra.ability.api.ComboAbility; import com.projectkorra.projectkorra.ability.CoreAbility; -import com.projectkorra.projectkorra.ability.SubAbility; +import com.projectkorra.projectkorra.ability.api.SubAbility; import com.projectkorra.projectkorra.ability.util.ComboManager; import com.projectkorra.projectkorra.ability.util.PassiveManager; import com.projectkorra.projectkorra.configuration.ConfigManager; diff --git a/src/com/projectkorra/projectkorra/command/HelpCommand.java b/src/com/projectkorra/projectkorra/command/HelpCommand.java index 2d487ec9..5144223e 100644 --- a/src/com/projectkorra/projectkorra/command/HelpCommand.java +++ b/src/com/projectkorra/projectkorra/command/HelpCommand.java @@ -11,10 +11,10 @@ import org.bukkit.entity.Player; import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.AddonAbility; -import com.projectkorra.projectkorra.ability.ComboAbility; +import com.projectkorra.projectkorra.ability.api.AddonAbility; +import com.projectkorra.projectkorra.ability.api.ComboAbility; import com.projectkorra.projectkorra.ability.CoreAbility; -import com.projectkorra.projectkorra.ability.PassiveAbility; +import com.projectkorra.projectkorra.ability.api.PassiveAbility; import com.projectkorra.projectkorra.ability.util.ComboManager; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.configs.commands.HelpCommandConfig; diff --git a/src/com/projectkorra/projectkorra/earthbending/Catapult.java b/src/com/projectkorra/projectkorra/earthbending/Catapult.java index 9e624c4b..875dde60 100644 --- a/src/com/projectkorra/projectkorra/earthbending/Catapult.java +++ b/src/com/projectkorra/projectkorra/earthbending/Catapult.java @@ -13,7 +13,7 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.EarthAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.earth.CatapultConfig; import com.projectkorra.projectkorra.util.ParticleEffect; diff --git a/src/com/projectkorra/projectkorra/earthbending/Collapse.java b/src/com/projectkorra/projectkorra/earthbending/Collapse.java index a2e879ed..3fdc7e81 100644 --- a/src/com/projectkorra/projectkorra/earthbending/Collapse.java +++ b/src/com/projectkorra/projectkorra/earthbending/Collapse.java @@ -10,7 +10,7 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import com.projectkorra.projectkorra.ability.EarthAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.earth.CollapseConfig; import com.projectkorra.projectkorra.util.BlockSource; diff --git a/src/com/projectkorra/projectkorra/earthbending/CollapseWall.java b/src/com/projectkorra/projectkorra/earthbending/CollapseWall.java index 310bbaf2..6cba236f 100644 --- a/src/com/projectkorra/projectkorra/earthbending/CollapseWall.java +++ b/src/com/projectkorra/projectkorra/earthbending/CollapseWall.java @@ -10,7 +10,7 @@ import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.EarthAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.earth.CollapseConfig; import com.projectkorra.projectkorra.util.BlockSource; diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthArmor.java b/src/com/projectkorra/projectkorra/earthbending/EarthArmor.java index 60a095de..a75de53c 100644 --- a/src/com/projectkorra/projectkorra/earthbending/EarthArmor.java +++ b/src/com/projectkorra/projectkorra/earthbending/EarthArmor.java @@ -19,8 +19,8 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.EarthAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.configuration.ConfigManager; diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java b/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java index 16e3cb9d..4f98f538 100644 --- a/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java +++ b/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java @@ -13,8 +13,8 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.EarthAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; import com.projectkorra.projectkorra.ability.util.Collision; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.earth.EarthBlastConfig; diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthDome.java b/src/com/projectkorra/projectkorra/earthbending/EarthDome.java index f29a3251..c5ef37f9 100644 --- a/src/com/projectkorra/projectkorra/earthbending/EarthDome.java +++ b/src/com/projectkorra/projectkorra/earthbending/EarthDome.java @@ -11,7 +11,7 @@ import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.EarthAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.configs.abilities.earth.EarthDomeConfig; diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthGrab.java b/src/com/projectkorra/projectkorra/earthbending/EarthGrab.java index b08123aa..ec092fb5 100644 --- a/src/com/projectkorra/projectkorra/earthbending/EarthGrab.java +++ b/src/com/projectkorra/projectkorra/earthbending/EarthGrab.java @@ -28,8 +28,8 @@ import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ability.CoreAbility; -import com.projectkorra.projectkorra.ability.EarthAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.configuration.configs.abilities.earth.EarthGrabConfig; diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthSmash.java b/src/com/projectkorra/projectkorra/earthbending/EarthSmash.java index 9bf249ac..899a7788 100644 --- a/src/com/projectkorra/projectkorra/earthbending/EarthSmash.java +++ b/src/com/projectkorra/projectkorra/earthbending/EarthSmash.java @@ -16,8 +16,8 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.EarthAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.configuration.configs.abilities.earth.EarthSmashConfig; diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthTunnel.java b/src/com/projectkorra/projectkorra/earthbending/EarthTunnel.java index 51e11779..e930ddc3 100644 --- a/src/com/projectkorra/projectkorra/earthbending/EarthTunnel.java +++ b/src/com/projectkorra/projectkorra/earthbending/EarthTunnel.java @@ -10,8 +10,8 @@ import org.bukkit.entity.Player; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.EarthAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.earth.EarthTunnelConfig; import com.projectkorra.projectkorra.util.TempBlock; diff --git a/src/com/projectkorra/projectkorra/earthbending/RaiseEarth.java b/src/com/projectkorra/projectkorra/earthbending/RaiseEarth.java index e89a2ed7..65910006 100644 --- a/src/com/projectkorra/projectkorra/earthbending/RaiseEarth.java +++ b/src/com/projectkorra/projectkorra/earthbending/RaiseEarth.java @@ -9,7 +9,7 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import com.projectkorra.projectkorra.ability.EarthAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.earth.RaiseEarthConfig; import com.projectkorra.projectkorra.util.BlockSource; diff --git a/src/com/projectkorra/projectkorra/earthbending/RaiseEarthWall.java b/src/com/projectkorra/projectkorra/earthbending/RaiseEarthWall.java index 960c09dc..0c30fec8 100644 --- a/src/com/projectkorra/projectkorra/earthbending/RaiseEarthWall.java +++ b/src/com/projectkorra/projectkorra/earthbending/RaiseEarthWall.java @@ -7,7 +7,7 @@ import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import com.projectkorra.projectkorra.ability.EarthAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.earth.RaiseEarthConfig; import com.projectkorra.projectkorra.util.BlockSource; diff --git a/src/com/projectkorra/projectkorra/earthbending/Ripple.java b/src/com/projectkorra/projectkorra/earthbending/Ripple.java index 56fbd26f..d0c8dc8a 100644 --- a/src/com/projectkorra/projectkorra/earthbending/Ripple.java +++ b/src/com/projectkorra/projectkorra/earthbending/Ripple.java @@ -14,8 +14,8 @@ import org.bukkit.entity.Player; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.EarthAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.command.Commands; diff --git a/src/com/projectkorra/projectkorra/earthbending/Shockwave.java b/src/com/projectkorra/projectkorra/earthbending/Shockwave.java index a38755f7..5fbf9eac 100644 --- a/src/com/projectkorra/projectkorra/earthbending/Shockwave.java +++ b/src/com/projectkorra/projectkorra/earthbending/Shockwave.java @@ -4,7 +4,7 @@ import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import com.projectkorra.projectkorra.ability.EarthAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.earth.ShockwaveConfig; import com.projectkorra.projectkorra.util.ParticleEffect; diff --git a/src/com/projectkorra/projectkorra/earthbending/Tremorsense.java b/src/com/projectkorra/projectkorra/earthbending/Tremorsense.java index 8c1e3eb6..cd6a09ad 100644 --- a/src/com/projectkorra/projectkorra/earthbending/Tremorsense.java +++ b/src/com/projectkorra/projectkorra/earthbending/Tremorsense.java @@ -13,8 +13,8 @@ import org.bukkit.entity.Player; import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.EarthAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.earth.TremorsenseConfig; diff --git a/src/com/projectkorra/projectkorra/earthbending/combo/EarthDomeOthers.java b/src/com/projectkorra/projectkorra/earthbending/combo/EarthDomeOthers.java index 4e56929b..ad06d70f 100644 --- a/src/com/projectkorra/projectkorra/earthbending/combo/EarthDomeOthers.java +++ b/src/com/projectkorra/projectkorra/earthbending/combo/EarthDomeOthers.java @@ -9,7 +9,7 @@ import org.bukkit.entity.Player; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.EarthAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.earth.EarthDomeConfig; import com.projectkorra.projectkorra.earthbending.EarthDome; diff --git a/src/com/projectkorra/projectkorra/earthbending/combo/EarthDomeSelf.java b/src/com/projectkorra/projectkorra/earthbending/combo/EarthDomeSelf.java index a3869e49..d3ea5d34 100644 --- a/src/com/projectkorra/projectkorra/earthbending/combo/EarthDomeSelf.java +++ b/src/com/projectkorra/projectkorra/earthbending/combo/EarthDomeSelf.java @@ -5,8 +5,8 @@ import java.util.ArrayList; import org.bukkit.Location; import org.bukkit.entity.Player; -import com.projectkorra.projectkorra.ability.ComboAbility; -import com.projectkorra.projectkorra.ability.EarthAbility; +import com.projectkorra.projectkorra.ability.api.ComboAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.configs.abilities.earth.EarthDomeConfig; diff --git a/src/com/projectkorra/projectkorra/earthbending/combo/EarthPillars.java b/src/com/projectkorra/projectkorra/earthbending/combo/EarthPillars.java index 2788d31a..e1efccbc 100644 --- a/src/com/projectkorra/projectkorra/earthbending/combo/EarthPillars.java +++ b/src/com/projectkorra/projectkorra/earthbending/combo/EarthPillars.java @@ -13,8 +13,8 @@ import org.bukkit.entity.Player; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.ComboAbility; -import com.projectkorra.projectkorra.ability.EarthAbility; +import com.projectkorra.projectkorra.ability.api.ComboAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.ConfigManager; diff --git a/src/com/projectkorra/projectkorra/earthbending/lava/LavaFlow.java b/src/com/projectkorra/projectkorra/earthbending/lava/LavaFlow.java index f48048a4..bfc73935 100644 --- a/src/com/projectkorra/projectkorra/earthbending/lava/LavaFlow.java +++ b/src/com/projectkorra/projectkorra/earthbending/lava/LavaFlow.java @@ -17,8 +17,8 @@ import org.bukkit.scheduler.BukkitRunnable; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ability.CoreAbility; -import com.projectkorra.projectkorra.ability.EarthAbility; -import com.projectkorra.projectkorra.ability.LavaAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; +import com.projectkorra.projectkorra.ability.api.LavaAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.earth.LavaFlowConfig; import com.projectkorra.projectkorra.util.BlockSource; diff --git a/src/com/projectkorra/projectkorra/earthbending/metal/Extraction.java b/src/com/projectkorra/projectkorra/earthbending/metal/Extraction.java index 58aca48e..76d6c1b6 100644 --- a/src/com/projectkorra/projectkorra/earthbending/metal/Extraction.java +++ b/src/com/projectkorra/projectkorra/earthbending/metal/Extraction.java @@ -10,7 +10,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.MetalAbility; +import com.projectkorra.projectkorra.ability.api.MetalAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.earth.ExtractionConfig; import com.projectkorra.projectkorra.util.TempBlock; diff --git a/src/com/projectkorra/projectkorra/earthbending/metal/MetalClips.java b/src/com/projectkorra/projectkorra/earthbending/metal/MetalClips.java index f65e30c8..7bbc8c1b 100644 --- a/src/com/projectkorra/projectkorra/earthbending/metal/MetalClips.java +++ b/src/com/projectkorra/projectkorra/earthbending/metal/MetalClips.java @@ -21,7 +21,7 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ability.CoreAbility; -import com.projectkorra.projectkorra.ability.MetalAbility; +import com.projectkorra.projectkorra.ability.api.MetalAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.earth.MetalClipsConfig; import com.projectkorra.projectkorra.util.DamageHandler; diff --git a/src/com/projectkorra/projectkorra/earthbending/passive/DensityShift.java b/src/com/projectkorra/projectkorra/earthbending/passive/DensityShift.java index f297dd42..1845c135 100644 --- a/src/com/projectkorra/projectkorra/earthbending/passive/DensityShift.java +++ b/src/com/projectkorra/projectkorra/earthbending/passive/DensityShift.java @@ -11,9 +11,9 @@ import org.bukkit.entity.Player; import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.EarthAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; -import com.projectkorra.projectkorra.ability.PassiveAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.PassiveAbility; import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.configs.abilities.earth.DensityShiftConfig; diff --git a/src/com/projectkorra/projectkorra/earthbending/passive/FerroControl.java b/src/com/projectkorra/projectkorra/earthbending/passive/FerroControl.java index 073fd7f3..eedc34f8 100644 --- a/src/com/projectkorra/projectkorra/earthbending/passive/FerroControl.java +++ b/src/com/projectkorra/projectkorra/earthbending/passive/FerroControl.java @@ -11,8 +11,8 @@ import org.bukkit.block.data.type.TrapDoor; import org.bukkit.entity.Player; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.MetalAbility; -import com.projectkorra.projectkorra.ability.PassiveAbility; +import com.projectkorra.projectkorra.ability.api.MetalAbility; +import com.projectkorra.projectkorra.ability.api.PassiveAbility; import com.projectkorra.projectkorra.configuration.configs.abilities.earth.FerroControlConfig; public class FerroControl extends MetalAbility implements PassiveAbility { diff --git a/src/com/projectkorra/projectkorra/firebending/Blaze.java b/src/com/projectkorra/projectkorra/firebending/Blaze.java index becba90d..8e89db6f 100644 --- a/src/com/projectkorra/projectkorra/firebending/Blaze.java +++ b/src/com/projectkorra/projectkorra/firebending/Blaze.java @@ -4,7 +4,7 @@ import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import com.projectkorra.projectkorra.ability.FireAbility; +import com.projectkorra.projectkorra.ability.api.FireAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.configuration.configs.abilities.fire.BlazeConfig; diff --git a/src/com/projectkorra/projectkorra/firebending/BlazeArc.java b/src/com/projectkorra/projectkorra/firebending/BlazeArc.java index fe7eaf87..36034b01 100644 --- a/src/com/projectkorra/projectkorra/firebending/BlazeArc.java +++ b/src/com/projectkorra/projectkorra/firebending/BlazeArc.java @@ -14,7 +14,7 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.FireAbility; +import com.projectkorra.projectkorra.ability.api.FireAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.fire.BlazeConfig; import com.projectkorra.projectkorra.waterbending.plant.PlantRegrowth; diff --git a/src/com/projectkorra/projectkorra/firebending/BlazeRing.java b/src/com/projectkorra/projectkorra/firebending/BlazeRing.java index fed82d15..1e666dc6 100644 --- a/src/com/projectkorra/projectkorra/firebending/BlazeRing.java +++ b/src/com/projectkorra/projectkorra/firebending/BlazeRing.java @@ -4,7 +4,7 @@ import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import com.projectkorra.projectkorra.ability.FireAbility; +import com.projectkorra.projectkorra.ability.api.FireAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.fire.BlazeConfig; diff --git a/src/com/projectkorra/projectkorra/firebending/FireBlast.java b/src/com/projectkorra/projectkorra/firebending/FireBlast.java index 2c3dd735..ab8829b0 100644 --- a/src/com/projectkorra/projectkorra/firebending/FireBlast.java +++ b/src/com/projectkorra/projectkorra/firebending/FireBlast.java @@ -16,8 +16,8 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.FireAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.FireAbility; import com.projectkorra.projectkorra.ability.util.Collision; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.avatar.AvatarState; diff --git a/src/com/projectkorra/projectkorra/firebending/FireBlastCharged.java b/src/com/projectkorra/projectkorra/firebending/FireBlastCharged.java index 1b61e7a7..39dbff97 100644 --- a/src/com/projectkorra/projectkorra/firebending/FireBlastCharged.java +++ b/src/com/projectkorra/projectkorra/firebending/FireBlastCharged.java @@ -17,9 +17,9 @@ import org.bukkit.entity.TNTPrimed; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.AirAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; import com.projectkorra.projectkorra.ability.CoreAbility; -import com.projectkorra.projectkorra.ability.FireAbility; +import com.projectkorra.projectkorra.ability.api.FireAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.configuration.configs.abilities.fire.FireBlastConfig; diff --git a/src/com/projectkorra/projectkorra/firebending/FireBurst.java b/src/com/projectkorra/projectkorra/firebending/FireBurst.java index 61c92821..5b96e622 100644 --- a/src/com/projectkorra/projectkorra/firebending/FireBurst.java +++ b/src/com/projectkorra/projectkorra/firebending/FireBurst.java @@ -12,7 +12,7 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.FireAbility; +import com.projectkorra.projectkorra.ability.api.FireAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.configs.abilities.fire.FireBlastConfig; diff --git a/src/com/projectkorra/projectkorra/firebending/FireJet.java b/src/com/projectkorra/projectkorra/firebending/FireJet.java index 3fe40aad..fbccfbe3 100644 --- a/src/com/projectkorra/projectkorra/firebending/FireJet.java +++ b/src/com/projectkorra/projectkorra/firebending/FireJet.java @@ -10,8 +10,8 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import com.projectkorra.projectkorra.ability.ElementalAbility; -import com.projectkorra.projectkorra.ability.FireAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.FireAbility; import com.projectkorra.projectkorra.airbending.AirSpout; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.fire.FireJetConfig; diff --git a/src/com/projectkorra/projectkorra/firebending/FireManipulation.java b/src/com/projectkorra/projectkorra/firebending/FireManipulation.java index a877456c..10e36491 100644 --- a/src/com/projectkorra/projectkorra/firebending/FireManipulation.java +++ b/src/com/projectkorra/projectkorra/firebending/FireManipulation.java @@ -13,7 +13,7 @@ import org.bukkit.entity.Player; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.FireAbility; +import com.projectkorra.projectkorra.ability.api.FireAbility; import com.projectkorra.projectkorra.configuration.configs.abilities.fire.FireManipulationConfig; import com.projectkorra.projectkorra.util.DamageHandler; import com.projectkorra.projectkorra.util.ParticleEffect; diff --git a/src/com/projectkorra/projectkorra/firebending/FireShield.java b/src/com/projectkorra/projectkorra/firebending/FireShield.java index 37a961de..f04f58e0 100644 --- a/src/com/projectkorra/projectkorra/firebending/FireShield.java +++ b/src/com/projectkorra/projectkorra/firebending/FireShield.java @@ -13,7 +13,7 @@ import org.bukkit.entity.Projectile; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.FireAbility; +import com.projectkorra.projectkorra.ability.api.FireAbility; import com.projectkorra.projectkorra.ability.util.Collision; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.fire.FireShieldConfig; diff --git a/src/com/projectkorra/projectkorra/firebending/HeatControl.java b/src/com/projectkorra/projectkorra/firebending/HeatControl.java index a5423239..bafa906d 100644 --- a/src/com/projectkorra/projectkorra/firebending/HeatControl.java +++ b/src/com/projectkorra/projectkorra/firebending/HeatControl.java @@ -24,7 +24,7 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.FireAbility; +import com.projectkorra.projectkorra.ability.api.FireAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.configs.abilities.fire.HeatControlConfig; diff --git a/src/com/projectkorra/projectkorra/firebending/Illumination.java b/src/com/projectkorra/projectkorra/firebending/Illumination.java index 06b8d7f0..c6973d34 100644 --- a/src/com/projectkorra/projectkorra/firebending/Illumination.java +++ b/src/com/projectkorra/projectkorra/firebending/Illumination.java @@ -12,7 +12,7 @@ import org.bukkit.entity.Player; import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.FireAbility; +import com.projectkorra.projectkorra.ability.api.FireAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.fire.IlluminationConfig; import com.projectkorra.projectkorra.util.TempBlock; diff --git a/src/com/projectkorra/projectkorra/firebending/WallOfFire.java b/src/com/projectkorra/projectkorra/firebending/WallOfFire.java index 16a62b81..4fa994ce 100644 --- a/src/com/projectkorra/projectkorra/firebending/WallOfFire.java +++ b/src/com/projectkorra/projectkorra/firebending/WallOfFire.java @@ -12,8 +12,8 @@ import org.bukkit.entity.Player; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.FireAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.FireAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.fire.WallOfFireConfig; import com.projectkorra.projectkorra.firebending.util.FireDamageTimer; diff --git a/src/com/projectkorra/projectkorra/firebending/combo/FireComboStream.java b/src/com/projectkorra/projectkorra/firebending/combo/FireComboStream.java index 0c0d4108..ef005028 100644 --- a/src/com/projectkorra/projectkorra/firebending/combo/FireComboStream.java +++ b/src/com/projectkorra/projectkorra/firebending/combo/FireComboStream.java @@ -17,7 +17,7 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ability.CoreAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.firebending.util.FireDamageTimer; import com.projectkorra.projectkorra.util.DamageHandler; diff --git a/src/com/projectkorra/projectkorra/firebending/combo/FireKick.java b/src/com/projectkorra/projectkorra/firebending/combo/FireKick.java index f39eb31b..a6ff8987 100644 --- a/src/com/projectkorra/projectkorra/firebending/combo/FireKick.java +++ b/src/com/projectkorra/projectkorra/firebending/combo/FireKick.java @@ -12,8 +12,8 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.ComboAbility; -import com.projectkorra.projectkorra.ability.FireAbility; +import com.projectkorra.projectkorra.ability.api.ComboAbility; +import com.projectkorra.projectkorra.ability.api.FireAbility; import com.projectkorra.projectkorra.ability.util.Collision; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; import com.projectkorra.projectkorra.attribute.Attribute; diff --git a/src/com/projectkorra/projectkorra/firebending/combo/FireSpin.java b/src/com/projectkorra/projectkorra/firebending/combo/FireSpin.java index 890db77e..6bf72ed9 100644 --- a/src/com/projectkorra/projectkorra/firebending/combo/FireSpin.java +++ b/src/com/projectkorra/projectkorra/firebending/combo/FireSpin.java @@ -13,8 +13,8 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.ComboAbility; -import com.projectkorra.projectkorra.ability.FireAbility; +import com.projectkorra.projectkorra.ability.api.ComboAbility; +import com.projectkorra.projectkorra.ability.api.FireAbility; import com.projectkorra.projectkorra.ability.util.Collision; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; import com.projectkorra.projectkorra.attribute.Attribute; diff --git a/src/com/projectkorra/projectkorra/firebending/combo/FireWheel.java b/src/com/projectkorra/projectkorra/firebending/combo/FireWheel.java index 2bdf3352..fe6df6dc 100644 --- a/src/com/projectkorra/projectkorra/firebending/combo/FireWheel.java +++ b/src/com/projectkorra/projectkorra/firebending/combo/FireWheel.java @@ -13,9 +13,9 @@ import org.bukkit.entity.Player; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.ComboAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; -import com.projectkorra.projectkorra.ability.FireAbility; +import com.projectkorra.projectkorra.ability.api.ComboAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.FireAbility; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.ConfigManager; diff --git a/src/com/projectkorra/projectkorra/firebending/combo/JetBlast.java b/src/com/projectkorra/projectkorra/firebending/combo/JetBlast.java index 5e044148..dda6dc4c 100644 --- a/src/com/projectkorra/projectkorra/firebending/combo/JetBlast.java +++ b/src/com/projectkorra/projectkorra/firebending/combo/JetBlast.java @@ -7,8 +7,8 @@ import org.bukkit.Sound; import org.bukkit.entity.Player; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.ComboAbility; -import com.projectkorra.projectkorra.ability.FireAbility; +import com.projectkorra.projectkorra.ability.api.ComboAbility; +import com.projectkorra.projectkorra.ability.api.FireAbility; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.ConfigManager; diff --git a/src/com/projectkorra/projectkorra/firebending/combo/JetBlaze.java b/src/com/projectkorra/projectkorra/firebending/combo/JetBlaze.java index bb4dd4a7..199d69b2 100644 --- a/src/com/projectkorra/projectkorra/firebending/combo/JetBlaze.java +++ b/src/com/projectkorra/projectkorra/firebending/combo/JetBlaze.java @@ -9,8 +9,8 @@ import org.bukkit.entity.Player; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.ComboAbility; -import com.projectkorra.projectkorra.ability.FireAbility; +import com.projectkorra.projectkorra.ability.api.ComboAbility; +import com.projectkorra.projectkorra.ability.api.FireAbility; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.ConfigManager; diff --git a/src/com/projectkorra/projectkorra/firebending/combustion/Combustion.java b/src/com/projectkorra/projectkorra/firebending/combustion/Combustion.java index 98284e32..12e44b44 100644 --- a/src/com/projectkorra/projectkorra/firebending/combustion/Combustion.java +++ b/src/com/projectkorra/projectkorra/firebending/combustion/Combustion.java @@ -9,9 +9,9 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.CombustionAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.CombustionAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; import com.projectkorra.projectkorra.ability.util.Collision; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.avatar.AvatarState; diff --git a/src/com/projectkorra/projectkorra/firebending/lightning/Lightning.java b/src/com/projectkorra/projectkorra/firebending/lightning/Lightning.java index 31b84960..48b49e6c 100644 --- a/src/com/projectkorra/projectkorra/firebending/lightning/Lightning.java +++ b/src/com/projectkorra/projectkorra/firebending/lightning/Lightning.java @@ -16,7 +16,7 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.LightningAbility; +import com.projectkorra.projectkorra.ability.api.LightningAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.fire.LightningConfig; import com.projectkorra.projectkorra.util.DamageHandler; diff --git a/src/com/projectkorra/projectkorra/firebending/util/FirebendingManager.java b/src/com/projectkorra/projectkorra/firebending/util/FirebendingManager.java index e62ef7d4..2d3a96d2 100644 --- a/src/com/projectkorra/projectkorra/firebending/util/FirebendingManager.java +++ b/src/com/projectkorra/projectkorra/firebending/util/FirebendingManager.java @@ -1,7 +1,7 @@ package com.projectkorra.projectkorra.firebending.util; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.FireAbility; +import com.projectkorra.projectkorra.ability.api.FireAbility; import com.projectkorra.projectkorra.firebending.BlazeArc; public class FirebendingManager implements Runnable { diff --git a/src/com/projectkorra/projectkorra/module/ModuleManager.java b/src/com/projectkorra/projectkorra/module/ModuleManager.java index 20418125..db60c3c2 100644 --- a/src/com/projectkorra/projectkorra/module/ModuleManager.java +++ b/src/com/projectkorra/projectkorra/module/ModuleManager.java @@ -2,6 +2,7 @@ package com.projectkorra.projectkorra.module; import com.google.common.base.Preconditions; import com.projectkorra.projectkorra.ability.AbilityManager; +import com.projectkorra.projectkorra.ability.bind.AbilityBindManager; import com.projectkorra.projectkorra.cooldown.CooldownManager; import com.projectkorra.projectkorra.database.DatabaseManager; import com.projectkorra.projectkorra.element.ElementManager; @@ -66,6 +67,7 @@ public class ModuleManager { registerModule(BendingPlayerManager.class); registerModule(ElementManager.class); registerModule(AbilityManager.class); + registerModule(AbilityBindManager.class); registerModule(CooldownManager.class); } @@ -74,6 +76,7 @@ public class ModuleManager { */ public static void shutdown() { registerModule(CooldownManager.class); + registerModule(AbilityBindManager.class); registerModule(AbilityManager.class); registerModule(ElementManager.class); getModule(BendingPlayerManager.class).disable(); diff --git a/src/com/projectkorra/projectkorra/object/HorizontalVelocityTracker.java b/src/com/projectkorra/projectkorra/object/HorizontalVelocityTracker.java index 8c9936f3..96483995 100644 --- a/src/com/projectkorra/projectkorra/object/HorizontalVelocityTracker.java +++ b/src/com/projectkorra/projectkorra/object/HorizontalVelocityTracker.java @@ -18,7 +18,7 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ability.Ability; -import com.projectkorra.projectkorra.ability.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.configs.properties.GeneralPropertiesConfig; import com.projectkorra.projectkorra.event.HorizontalVelocityChangeEvent; diff --git a/src/com/projectkorra/projectkorra/player/BendingPlayer.java b/src/com/projectkorra/projectkorra/player/BendingPlayer.java index 67dae2a0..bca132d9 100644 --- a/src/com/projectkorra/projectkorra/player/BendingPlayer.java +++ b/src/com/projectkorra/projectkorra/player/BendingPlayer.java @@ -1,9 +1,8 @@ package com.projectkorra.projectkorra.player; import com.projectkorra.projectkorra.ability.Ability; -import com.projectkorra.projectkorra.ability.AbilityManager; -import com.projectkorra.projectkorra.ability.ChiAbility; -import com.projectkorra.projectkorra.ability.CoreAbility; +import com.projectkorra.projectkorra.ability.bind.AbilityBindManager; +import com.projectkorra.projectkorra.ability.api.ChiAbility; import com.projectkorra.projectkorra.ability.util.PassiveManager; import com.projectkorra.projectkorra.cooldown.CooldownManager; import com.projectkorra.projectkorra.element.Element; @@ -17,7 +16,7 @@ public class BendingPlayer { private final BendingPlayerManager manager; private final ElementManager elementManager; - private final AbilityManager abilityManager; + private final AbilityBindManager abilityBindManager; private final CooldownManager cooldownManager; private final int playerId; @@ -41,7 +40,7 @@ public class BendingPlayer { public BendingPlayer(int playerId, UUID uuid, String playerName, long firstLogin) { this.manager = ModuleManager.getModule(BendingPlayerManager.class); this.elementManager = ModuleManager.getModule(ElementManager.class); - this.abilityManager = ModuleManager.getModule(AbilityManager.class); + this.abilityBindManager = ModuleManager.getModule(AbilityBindManager.class); this.cooldownManager = ModuleManager.getModule(CooldownManager.class); this.playerId = playerId; @@ -135,8 +134,8 @@ public class BendingPlayer { } } - public CoreAbility getBoundAbility() { - return CoreAbility.getAbility(getBoundAbilityName()); + public Ability getBoundAbility() { + return Ability.getAbility(getBoundAbilityName()); } public String getBoundAbilityName() { diff --git a/src/com/projectkorra/projectkorra/util/BlockSource.java b/src/com/projectkorra/projectkorra/util/BlockSource.java index ed985e1b..ebd82d57 100644 --- a/src/com/projectkorra/projectkorra/util/BlockSource.java +++ b/src/com/projectkorra/projectkorra/util/BlockSource.java @@ -8,9 +8,9 @@ import org.bukkit.entity.Player; import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.ability.CoreAbility; -import com.projectkorra.projectkorra.ability.EarthAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; -import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.WaterAbility; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.configs.properties.EarthPropertiesConfig; import com.projectkorra.projectkorra.configuration.configs.properties.WaterPropertiesConfig; diff --git a/src/com/projectkorra/projectkorra/util/RevertChecker.java b/src/com/projectkorra/projectkorra/util/RevertChecker.java index 6c98ada5..4d3c2ffc 100644 --- a/src/com/projectkorra/projectkorra/util/RevertChecker.java +++ b/src/com/projectkorra/projectkorra/util/RevertChecker.java @@ -13,7 +13,7 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.EarthAbility; +import com.projectkorra.projectkorra.ability.api.EarthAbility; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.configs.properties.EarthPropertiesConfig; diff --git a/src/com/projectkorra/projectkorra/waterbending/OctopusForm.java b/src/com/projectkorra/projectkorra/waterbending/OctopusForm.java index dd8d6dfa..6968f8c9 100644 --- a/src/com/projectkorra/projectkorra/waterbending/OctopusForm.java +++ b/src/com/projectkorra/projectkorra/waterbending/OctopusForm.java @@ -15,8 +15,8 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.WaterAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.configuration.ConfigManager; diff --git a/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java b/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java index 7db0060e..93535c73 100644 --- a/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java +++ b/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java @@ -16,8 +16,8 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.ElementalAbility; -import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.WaterAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.water.SurgeConfig; import com.projectkorra.projectkorra.firebending.FireBlast; diff --git a/src/com/projectkorra/projectkorra/waterbending/SurgeWave.java b/src/com/projectkorra/projectkorra/waterbending/SurgeWave.java index a297575c..3673e62f 100644 --- a/src/com/projectkorra/projectkorra/waterbending/SurgeWave.java +++ b/src/com/projectkorra/projectkorra/waterbending/SurgeWave.java @@ -16,9 +16,9 @@ import org.bukkit.entity.Player; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; -import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.WaterAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.command.Commands; diff --git a/src/com/projectkorra/projectkorra/waterbending/Torrent.java b/src/com/projectkorra/projectkorra/waterbending/Torrent.java index 76310282..890b8d56 100644 --- a/src/com/projectkorra/projectkorra/waterbending/Torrent.java +++ b/src/com/projectkorra/projectkorra/waterbending/Torrent.java @@ -18,8 +18,8 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.WaterAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.command.Commands; diff --git a/src/com/projectkorra/projectkorra/waterbending/TorrentWave.java b/src/com/projectkorra/projectkorra/waterbending/TorrentWave.java index 11b68cac..bf1e475d 100644 --- a/src/com/projectkorra/projectkorra/waterbending/TorrentWave.java +++ b/src/com/projectkorra/projectkorra/waterbending/TorrentWave.java @@ -14,7 +14,7 @@ import org.bukkit.entity.Player; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.ability.api.WaterAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.configuration.configs.abilities.water.TorrentConfig; diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterBubble.java b/src/com/projectkorra/projectkorra/waterbending/WaterBubble.java index 7d636fa8..e8212b00 100644 --- a/src/com/projectkorra/projectkorra/waterbending/WaterBubble.java +++ b/src/com/projectkorra/projectkorra/waterbending/WaterBubble.java @@ -15,8 +15,8 @@ import org.bukkit.block.data.Waterlogged; import org.bukkit.entity.Player; import com.projectkorra.projectkorra.ability.CoreAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; -import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.WaterAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.water.WaterBubbleConfig; import com.projectkorra.projectkorra.util.TempBlock; diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterManipulation.java b/src/com/projectkorra/projectkorra/waterbending/WaterManipulation.java index 1e3c3396..2ad245d7 100644 --- a/src/com/projectkorra/projectkorra/waterbending/WaterManipulation.java +++ b/src/com/projectkorra/projectkorra/waterbending/WaterManipulation.java @@ -16,8 +16,8 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.WaterAbility; import com.projectkorra.projectkorra.ability.util.Collision; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.command.Commands; diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterSpout.java b/src/com/projectkorra/projectkorra/waterbending/WaterSpout.java index 48fa5733..d26f6496 100644 --- a/src/com/projectkorra/projectkorra/waterbending/WaterSpout.java +++ b/src/com/projectkorra/projectkorra/waterbending/WaterSpout.java @@ -13,8 +13,8 @@ import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffectType; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.ElementalAbility; -import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.WaterAbility; import com.projectkorra.projectkorra.ability.util.Collision; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.water.WaterSpoutConfig; diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterSpoutWave.java b/src/com/projectkorra/projectkorra/waterbending/WaterSpoutWave.java index 45202cc1..cd5d445c 100644 --- a/src/com/projectkorra/projectkorra/waterbending/WaterSpoutWave.java +++ b/src/com/projectkorra/projectkorra/waterbending/WaterSpoutWave.java @@ -22,8 +22,8 @@ import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ability.CoreAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; -import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.WaterAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.configuration.ConfigManager; diff --git a/src/com/projectkorra/projectkorra/waterbending/blood/Bloodbending.java b/src/com/projectkorra/projectkorra/waterbending/blood/Bloodbending.java index 2edfd386..bdd1c181 100644 --- a/src/com/projectkorra/projectkorra/waterbending/blood/Bloodbending.java +++ b/src/com/projectkorra/projectkorra/waterbending/blood/Bloodbending.java @@ -18,8 +18,8 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.BloodAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.BloodAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.configuration.configs.abilities.water.BloodbendingConfig; diff --git a/src/com/projectkorra/projectkorra/waterbending/combo/IceBullet.java b/src/com/projectkorra/projectkorra/waterbending/combo/IceBullet.java index 2d328071..b388118c 100644 --- a/src/com/projectkorra/projectkorra/waterbending/combo/IceBullet.java +++ b/src/com/projectkorra/projectkorra/waterbending/combo/IceBullet.java @@ -18,9 +18,9 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; -import com.projectkorra.projectkorra.ability.ComboAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; -import com.projectkorra.projectkorra.ability.IceAbility; +import com.projectkorra.projectkorra.ability.api.ComboAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.IceAbility; import com.projectkorra.projectkorra.ability.util.Collision; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; import com.projectkorra.projectkorra.attribute.Attribute; diff --git a/src/com/projectkorra/projectkorra/waterbending/combo/IceWave.java b/src/com/projectkorra/projectkorra/waterbending/combo/IceWave.java index 42fae6f0..b663f5d5 100644 --- a/src/com/projectkorra/projectkorra/waterbending/combo/IceWave.java +++ b/src/com/projectkorra/projectkorra/waterbending/combo/IceWave.java @@ -8,8 +8,8 @@ import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.entity.Player; -import com.projectkorra.projectkorra.ability.ComboAbility; -import com.projectkorra.projectkorra.ability.IceAbility; +import com.projectkorra.projectkorra.ability.api.ComboAbility; +import com.projectkorra.projectkorra.ability.api.IceAbility; import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.ConfigManager; diff --git a/src/com/projectkorra/projectkorra/waterbending/healing/HealingWaters.java b/src/com/projectkorra/projectkorra/waterbending/healing/HealingWaters.java index 6c8bb68a..80861ae8 100644 --- a/src/com/projectkorra/projectkorra/waterbending/healing/HealingWaters.java +++ b/src/com/projectkorra/projectkorra/waterbending/healing/HealingWaters.java @@ -15,9 +15,9 @@ import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; -import com.projectkorra.projectkorra.ability.HealingAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.HealingAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.chiblocking.Smokescreen; import com.projectkorra.projectkorra.configuration.configs.abilities.water.HealingWatersConfig; diff --git a/src/com/projectkorra/projectkorra/waterbending/ice/IceBlast.java b/src/com/projectkorra/projectkorra/waterbending/ice/IceBlast.java index 155cb100..ddd25dd9 100644 --- a/src/com/projectkorra/projectkorra/waterbending/ice/IceBlast.java +++ b/src/com/projectkorra/projectkorra/waterbending/ice/IceBlast.java @@ -17,8 +17,8 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.IceAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.IceAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.water.IceBlastConfig; import com.projectkorra.projectkorra.util.BlockSource; diff --git a/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikeBlast.java b/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikeBlast.java index aabe0a5d..e21b9f8a 100644 --- a/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikeBlast.java +++ b/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikeBlast.java @@ -15,8 +15,8 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.IceAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.IceAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.water.IceSpikeConfig; import com.projectkorra.projectkorra.util.DamageHandler; diff --git a/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikePillar.java b/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikePillar.java index feaca184..da7ca899 100644 --- a/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikePillar.java +++ b/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikePillar.java @@ -17,10 +17,10 @@ import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; -import com.projectkorra.projectkorra.ability.IceAbility; -import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.ability.api.AirAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.IceAbility; +import com.projectkorra.projectkorra.ability.api.WaterAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.water.IceSpikeConfig; import com.projectkorra.projectkorra.util.DamageHandler; diff --git a/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikePillarField.java b/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikePillarField.java index eb5ba680..2081e156 100644 --- a/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikePillarField.java +++ b/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikePillarField.java @@ -14,9 +14,9 @@ import org.bukkit.entity.Player; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.ElementalAbility; -import com.projectkorra.projectkorra.ability.IceAbility; -import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.IceAbility; +import com.projectkorra.projectkorra.ability.api.WaterAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.water.IceSpikeConfig; import com.projectkorra.projectkorra.util.TempBlock; diff --git a/src/com/projectkorra/projectkorra/waterbending/ice/PhaseChange.java b/src/com/projectkorra/projectkorra/waterbending/ice/PhaseChange.java index 23cb4c64..1dcaa42e 100644 --- a/src/com/projectkorra/projectkorra/waterbending/ice/PhaseChange.java +++ b/src/com/projectkorra/projectkorra/waterbending/ice/PhaseChange.java @@ -16,8 +16,8 @@ import org.bukkit.entity.Player; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.ElementalAbility; -import com.projectkorra.projectkorra.ability.IceAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.IceAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.water.PhaseChangeConfig; import com.projectkorra.projectkorra.util.TempBlock; diff --git a/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArms.java b/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArms.java index 3fb24ee2..fa272cb7 100644 --- a/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArms.java +++ b/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArms.java @@ -15,9 +15,9 @@ import org.bukkit.entity.Player; import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.ElementalAbility; -import com.projectkorra.projectkorra.ability.FireAbility; -import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.FireAbility; +import com.projectkorra.projectkorra.ability.api.WaterAbility; import com.projectkorra.projectkorra.ability.util.MultiAbilityManager; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.configuration.configs.abilities.water.WaterArmsConfig; diff --git a/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsFreeze.java b/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsFreeze.java index d0549b79..ac41a524 100644 --- a/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsFreeze.java +++ b/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsFreeze.java @@ -12,7 +12,7 @@ import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.IceAbility; +import com.projectkorra.projectkorra.ability.api.IceAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.configuration.configs.abilities.water.WaterArmsConfig; diff --git a/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsSpear.java b/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsSpear.java index 5427328f..5e854b57 100644 --- a/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsSpear.java +++ b/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsSpear.java @@ -16,7 +16,7 @@ import org.bukkit.entity.Player; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.ability.api.WaterAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.configuration.ConfigManager; diff --git a/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsWhip.java b/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsWhip.java index 693b6c6b..d4b86cbb 100644 --- a/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsWhip.java +++ b/src/com/projectkorra/projectkorra/waterbending/multiabilities/WaterArmsWhip.java @@ -13,7 +13,7 @@ import org.bukkit.entity.Player; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.ability.api.WaterAbility; import com.projectkorra.projectkorra.ability.util.MultiAbilityManager; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.command.Commands; diff --git a/src/com/projectkorra/projectkorra/waterbending/passive/FastSwim.java b/src/com/projectkorra/projectkorra/waterbending/passive/FastSwim.java index 475237c3..b384aea0 100644 --- a/src/com/projectkorra/projectkorra/waterbending/passive/FastSwim.java +++ b/src/com/projectkorra/projectkorra/waterbending/passive/FastSwim.java @@ -4,8 +4,8 @@ import org.bukkit.Location; import org.bukkit.entity.Player; import com.projectkorra.projectkorra.ability.CoreAbility; -import com.projectkorra.projectkorra.ability.PassiveAbility; -import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.ability.api.PassiveAbility; +import com.projectkorra.projectkorra.ability.api.WaterAbility; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.configs.abilities.water.FastSwimConfig; import com.projectkorra.projectkorra.earthbending.EarthArmor; diff --git a/src/com/projectkorra/projectkorra/waterbending/passive/HydroSink.java b/src/com/projectkorra/projectkorra/waterbending/passive/HydroSink.java index 69b6acbd..f62252f0 100644 --- a/src/com/projectkorra/projectkorra/waterbending/passive/HydroSink.java +++ b/src/com/projectkorra/projectkorra/waterbending/passive/HydroSink.java @@ -6,9 +6,9 @@ import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; -import com.projectkorra.projectkorra.ability.ElementalAbility; -import com.projectkorra.projectkorra.ability.PassiveAbility; -import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.PassiveAbility; +import com.projectkorra.projectkorra.ability.api.WaterAbility; import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.configs.abilities.water.HydroSinkConfig; diff --git a/src/com/projectkorra/projectkorra/waterbending/plant/PlantRegrowth.java b/src/com/projectkorra/projectkorra/waterbending/plant/PlantRegrowth.java index 889d9055..46cfbf01 100644 --- a/src/com/projectkorra/projectkorra/waterbending/plant/PlantRegrowth.java +++ b/src/com/projectkorra/projectkorra/waterbending/plant/PlantRegrowth.java @@ -8,8 +8,8 @@ import org.bukkit.block.data.BlockData; import org.bukkit.entity.Player; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.ElementalAbility; -import com.projectkorra.projectkorra.ability.PlantAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.PlantAbility; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.configs.abilities.EmptyAbilityConfig; import com.projectkorra.projectkorra.configuration.configs.properties.WaterPropertiesConfig; diff --git a/src/com/projectkorra/projectkorra/waterbending/util/WaterReturn.java b/src/com/projectkorra/projectkorra/waterbending/util/WaterReturn.java index 15543946..4322b496 100644 --- a/src/com/projectkorra/projectkorra/waterbending/util/WaterReturn.java +++ b/src/com/projectkorra/projectkorra/waterbending/util/WaterReturn.java @@ -14,7 +14,7 @@ import org.bukkit.potion.PotionType; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.ability.api.WaterAbility; import com.projectkorra.projectkorra.configuration.configs.abilities.EmptyAbilityConfig; import com.projectkorra.projectkorra.util.ParticleEffect; import com.projectkorra.projectkorra.util.TempBlock; diff --git a/src/com/projectkorra/projectkorra/waterbending/util/WaterSourceGrabber.java b/src/com/projectkorra/projectkorra/waterbending/util/WaterSourceGrabber.java index 6bd08cca..86b4eb60 100644 --- a/src/com/projectkorra/projectkorra/waterbending/util/WaterSourceGrabber.java +++ b/src/com/projectkorra/projectkorra/waterbending/util/WaterSourceGrabber.java @@ -13,8 +13,8 @@ import org.bukkit.entity.Player; import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; -import com.projectkorra.projectkorra.ability.ElementalAbility; -import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.ability.api.ElementalAbility; +import com.projectkorra.projectkorra.ability.api.WaterAbility; import com.projectkorra.projectkorra.util.TempBlock; @SuppressWarnings("deprecation")