mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-08-05 12:03:17 +00:00
Passives rework (#680)
* Passives rework * Re-add canCurrentlyBendWithWeapons() * Re-add changes from my previous PR
This commit is contained in:
parent
7a67becb58
commit
2bac32236a
32 changed files with 1023 additions and 486 deletions
|
@ -21,6 +21,7 @@ import com.projectkorra.projectkorra.ability.ChiAbility;
|
||||||
import com.projectkorra.projectkorra.ability.CoreAbility;
|
import com.projectkorra.projectkorra.ability.CoreAbility;
|
||||||
import com.projectkorra.projectkorra.ability.FireAbility;
|
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||||
import com.projectkorra.projectkorra.ability.WaterAbility;
|
import com.projectkorra.projectkorra.ability.WaterAbility;
|
||||||
|
import com.projectkorra.projectkorra.ability.util.PassiveManager;
|
||||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
import com.projectkorra.projectkorra.avatar.AvatarState;
|
||||||
import com.projectkorra.projectkorra.chiblocking.Paralyze;
|
import com.projectkorra.projectkorra.chiblocking.Paralyze;
|
||||||
import com.projectkorra.projectkorra.command.Commands;
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
|
@ -257,22 +258,22 @@ public class BendingPlayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canCurrentlyBendWithWeapons() {
|
public boolean canCurrentlyBendWithWeapons() {
|
||||||
if (getBoundAbility() != null && player.getInventory().getItemInMainHand() != null) {
|
if (getBoundAbility() != null && player.getInventory().getItemInMainHand() != null) {
|
||||||
boolean hasWeapon = GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType());
|
boolean hasWeapon = GeneralMethods.isWeapon(player.getInventory().getItemInMainHand().getType());
|
||||||
boolean noWeaponElement = GeneralMethods.getElementsWithNoWeaponBending().contains(getBoundAbility().getElement());
|
boolean noWeaponElement = GeneralMethods.getElementsWithNoWeaponBending().contains(getBoundAbility().getElement());
|
||||||
|
|
||||||
if (hasWeapon) {
|
if (hasWeapon) {
|
||||||
if(noWeaponElement) {
|
if(noWeaponElement) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks to see if {@link BendingPlayer} can be slowed.
|
* Checks to see if {@link BendingPlayer} can be slowed.
|
||||||
|
@ -728,6 +729,7 @@ public class BendingPlayer {
|
||||||
*/
|
*/
|
||||||
public void toggleBending() {
|
public void toggleBending() {
|
||||||
toggled = !toggled;
|
toggled = !toggled;
|
||||||
|
PassiveManager.registerPassives(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toggleElement(Element element) {
|
public void toggleElement(Element element) {
|
||||||
|
|
|
@ -52,6 +52,7 @@ import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryType.SlotType;
|
import org.bukkit.event.inventory.InventoryType.SlotType;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||||
|
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||||
import org.bukkit.event.player.PlayerGameModeChangeEvent;
|
import org.bukkit.event.player.PlayerGameModeChangeEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
@ -80,6 +81,7 @@ import com.projectkorra.projectkorra.ability.FireAbility;
|
||||||
import com.projectkorra.projectkorra.ability.WaterAbility;
|
import com.projectkorra.projectkorra.ability.WaterAbility;
|
||||||
import com.projectkorra.projectkorra.ability.util.ComboManager;
|
import com.projectkorra.projectkorra.ability.util.ComboManager;
|
||||||
import com.projectkorra.projectkorra.ability.util.MultiAbilityManager;
|
import com.projectkorra.projectkorra.ability.util.MultiAbilityManager;
|
||||||
|
import com.projectkorra.projectkorra.ability.util.PassiveManager;
|
||||||
import com.projectkorra.projectkorra.airbending.AirBlast;
|
import com.projectkorra.projectkorra.airbending.AirBlast;
|
||||||
import com.projectkorra.projectkorra.airbending.AirBubble;
|
import com.projectkorra.projectkorra.airbending.AirBubble;
|
||||||
import com.projectkorra.projectkorra.airbending.AirBurst;
|
import com.projectkorra.projectkorra.airbending.AirBurst;
|
||||||
|
@ -91,6 +93,7 @@ import com.projectkorra.projectkorra.airbending.AirSuction;
|
||||||
import com.projectkorra.projectkorra.airbending.AirSwipe;
|
import com.projectkorra.projectkorra.airbending.AirSwipe;
|
||||||
import com.projectkorra.projectkorra.airbending.Suffocate;
|
import com.projectkorra.projectkorra.airbending.Suffocate;
|
||||||
import com.projectkorra.projectkorra.airbending.Tornado;
|
import com.projectkorra.projectkorra.airbending.Tornado;
|
||||||
|
import com.projectkorra.projectkorra.airbending.passive.GracefulDescent;
|
||||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
import com.projectkorra.projectkorra.avatar.AvatarState;
|
||||||
import com.projectkorra.projectkorra.chiblocking.AcrobatStance;
|
import com.projectkorra.projectkorra.chiblocking.AcrobatStance;
|
||||||
import com.projectkorra.projectkorra.chiblocking.ChiCombo;
|
import com.projectkorra.projectkorra.chiblocking.ChiCombo;
|
||||||
|
@ -102,6 +105,7 @@ import com.projectkorra.projectkorra.chiblocking.RapidPunch;
|
||||||
import com.projectkorra.projectkorra.chiblocking.Smokescreen;
|
import com.projectkorra.projectkorra.chiblocking.Smokescreen;
|
||||||
import com.projectkorra.projectkorra.chiblocking.SwiftKick;
|
import com.projectkorra.projectkorra.chiblocking.SwiftKick;
|
||||||
import com.projectkorra.projectkorra.chiblocking.WarriorStance;
|
import com.projectkorra.projectkorra.chiblocking.WarriorStance;
|
||||||
|
import com.projectkorra.projectkorra.chiblocking.passive.Acrobatics;
|
||||||
import com.projectkorra.projectkorra.command.Commands;
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
import com.projectkorra.projectkorra.earthbending.Catapult;
|
import com.projectkorra.projectkorra.earthbending.Catapult;
|
||||||
|
@ -123,6 +127,7 @@ import com.projectkorra.projectkorra.earthbending.RaiseEarthWall;
|
||||||
import com.projectkorra.projectkorra.earthbending.SandSpout;
|
import com.projectkorra.projectkorra.earthbending.SandSpout;
|
||||||
import com.projectkorra.projectkorra.earthbending.Shockwave;
|
import com.projectkorra.projectkorra.earthbending.Shockwave;
|
||||||
import com.projectkorra.projectkorra.earthbending.Tremorsense;
|
import com.projectkorra.projectkorra.earthbending.Tremorsense;
|
||||||
|
import com.projectkorra.projectkorra.earthbending.passive.DensityShift;
|
||||||
import com.projectkorra.projectkorra.event.EntityBendingDeathEvent;
|
import com.projectkorra.projectkorra.event.EntityBendingDeathEvent;
|
||||||
import com.projectkorra.projectkorra.event.HorizontalVelocityChangeEvent;
|
import com.projectkorra.projectkorra.event.HorizontalVelocityChangeEvent;
|
||||||
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent;
|
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent;
|
||||||
|
@ -159,7 +164,7 @@ import com.projectkorra.projectkorra.waterbending.IceBlast;
|
||||||
import com.projectkorra.projectkorra.waterbending.IceSpikeBlast;
|
import com.projectkorra.projectkorra.waterbending.IceSpikeBlast;
|
||||||
import com.projectkorra.projectkorra.waterbending.OctopusForm;
|
import com.projectkorra.projectkorra.waterbending.OctopusForm;
|
||||||
import com.projectkorra.projectkorra.waterbending.PhaseChange;
|
import com.projectkorra.projectkorra.waterbending.PhaseChange;
|
||||||
import com.projectkorra.projectkorra.waterbending.PlantArmor;
|
import com.projectkorra.projectkorra.waterbending.PhaseChange.PhaseChangeType;
|
||||||
import com.projectkorra.projectkorra.waterbending.SurgeWall;
|
import com.projectkorra.projectkorra.waterbending.SurgeWall;
|
||||||
import com.projectkorra.projectkorra.waterbending.SurgeWave;
|
import com.projectkorra.projectkorra.waterbending.SurgeWave;
|
||||||
import com.projectkorra.projectkorra.waterbending.Torrent;
|
import com.projectkorra.projectkorra.waterbending.Torrent;
|
||||||
|
@ -168,29 +173,16 @@ import com.projectkorra.projectkorra.waterbending.WaterManipulation;
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterPassive;
|
import com.projectkorra.projectkorra.waterbending.WaterPassive;
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterSpout;
|
import com.projectkorra.projectkorra.waterbending.WaterSpout;
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterSpoutWave;
|
import com.projectkorra.projectkorra.waterbending.WaterSpoutWave;
|
||||||
import com.projectkorra.projectkorra.waterbending.PhaseChange.PhaseChangeType;
|
import com.projectkorra.projectkorra.waterbending.passive.Hydrosink;
|
||||||
import com.projectkorra.rpg.RPGMethods;
|
import com.projectkorra.rpg.RPGMethods;
|
||||||
|
|
||||||
public class PKListener implements Listener {
|
public class PKListener implements Listener {
|
||||||
|
|
||||||
ProjectKorra plugin;
|
ProjectKorra plugin;
|
||||||
|
|
||||||
private static final HashMap<Player, String> BENDING_PLAYER_DEATH = new HashMap<>(); // Player
|
private static final HashMap<Player, String> BENDING_PLAYER_DEATH = new HashMap<>(); // Player killed by Bending.
|
||||||
// killed
|
private static final List<UUID> RIGHT_CLICK_INTERACT = new ArrayList<UUID>(); // Player right click block.
|
||||||
// by
|
private static final ArrayList<UUID> TOGGLED_OUT = new ArrayList<>(); // Stands for toggled = false while logging out.
|
||||||
// Bending
|
|
||||||
private static final List<UUID> RIGHT_CLICK_INTERACT = new ArrayList<UUID>(); // Player
|
|
||||||
// right
|
|
||||||
// click
|
|
||||||
// block
|
|
||||||
private static final ArrayList<UUID> TOGGLED_OUT = new ArrayList<>(); // Stands
|
|
||||||
// for
|
|
||||||
// toggled
|
|
||||||
// =
|
|
||||||
// false
|
|
||||||
// while
|
|
||||||
// logging
|
|
||||||
// out
|
|
||||||
private static final Map<Player, Integer> JUMPS = new HashMap<>();
|
private static final Map<Player, Integer> JUMPS = new HashMap<>();
|
||||||
|
|
||||||
public PKListener(ProjectKorra plugin) {
|
public PKListener(ProjectKorra plugin) {
|
||||||
|
@ -325,8 +317,7 @@ public class PKListener implements Listener {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is a TempBlock of Air bellow FallingSand blocks, prevent it
|
// If there is a TempBlock of Air bellow FallingSand blocks, prevent it from updating.
|
||||||
// from updating.
|
|
||||||
if (!event.isCancelled()
|
if (!event.isCancelled()
|
||||||
&& (block.getType() == Material.SAND || block.getType() == Material.GRAVEL
|
&& (block.getType() == Material.SAND || block.getType() == Material.GRAVEL
|
||||||
|| block.getType() == Material.ANVIL)
|
|| block.getType() == Material.ANVIL)
|
||||||
|
@ -352,6 +343,7 @@ public class PKListener implements Listener {
|
||||||
public void onElementChange(PlayerChangeElementEvent event) {
|
public void onElementChange(PlayerChangeElementEvent event) {
|
||||||
Player player = event.getTarget();
|
Player player = event.getTarget();
|
||||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||||
|
PassiveManager.registerPassives(player);
|
||||||
boolean chatEnabled = ConfigManager.languageConfig.get().getBoolean("Chat.Enable");
|
boolean chatEnabled = ConfigManager.languageConfig.get().getBoolean("Chat.Enable");
|
||||||
if (chatEnabled) {
|
if (chatEnabled) {
|
||||||
Element element = event.getElement();
|
Element element = event.getElement();
|
||||||
|
@ -706,9 +698,6 @@ public class PKListener implements Listener {
|
||||||
&& CoreAbility.hasAbility((Player) event.getWhoClicked(), EarthArmor.class)) {
|
&& CoreAbility.hasAbility((Player) event.getWhoClicked(), EarthArmor.class)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
if (event.getSlotType() == SlotType.ARMOR && !PlantArmor.canRemoveArmor((Player) event.getWhoClicked())) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.getSlotType() == SlotType.ARMOR && TempArmor.hasTempArmor((Player) event.getWhoClicked())) {
|
if (event.getSlotType() == SlotType.ARMOR && TempArmor.hasTempArmor((Player) event.getWhoClicked())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -801,12 +790,14 @@ public class PKListener implements Listener {
|
||||||
if (!event.isCancelled() && bPlayer.hasElement(Element.AIR) && event.getCause() == DamageCause.FALL
|
if (!event.isCancelled() && bPlayer.hasElement(Element.AIR) && event.getCause() == DamageCause.FALL
|
||||||
&& bPlayer.canBendPassive(Element.AIR)) {
|
&& bPlayer.canBendPassive(Element.AIR)) {
|
||||||
new AirBurst(player, true);
|
new AirBurst(player, true);
|
||||||
event.setDamage(0D);
|
if (CoreAbility.getAbility(GracefulDescent.class).isEnabled()) {
|
||||||
event.setCancelled(true);
|
event.setDamage(0D);
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!event.isCancelled() && bPlayer.hasElement(Element.WATER) && event.getCause() == DamageCause.FALL
|
if (!event.isCancelled() && bPlayer.hasElement(Element.WATER) && event.getCause() == DamageCause.FALL
|
||||||
&& bPlayer.canBendPassive(Element.WATER)) {
|
&& bPlayer.canBendPassive(Element.WATER) && CoreAbility.getAbility(Hydrosink.class).isEnabled()) {
|
||||||
if (WaterPassive.applyNoFall(player)) {
|
if (WaterPassive.applyNoFall(player)) {
|
||||||
event.setDamage(0D);
|
event.setDamage(0D);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -814,7 +805,8 @@ public class PKListener implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!event.isCancelled() && bPlayer.hasElement(Element.EARTH) && event.getCause() == DamageCause.FALL
|
if (!event.isCancelled() && bPlayer.hasElement(Element.EARTH) && event.getCause() == DamageCause.FALL
|
||||||
&& bPlayer.canBendPassive(Element.EARTH)) {
|
&& bPlayer.canBendPassive(Element.EARTH)
|
||||||
|
&& CoreAbility.getAbility(DensityShift.class).isEnabled()) {
|
||||||
if (EarthPassive.softenLanding(player)) {
|
if (EarthPassive.softenLanding(player)) {
|
||||||
event.setDamage(0D);
|
event.setDamage(0D);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -822,7 +814,7 @@ public class PKListener implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!event.isCancelled() && bPlayer.hasElement(Element.CHI) && event.getCause() == DamageCause.FALL
|
if (!event.isCancelled() && bPlayer.hasElement(Element.CHI) && event.getCause() == DamageCause.FALL
|
||||||
&& bPlayer.canBendPassive(Element.CHI)) {
|
&& bPlayer.canBendPassive(Element.CHI) && CoreAbility.getAbility(Acrobatics.class).isEnabled()) {
|
||||||
double initdamage = event.getDamage();
|
double initdamage = event.getDamage();
|
||||||
double newdamage = event.getDamage() * ChiPassive.getFallReductionFactor();
|
double newdamage = event.getDamage() * ChiPassive.getFallReductionFactor();
|
||||||
double finaldamage = initdamage - newdamage;
|
double finaldamage = initdamage - newdamage;
|
||||||
|
@ -883,8 +875,7 @@ public class PKListener implements Listener {
|
||||||
|
|
||||||
Entity en = e.getEntity();
|
Entity en = e.getEntity();
|
||||||
if (en instanceof Player) {
|
if (en instanceof Player) {
|
||||||
if (e.getDamager() instanceof Player) { // This is the player
|
if (e.getDamager() instanceof Player) { // This is the player hitting someone.
|
||||||
// hitting someone.
|
|
||||||
Player sourcePlayer = (Player) e.getDamager();
|
Player sourcePlayer = (Player) e.getDamager();
|
||||||
Player targetPlayer = (Player) e.getEntity();
|
Player targetPlayer = (Player) e.getEntity();
|
||||||
BendingPlayer sourceBPlayer = BendingPlayer.getBendingPlayer(sourcePlayer);
|
BendingPlayer sourceBPlayer = BendingPlayer.getBendingPlayer(sourcePlayer);
|
||||||
|
@ -932,8 +923,7 @@ public class PKListener implements Listener {
|
||||||
TempArmor.getTempArmor(event.getEntity()).revert();
|
TempArmor.getTempArmor(event.getEntity()).revert();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Do nothing. TempArmor drops are handled by the EntityDeath event
|
// Do nothing. TempArmor drops are handled by the EntityDeath event and not PlayerDeath.
|
||||||
// and not PlayerDeath
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getEntity().getKiller() != null) {
|
if (event.getEntity().getKiller() != null) {
|
||||||
|
@ -1080,11 +1070,17 @@ public class PKListener implements Listener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
PassiveManager.registerPassives(player);
|
||||||
GeneralMethods.removeUnusableAbilities(player.getName());
|
GeneralMethods.removeUnusableAbilities(player.getName());
|
||||||
}
|
}
|
||||||
}, 5);
|
}, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerChangeWorld(PlayerChangedWorldEvent event) {
|
||||||
|
PassiveManager.registerPassives(event.getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerKick(PlayerKickEvent event) {
|
public void onPlayerKick(PlayerKickEvent event) {
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
|
@ -1156,12 +1152,7 @@ public class PKListener implements Listener {
|
||||||
|
|
||||||
else {
|
else {
|
||||||
if (bPlayer != null) {
|
if (bPlayer != null) {
|
||||||
if (bPlayer.hasElement(Element.AIR) || bPlayer.hasElement(Element.CHI)
|
|
||||||
|| bPlayer.hasElement(Element.EARTH)) {
|
|
||||||
PassiveHandler.checkSpeedPassives(player);
|
|
||||||
}
|
|
||||||
if (bPlayer.hasElement(Element.AIR) || bPlayer.hasElement(Element.CHI)) {
|
if (bPlayer.hasElement(Element.AIR) || bPlayer.hasElement(Element.CHI)) {
|
||||||
PassiveHandler.checkJumpPassives(player);
|
|
||||||
PassiveHandler.checkExhaustionPassives(player);
|
PassiveHandler.checkExhaustionPassives(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1249,7 +1240,7 @@ public class PKListener implements Listener {
|
||||||
if (player.isSneaking()) {
|
if (player.isSneaking()) {
|
||||||
ComboManager.addComboAbility(player, ClickType.SHIFT_UP);
|
ComboManager.addComboAbility(player, ClickType.SHIFT_UP);
|
||||||
} else {
|
} else {
|
||||||
ComboManager.addComboAbility(player, ClickType.SHIFT_DOWN);
|
ComboManager.addComboAbility(player, ClickType.SHIFT_DOWN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1372,16 +1363,16 @@ public class PKListener implements Listener {
|
||||||
} else {
|
} else {
|
||||||
clips.setControlling(true);
|
clips.setControlling(true);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
new MetalClips(player, 1);
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
new MetalClips(player, 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else if (abil.equalsIgnoreCase("LavaFlow")) {
|
else if (abil.equalsIgnoreCase("LavaFlow")) {
|
||||||
new LavaFlow(player, LavaFlow.AbilityType.SHIFT);
|
new LavaFlow(player, LavaFlow.AbilityType.SHIFT);
|
||||||
} else if (abil.equalsIgnoreCase("EarthSmash")) {
|
} else if (abil.equalsIgnoreCase("EarthSmash")) {
|
||||||
new EarthSmash(player, ClickType.SHIFT_DOWN);
|
new EarthSmash(player, ClickType.SHIFT_DOWN);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1441,7 +1432,7 @@ public class PKListener implements Listener {
|
||||||
|
|
||||||
Entity target = GeneralMethods.getTargetedEntity(player, 3);
|
Entity target = GeneralMethods.getTargetedEntity(player, 3);
|
||||||
|
|
||||||
if(bPlayer.canCurrentlyBendWithWeapons()) {
|
if (bPlayer.canCurrentlyBendWithWeapons()) {
|
||||||
if (target != null && !(target.equals(player)) && target instanceof LivingEntity) {
|
if (target != null && !(target.equals(player)) && target instanceof LivingEntity) {
|
||||||
ComboManager.addComboAbility(player, ClickType.LEFT_CLICK_ENTITY);
|
ComboManager.addComboAbility(player, ClickType.LEFT_CLICK_ENTITY);
|
||||||
|
|
||||||
|
@ -1527,8 +1518,6 @@ public class PKListener implements Listener {
|
||||||
PhaseChange pc = CoreAbility.getAbility(player, PhaseChange.class);
|
PhaseChange pc = CoreAbility.getAbility(player, PhaseChange.class);
|
||||||
pc.startNewType(PhaseChangeType.FREEZE);
|
pc.startNewType(PhaseChangeType.FREEZE);
|
||||||
}
|
}
|
||||||
} else if (abil.equalsIgnoreCase("PlantArmor")) {
|
|
||||||
new PlantArmor(player);
|
|
||||||
} else if (abil.equalsIgnoreCase("WaterSpout")) {
|
} else if (abil.equalsIgnoreCase("WaterSpout")) {
|
||||||
new WaterSpout(player);
|
new WaterSpout(player);
|
||||||
} else if (abil.equalsIgnoreCase("WaterManipulation")) {
|
} else if (abil.equalsIgnoreCase("WaterManipulation")) {
|
||||||
|
@ -1604,7 +1593,6 @@ public class PKListener implements Listener {
|
||||||
} else {
|
} else {
|
||||||
new Illumination(player);
|
new Illumination(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (abil.equalsIgnoreCase("FireBurst")) {
|
} else if (abil.equalsIgnoreCase("FireBurst")) {
|
||||||
FireBurst.coneBurst(player);
|
FireBurst.coneBurst(player);
|
||||||
} else if (abil.equalsIgnoreCase("FireShield")) {
|
} else if (abil.equalsIgnoreCase("FireShield")) {
|
||||||
|
@ -1636,12 +1624,12 @@ public class PKListener implements Listener {
|
||||||
new AvatarState(player);
|
new AvatarState(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (MultiAbilityManager.hasMultiAbilityBound(player)) {
|
if (MultiAbilityManager.hasMultiAbilityBound(player)) {
|
||||||
abil = MultiAbilityManager.getBoundMultiAbility(player);
|
abil = MultiAbilityManager.getBoundMultiAbility(player);
|
||||||
if (abil.equalsIgnoreCase("WaterArms")) {
|
if (abil.equalsIgnoreCase("WaterArms")) {
|
||||||
new WaterArms(player);
|
new WaterArms(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import com.projectkorra.projectkorra.ability.util.CollisionInitializer;
|
||||||
import com.projectkorra.projectkorra.ability.util.CollisionManager;
|
import com.projectkorra.projectkorra.ability.util.CollisionManager;
|
||||||
import com.projectkorra.projectkorra.ability.util.ComboManager;
|
import com.projectkorra.projectkorra.ability.util.ComboManager;
|
||||||
import com.projectkorra.projectkorra.ability.util.MultiAbilityManager;
|
import com.projectkorra.projectkorra.ability.util.MultiAbilityManager;
|
||||||
|
import com.projectkorra.projectkorra.ability.util.PassiveManager;
|
||||||
import com.projectkorra.projectkorra.airbending.AirbendingManager;
|
import com.projectkorra.projectkorra.airbending.AirbendingManager;
|
||||||
import com.projectkorra.projectkorra.chiblocking.ChiblockingManager;
|
import com.projectkorra.projectkorra.chiblocking.ChiblockingManager;
|
||||||
import com.projectkorra.projectkorra.command.Commands;
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
|
@ -24,7 +25,6 @@ import com.projectkorra.projectkorra.firebending.FirebendingManager;
|
||||||
import com.projectkorra.projectkorra.object.Preset;
|
import com.projectkorra.projectkorra.object.Preset;
|
||||||
import com.projectkorra.projectkorra.storage.DBConnection;
|
import com.projectkorra.projectkorra.storage.DBConnection;
|
||||||
import com.projectkorra.projectkorra.util.MetricsLite;
|
import com.projectkorra.projectkorra.util.MetricsLite;
|
||||||
import com.projectkorra.projectkorra.util.PassiveHandler;
|
|
||||||
import com.projectkorra.projectkorra.util.RevertChecker;
|
import com.projectkorra.projectkorra.util.RevertChecker;
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
import com.projectkorra.projectkorra.util.Updater;
|
import com.projectkorra.projectkorra.util.Updater;
|
||||||
|
@ -89,15 +89,22 @@ public class ProjectKorra extends JavaPlugin {
|
||||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new EarthbendingManager(this), 0, 1);
|
getServer().getScheduler().scheduleSyncRepeatingTask(this, new EarthbendingManager(this), 0, 1);
|
||||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new FirebendingManager(this), 0, 1);
|
getServer().getScheduler().scheduleSyncRepeatingTask(this, new FirebendingManager(this), 0, 1);
|
||||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new ChiblockingManager(this), 0, 1);
|
getServer().getScheduler().scheduleSyncRepeatingTask(this, new ChiblockingManager(this), 0, 1);
|
||||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new PassiveHandler(), 0, 1);
|
//getServer().getScheduler().scheduleSyncRepeatingTask(this, new PassiveHandler(), 0, 1);
|
||||||
getServer().getScheduler().runTaskTimerAsynchronously(this, new RevertChecker(this), 0, 200);
|
getServer().getScheduler().runTaskTimerAsynchronously(this, new RevertChecker(this), 0, 200);
|
||||||
TempBlock.startReversion();
|
TempBlock.startReversion();
|
||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (final Player player : Bukkit.getOnlinePlayers()) {
|
||||||
PKListener.getJumpStatistics().put(player, player.getStatistic(Statistic.JUMP));
|
PKListener.getJumpStatistics().put(player, player.getStatistic(Statistic.JUMP));
|
||||||
|
|
||||||
GeneralMethods.createBendingPlayer(player.getUniqueId(), player.getName());
|
GeneralMethods.createBendingPlayer(player.getUniqueId(), player.getName());
|
||||||
GeneralMethods.removeUnusableAbilities(player.getName());
|
GeneralMethods.removeUnusableAbilities(player.getName());
|
||||||
|
Bukkit.getScheduler().runTaskLater(ProjectKorra.plugin, new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
PassiveManager.registerPassives(player);
|
||||||
|
GeneralMethods.removeUnusableAbilities(player.getName());
|
||||||
|
}
|
||||||
|
}, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -35,6 +35,7 @@ import com.projectkorra.projectkorra.ability.util.CollisionManager;
|
||||||
import com.projectkorra.projectkorra.ability.util.ComboManager;
|
import com.projectkorra.projectkorra.ability.util.ComboManager;
|
||||||
import com.projectkorra.projectkorra.ability.util.MultiAbilityManager;
|
import com.projectkorra.projectkorra.ability.util.MultiAbilityManager;
|
||||||
import com.projectkorra.projectkorra.ability.util.MultiAbilityManager.MultiAbilityInfo;
|
import com.projectkorra.projectkorra.ability.util.MultiAbilityManager.MultiAbilityInfo;
|
||||||
|
import com.projectkorra.projectkorra.ability.util.PassiveManager;
|
||||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
import com.projectkorra.projectkorra.event.AbilityEndEvent;
|
import com.projectkorra.projectkorra.event.AbilityEndEvent;
|
||||||
import com.projectkorra.projectkorra.event.AbilityProgressEvent;
|
import com.projectkorra.projectkorra.event.AbilityProgressEvent;
|
||||||
|
@ -74,6 +75,7 @@ public abstract class CoreAbility implements Ability {
|
||||||
|
|
||||||
private boolean started;
|
private boolean started;
|
||||||
private boolean removed;
|
private boolean removed;
|
||||||
|
private boolean hidden;
|
||||||
private int id;
|
private int id;
|
||||||
private long startTime;
|
private long startTime;
|
||||||
private long startTick;
|
private long startTick;
|
||||||
|
@ -207,6 +209,16 @@ public abstract class CoreAbility implements Ability {
|
||||||
public static void progressAll() {
|
public static void progressAll() {
|
||||||
for (Set<CoreAbility> setAbils : INSTANCES_BY_CLASS.values()) {
|
for (Set<CoreAbility> setAbils : INSTANCES_BY_CLASS.values()) {
|
||||||
for (CoreAbility abil : setAbils) {
|
for (CoreAbility abil : setAbils) {
|
||||||
|
if (abil instanceof PassiveAbility) {
|
||||||
|
BendingPlayer bPlayer = abil.getBendingPlayer();
|
||||||
|
if (bPlayer == null || !abil.getPlayer().isOnline()) {
|
||||||
|
abil.remove();
|
||||||
|
return;
|
||||||
|
} else if (!bPlayer.canBendPassive(abil.getElement())) {
|
||||||
|
abil.remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
abil.progress();
|
abil.progress();
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new AbilityProgressEvent(abil));
|
Bukkit.getServer().getPluginManager().callEvent(new AbilityProgressEvent(abil));
|
||||||
}
|
}
|
||||||
|
@ -461,6 +473,18 @@ public abstract class CoreAbility implements Ability {
|
||||||
MultiAbilityManager.multiAbilityList.add(new MultiAbilityInfo(name, multiAbil.getMultiAbilities()));
|
MultiAbilityManager.multiAbilityList.add(new MultiAbilityInfo(name, multiAbil.getMultiAbilities()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ability instanceof PassiveAbility) {
|
||||||
|
ability.setHiddenAbility(true);
|
||||||
|
PassiveManager.getPassives().put(name, ability);
|
||||||
|
if (!PassiveManager.getPassivesByElement().containsKey(ability.getElement())) {
|
||||||
|
PassiveManager.getPassivesByElement().put(ability.getElement(), new HashSet<String>());
|
||||||
|
}
|
||||||
|
PassiveManager.getPassivesByElement().get(ability.getElement()).add(name);
|
||||||
|
if (ability.getElement() instanceof SubElement) {
|
||||||
|
PassiveManager.getPassivesByElement().get(((SubElement) ability.getElement()).getParentElement()).add(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ability instanceof AddonAbility) {
|
if (ability instanceof AddonAbility) {
|
||||||
AddonAbility addon = (AddonAbility) ability;
|
AddonAbility addon = (AddonAbility) ability;
|
||||||
addon.load();
|
addon.load();
|
||||||
|
@ -526,6 +550,18 @@ public abstract class CoreAbility implements Ability {
|
||||||
MultiAbility multiAbil = (MultiAbility) coreAbil;
|
MultiAbility multiAbil = (MultiAbility) coreAbil;
|
||||||
MultiAbilityManager.multiAbilityList.add(new MultiAbilityInfo(name, multiAbil.getMultiAbilities()));
|
MultiAbilityManager.multiAbilityList.add(new MultiAbilityInfo(name, multiAbil.getMultiAbilities()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (coreAbil instanceof PassiveAbility) {
|
||||||
|
coreAbil.setHiddenAbility(true);
|
||||||
|
PassiveManager.getPassives().put(name, coreAbil);
|
||||||
|
if (!PassiveManager.getPassivesByElement().containsKey(coreAbil.getElement())) {
|
||||||
|
PassiveManager.getPassivesByElement().put(coreAbil.getElement(), new HashSet<String>());
|
||||||
|
}
|
||||||
|
PassiveManager.getPassivesByElement().get(coreAbil.getElement()).add(name);
|
||||||
|
if (coreAbil.getElement() instanceof SubElement) {
|
||||||
|
PassiveManager.getPassivesByElement().get(((SubElement) coreAbil.getElement()).getParentElement()).add(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception | Error e) {
|
catch (Exception | Error e) {
|
||||||
plugin.getLogger().warning("The ability " + coreAbil.getName() + " was not able to load, if this message shows again please remove it!");
|
plugin.getLogger().warning("The ability " + coreAbil.getName() + " was not able to load, if this message shows again please remove it!");
|
||||||
|
@ -566,7 +602,11 @@ public abstract class CoreAbility implements Ability {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isHiddenAbility() {
|
public boolean isHiddenAbility() {
|
||||||
return false;
|
return hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHiddenAbility(boolean hidden) {
|
||||||
|
this.hidden = hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -583,6 +623,8 @@ public abstract class CoreAbility implements Ability {
|
||||||
String tag = null;
|
String tag = null;
|
||||||
if (this instanceof ComboAbility) {
|
if (this instanceof ComboAbility) {
|
||||||
tag = "Abilities." + elementName + "." + elementName + "Combo." + getName() + ".Enabled";
|
tag = "Abilities." + elementName + "." + elementName + "Combo." + getName() + ".Enabled";
|
||||||
|
} else if (this instanceof PassiveAbility) {
|
||||||
|
tag = "Abilities." + elementName + ".Passive." + getName() + ".Enabled";
|
||||||
} else {
|
} else {
|
||||||
tag = "Abilities." + elementName + "." + getName() + ".Enabled";
|
tag = "Abilities." + elementName + "." + getName() + ".Enabled";
|
||||||
}
|
}
|
||||||
|
@ -610,6 +652,9 @@ public abstract class CoreAbility implements Ability {
|
||||||
if (getElement() instanceof SubElement) {
|
if (getElement() instanceof SubElement) {
|
||||||
elementName = ((SubElement) getElement()).getParentElement().getName();
|
elementName = ((SubElement) getElement()).getParentElement().getName();
|
||||||
}
|
}
|
||||||
|
if (this instanceof PassiveAbility) {
|
||||||
|
return ConfigManager.languageConfig.get().getString("Abilities." + elementName + ".Passive." + getName() + ".Description");
|
||||||
|
}
|
||||||
return ConfigManager.languageConfig.get().getString("Abilities." + elementName + "." + getName() + ".Description");
|
return ConfigManager.languageConfig.get().getString("Abilities." + elementName + "." + getName() + ".Description");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.projectkorra.projectkorra.ability;
|
||||||
|
|
||||||
|
public interface PassiveAbility {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return false if the passive does not actually do anything, but so it still registers in /b d [element]passive
|
||||||
|
*/
|
||||||
|
public boolean isInstantiable();
|
||||||
|
|
||||||
|
}
|
|
@ -41,7 +41,6 @@ import com.projectkorra.projectkorra.waterbending.HealingWaters;
|
||||||
import com.projectkorra.projectkorra.waterbending.IceBlast;
|
import com.projectkorra.projectkorra.waterbending.IceBlast;
|
||||||
import com.projectkorra.projectkorra.waterbending.IceSpikeBlast;
|
import com.projectkorra.projectkorra.waterbending.IceSpikeBlast;
|
||||||
import com.projectkorra.projectkorra.waterbending.OctopusForm;
|
import com.projectkorra.projectkorra.waterbending.OctopusForm;
|
||||||
import com.projectkorra.projectkorra.waterbending.PlantArmor;
|
|
||||||
import com.projectkorra.projectkorra.waterbending.SurgeWall;
|
import com.projectkorra.projectkorra.waterbending.SurgeWall;
|
||||||
import com.projectkorra.projectkorra.waterbending.SurgeWave;
|
import com.projectkorra.projectkorra.waterbending.SurgeWave;
|
||||||
import com.projectkorra.projectkorra.waterbending.Torrent;
|
import com.projectkorra.projectkorra.waterbending.Torrent;
|
||||||
|
@ -121,7 +120,6 @@ public class CollisionInitializer {
|
||||||
CoreAbility iceWave = CoreAbility.getAbility(IceWave.class);
|
CoreAbility iceWave = CoreAbility.getAbility(IceWave.class);
|
||||||
CoreAbility iceSpikeBlast = CoreAbility.getAbility(IceSpikeBlast.class);
|
CoreAbility iceSpikeBlast = CoreAbility.getAbility(IceSpikeBlast.class);
|
||||||
CoreAbility octopusForm = CoreAbility.getAbility(OctopusForm.class);
|
CoreAbility octopusForm = CoreAbility.getAbility(OctopusForm.class);
|
||||||
CoreAbility plantArmor = CoreAbility.getAbility(PlantArmor.class);
|
|
||||||
CoreAbility surgeWall = CoreAbility.getAbility(SurgeWall.class);
|
CoreAbility surgeWall = CoreAbility.getAbility(SurgeWall.class);
|
||||||
CoreAbility surgeWave = CoreAbility.getAbility(SurgeWave.class);
|
CoreAbility surgeWave = CoreAbility.getAbility(SurgeWave.class);
|
||||||
CoreAbility torrent = CoreAbility.getAbility(Torrent.class);
|
CoreAbility torrent = CoreAbility.getAbility(Torrent.class);
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
package com.projectkorra.projectkorra.ability.util;
|
||||||
|
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.BendingPlayer;
|
||||||
|
import com.projectkorra.projectkorra.Element;
|
||||||
|
import com.projectkorra.projectkorra.ability.CoreAbility;
|
||||||
|
import com.projectkorra.projectkorra.ability.PassiveAbility;
|
||||||
|
|
||||||
|
public class PassiveManager {
|
||||||
|
|
||||||
|
private static final Map<String, CoreAbility> PASSIVES = new HashMap<>();
|
||||||
|
private static final Map<Element, Set<String>> PASSIVES_BY_ELEMENT = new HashMap<>(); // Parent elements INCLUDE subelement passives.
|
||||||
|
|
||||||
|
public static void registerPassives(Player player) {
|
||||||
|
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||||
|
if (bPlayer == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (CoreAbility ability : CoreAbility.getAbilities()) {
|
||||||
|
if (ability instanceof PassiveAbility) {
|
||||||
|
if (!ability.isEnabled()) {
|
||||||
|
continue;
|
||||||
|
} else if (!bPlayer.canBendPassive(ability.getElement())) {
|
||||||
|
continue;
|
||||||
|
} else if (CoreAbility.hasAbility(player, ability.getClass())) {
|
||||||
|
continue;
|
||||||
|
/*
|
||||||
|
* Passive's such as not taking fall damage are managed in
|
||||||
|
* PKListener, so we do not want to create instances of them
|
||||||
|
* here. This just enables the passive to be displayed in /b
|
||||||
|
* d [element]passive
|
||||||
|
*/
|
||||||
|
} else if (!((PassiveAbility) ability).isInstantiable()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Class<?> clazz = null;
|
||||||
|
try {
|
||||||
|
clazz = Class.forName(ability.getClass().getName());
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
Constructor<?> constructor = null;
|
||||||
|
try {
|
||||||
|
constructor = clazz.getConstructor(Player.class);
|
||||||
|
} catch (NoSuchMethodException | SecurityException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
Object object = null;
|
||||||
|
try {
|
||||||
|
object = constructor.newInstance(new Object[] { player });
|
||||||
|
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException
|
||||||
|
| InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
((CoreAbility) object).start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Set<String> getPassivesForElement(Element element) {
|
||||||
|
if (PASSIVES_BY_ELEMENT.get(element) == null) {
|
||||||
|
return new HashSet<>();
|
||||||
|
}
|
||||||
|
return PASSIVES_BY_ELEMENT.get(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, CoreAbility> getPassives() {
|
||||||
|
return PASSIVES;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<Element, Set<String>> getPassivesByElement() {
|
||||||
|
return PASSIVES_BY_ELEMENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -13,10 +13,10 @@ public class AirPassive {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getJumpPower() {
|
public static int getJumpPower() {
|
||||||
return ConfigManager.getConfig().getInt("Abilities.Air.Passive.Jump");
|
return ConfigManager.getConfig().getInt("Abilities.Air.Passive.AirAgility.JumpPower");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getSpeedPower() {
|
public static int getSpeedPower() {
|
||||||
return ConfigManager.getConfig().getInt("Abilities.Air.Passive.Speed");
|
return ConfigManager.getConfig().getInt("Abilities.Air.Passive.AirAgility.SpeedPower");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,99 @@
|
||||||
|
package com.projectkorra.projectkorra.airbending.passive;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
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.configuration.ConfigManager;
|
||||||
|
|
||||||
|
public class AirAgilityPassive extends AirAbility implements PassiveAbility {
|
||||||
|
|
||||||
|
// Configurable variables
|
||||||
|
private int jumpPower;
|
||||||
|
private int speedPower;
|
||||||
|
|
||||||
|
// Instance related variables
|
||||||
|
private boolean jumpActivate;
|
||||||
|
private boolean speedActivate;
|
||||||
|
|
||||||
|
public AirAgilityPassive(Player player) {
|
||||||
|
super(player);
|
||||||
|
setFields();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFields() {
|
||||||
|
this.jumpPower = ConfigManager.getConfig().getInt("Abilities.Air.Passive.AirAgility.JumpPower");
|
||||||
|
this.speedPower = ConfigManager.getConfig().getInt("Abilities.Air.Passive.AirAgility.SpeedPower");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progress() {
|
||||||
|
if (!player.isSprinting()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Jump Buff
|
||||||
|
jumpActivate = true;
|
||||||
|
if (player.hasPotionEffect(PotionEffectType.JUMP)) {
|
||||||
|
for (PotionEffect potion : player.getActivePotionEffects()) {
|
||||||
|
if (potion.getType() == PotionEffectType.JUMP) {
|
||||||
|
if (potion.getAmplifier() > jumpPower - 1) {
|
||||||
|
jumpActivate = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (jumpActivate) {
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 20, jumpPower - 1, true, false), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Speed Buff
|
||||||
|
speedActivate = true;
|
||||||
|
if (player.hasPotionEffect(PotionEffectType.SPEED)) {
|
||||||
|
for (PotionEffect potion : player.getActivePotionEffects()) {
|
||||||
|
if (potion.getType() == PotionEffectType.SPEED) {
|
||||||
|
if (potion.getAmplifier() > speedPower - 1) {
|
||||||
|
speedActivate = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (speedActivate) {
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 20, speedPower - 1, true, false), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSneakAbility() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isHarmlessAbility() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getCooldown() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "AirAgility";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Location getLocation() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInstantiable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
public class AirSaturation extends AirAbility implements PassiveAbility {
|
||||||
|
|
||||||
|
public AirSaturation(Player player) {
|
||||||
|
super(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progress() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSneakAbility() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isHarmlessAbility() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getCooldown() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "AirSaturation" ;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Location getLocation() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInstantiable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
public class GracefulDescent extends AirAbility implements PassiveAbility {
|
||||||
|
|
||||||
|
public GracefulDescent(Player player) {
|
||||||
|
super(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progress() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSneakAbility() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isHarmlessAbility() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getCooldown() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "GracefulDescent";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Location getLocation() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInstantiable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -61,19 +61,19 @@ public class ChiPassive {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getExhaustionFactor() {
|
public static double getExhaustionFactor() {
|
||||||
return ConfigManager.getConfig().getDouble("Abilities.Chi.Passive.ExhaustionFactor");
|
return ConfigManager.getConfig().getDouble("Abilities.Chi.Passive.ChiSaturation.ExhaustionFactor");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getFallReductionFactor() {
|
public static double getFallReductionFactor() {
|
||||||
return ConfigManager.getConfig().getDouble("Abilities.Chi.Passive.FallReductionFactor");
|
return ConfigManager.getConfig().getDouble("Abilities.Chi.Passive.Acrobatics.FallReductionFactor");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getJumpPower() {
|
public static int getJumpPower() {
|
||||||
return ConfigManager.getConfig().getInt("Abilities.Chi.Passive.Jump");
|
return ConfigManager.getConfig().getInt("Abilities.Chi.Passive.ChiAgility.JumpPower");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getSpeedPower() {
|
public static int getSpeedPower() {
|
||||||
return ConfigManager.getConfig().getInt("Abilities.Chi.Passive.Speed");
|
return ConfigManager.getConfig().getInt("Abilities.Chi.Passive.ChiAgility.SpeedPower");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getChance() {
|
public static double getChance() {
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
public class Acrobatics extends ChiAbility implements PassiveAbility {
|
||||||
|
|
||||||
|
public Acrobatics(Player player) {
|
||||||
|
super(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progress() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSneakAbility() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isHarmlessAbility() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getCooldown() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Acrobatics";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Location getLocation() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInstantiable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,110 @@
|
||||||
|
package com.projectkorra.projectkorra.chiblocking.passive;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
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.chiblocking.AcrobatStance;
|
||||||
|
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
|
|
||||||
|
public class ChiAgilityPassive extends ChiAbility implements PassiveAbility {
|
||||||
|
|
||||||
|
// Configurable variables
|
||||||
|
private int jumpPower;
|
||||||
|
private int speedPower;
|
||||||
|
|
||||||
|
// Instance related variables
|
||||||
|
private boolean jumpActivate;
|
||||||
|
private boolean speedActivate;
|
||||||
|
|
||||||
|
public ChiAgilityPassive(Player player) {
|
||||||
|
super(player);
|
||||||
|
setFields();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFields() {
|
||||||
|
this.jumpPower = ConfigManager.getConfig().getInt("Abilities.Chi.Passive.ChiAgility.JumpPower");
|
||||||
|
this.speedPower = ConfigManager.getConfig().getInt("Abilities.Chi.Passive.ChiAgility.SpeedPower");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progress() {
|
||||||
|
if (!player.isSprinting()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Jump Buff
|
||||||
|
int jMax = jumpPower;
|
||||||
|
if (hasAbility(player, AcrobatStance.class)) {
|
||||||
|
AcrobatStance stance = getAbility(player, AcrobatStance.class);
|
||||||
|
jMax = Math.max(jMax, stance.getJump());
|
||||||
|
}
|
||||||
|
jumpActivate = true;
|
||||||
|
if (player.hasPotionEffect(PotionEffectType.JUMP)) {
|
||||||
|
for (PotionEffect potion : player.getActivePotionEffects()) {
|
||||||
|
if (potion.getType() == PotionEffectType.JUMP) {
|
||||||
|
if (potion.getAmplifier() > jMax - 1) {
|
||||||
|
jumpActivate = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (jumpActivate) {
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 20, jMax - 1, true, false), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Speed Buff
|
||||||
|
int sMax = speedPower;
|
||||||
|
if (hasAbility(player, AcrobatStance.class)) {
|
||||||
|
AcrobatStance stance = getAbility(player, AcrobatStance.class);
|
||||||
|
sMax = Math.max(sMax, stance.getJump());
|
||||||
|
}
|
||||||
|
speedActivate = true;
|
||||||
|
if (player.hasPotionEffect(PotionEffectType.SPEED)) {
|
||||||
|
for (PotionEffect potion : player.getActivePotionEffects()) {
|
||||||
|
if (potion.getType() == PotionEffectType.SPEED) {
|
||||||
|
if (potion.getAmplifier() > sMax - 1) {
|
||||||
|
speedActivate = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (speedActivate) {
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 20, sMax - 1, true, false), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSneakAbility() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isHarmlessAbility() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getCooldown() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "ChiAgility";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Location getLocation() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInstantiable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
public class ChiSaturation extends ChiAbility implements PassiveAbility {
|
||||||
|
|
||||||
|
public ChiSaturation(Player player) {
|
||||||
|
super(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progress() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSneakAbility() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isHarmlessAbility() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getCooldown() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "ChiSaturation";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Location getLocation() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInstantiable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -103,9 +103,9 @@ public class AddCommand extends PKCommand {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bPlayer.addElement(e);
|
bPlayer.addElement(e);
|
||||||
|
bPlayer.getSubElements().clear();
|
||||||
for (SubElement sub : Element.getAllSubElements()) {
|
for (SubElement sub : Element.getAllSubElements()) {
|
||||||
if (sub.getParentElement() == e && bPlayer.hasSubElementPermission(sub)) {
|
if (bPlayer.hasElement(sub.getParentElement()) && bPlayer.hasSubElementPermission(sub)) {
|
||||||
bPlayer.addSubElement(sub);
|
bPlayer.addSubElement(sub);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,10 +133,10 @@ public class ChooseCommand extends PKCommand {
|
||||||
GeneralMethods.saveSubElements(bPlayer);
|
GeneralMethods.saveSubElements(bPlayer);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeSubElementEvent(sender, target, sub, com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent.Result.CHOOSE));
|
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeSubElementEvent(sender, target, sub, com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent.Result.CHOOSE));
|
||||||
} else {
|
} else {
|
||||||
bPlayer.setElement(element);
|
bPlayer.addElement(element);
|
||||||
|
bPlayer.getSubElements().clear();
|
||||||
for (SubElement sub : Element.getAllSubElements()) {
|
for (SubElement sub : Element.getAllSubElements()) {
|
||||||
if (sub.getParentElement() == element && bPlayer.hasSubElementPermission(sub)) {
|
if (bPlayer.hasElement(sub.getParentElement()) && bPlayer.hasSubElementPermission(sub)) {
|
||||||
bPlayer.addSubElement(sub);
|
bPlayer.addSubElement(sub);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,12 @@ public class Commands {
|
||||||
|
|
||||||
public static String[] comboaliases = { "aircombo", "ac", "aircombos", "airbendingcombos", "chicombo", "cc", "chicombos", "chiblockingcombos", "chiblockercombos", "earthcombo", "ec", "earthcombos", "earthbendingcombos", "firecombo", "fc", "firecombos", "firebendingcombos", "watercombo", "wc", "watercombos", "waterbendingcombos" };
|
public static String[] comboaliases = { "aircombo", "ac", "aircombos", "airbendingcombos", "chicombo", "cc", "chicombos", "chiblockingcombos", "chiblockercombos", "earthcombo", "ec", "earthcombos", "earthbendingcombos", "firecombo", "fc", "firecombos", "firebendingcombos", "watercombo", "wc", "watercombos", "waterbendingcombos" };
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Passive Aliases
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static String[] passivealiases = { "airpassive", "ap", "airpassives", "airbendingpassives", "chipassive", "cp", "chipassives", "chiblockingpassives", "chiblockerpassives", "earthpassive", "ep", "earthpassives", "earthbendingpassives", "firepassive", "fp", "firepassives", "firebendingpassives", "waterpassive", "wp", "waterpassives", "waterbendingpassives" };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Subelement Aliases
|
* Subelement Aliases
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
package com.projectkorra.projectkorra.command;
|
package com.projectkorra.projectkorra.command;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.BendingPlayer;
|
import com.projectkorra.projectkorra.BendingPlayer;
|
||||||
import com.projectkorra.projectkorra.Element;
|
import com.projectkorra.projectkorra.Element;
|
||||||
import com.projectkorra.projectkorra.Element.SubElement;
|
import com.projectkorra.projectkorra.Element.SubElement;
|
||||||
|
@ -7,23 +17,16 @@ import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.CoreAbility;
|
import com.projectkorra.projectkorra.ability.CoreAbility;
|
||||||
import com.projectkorra.projectkorra.ability.SubAbility;
|
import com.projectkorra.projectkorra.ability.SubAbility;
|
||||||
import com.projectkorra.projectkorra.ability.util.ComboManager;
|
import com.projectkorra.projectkorra.ability.util.ComboManager;
|
||||||
|
import com.projectkorra.projectkorra.ability.util.PassiveManager;
|
||||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executor for /bending display. Extends {@link PKCommand}.
|
* Executor for /bending display. Extends {@link PKCommand}.
|
||||||
*/
|
*/
|
||||||
public class DisplayCommand extends PKCommand {
|
public class DisplayCommand extends PKCommand {
|
||||||
|
|
||||||
private String noCombosAvailable;
|
private String noCombosAvailable;
|
||||||
|
private String noPassivesAvailable;
|
||||||
private String invalidArgument;
|
private String invalidArgument;
|
||||||
private String playersOnly;
|
private String playersOnly;
|
||||||
private String noAbilitiesAvailable;
|
private String noAbilitiesAvailable;
|
||||||
|
@ -33,6 +36,7 @@ public class DisplayCommand extends PKCommand {
|
||||||
super("display", "/bending display <Element>", ConfigManager.languageConfig.get().getString("Commands.Display.Description"), new String[] { "display", "dis", "d" });
|
super("display", "/bending display <Element>", ConfigManager.languageConfig.get().getString("Commands.Display.Description"), new String[] { "display", "dis", "d" });
|
||||||
|
|
||||||
this.noCombosAvailable = ConfigManager.languageConfig.get().getString("Commands.Display.NoCombosAvailable");
|
this.noCombosAvailable = ConfigManager.languageConfig.get().getString("Commands.Display.NoCombosAvailable");
|
||||||
|
this.noPassivesAvailable = ConfigManager.languageConfig.get().getString("Commands.Display.NoPassivesAvailable");
|
||||||
this.noAbilitiesAvailable = ConfigManager.languageConfig.get().getString("Commands.Display.NoAbilitiesAvailable");
|
this.noAbilitiesAvailable = ConfigManager.languageConfig.get().getString("Commands.Display.NoAbilitiesAvailable");
|
||||||
this.invalidArgument = ConfigManager.languageConfig.get().getString("Commands.Display.InvalidArgument");
|
this.invalidArgument = ConfigManager.languageConfig.get().getString("Commands.Display.InvalidArgument");
|
||||||
this.playersOnly = ConfigManager.languageConfig.get().getString("Commands.Display.PlayersOnly");
|
this.playersOnly = ConfigManager.languageConfig.get().getString("Commands.Display.PlayersOnly");
|
||||||
|
@ -48,13 +52,31 @@ public class DisplayCommand extends PKCommand {
|
||||||
//bending display [Element]
|
//bending display [Element]
|
||||||
if (args.size() == 1) {
|
if (args.size() == 1) {
|
||||||
String elementName = args.get(0).toLowerCase().replace("bending", "");
|
String elementName = args.get(0).toLowerCase().replace("bending", "");
|
||||||
if (elementName.equalsIgnoreCase("wc")) elementName = "watercombo";
|
if (elementName.equalsIgnoreCase("wc"))
|
||||||
else if (elementName.equalsIgnoreCase("ac")) elementName = "aircombo";
|
elementName = "watercombo";
|
||||||
else if (elementName.equalsIgnoreCase("ec")) elementName = "earthcombo";
|
else if (elementName.equalsIgnoreCase("ac"))
|
||||||
else if (elementName.equalsIgnoreCase("fc")) elementName = "firecombo";
|
elementName = "aircombo";
|
||||||
else if (elementName.equalsIgnoreCase("cc")) elementName = "chicombo";
|
else if (elementName.equalsIgnoreCase("ec"))
|
||||||
else if (elementName.equalsIgnoreCase("avc")) elementName = "avatarcombo";
|
elementName = "earthcombo";
|
||||||
Element element = Element.fromString(elementName.replace("combos", "").replace("combo", ""));
|
else if (elementName.equalsIgnoreCase("fc"))
|
||||||
|
elementName = "firecombo";
|
||||||
|
else if (elementName.equalsIgnoreCase("cc"))
|
||||||
|
elementName = "chicombo";
|
||||||
|
else if (elementName.equalsIgnoreCase("avc"))
|
||||||
|
elementName = "avatarcombo";
|
||||||
|
else if (elementName.equalsIgnoreCase("wp"))
|
||||||
|
elementName = "waterpassive";
|
||||||
|
else if (elementName.equalsIgnoreCase("ap"))
|
||||||
|
elementName = "airpassive";
|
||||||
|
else if (elementName.equalsIgnoreCase("ep"))
|
||||||
|
elementName = "earthpassive";
|
||||||
|
else if (elementName.equalsIgnoreCase("fp"))
|
||||||
|
elementName = "firepassive";
|
||||||
|
else if (elementName.equalsIgnoreCase("cp"))
|
||||||
|
elementName = "chipassive";
|
||||||
|
else if (elementName.equalsIgnoreCase("avp"))
|
||||||
|
elementName = "avatarpassive";
|
||||||
|
Element element = Element.fromString(elementName.replace("combos", "").replace("combo", "").replace("passives", "").replace("passive", ""));
|
||||||
//combos
|
//combos
|
||||||
if (element != null && elementName.contains("combo")) {
|
if (element != null && elementName.contains("combo")) {
|
||||||
ChatColor color = element != null ? element.getColor() : null;
|
ChatColor color = element != null ? element.getColor() : null;
|
||||||
|
@ -77,13 +99,34 @@ public class DisplayCommand extends PKCommand {
|
||||||
sender.sendMessage(comboColor + comboMove);
|
sender.sendMessage(comboColor + comboMove);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
//passives
|
||||||
else if (element != null) {
|
} else if (element != null && elementName.contains("passive")) {
|
||||||
|
ChatColor color = element != null ? element.getColor() : null;
|
||||||
|
Set<String> passives = PassiveManager.getPassivesForElement(element);
|
||||||
|
|
||||||
|
if (passives.isEmpty()) {
|
||||||
|
sender.sendMessage(color + noPassivesAvailable.replace("{element}", element.getName()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (String passiveAbil : passives) {
|
||||||
|
ChatColor passiveColor = color;
|
||||||
|
if (!sender.hasPermission("bending.ability." + passiveAbil)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
CoreAbility coreAbil = CoreAbility.getAbility(passiveAbil);
|
||||||
|
if (coreAbil != null) {
|
||||||
|
passiveColor = coreAbil.getElement().getColor();
|
||||||
|
}
|
||||||
|
sender.sendMessage(passiveColor + passiveAbil);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
} else if (element != null) {
|
||||||
if (!element.equals(Element.AVATAR)) {
|
if (!element.equals(Element.AVATAR)) {
|
||||||
if (!(element instanceof SubElement)) {
|
if (!(element instanceof SubElement)) {
|
||||||
displayElement(sender, element);
|
displayElement(sender, element);
|
||||||
} else {
|
} else {
|
||||||
displaySubElement(sender, element);
|
displaySubElement(sender, (SubElement) element);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
displayAvatar(sender);
|
displayAvatar(sender);
|
||||||
|
@ -167,9 +210,11 @@ public class DisplayCommand extends PKCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element.equals(Element.CHI)) {
|
if (element.equals(Element.CHI)) {
|
||||||
sender.sendMessage(ChatColor.GOLD + "Combos: " + ChatColor.YELLOW + "/bending display ChiCombos");
|
sender.sendMessage(ChatColor.YELLOW + "Combos: " + ChatColor.GOLD + "/bending display ChiCombos");
|
||||||
|
sender.sendMessage(ChatColor.YELLOW + "Passives: " + ChatColor.GOLD + "/bending display ChiPassives");
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(element.getSubColor() + "Combos: " + element.getColor() + "/bending display " + element.getName() + "Combos");
|
sender.sendMessage(element.getSubColor() + "Combos: " + element.getColor() + "/bending display " + element.getName() + "Combos");
|
||||||
|
sender.sendMessage(element.getSubColor() + "Passives: " + element.getColor() + "/bending display " + element.getName() + "Passives");
|
||||||
for (SubElement sub : Element.getSubElements(element)) {
|
for (SubElement sub : Element.getSubElements(element)) {
|
||||||
if (sender.hasPermission("bending." + element.getName().toLowerCase() + "." + sub.getName().toLowerCase())) {
|
if (sender.hasPermission("bending." + element.getName().toLowerCase() + "." + sub.getName().toLowerCase())) {
|
||||||
sender.sendMessage(sub.getColor() + sub.getName() + " abilities: " + element.getColor() + "/bending display " + sub.getName());
|
sender.sendMessage(sub.getColor() + sub.getName() + " abilities: " + element.getColor() + "/bending display " + sub.getName());
|
||||||
|
@ -184,7 +229,7 @@ public class DisplayCommand extends PKCommand {
|
||||||
* @param sender The CommandSender to show the moves to
|
* @param sender The CommandSender to show the moves to
|
||||||
* @param element The subelement to show the moves for
|
* @param element The subelement to show the moves for
|
||||||
*/
|
*/
|
||||||
private void displaySubElement(CommandSender sender, Element element) {
|
private void displaySubElement(CommandSender sender, SubElement element) {
|
||||||
List<CoreAbility> abilities = CoreAbility.getAbilitiesByElement(element);
|
List<CoreAbility> abilities = CoreAbility.getAbilitiesByElement(element);
|
||||||
|
|
||||||
if (abilities.isEmpty() && element != null) {
|
if (abilities.isEmpty() && element != null) {
|
||||||
|
@ -201,6 +246,7 @@ public class DisplayCommand extends PKCommand {
|
||||||
abilitiesSent.add(ability.getName());
|
abilitiesSent.add(ability.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sender.sendMessage(element.getParentElement().getColor() + "Passives: " + element.getColor() + "/bending display " + element.getName() + "Passives");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -231,7 +277,8 @@ public class DisplayCommand extends PKCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> getTabCompletion(CommandSender sender, List<String> args) {
|
protected List<String> getTabCompletion(CommandSender sender, List<String> args) {
|
||||||
if (args.size() >= 1 || !sender.hasPermission("bending.command.display")) return new ArrayList<String>();
|
if (args.size() >= 1 || !sender.hasPermission("bending.command.display"))
|
||||||
|
return new ArrayList<String>();
|
||||||
List<String> list = new ArrayList<String>();
|
List<String> list = new ArrayList<String>();
|
||||||
list.add("Air");
|
list.add("Air");
|
||||||
list.add("Earth");
|
list.add("Earth");
|
||||||
|
@ -266,6 +313,12 @@ public class DisplayCommand extends PKCommand {
|
||||||
list.add("ChiCombos");
|
list.add("ChiCombos");
|
||||||
list.add("Avatar");
|
list.add("Avatar");
|
||||||
|
|
||||||
|
list.add("AirPassives");
|
||||||
|
list.add("EarthPassives");
|
||||||
|
list.add("FirePassives");
|
||||||
|
list.add("WaterPassives");
|
||||||
|
list.add("ChiPassives");
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,25 @@
|
||||||
package com.projectkorra.projectkorra.command;
|
package com.projectkorra.projectkorra.command;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.projectkorra.items.command.PKICommand;
|
import com.projectkorra.items.command.PKICommand;
|
||||||
import com.projectkorra.projectkorra.BendingPlayer;
|
import com.projectkorra.projectkorra.BendingPlayer;
|
||||||
import com.projectkorra.projectkorra.Element;
|
import com.projectkorra.projectkorra.Element;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.ComboAbility;
|
import com.projectkorra.projectkorra.ability.ComboAbility;
|
||||||
import com.projectkorra.projectkorra.ability.CoreAbility;
|
import com.projectkorra.projectkorra.ability.CoreAbility;
|
||||||
|
import com.projectkorra.projectkorra.ability.PassiveAbility;
|
||||||
import com.projectkorra.projectkorra.ability.util.ComboManager;
|
import com.projectkorra.projectkorra.ability.util.ComboManager;
|
||||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
import com.projectkorra.rpg.commands.RPGCommand;
|
import com.projectkorra.rpg.commands.RPGCommand;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executor for /bending help. Extends {@link PKCommand}.
|
* Executor for /bending help. Extends {@link PKCommand}.
|
||||||
*/
|
*/
|
||||||
|
@ -116,12 +117,13 @@ public class HelpCommand extends PKCommand {
|
||||||
instances.get(arg).help(sender, true);
|
instances.get(arg).help(sender, true);
|
||||||
} else if (Arrays.asList(Commands.comboaliases).contains(arg)) { //bending help elementcombo
|
} else if (Arrays.asList(Commands.comboaliases).contains(arg)) { //bending help elementcombo
|
||||||
sender.sendMessage(ChatColor.GOLD + properUsage.replace("{command1}", ChatColor.RED + "/bending display " + arg + ChatColor.GOLD).replace("{command2}", ChatColor.RED + "/bending help <Combo Name>" + ChatColor.GOLD));
|
sender.sendMessage(ChatColor.GOLD + properUsage.replace("{command1}", ChatColor.RED + "/bending display " + arg + ChatColor.GOLD).replace("{command2}", ChatColor.RED + "/bending help <Combo Name>" + ChatColor.GOLD));
|
||||||
} else if (CoreAbility.getAbility(arg) != null && !(CoreAbility.getAbility(arg) instanceof ComboAbility) && CoreAbility.getAbility(arg).isEnabled() && !CoreAbility.getAbility(arg).isHiddenAbility()) { //bending help ability
|
} else if (Arrays.asList(Commands.passivealiases).contains(arg)) { //bending help elementpassive
|
||||||
|
sender.sendMessage(ChatColor.GOLD + properUsage.replace("{command1}", ChatColor.RED + "/bending display " + arg + ChatColor.GOLD).replace("{command2}", ChatColor.RED + "/bending help <Passive Name>" + ChatColor.RED));
|
||||||
|
} else if (CoreAbility.getAbility(arg) != null && !(CoreAbility.getAbility(arg) instanceof ComboAbility) && CoreAbility.getAbility(arg).isEnabled() && !CoreAbility.getAbility(arg).isHiddenAbility() || CoreAbility.getAbility(arg) instanceof PassiveAbility) { //bending help ability
|
||||||
CoreAbility ability = CoreAbility.getAbility(arg);
|
CoreAbility ability = CoreAbility.getAbility(arg);
|
||||||
ChatColor color = ability.getElement().getColor();
|
ChatColor color = ability.getElement().getColor();
|
||||||
sender.sendMessage(color + ability.getName() + " - ");
|
sender.sendMessage(color + ability.getName() + " - ");
|
||||||
sender.sendMessage(color + ability.getDescription());
|
sender.sendMessage(color + ability.getDescription());
|
||||||
sender.sendMessage(ChatColor.GOLD + usage + ability.getInstructions());
|
|
||||||
} else if (Arrays.asList(Commands.airaliases).contains(args.get(0))) {
|
} else if (Arrays.asList(Commands.airaliases).contains(args.get(0))) {
|
||||||
sender.sendMessage(Element.AIR.getColor() + air.replace("/b help AirCombos", Element.AIR.getSubColor() + "/b help AirCombos" + Element.AIR.getColor()));
|
sender.sendMessage(Element.AIR.getColor() + air.replace("/b help AirCombos", Element.AIR.getSubColor() + "/b help AirCombos" + Element.AIR.getColor()));
|
||||||
sender.sendMessage(ChatColor.YELLOW + learnMore + ChatColor.DARK_AQUA + "http://tinyurl.com/qffg9m3");
|
sender.sendMessage(ChatColor.YELLOW + learnMore + ChatColor.DARK_AQUA + "http://tinyurl.com/qffg9m3");
|
||||||
|
|
|
@ -77,6 +77,9 @@ public class RemoveCommand extends PKCommand {
|
||||||
} else if (e instanceof Element) {
|
} else if (e instanceof Element) {
|
||||||
if (senderBPlayer.hasElement(e)) {
|
if (senderBPlayer.hasElement(e)) {
|
||||||
senderBPlayer.getElements().remove(e);
|
senderBPlayer.getElements().remove(e);
|
||||||
|
for (SubElement sub : SubElement.getSubElements(e)) {
|
||||||
|
senderBPlayer.getSubElements().remove(sub);
|
||||||
|
}
|
||||||
GeneralMethods.saveElements(senderBPlayer);
|
GeneralMethods.saveElements(senderBPlayer);
|
||||||
GeneralMethods.removeUnusableAbilities(sender.getName());
|
GeneralMethods.removeUnusableAbilities(sender.getName());
|
||||||
|
|
||||||
|
|
|
@ -160,8 +160,9 @@ public class ConfigManager {
|
||||||
config.addDefault("Commands.Help.Usage", "Usage: ");
|
config.addDefault("Commands.Help.Usage", "Usage: ");
|
||||||
|
|
||||||
config.addDefault("Commands.Display.Description", "This command will show you all of the elements you have bound if you do not specify an element. If you do specify an element (Air, Water, Earth, Fire, or Chi), it will show you all of the available abilities of that element installed on the server.");
|
config.addDefault("Commands.Display.Description", "This command will show you all of the elements you have bound if you do not specify an element. If you do specify an element (Air, Water, Earth, Fire, or Chi), it will show you all of the available abilities of that element installed on the server.");
|
||||||
;
|
|
||||||
config.addDefault("Commands.Display.NoCombosAvailable", "There are no {element} combos available.");
|
config.addDefault("Commands.Display.NoCombosAvailable", "There are no {element} combos available.");
|
||||||
|
config.addDefault("Commands.Display.NoPassivesAvailable", "There are no {element} passives available.");
|
||||||
config.addDefault("Commands.Display.NoAbilitiesAvailable", "There are no {element} abilities on this server!");
|
config.addDefault("Commands.Display.NoAbilitiesAvailable", "There are no {element} abilities on this server!");
|
||||||
config.addDefault("Commands.Display.InvalidArgument", "Not a valid argument.");
|
config.addDefault("Commands.Display.InvalidArgument", "Not a valid argument.");
|
||||||
config.addDefault("Commands.Display.PlayersOnly", "This command is only useable by players.");
|
config.addDefault("Commands.Display.PlayersOnly", "This command is only useable by players.");
|
||||||
|
@ -257,6 +258,9 @@ public class ConfigManager {
|
||||||
config.addDefault("Abilities.Air.Combo.AirStream.Description", "Control a large stream of air that grabs onto enemies allowing you to direct them temporarily.");
|
config.addDefault("Abilities.Air.Combo.AirStream.Description", "Control a large stream of air that grabs onto enemies allowing you to direct them temporarily.");
|
||||||
config.addDefault("Abilities.Air.Combo.AirSweep.Description", "Sweep the air in front of you hitting multiple enemies, causing moderate damage and a large knockback. The radius and direction of AirSweep is controlled by moving your mouse in a sweeping motion. For example, if you want to AirSweep upward, then move your mouse upward right after you left click AirBurst");
|
config.addDefault("Abilities.Air.Combo.AirSweep.Description", "Sweep the air in front of you hitting multiple enemies, causing moderate damage and a large knockback. The radius and direction of AirSweep is controlled by moving your mouse in a sweeping motion. For example, if you want to AirSweep upward, then move your mouse upward right after you left click AirBurst");
|
||||||
config.addDefault("Abilities.Air.Combo.AirSweep.DeathMessage", "{victim} was swept away by {attacker}'s {ability}");
|
config.addDefault("Abilities.Air.Combo.AirSweep.DeathMessage", "{victim} was swept away by {attacker}'s {ability}");
|
||||||
|
config.addDefault("Abilities.Air.Passive.AirAgility.Description", "AirAgility is a passive ability which enables airbenders to run faster and jump higher.");
|
||||||
|
config.addDefault("Abilities.Air.Passive.AirSaturation.Description", "AirSaturation is a passive ability which causes airbenders' hunger to deplete at a slower rate.");
|
||||||
|
config.addDefault("Abilities.Air.Passive.GracefulDescent.Description", "GracefulDescent is a passive ability which allows airbenders to make a gentle landing, negating all fall damage on any surface.");
|
||||||
|
|
||||||
config.addDefault("Commands.Help.Elements.Water", "Water is the element of change. Waterbending focuses on using your opponents own force against them. Using redirection and various dodging tactics, you can be made practically untouchable by an opponent. Waterbending provides agility, along with strong offensive skills while in or near water.\nWaterbenders can chain their abilities into combos, type /b help WaterCombos for more information.");
|
config.addDefault("Commands.Help.Elements.Water", "Water is the element of change. Waterbending focuses on using your opponents own force against them. Using redirection and various dodging tactics, you can be made practically untouchable by an opponent. Waterbending provides agility, along with strong offensive skills while in or near water.\nWaterbenders can chain their abilities into combos, type /b help WaterCombos for more information.");
|
||||||
config.addDefault("Abilities.Water.Bloodbending.Description", "Bloodbending is one of the most unique bending abilities that existed and it has immense power, which is why it was made illegal in the Avatar universe. People who are capable of bloodbending are immune to your technique, and you are immune to theirs.");
|
config.addDefault("Abilities.Water.Bloodbending.Description", "Bloodbending is one of the most unique bending abilities that existed and it has immense power, which is why it was made illegal in the Avatar universe. People who are capable of bloodbending are immune to your technique, and you are immune to theirs.");
|
||||||
|
@ -299,6 +303,8 @@ public class ConfigManager {
|
||||||
config.addDefault("Abilities.Water.Combo.IceBullet.DeathMessage", "{victim}'s heart was frozen by {attacker}'s {ability}");
|
config.addDefault("Abilities.Water.Combo.IceBullet.DeathMessage", "{victim}'s heart was frozen by {attacker}'s {ability}");
|
||||||
config.addDefault("Abilities.Water.Combo.IceWave.Description", "PhaseChange your WaterWave into an IceWave that freezes and damages enemies.");
|
config.addDefault("Abilities.Water.Combo.IceWave.Description", "PhaseChange your WaterWave into an IceWave that freezes and damages enemies.");
|
||||||
config.addDefault("Abilities.Water.Combo.IceWave.DeathMessage", "{victim} was frozen solid by {attacker}'s {ability}");
|
config.addDefault("Abilities.Water.Combo.IceWave.DeathMessage", "{victim} was frozen solid by {attacker}'s {ability}");
|
||||||
|
config.addDefault("Abilities.Water.Passive.FastSwim.Description", "FastSwim is a passive ability for waterbenders allowing them to travel quickly through the water. Simple hold shift while underwater to propell yourself forward.");
|
||||||
|
config.addDefault("Abilities.Water.Passive.Hydrosink.Description", "Hydrosink is a passive ability for waterbenders enabling them to softly land on any waterbendable surface, cancelling all damage.");
|
||||||
|
|
||||||
config.addDefault("Commands.Help.Elements.Earth", "Earth is the element of substance. Earthbenders share many of the same fundamental techniques as Waterbenders, but their domain is quite different and more readily accessible. Earthbenders dominate the ground and subterranean, having abilities to pull columns of rock straight up from the earth or drill their way through the mountain. They can also launch themselves through the air using pillars of rock, and will not hurt themselves assuming they land on something they can bend. The more skilled Earthbenders can even bend metal.");
|
config.addDefault("Commands.Help.Elements.Earth", "Earth is the element of substance. Earthbenders share many of the same fundamental techniques as Waterbenders, but their domain is quite different and more readily accessible. Earthbenders dominate the ground and subterranean, having abilities to pull columns of rock straight up from the earth or drill their way through the mountain. They can also launch themselves through the air using pillars of rock, and will not hurt themselves assuming they land on something they can bend. The more skilled Earthbenders can even bend metal.");
|
||||||
config.addDefault("Abilities.Earth.Catapult.Description", "Catapult is the greatest mobility move in an earthbender's arsenal. It requires practice to be able to control yourself to land where you wish, but once mastered it's credibly useful for earthbenders.");
|
config.addDefault("Abilities.Earth.Catapult.Description", "Catapult is the greatest mobility move in an earthbender's arsenal. It requires practice to be able to control yourself to land where you wish, but once mastered it's credibly useful for earthbenders.");
|
||||||
|
@ -335,6 +341,7 @@ public class ConfigManager {
|
||||||
config.addDefault("Abilities.Earth.Sandspout.Instructions", "This ability will only work while you are on a sand block. Simply left click to create a sand spout underneath you. Then, hold spacebar to raise yourself upwards or hold sneak to go downwards. Left click again to disable this ability.");
|
config.addDefault("Abilities.Earth.Sandspout.Instructions", "This ability will only work while you are on a sand block. Simply left click to create a sand spout underneath you. Then, hold spacebar to raise yourself upwards or hold sneak to go downwards. Left click again to disable this ability.");
|
||||||
config.addDefault("Abilities.Earth.Tremorsense.Description", "This is a pure utility ability for earthbenders. If you are in an area of low-light and are standing on top of an earthbendable block, this ability will automatically turn that block into glowstone, visible *only by you*. If you lose contact with a bendable block, the light will go out as you have lost contact with the earth and cannot 'see' until you can touch earth again. Additionally, if you click with this ability selected, smoke will appear above nearby earth with pockets of air beneath them.");
|
config.addDefault("Abilities.Earth.Tremorsense.Description", "This is a pure utility ability for earthbenders. If you are in an area of low-light and are standing on top of an earthbendable block, this ability will automatically turn that block into glowstone, visible *only by you*. If you lose contact with a bendable block, the light will go out as you have lost contact with the earth and cannot 'see' until you can touch earth again. Additionally, if you click with this ability selected, smoke will appear above nearby earth with pockets of air beneath them.");
|
||||||
config.addDefault("Abilities.Earth.Tremorsense.Instructions", "Simply left click while on an earthbendable block.");
|
config.addDefault("Abilities.Earth.Tremorsense.Instructions", "Simply left click while on an earthbendable block.");
|
||||||
|
config.addDefault("Abilities.Earth.Passive.DensityShift.Description", "DensityShift is a passive ability which allows earthbenders to make a firm landing negating all fall damage on any earthbendable surface.");
|
||||||
|
|
||||||
config.addDefault("Commands.Help.Elements.Fire", "Fire is the element of power. Firebenders focus on destruction and incineration. Their abilities are pretty straight forward: set things on fire. They do have a bit of utility however, being able to make themselves un-ignitable, extinguish large areas, cook food in their hands, extinguish large areas, small bursts of flight, and then comes the abilities to shoot fire from your hands.\nFirebenders can chain their abilities into combos, type /b help FireCombos for more information.");
|
config.addDefault("Commands.Help.Elements.Fire", "Fire is the element of power. Firebenders focus on destruction and incineration. Their abilities are pretty straight forward: set things on fire. They do have a bit of utility however, being able to make themselves un-ignitable, extinguish large areas, cook food in their hands, extinguish large areas, small bursts of flight, and then comes the abilities to shoot fire from your hands.\nFirebenders can chain their abilities into combos, type /b help FireCombos for more information.");
|
||||||
config.addDefault("Abilities.Fire.Blaze.Description", "Blaze is a basic firebending technique that can be extremely deadly if used right. It's useful to stop people from chasing you or to create space between you and other players..");
|
config.addDefault("Abilities.Fire.Blaze.Description", "Blaze is a basic firebending technique that can be extremely deadly if used right. It's useful to stop people from chasing you or to create space between you and other players..");
|
||||||
|
@ -384,6 +391,10 @@ public class ConfigManager {
|
||||||
config.addDefault("Abilities.Chi.SwiftKick.Instructions", "Jump and left click on a player to swift kick them.");
|
config.addDefault("Abilities.Chi.SwiftKick.Instructions", "Jump and left click on a player to swift kick them.");
|
||||||
config.addDefault("Abilities.Chi.SwiftKick.DeathMessage", "{victim} was kicked to the floor by {attacker}'s {ability}");
|
config.addDefault("Abilities.Chi.SwiftKick.DeathMessage", "{victim} was kicked to the floor by {attacker}'s {ability}");
|
||||||
config.addDefault("Abilities.Chi.Combo.Immobilize.Description", "Immobilizes the opponent for several seconds.");
|
config.addDefault("Abilities.Chi.Combo.Immobilize.Description", "Immobilizes the opponent for several seconds.");
|
||||||
|
config.addDefault("Abilities.Chi.Passive.ChiAgility.Description", "ChiAgility is a passive ability which enables chiblockers to run faster and jump higher.");
|
||||||
|
config.addDefault("Abilities.Chi.Passive.ChiSaturation.Description", "ChiSaturation is a passive ability which causes chiblockers' hunger to deplete at a slower rate.");
|
||||||
|
config.addDefault("Abilities.Chi.Passive.Acrobatics.Description", "Acrobatics is a passive ability which negates all fall damage based on a percent chance.");
|
||||||
|
|
||||||
languageConfig.save();
|
languageConfig.save();
|
||||||
} else if (type == ConfigType.DEFAULT) {
|
} else if (type == ConfigType.DEFAULT) {
|
||||||
config = defaultConfig.get();
|
config = defaultConfig.get();
|
||||||
|
@ -524,8 +535,11 @@ public class ConfigManager {
|
||||||
config.addDefault("Abilities.Avatar.AvatarState.PotionEffects.FireResistance.Power", 3);
|
config.addDefault("Abilities.Avatar.AvatarState.PotionEffects.FireResistance.Power", 3);
|
||||||
|
|
||||||
config.addDefault("Abilities.Air.Passive.Factor", 0.3);
|
config.addDefault("Abilities.Air.Passive.Factor", 0.3);
|
||||||
config.addDefault("Abilities.Air.Passive.Speed", 2);
|
config.addDefault("Abilities.Air.Passive.AirAgility.Enabled", true);
|
||||||
config.addDefault("Abilities.Air.Passive.Jump", 3);
|
config.addDefault("Abilities.Air.Passive.AirAgility.JumpPower", 3);
|
||||||
|
config.addDefault("Abilities.Air.Passive.AirAgility.SpeedPower", 2);
|
||||||
|
config.addDefault("Abilities.Air.Passive.AirSaturation.Enabled", true);
|
||||||
|
config.addDefault("Abilities.Air.Passive.GracefulDescent.Enabled", true);
|
||||||
|
|
||||||
config.addDefault("Abilities.Air.AirBlast.Enabled", true);
|
config.addDefault("Abilities.Air.AirBlast.Enabled", true);
|
||||||
config.addDefault("Abilities.Air.AirBlast.Speed", 25);
|
config.addDefault("Abilities.Air.AirBlast.Speed", 25);
|
||||||
|
@ -651,7 +665,9 @@ public class ConfigManager {
|
||||||
config.addDefault("Abilities.Air.AirCombo.AirSweep.Knockback", 3.5);
|
config.addDefault("Abilities.Air.AirCombo.AirSweep.Knockback", 3.5);
|
||||||
config.addDefault("Abilities.Air.AirCombo.AirSweep.Cooldown", 6000);
|
config.addDefault("Abilities.Air.AirCombo.AirSweep.Cooldown", 6000);
|
||||||
|
|
||||||
config.addDefault("Abilities.Water.Passive.SwimSpeedFactor", 0.7);
|
config.addDefault("Abilities.Water.Passive.FastSwim.Enabled", true);
|
||||||
|
config.addDefault("Abilities.Water.Passive.FastSwim.SpeedFactor", 0.7);
|
||||||
|
config.addDefault("Abilities.Water.Passive.Hydrosink.Enabled", true);
|
||||||
|
|
||||||
config.addDefault("Abilities.Water.Bloodbending.Enabled", true);
|
config.addDefault("Abilities.Water.Bloodbending.Enabled", true);
|
||||||
config.addDefault("Abilities.Water.Bloodbending.CanOnlyBeUsedAtNight", true);
|
config.addDefault("Abilities.Water.Bloodbending.CanOnlyBeUsedAtNight", true);
|
||||||
|
@ -875,7 +891,7 @@ public class ConfigManager {
|
||||||
config.addDefault("Abilities.Water.WaterCombo.IceBullet.Cooldown", 10000);
|
config.addDefault("Abilities.Water.WaterCombo.IceBullet.Cooldown", 10000);
|
||||||
|
|
||||||
config.addDefault("Abilities.Earth.Passive.Duration", 2500);
|
config.addDefault("Abilities.Earth.Passive.Duration", 2500);
|
||||||
config.addDefault("Abilities.Earth.Passive.SandRunSpeed", 2);
|
config.addDefault("Abilities.Earth.Passive.DensityShift.Enabled", true);
|
||||||
|
|
||||||
config.addDefault("Abilities.Earth.Catapult.Enabled", true);
|
config.addDefault("Abilities.Earth.Catapult.Enabled", true);
|
||||||
config.addDefault("Abilities.Earth.Catapult.Length", 6);
|
config.addDefault("Abilities.Earth.Catapult.Length", 6);
|
||||||
|
@ -1149,10 +1165,14 @@ public class ConfigManager {
|
||||||
config.addDefault("Abilities.Fire.FireCombo.JetBlaze.Cooldown", 6000);
|
config.addDefault("Abilities.Fire.FireCombo.JetBlaze.Cooldown", 6000);
|
||||||
config.addDefault("Abilities.Fire.FireCombo.JetBlaze.FireTicks", 2.5);
|
config.addDefault("Abilities.Fire.FireCombo.JetBlaze.FireTicks", 2.5);
|
||||||
|
|
||||||
config.addDefault("Abilities.Chi.Passive.ExhaustionFactor", 0.3);
|
config.addDefault("Abilities.Chi.Passive.Acrobatics.Enabled", true);
|
||||||
|
config.addDefault("Abilities.Chi.Passive.Acrobatics.FallReductionFactor", 0.5);
|
||||||
config.addDefault("Abilities.Chi.Passive.FallReductionFactor", 0.5);
|
config.addDefault("Abilities.Chi.Passive.FallReductionFactor", 0.5);
|
||||||
config.addDefault("Abilities.Chi.Passive.Speed", 1);
|
config.addDefault("Abilities.Chi.Passive.ChiAgility.Enabled", true);
|
||||||
config.addDefault("Abilities.Chi.Passive.Jump", 1);
|
config.addDefault("Abilities.Chi.Passive.ChiAgility.JumpPower", 1);
|
||||||
|
config.addDefault("Abilities.Chi.Passive.ChiAgility.SpeedPower", 1);
|
||||||
|
config.addDefault("Abilities.Chi.Passive.ChiSaturation.Enabled", true);
|
||||||
|
config.addDefault("Abilities.Chi.Passive.ChiSaturation.ExhaustionFactor", 0.3);
|
||||||
config.addDefault("Abilities.Chi.Passive.BlockChi.Chance", 25);
|
config.addDefault("Abilities.Chi.Passive.BlockChi.Chance", 25);
|
||||||
config.addDefault("Abilities.Chi.Passive.BlockChi.Duration", 1000);
|
config.addDefault("Abilities.Chi.Passive.BlockChi.Duration", 1000);
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
package com.projectkorra.projectkorra.earthbending;
|
package com.projectkorra.projectkorra.earthbending;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
|
||||||
import com.projectkorra.projectkorra.ProjectKorra;
|
|
||||||
import com.projectkorra.projectkorra.ability.EarthAbility;
|
|
||||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
|
||||||
import com.projectkorra.projectkorra.util.TempArmor;
|
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
|
||||||
import com.projectkorra.projectkorra.waterbending.PlantArmor;
|
|
||||||
|
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
@ -23,6 +15,13 @@ import org.bukkit.potion.PotionEffectType;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.util.Vector;
|
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.util.ParticleEffect;
|
||||||
|
import com.projectkorra.projectkorra.util.TempArmor;
|
||||||
|
import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
|
|
||||||
public class EarthArmor extends EarthAbility {
|
public class EarthArmor extends EarthAbility {
|
||||||
|
|
||||||
private boolean formed;
|
private boolean formed;
|
||||||
|
@ -46,11 +45,6 @@ public class EarthArmor extends EarthAbility {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasAbility(player, PlantArmor.class)) {
|
|
||||||
PlantArmor abil = getAbility(player, PlantArmor.class);
|
|
||||||
abil.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.formed = false;
|
this.formed = false;
|
||||||
this.active = true;
|
this.active = true;
|
||||||
this.interval = 2000;
|
this.interval = 2000;
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.projectkorra.projectkorra.earthbending.passive;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||||
|
import com.projectkorra.projectkorra.ability.PassiveAbility;
|
||||||
|
|
||||||
|
public class DensityShift extends EarthAbility implements PassiveAbility {
|
||||||
|
|
||||||
|
public DensityShift(Player player) {
|
||||||
|
super(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progress() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSneakAbility() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isHarmlessAbility() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getCooldown() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "DensityShift";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Location getLocation() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInstantiable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -17,12 +17,12 @@ import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.BendingPlayer;
|
import com.projectkorra.projectkorra.BendingPlayer;
|
||||||
import com.projectkorra.projectkorra.Element;
|
import com.projectkorra.projectkorra.Element;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ProjectKorra;
|
import com.projectkorra.projectkorra.ProjectKorra;
|
||||||
import com.projectkorra.projectkorra.ability.EarthAbility;
|
|
||||||
import com.projectkorra.projectkorra.ability.FireAbility;
|
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
import com.projectkorra.projectkorra.util.ParticleEffect;
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
|
@ -105,7 +105,7 @@ public class HeatControl extends FireAbility {
|
||||||
} else if (this.heatControlType == HeatControlType.SOLIDIFY) {
|
} else if (this.heatControlType == HeatControlType.SOLIDIFY) {
|
||||||
if (!bPlayer.canBend(this)) {
|
if (!bPlayer.canBend(this)) {
|
||||||
return;
|
return;
|
||||||
} else if (EarthAbility.getLavaSourceBlock(player, solidifyRange) == null) {
|
} else if (getLavaBlock(player, solidifyRange) == null) {
|
||||||
remove();
|
remove();
|
||||||
new HeatControl(player, HeatControlType.EXTINGUISH);
|
new HeatControl(player, HeatControlType.EXTINGUISH);
|
||||||
return;
|
return;
|
||||||
|
@ -434,4 +434,28 @@ public class HeatControl extends FireAbility {
|
||||||
return player.getLocation();
|
return player.getLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public static Block getLavaBlock(Player player, double range) {
|
||||||
|
Location location = player.getEyeLocation();
|
||||||
|
Vector vector = location.getDirection().clone().normalize();
|
||||||
|
|
||||||
|
for (double i = 0; i <= range; i++) {
|
||||||
|
Block block = location.clone().add(vector.clone().multiply(i)).getBlock();
|
||||||
|
if (GeneralMethods.isRegionProtectedFromBuild(player, location)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (isLava(block)) {
|
||||||
|
if (TempBlock.isTempBlock(block)) {
|
||||||
|
TempBlock tb = TempBlock.get(block);
|
||||||
|
byte full = 0x0;
|
||||||
|
if (tb.getState().getRawData() != full && !isLava(tb.getState().getType())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,18 @@
|
||||||
package com.projectkorra.projectkorra.util;
|
package com.projectkorra.projectkorra.util;
|
||||||
|
|
||||||
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.EarthAbility;
|
|
||||||
import com.projectkorra.projectkorra.airbending.AirPassive;
|
|
||||||
import com.projectkorra.projectkorra.chiblocking.AcrobatStance;
|
|
||||||
import com.projectkorra.projectkorra.chiblocking.ChiPassive;
|
|
||||||
import com.projectkorra.projectkorra.command.Commands;
|
|
||||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthPassive;
|
|
||||||
import com.projectkorra.projectkorra.waterbending.PlantArmor;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class PassiveHandler implements Runnable {
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.BendingPlayer;
|
||||||
|
import com.projectkorra.projectkorra.Element;
|
||||||
|
import com.projectkorra.projectkorra.airbending.AirPassive;
|
||||||
|
import com.projectkorra.projectkorra.chiblocking.ChiPassive;
|
||||||
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
|
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
|
|
||||||
|
public class PassiveHandler {
|
||||||
|
|
||||||
private static final Map<Player, Float> FOOD = new ConcurrentHashMap<>();
|
private static final Map<Player, Float> FOOD = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
@ -42,34 +32,6 @@ public class PassiveHandler implements Runnable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkArmorPassives(Player player) {
|
|
||||||
if (ConfigManager.defaultConfig.get().getStringList("Properties.DisabledWorlds").contains(player.getWorld().getName())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Commands.isToggledForAll && ConfigManager.defaultConfig.get().getBoolean("Properties.TogglePassivesWithAllBending")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
|
||||||
|
|
||||||
if (bPlayer == null) return;
|
|
||||||
/*if (CoreAbility.hasAbility(player, EarthArmor.class)) {
|
|
||||||
EarthArmor abil = CoreAbility.getAbility(player, EarthArmor.class);
|
|
||||||
if (abil.isFormed()) {
|
|
||||||
int strength = abil.getStrength();
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 20, strength - 1), false);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
if (CoreAbility.hasAbility(player, PlantArmor.class)) {
|
|
||||||
PlantArmor abil = CoreAbility.getAbility(player, PlantArmor.class);
|
|
||||||
if (abil.isFormed()) {
|
|
||||||
int strength = abil.getResistance();
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 20, strength - 1), false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void checkExhaustionPassives(Player player) {
|
public static void checkExhaustionPassives(Player player) {
|
||||||
double air = AirPassive.getExhaustionFactor();
|
double air = AirPassive.getExhaustionFactor();
|
||||||
double chi = ChiPassive.getExhaustionFactor();
|
double chi = ChiPassive.getExhaustionFactor();
|
||||||
|
@ -96,6 +58,7 @@ public class PassiveHandler implements Runnable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public static void checkSpeedPassives(Player player) {
|
public static void checkSpeedPassives(Player player) {
|
||||||
if (!player.isSprinting()) return;
|
if (!player.isSprinting()) return;
|
||||||
int air = AirPassive.getSpeedPower();
|
int air = AirPassive.getSpeedPower();
|
||||||
|
@ -195,13 +158,5 @@ public class PassiveHandler implements Runnable {
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 15, max-1, true, false), false);
|
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 15, max-1, true, false), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
|
||||||
checkSpeedPassives(player);
|
|
||||||
checkJumpPassives(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,260 +0,0 @@
|
||||||
package com.projectkorra.projectkorra.waterbending;
|
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
|
||||||
import com.projectkorra.projectkorra.ability.PlantAbility;
|
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthArmor;
|
|
||||||
import com.projectkorra.projectkorra.util.PassiveHandler;
|
|
||||||
import com.projectkorra.projectkorra.util.TempArmor;
|
|
||||||
|
|
||||||
import org.bukkit.Color;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class PlantArmor extends PlantAbility {
|
|
||||||
|
|
||||||
private boolean formed;
|
|
||||||
private int resistance;
|
|
||||||
private long duration;
|
|
||||||
private long cooldown;
|
|
||||||
private long tickTime;
|
|
||||||
private double range;
|
|
||||||
private Material blockType;
|
|
||||||
private Block block;
|
|
||||||
private Location location;
|
|
||||||
private PlantRegrowth plantbending;
|
|
||||||
|
|
||||||
public PlantArmor(Player player) {
|
|
||||||
super(player);
|
|
||||||
|
|
||||||
this.resistance = getConfig().getInt("Abilities.Water.PlantArmor.Resistance");
|
|
||||||
this.range = getConfig().getInt("Abilities.Water.PlantArmor.Range");
|
|
||||||
this.duration = getConfig().getLong("Abilities.Water.PlantArmor.Duration");
|
|
||||||
this.cooldown = getConfig().getLong("Abilities.Water.PlantArmor.Cooldown");
|
|
||||||
|
|
||||||
this.range = getNightFactor(range);
|
|
||||||
this.duration = (long) getNightFactor(duration);
|
|
||||||
this.tickTime = System.currentTimeMillis();
|
|
||||||
|
|
||||||
if (hasAbility(player, PlantArmor.class)) {
|
|
||||||
return;
|
|
||||||
} else if (!bPlayer.canBend(this)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasAbility(player, EarthArmor.class)) {
|
|
||||||
EarthArmor abil = getAbility(player, EarthArmor.class);
|
|
||||||
abil.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
block = getPlantSourceBlock(player, range, true);
|
|
||||||
if (block == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
location = block.getLocation();
|
|
||||||
if (!canUse()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
plantbending = new PlantRegrowth(player, block);
|
|
||||||
blockType = block.getType();
|
|
||||||
block.setType(Material.AIR);
|
|
||||||
|
|
||||||
start();
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean canUse() {
|
|
||||||
if (!bPlayer.canPlantbend()
|
|
||||||
|| !bPlayer.canBend(this)
|
|
||||||
|| GeneralMethods.isRegionProtectedFromBuild(this, location)) {
|
|
||||||
remove();
|
|
||||||
return false;
|
|
||||||
} else if (location.distanceSquared(player.getEyeLocation()) > range * range) {
|
|
||||||
remove();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void formArmor() {
|
|
||||||
ItemStack helmet = new ItemStack(blockType);
|
|
||||||
ItemStack chestplate = new ItemStack(Material.LEATHER_CHESTPLATE);
|
|
||||||
|
|
||||||
LeatherArmorMeta itemMeta = (LeatherArmorMeta) chestplate.getItemMeta();
|
|
||||||
itemMeta.setColor(Color.GREEN);
|
|
||||||
chestplate.setItemMeta(itemMeta);
|
|
||||||
|
|
||||||
ItemStack leggings = new ItemStack(Material.LEATHER_LEGGINGS);
|
|
||||||
ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
|
|
||||||
leggings.setItemMeta(itemMeta);
|
|
||||||
boots.setItemMeta(itemMeta);
|
|
||||||
|
|
||||||
new TempArmor(player, this, new ItemStack[] {boots, leggings, chestplate, helmet});
|
|
||||||
|
|
||||||
formed = true;
|
|
||||||
tickTime = System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean inPosition() {
|
|
||||||
return location.distanceSquared(player.getEyeLocation()) <= 1.5 * 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void playEffect() {
|
|
||||||
if (!formed) {
|
|
||||||
if ((new Random()).nextInt(4) == 0) {
|
|
||||||
playPlantbendingSound(location);
|
|
||||||
}
|
|
||||||
|
|
||||||
GeneralMethods.displayColoredParticle(location, "009933");
|
|
||||||
Vector vector = player.getEyeLocation().toVector().subtract(location.toVector());
|
|
||||||
location = location.add(vector.normalize());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void progress() {
|
|
||||||
if (player.isDead() || !player.isOnline()) {
|
|
||||||
remove();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (formed) {
|
|
||||||
PassiveHandler.checkArmorPassives(player);
|
|
||||||
if (System.currentTimeMillis() > tickTime + duration) {
|
|
||||||
remove();
|
|
||||||
bPlayer.addCooldown(this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else if (!canUse()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
playEffect();
|
|
||||||
if (inPosition() && !formed) {
|
|
||||||
formArmor();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void remove() {
|
|
||||||
super.remove();
|
|
||||||
|
|
||||||
if (TempArmor.hasTempArmor(player) && TempArmor.getTempArmor(player).getAbility().equals(this)) {
|
|
||||||
TempArmor.getTempArmor(player).revert();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plantbending != null) {
|
|
||||||
plantbending.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSneakAbility() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHarmlessAbility() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean canRemoveArmor(Player player) {
|
|
||||||
PlantArmor plantArmor = getAbility(player, PlantArmor.class);
|
|
||||||
if (plantArmor != null) {
|
|
||||||
if (System.currentTimeMillis() < plantArmor.tickTime + plantArmor.duration) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResistance(int resistance) {
|
|
||||||
this.resistance = resistance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getResistance() {
|
|
||||||
return resistance;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "PlantArmor";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Location getLocation() {
|
|
||||||
if (!formed) {
|
|
||||||
return location;
|
|
||||||
}
|
|
||||||
return player != null ? player.getLocation() : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getCooldown() {
|
|
||||||
return cooldown;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFormed() {
|
|
||||||
return formed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFormed(boolean formed) {
|
|
||||||
this.formed = formed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getDuration() {
|
|
||||||
return duration;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDuration(long duration) {
|
|
||||||
this.duration = duration;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getRange() {
|
|
||||||
return range;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRange(double range) {
|
|
||||||
this.range = range;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Material getBlockType() {
|
|
||||||
return blockType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBlockType(Material blockType) {
|
|
||||||
this.blockType = blockType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Block getBlock() {
|
|
||||||
return block;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBlock(Block block) {
|
|
||||||
this.block = block;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PlantRegrowth getPlantbending() {
|
|
||||||
return plantbending;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPlantbending(PlantRegrowth plantbending) {
|
|
||||||
this.plantbending = plantbending;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCooldown(long cooldown) {
|
|
||||||
this.cooldown = cooldown;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLocation(Location location) {
|
|
||||||
this.location = location;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,20 +1,15 @@
|
||||||
package com.projectkorra.projectkorra.waterbending;
|
package com.projectkorra.projectkorra.waterbending;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.BendingPlayer;
|
|
||||||
import com.projectkorra.projectkorra.Element;
|
|
||||||
import com.projectkorra.projectkorra.ability.CoreAbility;
|
|
||||||
import com.projectkorra.projectkorra.ability.WaterAbility;
|
|
||||||
import com.projectkorra.projectkorra.command.Commands;
|
|
||||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthArmor;
|
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.ability.WaterAbility;
|
||||||
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
|
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
|
import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
|
|
||||||
public class WaterPassive {
|
public class WaterPassive {
|
||||||
|
|
||||||
public static boolean applyNoFall(Player player) {
|
public static boolean applyNoFall(Player player) {
|
||||||
|
@ -35,6 +30,10 @@ public class WaterPassive {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fast Swim is now managed in FastSwim.java
|
||||||
|
*/
|
||||||
|
/*
|
||||||
public static void handlePassive() {
|
public static void handlePassive() {
|
||||||
if (Commands.isToggledForAll && ConfigManager.defaultConfig.get().getBoolean("Properties.TogglePassivesWithAllBending")) {
|
if (Commands.isToggledForAll && ConfigManager.defaultConfig.get().getBoolean("Properties.TogglePassivesWithAllBending")) {
|
||||||
return;
|
return;
|
||||||
|
@ -63,8 +62,9 @@ public class WaterPassive {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
public static double getSwimSpeed() {
|
public static double getSwimSpeed() {
|
||||||
return ConfigManager.getConfig().getDouble("Abilities.Water.Passive.SwimSpeedFactor");
|
return ConfigManager.getConfig().getDouble("Abilities.Water.Passive.FastSwim.SpeedFactor");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class WaterbendingManager implements Runnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
WaterPassive.handlePassive();
|
//WaterPassive.handlePassive(); # Fast Swim is now managed in FastSwim.java
|
||||||
Torrent.progressAllCleanup();
|
Torrent.progressAllCleanup();
|
||||||
WaterArms.progressAllCleanup();
|
WaterArms.progressAllCleanup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.projectkorra.projectkorra.waterbending.passive;
|
||||||
|
|
||||||
|
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.configuration.ConfigManager;
|
||||||
|
import com.projectkorra.projectkorra.earthbending.EarthArmor;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.WaterArms;
|
||||||
|
import com.projectkorra.projectkorra.waterbending.WaterSpout;
|
||||||
|
|
||||||
|
public class FastSwim extends WaterAbility implements PassiveAbility {
|
||||||
|
|
||||||
|
private double swimSpeed;
|
||||||
|
|
||||||
|
public FastSwim(Player player) {
|
||||||
|
super(player);
|
||||||
|
|
||||||
|
this.swimSpeed = ConfigManager.getConfig().getDouble("Abilities.Water.Passive.FastSwim.SpeedFactor");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progress() {
|
||||||
|
if (CoreAbility.hasAbility(player, WaterSpout.class) || CoreAbility.hasAbility(player, EarthArmor.class)) {
|
||||||
|
return;
|
||||||
|
} else if (CoreAbility.hasAbility(player, WaterArms.class)) {
|
||||||
|
return;
|
||||||
|
} else if (bPlayer.getBoundAbility() == null || (bPlayer.getBoundAbility() != null && !bPlayer.getBoundAbility().isSneakAbility())) {
|
||||||
|
if (player.isSneaking() && WaterAbility.isWater(player.getLocation().getBlock())) {
|
||||||
|
player.setVelocity(player.getEyeLocation().getDirection().clone().normalize().multiply(swimSpeed));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSneakAbility() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isHarmlessAbility() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getCooldown() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "FastSwim";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Location getLocation() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInstantiable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.projectkorra.projectkorra.waterbending.passive;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.ability.PassiveAbility;
|
||||||
|
import com.projectkorra.projectkorra.ability.WaterAbility;
|
||||||
|
|
||||||
|
public class Hydrosink extends WaterAbility implements PassiveAbility {
|
||||||
|
|
||||||
|
public Hydrosink(Player player) {
|
||||||
|
super(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void progress() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSneakAbility() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isHarmlessAbility() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getCooldown() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Hydrosink";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Location getLocation() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInstantiable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -214,3 +214,33 @@ permissions:
|
||||||
description: Grants access to all ChiCombos.
|
description: Grants access to all ChiCombos.
|
||||||
children:
|
children:
|
||||||
bending.ability.Immobilize: true
|
bending.ability.Immobilize: true
|
||||||
|
bending.air.passive:
|
||||||
|
default: false
|
||||||
|
description: Grants access to all air passives.
|
||||||
|
children:
|
||||||
|
bending.ability.AirAgility: true
|
||||||
|
bending.ability.AirSatiation: true
|
||||||
|
bending.ability.GracefulDescent: true
|
||||||
|
bending.chi.passive:
|
||||||
|
default: false
|
||||||
|
description: Grants access to all chi passives.
|
||||||
|
children:
|
||||||
|
bending.ability.Acrobatics: true
|
||||||
|
bending.ability.ChiAgility: true
|
||||||
|
bending.ability.ChiSatiation: true
|
||||||
|
bending.earth.passive:
|
||||||
|
default: false
|
||||||
|
description: Grants access to all earth passives.
|
||||||
|
children:
|
||||||
|
bending.ability.DensityShift: true
|
||||||
|
bending.ability.SandAgility: true
|
||||||
|
bending.fire.passive:
|
||||||
|
default: false
|
||||||
|
description: Grants access to all fire passives.
|
||||||
|
children:
|
||||||
|
bending.water.passive:
|
||||||
|
default: false
|
||||||
|
description: Grants access to all water passives.
|
||||||
|
children:
|
||||||
|
bending.ability.FastSwim: true
|
||||||
|
bending.ability.Hydrosink: true
|
Loading…
Add table
Add a link
Reference in a new issue