mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 11:40:40 +00:00
Merge pull request #214 from kingbirdy/fix/bending-display
Move ChiComboManager to ChiCombo, integrate with ComboManager
This commit is contained in:
commit
f12062f5b8
11 changed files with 251 additions and 259 deletions
|
@ -1,7 +1,7 @@
|
||||||
package com.projectkorra.projectkorra;
|
package com.projectkorra.projectkorra;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.ability.AvatarState;
|
import com.projectkorra.projectkorra.ability.AvatarState;
|
||||||
import com.projectkorra.projectkorra.chiblocking.ChiComboManager;
|
import com.projectkorra.projectkorra.chiblocking.ChiCombo;
|
||||||
import com.projectkorra.projectkorra.chiblocking.RapidPunch;
|
import com.projectkorra.projectkorra.chiblocking.RapidPunch;
|
||||||
import com.projectkorra.projectkorra.configuration.ConfigLoadable;
|
import com.projectkorra.projectkorra.configuration.ConfigLoadable;
|
||||||
import com.projectkorra.projectkorra.firebending.FireMethods;
|
import com.projectkorra.projectkorra.firebending.FireMethods;
|
||||||
|
@ -172,7 +172,7 @@ public class BendingManager implements Runnable, ConfigLoadable {
|
||||||
Flight.handle();
|
Flight.handle();
|
||||||
RapidPunch.startPunchAll();
|
RapidPunch.startPunchAll();
|
||||||
RevertChecker.revertAirBlocks();
|
RevertChecker.revertAirBlocks();
|
||||||
ChiComboManager.handleParalysis();
|
ChiCombo.handleParalysis();
|
||||||
HorizontalVelocityTracker.updateAll();
|
HorizontalVelocityTracker.updateAll();
|
||||||
handleCooldowns();
|
handleCooldowns();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1001,7 +1001,7 @@ public class Commands {
|
||||||
{
|
{
|
||||||
ArrayList<String> chicombos = ComboManager.getCombosForElement(Element.Chi);
|
ArrayList<String> chicombos = ComboManager.getCombosForElement(Element.Chi);
|
||||||
if (chicombos.isEmpty()) {
|
if (chicombos.isEmpty()) {
|
||||||
s.sendMessage(WaterMethods.getWaterColor() + "There are no chiblocking combos avaliable.");
|
s.sendMessage(ChiMethods.getChiColor() + "There are no chiblocking combos avaliable.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -713,14 +713,15 @@ public class GeneralMethods {
|
||||||
public static Element getAbilityElement(String ability) {
|
public static Element getAbilityElement(String ability) {
|
||||||
if (AbilityModuleManager.airbendingabilities.contains(ability))
|
if (AbilityModuleManager.airbendingabilities.contains(ability))
|
||||||
return Element.Air;
|
return Element.Air;
|
||||||
if (AbilityModuleManager.earthbendingabilities.contains(ability))
|
else if (AbilityModuleManager.earthbendingabilities.contains(ability))
|
||||||
return Element.Earth;
|
return Element.Earth;
|
||||||
if (AbilityModuleManager.firebendingabilities.contains(ability))
|
else if (AbilityModuleManager.firebendingabilities.contains(ability))
|
||||||
return Element.Fire;
|
return Element.Fire;
|
||||||
if (AbilityModuleManager.waterbendingabilities.contains(ability))
|
else if (AbilityModuleManager.waterbendingabilities.contains(ability))
|
||||||
return Element.Water;
|
return Element.Water;
|
||||||
if (AbilityModuleManager.chiabilities.contains(ability))
|
else if (AbilityModuleManager.chiabilities.contains(ability))
|
||||||
return Element.Chi;
|
return Element.Chi;
|
||||||
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1006,26 +1007,6 @@ public class GeneralMethods {
|
||||||
}
|
}
|
||||||
return getAvatarColor();
|
return getAvatarColor();
|
||||||
}
|
}
|
||||||
/**Returns the correct element for the combo*/
|
|
||||||
public static Element getComboElement(String combo) {
|
|
||||||
Iterator<ComboAbility> it = ComboManager.comboAbilityList.iterator();
|
|
||||||
Element element = null;
|
|
||||||
while (it.hasNext()) {
|
|
||||||
ComboAbility comboability = it.next();
|
|
||||||
if (!comboability.getName().equalsIgnoreCase(combo)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (AbilityInformation abilityinfo : comboability.getAbilities())
|
|
||||||
{
|
|
||||||
Element abilityelement = getAbilityElement(abilityinfo.getAbilityName());
|
|
||||||
if (abilityelement == null) return null;
|
|
||||||
else if (element == null) element = abilityelement;
|
|
||||||
else if (element != abilityelement) return null;
|
|
||||||
}
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getCurrentDate() {
|
public static String getCurrentDate() {
|
||||||
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
||||||
|
|
|
@ -1,62 +1,5 @@
|
||||||
package com.projectkorra.projectkorra;
|
package com.projectkorra.projectkorra;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.block.Action;
|
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
|
||||||
import org.bukkit.event.block.BlockFadeEvent;
|
|
||||||
import org.bukkit.event.block.BlockFormEvent;
|
|
||||||
import org.bukkit.event.block.BlockFromToEvent;
|
|
||||||
import org.bukkit.event.block.BlockIgniteEvent;
|
|
||||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
|
||||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
|
||||||
import org.bukkit.event.entity.EntityCombustEvent;
|
|
||||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
|
||||||
import org.bukkit.event.entity.EntityInteractEvent;
|
|
||||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
|
||||||
import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
|
|
||||||
import org.bukkit.event.entity.EntityTeleportEvent;
|
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
|
||||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
|
||||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
|
||||||
import org.bukkit.event.entity.SlimeSplitEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryType.SlotType;
|
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
|
||||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
|
||||||
import org.bukkit.event.player.PlayerKickEvent;
|
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
|
||||||
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
|
||||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.ability.AvatarState;
|
import com.projectkorra.projectkorra.ability.AvatarState;
|
||||||
import com.projectkorra.projectkorra.ability.combo.ComboManager;
|
import com.projectkorra.projectkorra.ability.combo.ComboManager;
|
||||||
import com.projectkorra.projectkorra.ability.multiability.MultiAbilityManager;
|
import com.projectkorra.projectkorra.ability.multiability.MultiAbilityManager;
|
||||||
|
@ -73,7 +16,7 @@ import com.projectkorra.projectkorra.airbending.FlightAbility;
|
||||||
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.chiblocking.AcrobatStance;
|
import com.projectkorra.projectkorra.chiblocking.AcrobatStance;
|
||||||
import com.projectkorra.projectkorra.chiblocking.ChiComboManager;
|
import com.projectkorra.projectkorra.chiblocking.ChiCombo;
|
||||||
import com.projectkorra.projectkorra.chiblocking.ChiMethods;
|
import com.projectkorra.projectkorra.chiblocking.ChiMethods;
|
||||||
import com.projectkorra.projectkorra.chiblocking.ChiPassive;
|
import com.projectkorra.projectkorra.chiblocking.ChiPassive;
|
||||||
import com.projectkorra.projectkorra.chiblocking.HighJump;
|
import com.projectkorra.projectkorra.chiblocking.HighJump;
|
||||||
|
@ -145,6 +88,63 @@ import com.projectkorra.projectkorra.waterbending.WaterWall;
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterWave;
|
import com.projectkorra.projectkorra.waterbending.WaterWave;
|
||||||
import com.projectkorra.projectkorra.waterbending.Wave;
|
import com.projectkorra.projectkorra.waterbending.Wave;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
|
import org.bukkit.event.block.BlockFadeEvent;
|
||||||
|
import org.bukkit.event.block.BlockFormEvent;
|
||||||
|
import org.bukkit.event.block.BlockFromToEvent;
|
||||||
|
import org.bukkit.event.block.BlockIgniteEvent;
|
||||||
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||||
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||||
|
import org.bukkit.event.entity.EntityCombustEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
import org.bukkit.event.entity.EntityInteractEvent;
|
||||||
|
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||||
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
|
import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityTeleportEvent;
|
||||||
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
|
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||||
|
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||||
|
import org.bukkit.event.entity.SlimeSplitEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryType.SlotType;
|
||||||
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
|
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerKickEvent;
|
||||||
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||||
|
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class PKListener implements Listener {
|
public class PKListener implements Listener {
|
||||||
|
|
||||||
ProjectKorra plugin;
|
ProjectKorra plugin;
|
||||||
|
@ -336,7 +336,7 @@ public class PKListener implements Listener {
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
return;
|
return;
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (Paralyze.isParalyzed(player) || ChiComboManager.isParalyzed(player) || Bloodbending.isBloodbended(player) || Suffocate.isBreathbent(player)) {
|
if (Paralyze.isParalyzed(player) || ChiCombo.isParalyzed(player) || Bloodbending.isBloodbended(player) || Suffocate.isBreathbent(player)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -347,7 +347,7 @@ public class PKListener implements Listener {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (Paralyze.isParalyzed(entity) || ChiComboManager.isParalyzed(entity) || Bloodbending.isBloodbended(entity) || Suffocate.isBreathbent(entity))
|
if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbended(entity) || Suffocate.isBreathbent(entity))
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
if (event.getEntityType() == EntityType.FALLING_BLOCK) {
|
if (event.getEntityType() == EntityType.FALLING_BLOCK) {
|
||||||
|
@ -450,7 +450,7 @@ public class PKListener implements Listener {
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (entity != null)
|
if (entity != null)
|
||||||
if (Paralyze.isParalyzed(entity) || ChiComboManager.isParalyzed(entity) || Bloodbending.isBloodbended(entity) || Suffocate.isBreathbent(entity))
|
if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbended(entity) || Suffocate.isBreathbent(entity))
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,7 +460,7 @@ public class PKListener implements Listener {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (Paralyze.isParalyzed(entity) || ChiComboManager.isParalyzed(entity) || Bloodbending.isBloodbended(entity) || Suffocate.isBreathbent(entity))
|
if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbended(entity) || Suffocate.isBreathbent(entity))
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,7 +470,7 @@ public class PKListener implements Listener {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (Paralyze.isParalyzed(entity) || ChiComboManager.isParalyzed(entity) || Bloodbending.isBloodbended(entity) || Suffocate.isBreathbent(entity))
|
if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbended(entity) || Suffocate.isBreathbent(entity))
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,7 +480,7 @@ public class PKListener implements Listener {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (Paralyze.isParalyzed(entity) || ChiComboManager.isParalyzed(entity) || Bloodbending.isBloodbended(entity) || Suffocate.isBreathbent(entity))
|
if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbended(entity) || Suffocate.isBreathbent(entity))
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,7 +490,7 @@ public class PKListener implements Listener {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (Paralyze.isParalyzed(entity) || ChiComboManager.isParalyzed(entity) || Bloodbending.isBloodbended(entity) || Suffocate.isBreathbent(entity))
|
if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbended(entity) || Suffocate.isBreathbent(entity))
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,7 +512,7 @@ public class PKListener implements Listener {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (Paralyze.isParalyzed(entity) || ChiComboManager.isParalyzed(entity) || Bloodbending.isBloodbended(entity)) {
|
if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbended(entity)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -523,7 +523,7 @@ public class PKListener implements Listener {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (Paralyze.isParalyzed(entity) || ChiComboManager.isParalyzed(entity) || Bloodbending.isBloodbended(entity)) {
|
if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbended(entity)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -534,7 +534,7 @@ public class PKListener implements Listener {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (Paralyze.isParalyzed(entity) || ChiComboManager.isParalyzed(entity) || Bloodbending.isBloodbended(entity) || Suffocate.isBreathbent(entity))
|
if (Paralyze.isParalyzed(entity) || ChiCombo.isParalyzed(entity) || Bloodbending.isBloodbended(entity) || Suffocate.isBreathbent(entity))
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -708,7 +708,7 @@ public class PKListener implements Listener {
|
||||||
// e.setCancelled(true);
|
// e.setCancelled(true);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (Paralyze.isParalyzed(e.getDamager()) || ChiComboManager.isParalyzed(e.getDamager())) {
|
if (Paralyze.isParalyzed(e.getDamager()) || ChiCombo.isParalyzed(e.getDamager())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -858,7 +858,7 @@ public class PKListener implements Listener {
|
||||||
if (ability != null && ability.equalsIgnoreCase("EarthSmash"))
|
if (ability != null && ability.equalsIgnoreCase("EarthSmash"))
|
||||||
new EarthSmash(player, ClickType.RIGHT_CLICK);
|
new EarthSmash(player, ClickType.RIGHT_CLICK);
|
||||||
}
|
}
|
||||||
if (Paralyze.isParalyzed(player) || ChiComboManager.isParalyzed(player) || Bloodbending.isBloodbended(player) || Suffocate.isBreathbent(player)) {
|
if (Paralyze.isParalyzed(player) || ChiCombo.isParalyzed(player) || Bloodbending.isBloodbended(player) || Suffocate.isBreathbent(player)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -887,7 +887,7 @@ public class PKListener implements Listener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ChiComboManager.isParalyzed(player)) {
|
if (ChiCombo.isParalyzed(player)) {
|
||||||
event.setTo(event.getFrom());
|
event.setTo(event.getFrom());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -996,7 +996,7 @@ public class PKListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Paralyze.isParalyzed(player) || ChiComboManager.isParalyzed(player) || Bloodbending.isBloodbended(player)) {
|
if (Paralyze.isParalyzed(player) || ChiCombo.isParalyzed(player) || Bloodbending.isBloodbended(player)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1181,7 +1181,7 @@ public class PKListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Bloodbending.isBloodbended(player) || Paralyze.isParalyzed(player) || ChiComboManager.isParalyzed(player)) {
|
if (Bloodbending.isBloodbended(player) || Paralyze.isParalyzed(player) || ChiCombo.isParalyzed(player)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,11 @@
|
||||||
package com.projectkorra.projectkorra;
|
package com.projectkorra.projectkorra;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.ability.AbilityModuleManager;
|
import com.projectkorra.projectkorra.ability.AbilityModuleManager;
|
||||||
import com.projectkorra.projectkorra.ability.combo.ComboManager;
|
import com.projectkorra.projectkorra.ability.combo.ComboManager;
|
||||||
import com.projectkorra.projectkorra.ability.combo.ComboModuleManager;
|
import com.projectkorra.projectkorra.ability.combo.ComboModuleManager;
|
||||||
import com.projectkorra.projectkorra.ability.multiability.MultiAbilityManager;
|
import com.projectkorra.projectkorra.ability.multiability.MultiAbilityManager;
|
||||||
import com.projectkorra.projectkorra.ability.multiability.MultiAbilityModuleManager;
|
import com.projectkorra.projectkorra.ability.multiability.MultiAbilityModuleManager;
|
||||||
import com.projectkorra.projectkorra.airbending.AirbendingManager;
|
import com.projectkorra.projectkorra.airbending.AirbendingManager;
|
||||||
import com.projectkorra.projectkorra.chiblocking.ChiComboManager;
|
|
||||||
import com.projectkorra.projectkorra.chiblocking.ChiblockingManager;
|
import com.projectkorra.projectkorra.chiblocking.ChiblockingManager;
|
||||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
import com.projectkorra.projectkorra.earthbending.EarthbendingManager;
|
import com.projectkorra.projectkorra.earthbending.EarthbendingManager;
|
||||||
|
@ -27,6 +18,14 @@ import com.projectkorra.projectkorra.util.Updater;
|
||||||
import com.projectkorra.projectkorra.util.logging.PKLogHandler;
|
import com.projectkorra.projectkorra.util.logging.PKLogHandler;
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterbendingManager;
|
import com.projectkorra.projectkorra.waterbending.WaterbendingManager;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class ProjectKorra extends JavaPlugin {
|
public class ProjectKorra extends JavaPlugin {
|
||||||
|
|
||||||
public static ProjectKorra plugin;
|
public static ProjectKorra plugin;
|
||||||
|
@ -59,7 +58,6 @@ public class ProjectKorra extends JavaPlugin {
|
||||||
new MultiAbilityManager();
|
new MultiAbilityManager();
|
||||||
new ComboModuleManager();
|
new ComboModuleManager();
|
||||||
new ComboManager();
|
new ComboManager();
|
||||||
new ChiComboManager();
|
|
||||||
|
|
||||||
DBConnection.host = getConfig().getString("Storage.MySQL.host");
|
DBConnection.host = getConfig().getString("Storage.MySQL.host");
|
||||||
DBConnection.port = getConfig().getInt("Storage.MySQL.port");
|
DBConnection.port = getConfig().getInt("Storage.MySQL.port");
|
||||||
|
|
|
@ -4,6 +4,7 @@ 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.airbending.AirCombo;
|
import com.projectkorra.projectkorra.airbending.AirCombo;
|
||||||
|
import com.projectkorra.projectkorra.chiblocking.ChiCombo;
|
||||||
import com.projectkorra.projectkorra.firebending.FireCombo;
|
import com.projectkorra.projectkorra.firebending.FireCombo;
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
import com.projectkorra.projectkorra.util.ClickType;
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterCombo;
|
import com.projectkorra.projectkorra.waterbending.WaterCombo;
|
||||||
|
@ -150,6 +151,15 @@ public class ComboManager {
|
||||||
iceBulletRight.add(new AbilityInformation("IceBlast", ClickType.RIGHT_CLICK));
|
iceBulletRight.add(new AbilityInformation("IceBlast", ClickType.RIGHT_CLICK));
|
||||||
comboAbilityList.add(new ComboAbility("IceBulletRightClick", iceBulletRight, WaterCombo.class));
|
comboAbilityList.add(new ComboAbility("IceBulletRightClick", iceBulletRight, WaterCombo.class));
|
||||||
|
|
||||||
|
ArrayList<AbilityInformation> immobilize = new ArrayList<AbilityInformation>();
|
||||||
|
immobilize.add(new AbilityInformation("QuickStrike", ClickType.LEFT_CLICK));
|
||||||
|
immobilize.add(new AbilityInformation("SwiftKick", ClickType.LEFT_CLICK));
|
||||||
|
immobilize.add(new AbilityInformation("QuickStrike", ClickType.LEFT_CLICK));
|
||||||
|
immobilize.add(new AbilityInformation("QuickStrike", ClickType.LEFT_CLICK));
|
||||||
|
comboAbilityList.add(new ComboAbility("Immobilize", immobilize, ChiCombo.class));
|
||||||
|
descriptions.put("Immobilize", "Does stuff to people.");
|
||||||
|
instructions.put("Immobilize", "QuickStrike (Left Click) > SwiftKick (Left Click) > QuickStrike (Left Click) > QuickStrike (Left Click)");
|
||||||
|
|
||||||
startCleanupTask();
|
startCleanupTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +167,6 @@ public class ComboManager {
|
||||||
String abilityName = GeneralMethods.getBoundAbility(player);
|
String abilityName = GeneralMethods.getBoundAbility(player);
|
||||||
if (abilityName == null)
|
if (abilityName == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AbilityInformation info = new AbilityInformation(abilityName, type, System.currentTimeMillis());
|
AbilityInformation info = new AbilityInformation(abilityName, type, System.currentTimeMillis());
|
||||||
addRecentAbility(player, info);
|
addRecentAbility(player, info);
|
||||||
|
|
||||||
|
@ -174,6 +183,8 @@ public class ComboManager {
|
||||||
new AirCombo(player, comboAbil.getName());
|
new AirCombo(player, comboAbil.getName());
|
||||||
else if (comboAbil.getComboType().equals(WaterCombo.class))
|
else if (comboAbil.getComboType().equals(WaterCombo.class))
|
||||||
new WaterCombo(player, comboAbil.getName());
|
new WaterCombo(player, comboAbil.getName());
|
||||||
|
else if (comboAbil.getComboType().equals(ChiCombo.class))
|
||||||
|
new ChiCombo(player, comboAbil.getName());
|
||||||
else {
|
else {
|
||||||
for (ComboAbility ca : comboAbilityList) {
|
for (ComboAbility ca : comboAbilityList) {
|
||||||
if (comboAbil.getName().equals(ca.getName())) {
|
if (comboAbil.getName().equals(ca.getName())) {
|
||||||
|
@ -186,18 +197,31 @@ public class ComboManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an {@link AbilityInformation} to the player's
|
||||||
|
* {@link ComboManager#recentlyUsedAbilities recentlyUsedAbilities}.
|
||||||
|
*
|
||||||
|
* @param player The player to add the AbilityInformation for
|
||||||
|
* @param info The AbilityInformation to add
|
||||||
|
*/
|
||||||
public static void addRecentAbility(Player player, AbilityInformation info) {
|
public static void addRecentAbility(Player player, AbilityInformation info) {
|
||||||
ArrayList<AbilityInformation> list;
|
ArrayList<AbilityInformation> list;
|
||||||
String name = player.getName();
|
String name = player.getName();
|
||||||
if (recentlyUsedAbilities.containsKey(name)) {
|
if (recentlyUsedAbilities.containsKey(name))
|
||||||
list = recentlyUsedAbilities.get(name);
|
list = recentlyUsedAbilities.get(name);
|
||||||
recentlyUsedAbilities.remove(player);
|
else
|
||||||
} else
|
|
||||||
list = new ArrayList<AbilityInformation>();
|
list = new ArrayList<AbilityInformation>();
|
||||||
list.add(info);
|
list.add(info);
|
||||||
recentlyUsedAbilities.put(name, list);
|
recentlyUsedAbilities.put(name, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a Player's {@link ComboManager#recentlyUsedAbilities recentlyUsedAbilities}
|
||||||
|
* contains a valid set of moves to perform any combos. If it does, it
|
||||||
|
* returns the valid combo.
|
||||||
|
* @param player The player for whom to check if a valid combo has been performed
|
||||||
|
* @return The ComboAbility of the combo that has been performed, or null if no valid combo was found
|
||||||
|
*/
|
||||||
public static ComboAbility checkForValidCombo(Player player) {
|
public static ComboAbility checkForValidCombo(Player player) {
|
||||||
ArrayList<AbilityInformation> playerCombo = getRecentlyUsedAbilities(player, 8);
|
ArrayList<AbilityInformation> playerCombo = getRecentlyUsedAbilities(player, 8);
|
||||||
for (ComboAbility customAbility : comboAbilityList) {
|
for (ComboAbility customAbility : comboAbilityList) {
|
||||||
|
@ -239,6 +263,12 @@ public class ComboManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the player's most recently used abilities, up to a maximum of 10.
|
||||||
|
* @param player The player to get recent abilities for
|
||||||
|
* @param amount The amount of recent abilities to get, starting from most recent and getting older
|
||||||
|
* @return An ArrayList<{@link AbilityInformation}> of the player's recently used abilities
|
||||||
|
*/
|
||||||
public static ArrayList<AbilityInformation> getRecentlyUsedAbilities(Player player, int amount) {
|
public static ArrayList<AbilityInformation> getRecentlyUsedAbilities(Player player, int amount) {
|
||||||
String name = player.getName();
|
String name = player.getName();
|
||||||
if (!recentlyUsedAbilities.containsKey(name))
|
if (!recentlyUsedAbilities.containsKey(name))
|
||||||
|
@ -254,10 +284,15 @@ public class ComboManager {
|
||||||
return tempList;
|
return tempList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all of the combos for a given element.
|
||||||
|
* @param element The element to get combos for
|
||||||
|
* @return An ArrayList of the combos for that element
|
||||||
|
*/
|
||||||
public static ArrayList<String> getCombosForElement(Element element) {
|
public static ArrayList<String> getCombosForElement(Element element) {
|
||||||
ArrayList<String> list = new ArrayList<String>();
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
for (ComboAbility comboab : comboAbilityList) {
|
for (ComboAbility comboab : comboAbilityList) {
|
||||||
if (GeneralMethods.getComboElement(comboab.getName()) == element && descriptions.containsKey(comboab.getName()))
|
if(GeneralMethods.getAbilityElement(comboab.getAbilities().get(0).getAbilityName())==element)
|
||||||
list.add(comboab.getName());
|
list.add(comboab.getName());
|
||||||
}
|
}
|
||||||
Collections.sort(list);
|
Collections.sort(list);
|
||||||
|
@ -272,6 +307,11 @@ public class ComboManager {
|
||||||
}.runTaskTimer(ProjectKorra.plugin, 0, CLEANUP_DELAY / 1000 * 20);
|
}.runTaskTimer(ProjectKorra.plugin, 0, CLEANUP_DELAY / 1000 * 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains information on an ability used in a combo.
|
||||||
|
* @author kingbirdy
|
||||||
|
*
|
||||||
|
*/
|
||||||
public static class AbilityInformation {
|
public static class AbilityInformation {
|
||||||
private String abilityName;
|
private String abilityName;
|
||||||
private ClickType clickType;
|
private ClickType clickType;
|
||||||
|
@ -287,14 +327,27 @@ public class ComboManager {
|
||||||
this.time = time;
|
this.time = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares if two {@link AbilityInformation}'s are equal without respect to {@link AbilityInformation#time time}.
|
||||||
|
* @param info The AbilityInformation to compare against
|
||||||
|
* @return True if they are equal without respect to time
|
||||||
|
*/
|
||||||
public boolean equalsWithoutTime(AbilityInformation info) {
|
public boolean equalsWithoutTime(AbilityInformation info) {
|
||||||
return this.getAbilityName().equals(info.getAbilityName()) && this.getClickType().equals(info.getClickType());
|
return this.getAbilityName().equals(info.getAbilityName()) && this.getClickType().equals(info.getClickType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the name of the ability.
|
||||||
|
* @return The name of the ability.
|
||||||
|
*/
|
||||||
public String getAbilityName() {
|
public String getAbilityName() {
|
||||||
return abilityName;
|
return abilityName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the {@link ClickType} of the {@link AbilityInformation}.
|
||||||
|
* @return The ClickType
|
||||||
|
*/
|
||||||
public ClickType getClickType() {
|
public ClickType getClickType() {
|
||||||
return clickType;
|
return clickType;
|
||||||
}
|
}
|
||||||
|
|
100
src/com/projectkorra/projectkorra/chiblocking/ChiCombo.java
Normal file
100
src/com/projectkorra/projectkorra/chiblocking/ChiCombo.java
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
package com.projectkorra.projectkorra.chiblocking;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
|
import com.projectkorra.projectkorra.ProjectKorra;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A representation of all chi combo moves.
|
||||||
|
* @author kingbirdy
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ChiCombo {
|
||||||
|
|
||||||
|
private static boolean enabled = ProjectKorra.plugin.getConfig().getBoolean("Abilities.Chi.ChiCombo.Enabled");
|
||||||
|
|
||||||
|
public static long IMMOBILIZE_DURATION = ProjectKorra.plugin.getConfig().getLong("Abilities.Chi.ChiCombo.Immobilize.ParalyzeDuration");
|
||||||
|
public static long IMMOBILIZE_COOLDOWN = ProjectKorra.plugin.getConfig().getLong("Abilities.Chi.ChiCombo.Immobilize.Cooldown");
|
||||||
|
/**
|
||||||
|
* A List of every instance of an active {@link ChiCombo}.
|
||||||
|
*/
|
||||||
|
public static List<ChiCombo> instances = new ArrayList<ChiCombo>();
|
||||||
|
/**
|
||||||
|
* a Map containing every entity which is paralyzed, and the time in milliseconds at which they will be unparalyzed.
|
||||||
|
*/
|
||||||
|
public static Map<Entity, Long> paralyzedEntities = new HashMap<Entity, Long>();
|
||||||
|
|
||||||
|
private Player player;
|
||||||
|
private Entity target;
|
||||||
|
|
||||||
|
public ChiCombo(Player player, String ability) {
|
||||||
|
if (!enabled)
|
||||||
|
return;
|
||||||
|
if (ability.equalsIgnoreCase("Immobilize")) {
|
||||||
|
if (!GeneralMethods.canBend(player.getName(), "Immobilize") || GeneralMethods.getBendingPlayer(player).isOnCooldown("Immobilize"))
|
||||||
|
return;
|
||||||
|
else {
|
||||||
|
this.player = player;
|
||||||
|
target = GeneralMethods.getTargetedEntity(player, 5, new ArrayList<Entity>());
|
||||||
|
paralyze(target, IMMOBILIZE_DURATION);
|
||||||
|
instances.add(this);
|
||||||
|
GeneralMethods.getBendingPlayer(player).addCooldown("Immobilize", IMMOBILIZE_COOLDOWN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paralyzes the target for the given duration. The player will
|
||||||
|
* be unable to move or interact for the duration.
|
||||||
|
* @param target The Entity to be paralyzed
|
||||||
|
* @param duration The time in milliseconds the target will be paralyzed
|
||||||
|
*/
|
||||||
|
private static void paralyze(Entity target, Long duration) {
|
||||||
|
paralyzedEntities.put(target, Long.sum(System.currentTimeMillis(), duration));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience method to see if a Player is paralyzed by a ChiCombo.
|
||||||
|
* Calls {@link ChiCombo#isParalyzed(Entity)} with the Player casted to an Entity.
|
||||||
|
*
|
||||||
|
* @param player The player to check if they're paralyzed
|
||||||
|
* @return True if the player is paralyzed, false otherwise
|
||||||
|
*/
|
||||||
|
public static boolean isParalyzed(Player player) {
|
||||||
|
return isParalyzed((Entity) player);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if an entity is paralyzed by a ChiCombo.
|
||||||
|
*
|
||||||
|
* @param entity The entity to check if they're paralyzed
|
||||||
|
* @return True if the entity is paralyzed, false otherwise
|
||||||
|
*/
|
||||||
|
public static boolean isParalyzed(Entity entity) {
|
||||||
|
return paralyzedEntities.containsKey(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the status of all paralyzed entities. If their paralysis has expired,
|
||||||
|
* it removes them from {@link ChiCombo#paralyzedEntities paralyzedEntities} and
|
||||||
|
* removes the instance of the combo from {@link ChiCombo#instances instances}.
|
||||||
|
*/
|
||||||
|
public static void handleParalysis() {
|
||||||
|
for (Entity e : paralyzedEntities.keySet()) {
|
||||||
|
if (paralyzedEntities.get(e) <= System.currentTimeMillis()) {
|
||||||
|
paralyzedEntities.remove(e);
|
||||||
|
for (ChiCombo c : instances) {
|
||||||
|
if (c.target.equals(e))
|
||||||
|
instances.remove(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,136 +0,0 @@
|
||||||
package com.projectkorra.projectkorra.chiblocking;
|
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
|
||||||
import com.projectkorra.projectkorra.ProjectKorra;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ChiComboManager {
|
|
||||||
public enum ChiCombo {
|
|
||||||
QuickStrike, SwiftKick;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HashMap<Player, List<ChiCombo>> instances = new HashMap<Player, List<ChiCombo>>();
|
|
||||||
public static List<List<ChiCombo>> knownCombos = new ArrayList<List<ChiCombo>>();
|
|
||||||
public static List<Entity> paralyzed = new ArrayList<Entity>();
|
|
||||||
public static HashMap<Entity, Location> paralyzedLocations = new HashMap<Entity, Location>();
|
|
||||||
public static long paralysisDuration = ProjectKorra.plugin.getConfig().getLong("Abilities.Chi.ChiCombo.ParalyzeDuration");
|
|
||||||
public static long cooldown = ProjectKorra.plugin.getConfig().getLong("Abilities.Chi.ChiCombo.Cooldown");
|
|
||||||
|
|
||||||
public ChiComboManager() {
|
|
||||||
List<ChiCombo> combo1 = new ArrayList<ChiCombo>();
|
|
||||||
combo1.add(ChiCombo.QuickStrike);
|
|
||||||
combo1.add(ChiCombo.SwiftKick);
|
|
||||||
combo1.add(ChiCombo.QuickStrike);
|
|
||||||
combo1.add(ChiCombo.QuickStrike);
|
|
||||||
knownCombos.add(combo1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addCombo(Player player, ChiCombo combo) {
|
|
||||||
if (!player.hasPermission("bending.ability.ChiCombo"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!instances.containsKey(player))
|
|
||||||
instances.put(player, new ArrayList<ChiCombo>());
|
|
||||||
instances.get(player).add(combo);
|
|
||||||
|
|
||||||
if (instances.get(player).size() > 4)
|
|
||||||
instances.put(player, shiftList(instances.get(player)));
|
|
||||||
//ProjectKorra.log.info(instances.get(player).toString());
|
|
||||||
|
|
||||||
checkForValidCombo(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<ChiCombo> shiftList(List<ChiCombo> list) {
|
|
||||||
List<ChiCombo> list2 = new ArrayList<ChiCombo>();
|
|
||||||
|
|
||||||
for (int i = 1; i < list.size(); i++) {
|
|
||||||
list2.add(list.get(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
return list2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean checkForValidCombo(Player player) {
|
|
||||||
List<ChiCombo> combo = instances.get(player);
|
|
||||||
|
|
||||||
for (List<ChiCombo> knownCombo : knownCombos) {
|
|
||||||
int size = knownCombo.size();
|
|
||||||
|
|
||||||
//ProjectKorra.log.info("Scanning " + knownCombo.toString());
|
|
||||||
|
|
||||||
if (combo.size() < size)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
boolean isValid = true;
|
|
||||||
for (int i = 1; i <= size; i++) {
|
|
||||||
if (combo.get(combo.size() - i) != (knownCombo.get(knownCombo.size() - i))) {
|
|
||||||
isValid = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isValid) {
|
|
||||||
//ProjectKorra.log.info("Combo Matched for player "+player.getName());
|
|
||||||
|
|
||||||
if (combo.size() == 4 && combo.get(0) == ChiCombo.QuickStrike && combo.get(1) == ChiCombo.SwiftKick && combo.get(2) == ChiCombo.QuickStrike && combo.get(3) == ChiCombo.QuickStrike) {
|
|
||||||
if (!GeneralMethods.getBendingPlayer(player.getName()).isOnCooldown("Immobilize") && GeneralMethods.canBend(player.getName(), "Immobilize")) {
|
|
||||||
GeneralMethods.getBendingPlayer(player.getName()).addCooldown("Immobilize", cooldown);
|
|
||||||
paralyzeTarget(player, paralysisDuration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
instances.remove(player);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public static void paralyzeTarget(Player player, long time) {
|
|
||||||
Entity e = GeneralMethods.getTargetedEntity(player, 4, new ArrayList<Entity>());
|
|
||||||
|
|
||||||
if (e == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (e instanceof LivingEntity) {
|
|
||||||
final LivingEntity le = (LivingEntity) e;
|
|
||||||
paralyzed.add(le);
|
|
||||||
paralyzedLocations.put(le, le.getLocation());
|
|
||||||
|
|
||||||
ProjectKorra.plugin.getServer().getScheduler().scheduleSyncDelayedTask(ProjectKorra.plugin, new BukkitRunnable() {
|
|
||||||
public void run() {
|
|
||||||
paralyzed.remove(le);
|
|
||||||
paralyzedLocations.remove(le);
|
|
||||||
}
|
|
||||||
}, (long) ((time / 1000) * 20));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addNewCombo(List<ChiCombo> combo) {
|
|
||||||
knownCombos.add(combo);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isParalyzed(Entity e) {
|
|
||||||
return paralyzed.contains(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void handleParalysis() {
|
|
||||||
for (Entity e : paralyzed) {
|
|
||||||
if (!(e instanceof Player)) {
|
|
||||||
e.setVelocity(GeneralMethods.getDirection(e.getLocation(), paralyzedLocations.get(e)));
|
|
||||||
}
|
|
||||||
//e.teleport(paralyzedLocations.get(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,7 +2,6 @@ package com.projectkorra.projectkorra.chiblocking;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ProjectKorra;
|
import com.projectkorra.projectkorra.ProjectKorra;
|
||||||
import com.projectkorra.projectkorra.chiblocking.ChiComboManager.ChiCombo;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -27,8 +26,6 @@ public class QuickStrike {
|
||||||
if (GeneralMethods.rand.nextInt(100) < blockChance && e instanceof Player) {
|
if (GeneralMethods.rand.nextInt(100) < blockChance && e instanceof Player) {
|
||||||
ChiPassive.blockChi((Player) e);
|
ChiPassive.blockChi((Player) e);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChiComboManager.addCombo(player, ChiCombo.QuickStrike);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEligible(Player player) {
|
public boolean isEligible(Player player) {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.projectkorra.projectkorra.chiblocking;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ProjectKorra;
|
import com.projectkorra.projectkorra.ProjectKorra;
|
||||||
import com.projectkorra.projectkorra.chiblocking.ChiComboManager.ChiCombo;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -29,7 +28,6 @@ public class SwiftKick {
|
||||||
}
|
}
|
||||||
|
|
||||||
GeneralMethods.getBendingPlayer(player.getName()).addCooldown("SwiftKick", 4000);
|
GeneralMethods.getBendingPlayer(player.getName()).addCooldown("SwiftKick", 4000);
|
||||||
ChiComboManager.addCombo(player, ChiCombo.SwiftKick);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
|
|
@ -729,8 +729,9 @@ public class ConfigManager {
|
||||||
config.addDefault("Abilities.Chi.Passive.BlockChi.Duration", 1500);
|
config.addDefault("Abilities.Chi.Passive.BlockChi.Duration", 1500);
|
||||||
config.addDefault("Abilities.Chi.Passive.DodgeChange", 25);
|
config.addDefault("Abilities.Chi.Passive.DodgeChange", 25);
|
||||||
|
|
||||||
config.addDefault("Abilities.Chi.ChiCombo.ParalyzeDuration", 4000);
|
config.addDefault("Abilities.Chi.ChiCombo.Enabled", true);
|
||||||
config.addDefault("Abilities.Chi.ChiCombo.Cooldown", 15000);
|
config.addDefault("Abilities.Chi.ChiCombo.Immobilize.ParalyzeDuration", 4000);
|
||||||
|
config.addDefault("Abilities.Chi.ChiCombo.Immobilize.Cooldown", 15000);
|
||||||
|
|
||||||
config.addDefault("Abilities.Chi.AcrobatStance.Enabled", true);
|
config.addDefault("Abilities.Chi.AcrobatStance.Enabled", true);
|
||||||
config.addDefault("Abilities.Chi.AcrobatStance.Description", "AcrobatStance gives a Chiblocker a higher probability of blocking a Bender's Chi while granting them a Speed and Jump Boost. It also increases the rate at which the hunger bar depletes. To use, simply left click. Left clicking again will de-activate the stance.");
|
config.addDefault("Abilities.Chi.AcrobatStance.Description", "AcrobatStance gives a Chiblocker a higher probability of blocking a Bender's Chi while granting them a Speed and Jump Boost. It also increases the rate at which the hunger bar depletes. To use, simply left click. Left clicking again will de-activate the stance.");
|
||||||
|
|
Loading…
Reference in a new issue