mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-01-03 13:38:20 +00:00
New ClickType / Fixes Immobilize bug
Added new ClickType (LEFT_CLICK_ENTITY) Updated Immobilize to use LEFT_CLICK_ENTITY to fix being able to do the steps of Immobilize without hitting an entity
This commit is contained in:
parent
249f2f451e
commit
cc23128b5b
5 changed files with 136 additions and 137 deletions
|
@ -317,32 +317,31 @@ public class PKListener implements Listener {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
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);
|
||||||
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();
|
||||||
String prefix = "";
|
String prefix = "";
|
||||||
|
|
||||||
if (bPlayer == null) {
|
if (bPlayer == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (bPlayer.getElements().size() > 1) {
|
if (bPlayer.getElements().size() > 1) {
|
||||||
prefix = Element.AVATAR.getPrefix();
|
prefix = Element.AVATAR.getPrefix();
|
||||||
} else if (element != null){
|
} else if (element != null) {
|
||||||
prefix = element.getPrefix();
|
prefix = element.getPrefix();
|
||||||
} else {
|
} else {
|
||||||
prefix = ChatColor.WHITE + "[Nonbender] ";
|
prefix = ChatColor.WHITE + "[Nonbender] ";
|
||||||
}
|
}
|
||||||
player.setDisplayName(player.getName());
|
player.setDisplayName(player.getName());
|
||||||
player.setDisplayName(prefix + ChatColor.RESET + player.getDisplayName());
|
player.setDisplayName(prefix + ChatColor.RESET + player.getDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getResult() == Result.REMOVE) {
|
if (event.getResult() == Result.REMOVE) {
|
||||||
if (GeneralMethods.hasRPG()) {
|
if (GeneralMethods.hasRPG()) {
|
||||||
RPGMethods.revokeAvatar(player.getUniqueId());
|
RPGMethods.revokeAvatar(player.getUniqueId());
|
||||||
|
@ -390,7 +389,7 @@ public class PKListener implements Listener {
|
||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
public void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
|
public void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
|
||||||
Block block = event.getDamager();
|
Block block = event.getDamager();
|
||||||
|
|
||||||
if (TempBlock.isTempBlock(block)) {
|
if (TempBlock.isTempBlock(block)) {
|
||||||
if (EarthAbility.isEarthbendable(block.getType()) && GeneralMethods.isSolid(block)) {
|
if (EarthAbility.isEarthbendable(block.getType()) && GeneralMethods.isSolid(block)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -422,7 +421,7 @@ public class PKListener implements Listener {
|
||||||
if (bPlayer == null) {
|
if (bPlayer == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bPlayer.isElementToggled(Element.FIRE)) {
|
if (bPlayer.isElementToggled(Element.FIRE)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -434,7 +433,7 @@ public class PKListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onEntityDeath(EntityDeathEvent event) {
|
public void onEntityDeath(EntityDeathEvent event) {
|
||||||
if (MetalClips.getEntityClipsCount().containsKey(event.getEntity())) {
|
if (MetalClips.getEntityClipsCount().containsKey(event.getEntity())) {
|
||||||
|
@ -445,19 +444,20 @@ public class PKListener implements Listener {
|
||||||
newdrops.add(drops.get(i));
|
newdrops.add(drops.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
newdrops.add(new ItemStack(Material.IRON_INGOT, MetalClips.getEntityClipsCount().get(event.getEntity())));
|
newdrops.add(new ItemStack(Material.IRON_INGOT, MetalClips.getEntityClipsCount().get(event.getEntity())));
|
||||||
newdrops.add(MetalClips.getOriginalHelmet(event.getEntity()));
|
newdrops.add(MetalClips.getOriginalHelmet(event.getEntity()));
|
||||||
newdrops.add(MetalClips.getOriginalChestplate(event.getEntity()));
|
newdrops.add(MetalClips.getOriginalChestplate(event.getEntity()));
|
||||||
newdrops.add(MetalClips.getOriginalLeggings(event.getEntity()));
|
newdrops.add(MetalClips.getOriginalLeggings(event.getEntity()));
|
||||||
newdrops.add(MetalClips.getOriginalBoots(event.getEntity()));
|
newdrops.add(MetalClips.getOriginalBoots(event.getEntity()));
|
||||||
|
|
||||||
event.getDrops().clear();
|
event.getDrops().clear();
|
||||||
event.getDrops().addAll(newdrops);
|
event.getDrops().addAll(newdrops);
|
||||||
MetalClips.getEntityClipsCount().remove(event.getEntity());
|
MetalClips.getEntityClipsCount().remove(event.getEntity());
|
||||||
}
|
}
|
||||||
for (FireCombo fc : CoreAbility.getAbilities(event.getEntity().getKiller(), FireCombo.class)) {
|
for (FireCombo fc : CoreAbility.getAbilities(event.getEntity().getKiller(), FireCombo.class)) {
|
||||||
if (!fc.getAffectedEntities().contains(event.getEntity())) continue;
|
if (!fc.getAffectedEntities().contains(event.getEntity()))
|
||||||
|
continue;
|
||||||
List<ItemStack> drops = event.getDrops();
|
List<ItemStack> drops = event.getDrops();
|
||||||
List<ItemStack> newDrops = new ArrayList<>();
|
List<ItemStack> newDrops = new ArrayList<>();
|
||||||
for (int i = 0; i < drops.size(); i++) {
|
for (int i = 0; i < drops.size(); i++) {
|
||||||
|
@ -490,7 +490,7 @@ public class PKListener implements Listener {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
newDrops.add(cooked);
|
newDrops.add(cooked);
|
||||||
}
|
}
|
||||||
event.getDrops().clear();
|
event.getDrops().clear();
|
||||||
|
@ -644,7 +644,7 @@ public class PKListener implements Listener {
|
||||||
double maxDamage = plugin.getConfig().getDouble("Properties.HorizontalCollisionPhysics.WallDamageCap");
|
double maxDamage = plugin.getConfig().getDouble("Properties.HorizontalCollisionPhysics.WallDamageCap");
|
||||||
double damage = ((e.getDistanceTraveled() - minimumDistance) < 0 ? 0 : e.getDistanceTraveled() - minimumDistance) / (e.getDifference().length());
|
double damage = ((e.getDistanceTraveled() - minimumDistance) < 0 ? 0 : e.getDistanceTraveled() - minimumDistance) / (e.getDifference().length());
|
||||||
if (damage > 0) {
|
if (damage > 0) {
|
||||||
if(damage <= maxDamage) {
|
if (damage <= maxDamage) {
|
||||||
DamageHandler.damageEntity((LivingEntity) e.getEntity(), damage, e.getAbility());
|
DamageHandler.damageEntity((LivingEntity) e.getEntity(), damage, e.getAbility());
|
||||||
} else {
|
} else {
|
||||||
DamageHandler.damageEntity((LivingEntity) e.getEntity(), maxDamage, e.getAbility());
|
DamageHandler.damageEntity((LivingEntity) e.getEntity(), maxDamage, e.getAbility());
|
||||||
|
@ -679,11 +679,11 @@ public class PKListener implements Listener {
|
||||||
public void onPlayerBendingDeath(EntityBendingDeathEvent event) {
|
public void onPlayerBendingDeath(EntityBendingDeathEvent event) {
|
||||||
if (ConfigManager.languageConfig.get().getBoolean("DeathMessages.Enabled") && event.getEntity() instanceof Player) {
|
if (ConfigManager.languageConfig.get().getBoolean("DeathMessages.Enabled") && event.getEntity() instanceof Player) {
|
||||||
Ability ability = event.getAbility();
|
Ability ability = event.getAbility();
|
||||||
|
|
||||||
if (ability == null) {
|
if (ability == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(ability.getElement().getColor());
|
sb.append(ability.getElement().getColor());
|
||||||
sb.append(event.getAbility().getName());
|
sb.append(event.getAbility().getName());
|
||||||
|
@ -710,7 +710,7 @@ public class PKListener implements Listener {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||||
ChatColor color = ChatColor.WHITE;
|
ChatColor color = ChatColor.WHITE;
|
||||||
|
|
||||||
if (bPlayer == null) {
|
if (bPlayer == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -741,11 +741,11 @@ public class PKListener implements Listener {
|
||||||
if (event.getEntity() instanceof Player) {
|
if (event.getEntity() instanceof Player) {
|
||||||
Player player = (Player) event.getEntity();
|
Player player = (Player) event.getEntity();
|
||||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||||
|
|
||||||
if (bPlayer == null) {
|
if (bPlayer == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bPlayer.hasElement(Element.EARTH) && event.getCause() == DamageCause.FALL) {
|
if (bPlayer.hasElement(Element.EARTH) && event.getCause() == DamageCause.FALL) {
|
||||||
new Shockwave(player, true);
|
new Shockwave(player, true);
|
||||||
}
|
}
|
||||||
|
@ -775,7 +775,8 @@ public class PKListener implements Listener {
|
||||||
double newdamage = event.getDamage() * ChiPassive.getFallReductionFactor();
|
double newdamage = event.getDamage() * ChiPassive.getFallReductionFactor();
|
||||||
double finaldamage = initdamage - newdamage;
|
double finaldamage = initdamage - newdamage;
|
||||||
event.setDamage(finaldamage);
|
event.setDamage(finaldamage);
|
||||||
if (finaldamage <= 0.4) event.setCancelled(true);
|
if (finaldamage <= 0.4)
|
||||||
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!event.isCancelled() && event.getCause() == DamageCause.FALL) {
|
if (!event.isCancelled() && event.getCause() == DamageCause.FALL) {
|
||||||
|
@ -785,9 +786,7 @@ public class PKListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bPlayer.canBendPassive(Element.FIRE)
|
if (bPlayer.canBendPassive(Element.FIRE) && bPlayer.hasElement(Element.FIRE) && (event.getCause() == DamageCause.FIRE || event.getCause() == DamageCause.FIRE_TICK)) {
|
||||||
&& bPlayer.hasElement(Element.FIRE)
|
|
||||||
&& (event.getCause() == DamageCause.FIRE || event.getCause() == DamageCause.FIRE_TICK)) {
|
|
||||||
event.setCancelled(!HeatControlExtinguish.canBurn(player));
|
event.setCancelled(!HeatControlExtinguish.canBurn(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -832,9 +831,9 @@ public class PKListener implements Listener {
|
||||||
if (sourceBPlayer == null) {
|
if (sourceBPlayer == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String boundAbil = sourceBPlayer.getBoundAbilityName();
|
String boundAbil = sourceBPlayer.getBoundAbilityName();
|
||||||
|
|
||||||
if (sourceBPlayer.canBendPassive(Element.CHI)) {
|
if (sourceBPlayer.canBendPassive(Element.CHI)) {
|
||||||
if (e.getCause() == DamageCause.ENTITY_ATTACK && e.getDamage() == 1) {
|
if (e.getCause() == DamageCause.ENTITY_ATTACK && e.getDamage() == 1) {
|
||||||
if (sourceBPlayer.getBoundAbility() instanceof ChiAbility) {
|
if (sourceBPlayer.getBoundAbility() instanceof ChiAbility) {
|
||||||
|
@ -859,8 +858,7 @@ public class PKListener implements Listener {
|
||||||
}
|
}
|
||||||
if (e.getCause() == DamageCause.ENTITY_ATTACK && sourceBPlayer.isElementToggled(Element.CHI) == true) {
|
if (e.getCause() == DamageCause.ENTITY_ATTACK && sourceBPlayer.isElementToggled(Element.CHI) == true) {
|
||||||
if (boundAbil.equalsIgnoreCase("Paralyze") && e.getDamage() == 1) {
|
if (boundAbil.equalsIgnoreCase("Paralyze") && e.getDamage() == 1) {
|
||||||
if (sourcePlayer.getWorld().equals(targetPlayer.getWorld())
|
if (sourcePlayer.getWorld().equals(targetPlayer.getWorld()) && Math.abs(sourcePlayer.getLocation().distance(targetPlayer.getLocation())) < 3) {
|
||||||
&& Math.abs(sourcePlayer.getLocation().distance(targetPlayer.getLocation())) < 3) {
|
|
||||||
new Paralyze(sourcePlayer, targetPlayer);
|
new Paralyze(sourcePlayer, targetPlayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -875,19 +873,17 @@ public class PKListener implements Listener {
|
||||||
if (!(event.getEntity() instanceof Player)) {
|
if (!(event.getEntity() instanceof Player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = event.getEntity();
|
Player player = event.getEntity();
|
||||||
EarthArmor earthArmor = CoreAbility.getAbility(player, EarthArmor.class);
|
EarthArmor earthArmor = CoreAbility.getAbility(player, EarthArmor.class);
|
||||||
PlantArmor plantArmor = CoreAbility.getAbility(player, PlantArmor.class);
|
PlantArmor plantArmor = CoreAbility.getAbility(player, PlantArmor.class);
|
||||||
|
|
||||||
if (earthArmor != null) {
|
if (earthArmor != null) {
|
||||||
List<ItemStack> drops = event.getDrops();
|
List<ItemStack> drops = event.getDrops();
|
||||||
List<ItemStack> newDrops = new ArrayList<ItemStack>();
|
List<ItemStack> newDrops = new ArrayList<ItemStack>();
|
||||||
for (int i = 0; i < drops.size(); i++) {
|
for (int i = 0; i < drops.size(); i++) {
|
||||||
Material type = drops.get(i).getType();
|
Material type = drops.get(i).getType();
|
||||||
if (!(type == Material.LEATHER_BOOTS || type == Material.LEATHER_CHESTPLATE
|
if (!(type == Material.LEATHER_BOOTS || type == Material.LEATHER_CHESTPLATE || type == Material.LEATHER_HELMET || type == Material.LEATHER_LEGGINGS || type == Material.AIR)) {
|
||||||
|| type == Material.LEATHER_HELMET || type == Material.LEATHER_LEGGINGS
|
|
||||||
|| type == Material.AIR)) {
|
|
||||||
newDrops.add(drops.get(i));
|
newDrops.add(drops.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -902,16 +898,14 @@ public class PKListener implements Listener {
|
||||||
event.getDrops().addAll(newDrops);
|
event.getDrops().addAll(newDrops);
|
||||||
earthArmor.remove();
|
earthArmor.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plantArmor != null) {
|
if (plantArmor != null) {
|
||||||
List<ItemStack> drops = event.getDrops();
|
List<ItemStack> drops = event.getDrops();
|
||||||
List<ItemStack> newDrops = new ArrayList<>();
|
List<ItemStack> newDrops = new ArrayList<>();
|
||||||
|
|
||||||
for (int i = 0; i < drops.size(); i++) {
|
for (int i = 0; i < drops.size(); i++) {
|
||||||
Material type = drops.get(i).getType();
|
Material type = drops.get(i).getType();
|
||||||
if (!(type == Material.LEATHER_BOOTS || type == Material.LEATHER_CHESTPLATE
|
if (!(type == Material.LEATHER_BOOTS || type == Material.LEATHER_CHESTPLATE || type == Material.LEAVES || type == Material.LEAVES_2 || type == Material.LEATHER_LEGGINGS || type == Material.AIR)) {
|
||||||
|| type == Material.LEAVES || type == Material.LEAVES_2
|
|
||||||
|| type == Material.LEATHER_LEGGINGS || type == Material.AIR)) {
|
|
||||||
newDrops.add(drops.get(i));
|
newDrops.add(drops.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -922,12 +916,12 @@ public class PKListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
event.getDrops().clear();
|
event.getDrops().clear();
|
||||||
event.getDrops().addAll(newDrops);
|
event.getDrops().addAll(newDrops);
|
||||||
plantArmor.remove();
|
plantArmor.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MetalClips.getEntityClipsCount().containsKey(event.getEntity())) {
|
if (MetalClips.getEntityClipsCount().containsKey(event.getEntity())) {
|
||||||
List<ItemStack> drops = event.getDrops();
|
List<ItemStack> drops = event.getDrops();
|
||||||
List<ItemStack> newdrops = new ArrayList<ItemStack>();
|
List<ItemStack> newdrops = new ArrayList<ItemStack>();
|
||||||
|
@ -936,17 +930,17 @@ public class PKListener implements Listener {
|
||||||
newdrops.add(drops.get(i));
|
newdrops.add(drops.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
newdrops.add(MetalClips.getOriginalHelmet(event.getEntity()));
|
newdrops.add(MetalClips.getOriginalHelmet(event.getEntity()));
|
||||||
newdrops.add(MetalClips.getOriginalChestplate(event.getEntity()));
|
newdrops.add(MetalClips.getOriginalChestplate(event.getEntity()));
|
||||||
newdrops.add(MetalClips.getOriginalLeggings(event.getEntity()));
|
newdrops.add(MetalClips.getOriginalLeggings(event.getEntity()));
|
||||||
newdrops.add(MetalClips.getOriginalBoots(event.getEntity()));
|
newdrops.add(MetalClips.getOriginalBoots(event.getEntity()));
|
||||||
|
|
||||||
event.getDrops().clear();
|
event.getDrops().clear();
|
||||||
event.getDrops().addAll(newdrops);
|
event.getDrops().addAll(newdrops);
|
||||||
MetalClips.getEntityClipsCount().remove(event.getEntity());
|
MetalClips.getEntityClipsCount().remove(event.getEntity());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getEntity().getKiller() != null) {
|
if (event.getEntity().getKiller() != null) {
|
||||||
if (BENDING_PLAYER_DEATH.containsKey(event.getEntity())) {
|
if (BENDING_PLAYER_DEATH.containsKey(event.getEntity())) {
|
||||||
String message = ConfigManager.languageConfig.get().getString("DeathMessages.Default");
|
String message = ConfigManager.languageConfig.get().getString("DeathMessages.Default");
|
||||||
|
@ -955,11 +949,11 @@ public class PKListener implements Listener {
|
||||||
CoreAbility coreAbil = CoreAbility.getAbility(ability);
|
CoreAbility coreAbil = CoreAbility.getAbility(ability);
|
||||||
Element element = null;
|
Element element = null;
|
||||||
boolean isAvatarAbility = false;
|
boolean isAvatarAbility = false;
|
||||||
|
|
||||||
if (coreAbil != null) {
|
if (coreAbil != null) {
|
||||||
element = coreAbil.getElement();
|
element = coreAbil.getElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HorizontalVelocityTracker.hasBeenDamagedByHorizontalVelocity(event.getEntity()) && Arrays.asList(HorizontalVelocityTracker.abils).contains(tempAbility)) {
|
if (HorizontalVelocityTracker.hasBeenDamagedByHorizontalVelocity(event.getEntity()) && Arrays.asList(HorizontalVelocityTracker.abils).contains(tempAbility)) {
|
||||||
if (ConfigManager.languageConfig.get().contains("Abilities." + element.getName() + "." + tempAbility + ".HorizontalVelocityDeath")) {
|
if (ConfigManager.languageConfig.get().contains("Abilities." + element.getName() + "." + tempAbility + ".HorizontalVelocityDeath")) {
|
||||||
message = ConfigManager.languageConfig.get().getString("Abilities." + element.getName() + "." + tempAbility + ".HorizontalVelocityDeath");
|
message = ConfigManager.languageConfig.get().getString("Abilities." + element.getName() + "." + tempAbility + ".HorizontalVelocityDeath");
|
||||||
|
@ -997,20 +991,20 @@ public class PKListener implements Listener {
|
||||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||||
final UUID uuid = player.getUniqueId();
|
final UUID uuid = player.getUniqueId();
|
||||||
RIGHT_CLICK_INTERACT.add(uuid);
|
RIGHT_CLICK_INTERACT.add(uuid);
|
||||||
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
RIGHT_CLICK_INTERACT.remove(uuid);
|
RIGHT_CLICK_INTERACT.remove(uuid);
|
||||||
}
|
}
|
||||||
}.runTaskLater(plugin, 5);
|
}.runTaskLater(plugin, 5);
|
||||||
|
|
||||||
if (event.getClickedBlock() != null) {
|
if (event.getClickedBlock() != null) {
|
||||||
ComboManager.addComboAbility(player, ClickType.RIGHT_CLICK_BLOCK);
|
ComboManager.addComboAbility(player, ClickType.RIGHT_CLICK_BLOCK);
|
||||||
} else {
|
} else {
|
||||||
ComboManager.addComboAbility(player, ClickType.RIGHT_CLICK);
|
ComboManager.addComboAbility(player, ClickType.RIGHT_CLICK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bPlayer.getBoundAbilityName().equalsIgnoreCase("EarthSmash")) {
|
if (bPlayer.getBoundAbilityName().equalsIgnoreCase("EarthSmash")) {
|
||||||
new EarthSmash(player, ClickType.RIGHT_CLICK);
|
new EarthSmash(player, ClickType.RIGHT_CLICK);
|
||||||
}
|
}
|
||||||
|
@ -1019,17 +1013,17 @@ public class PKListener implements Listener {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
ComboManager.addComboAbility(player, ClickType.RIGHT_CLICK_ENTITY);
|
ComboManager.addComboAbility(player, ClickType.RIGHT_CLICK_ENTITY);
|
||||||
|
|
||||||
if (Paralyze.isParalyzed(player) || ChiCombo.isParalyzed(player) || Bloodbending.isBloodbent(player) || Suffocate.isBreathbent(player)) {
|
if (Paralyze.isParalyzed(player) || ChiCombo.isParalyzed(player) || Bloodbending.isBloodbent(player) || Suffocate.isBreathbent(player)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -1039,7 +1033,7 @@ public class PKListener implements Listener {
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
JUMPS.put(player, player.getStatistic(Statistic.JUMP));
|
JUMPS.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());
|
||||||
}
|
}
|
||||||
|
@ -1070,9 +1064,7 @@ public class PKListener implements Listener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (CoreAbility.hasAbility(player, WaterSpout.class)
|
else if (CoreAbility.hasAbility(player, WaterSpout.class) || CoreAbility.hasAbility(player, AirSpout.class) || CoreAbility.hasAbility(player, SandSpout.class)) {
|
||||||
|| CoreAbility.hasAbility(player, AirSpout.class)
|
|
||||||
|| CoreAbility.hasAbility(player, SandSpout.class)) {
|
|
||||||
Vector vel = new Vector();
|
Vector vel = new Vector();
|
||||||
vel.setX(event.getTo().getX() - event.getFrom().getX());
|
vel.setX(event.getTo().getX() - event.getFrom().getX());
|
||||||
vel.setY(event.getTo().getY() - event.getFrom().getY());
|
vel.setY(event.getTo().getY() - event.getFrom().getY());
|
||||||
|
@ -1109,8 +1101,8 @@ public class PKListener implements Listener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||||
if (bPlayer != null) {
|
if (bPlayer != null) {
|
||||||
|
@ -1123,17 +1115,17 @@ public class PKListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getTo().getY() > event.getFrom().getY()) {
|
if (event.getTo().getY() > event.getFrom().getY()) {
|
||||||
if (!(player.getLocation().getBlock().getType() == Material.VINE) && !(player.getLocation().getBlock().getType() == Material.LADDER)) {
|
if (!(player.getLocation().getBlock().getType() == Material.VINE) && !(player.getLocation().getBlock().getType() == Material.LADDER)) {
|
||||||
int current = player.getStatistic(Statistic.JUMP);
|
int current = player.getStatistic(Statistic.JUMP);
|
||||||
int last = JUMPS.get(player);
|
int last = JUMPS.get(player);
|
||||||
|
|
||||||
if (last != current) {
|
if (last != current) {
|
||||||
JUMPS.put(player, current);
|
JUMPS.put(player, current);
|
||||||
|
|
||||||
double yDif = event.getTo().getY() - event.getFrom().getY();
|
double yDif = event.getTo().getY() - event.getFrom().getY();
|
||||||
|
|
||||||
if ((yDif < 0.035 || yDif > 0.037) && (yDif < 0.116 || yDif > 0.118)) {
|
if ((yDif < 0.035 || yDif > 0.037) && (yDif < 0.116 || yDif > 0.118)) {
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new PlayerJumpEvent(player, yDif));
|
Bukkit.getServer().getPluginManager().callEvent(new PlayerJumpEvent(player, yDif));
|
||||||
}
|
}
|
||||||
|
@ -1141,7 +1133,7 @@ public class PKListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerGamemodeChange(PlayerGameModeChangeEvent event) {
|
public void onPlayerGamemodeChange(PlayerGameModeChangeEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
@ -1149,18 +1141,17 @@ public class PKListener implements Listener {
|
||||||
if (!Commands.invincible.contains(player.getName())) {
|
if (!Commands.invincible.contains(player.getName())) {
|
||||||
Commands.invincible.add(player.getName());
|
Commands.invincible.add(player.getName());
|
||||||
}
|
}
|
||||||
}
|
} else if (!(event.getNewGameMode() == GameMode.SPECTATOR) && Commands.invincible.contains(player.getName())) {
|
||||||
else if (!(event.getNewGameMode() == GameMode.SPECTATOR) && Commands.invincible.contains(player.getName())) {
|
|
||||||
Commands.invincible.remove(player.getName());
|
Commands.invincible.remove(player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||||
|
|
||||||
if (bPlayer != null) {
|
if (bPlayer != null) {
|
||||||
if (TOGGLED_OUT.contains(player.getUniqueId()) && bPlayer.isToggled()) {
|
if (TOGGLED_OUT.contains(player.getUniqueId()) && bPlayer.isToggled()) {
|
||||||
TOGGLED_OUT.remove(player.getUniqueId());
|
TOGGLED_OUT.remove(player.getUniqueId());
|
||||||
|
@ -1178,7 +1169,7 @@ public class PKListener implements Listener {
|
||||||
EarthArmor earthArmor = CoreAbility.getAbility(player, EarthArmor.class);
|
EarthArmor earthArmor = CoreAbility.getAbility(player, EarthArmor.class);
|
||||||
PlantArmor plantArmor = CoreAbility.getAbility(player, PlantArmor.class);
|
PlantArmor plantArmor = CoreAbility.getAbility(player, PlantArmor.class);
|
||||||
MetalClips metalClips = CoreAbility.getAbility(player, MetalClips.class);
|
MetalClips metalClips = CoreAbility.getAbility(player, MetalClips.class);
|
||||||
|
|
||||||
if (earthArmor != null) {
|
if (earthArmor != null) {
|
||||||
earthArmor.remove();
|
earthArmor.remove();
|
||||||
}
|
}
|
||||||
|
@ -1211,11 +1202,8 @@ public class PKListener implements Listener {
|
||||||
|
|
||||||
String abilName = bPlayer.getBoundAbilityName();
|
String abilName = bPlayer.getBoundAbilityName();
|
||||||
if (Suffocate.isBreathbent(player)) {
|
if (Suffocate.isBreathbent(player)) {
|
||||||
if (!abilName.equalsIgnoreCase("AirSwipe")
|
if (!abilName.equalsIgnoreCase("AirSwipe") || !abilName.equalsIgnoreCase("FireBlast") || !abilName.equalsIgnoreCase("EarthBlast") || !abilName.equalsIgnoreCase("WaterManipulation")) {
|
||||||
|| !abilName.equalsIgnoreCase("FireBlast")
|
if (!player.isSneaking()) {
|
||||||
|| !abilName.equalsIgnoreCase("EarthBlast")
|
|
||||||
|| !abilName.equalsIgnoreCase("WaterManipulation")) {
|
|
||||||
if(!player.isSneaking()) {
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1232,7 +1220,6 @@ public class PKListener implements Listener {
|
||||||
|
|
||||||
AirScooter.check(player);
|
AirScooter.check(player);
|
||||||
|
|
||||||
|
|
||||||
CoreAbility coreAbil = bPlayer.getBoundAbility();
|
CoreAbility coreAbil = bPlayer.getBoundAbility();
|
||||||
String abil = bPlayer.getBoundAbilityName();
|
String abil = bPlayer.getBoundAbilityName();
|
||||||
if (coreAbil == null) {
|
if (coreAbil == null) {
|
||||||
|
@ -1243,7 +1230,7 @@ public class PKListener implements Listener {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!player.isSneaking() && bPlayer.canBendIgnoreCooldowns(coreAbil)) {
|
if (!player.isSneaking() && bPlayer.canBendIgnoreCooldowns(coreAbil)) {
|
||||||
if (coreAbil instanceof AddonAbility) {
|
if (coreAbil instanceof AddonAbility) {
|
||||||
return;
|
return;
|
||||||
|
@ -1313,7 +1300,7 @@ public class PKListener implements Listener {
|
||||||
new WaterArms(player);
|
new WaterArms(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (coreAbil instanceof EarthAbility && bPlayer.isElementToggled(Element.EARTH) == true) {
|
if (coreAbil instanceof EarthAbility && bPlayer.isElementToggled(Element.EARTH) == true) {
|
||||||
if (GeneralMethods.isWeapon(player.getItemInHand().getType()) && !plugin.getConfig().getBoolean("Properties.Earth.CanBendWithWeapons")) {
|
if (GeneralMethods.isWeapon(player.getItemInHand().getType()) && !plugin.getConfig().getBoolean("Properties.Earth.CanBendWithWeapons")) {
|
||||||
return;
|
return;
|
||||||
|
@ -1391,14 +1378,14 @@ public class PKListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onPlayerSlotChange(PlayerItemHeldEvent event) {
|
public void onPlayerSlotChange(PlayerItemHeldEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
WaterArms waterArms = CoreAbility.getAbility(player, WaterArms.class);
|
WaterArms waterArms = CoreAbility.getAbility(player, WaterArms.class);
|
||||||
if (waterArms != null) {
|
if (waterArms != null) {
|
||||||
waterArms.displayBoundMsg(event.getNewSlot()+1);
|
waterArms.displayBoundMsg(event.getNewSlot() + 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1410,14 +1397,20 @@ public class PKListener implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||||
if (bPlayer == null) {
|
if (bPlayer == null) {
|
||||||
return;
|
return;
|
||||||
} else if (RIGHT_CLICK_INTERACT.contains(player.getUniqueId())) {
|
} else if (RIGHT_CLICK_INTERACT.contains(player.getUniqueId())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ComboManager.addComboAbility(player, ClickType.LEFT_CLICK);
|
Entity target = GeneralMethods.getTargetedEntity(player, 3);
|
||||||
|
if (target != null && !(target.equals(player)) && target instanceof LivingEntity) {
|
||||||
|
ComboManager.addComboAbility(player, ClickType.LEFT_CLICK_ENTITY);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ComboManager.addComboAbility(player, ClickType.LEFT_CLICK);
|
||||||
|
}
|
||||||
|
|
||||||
if (Suffocate.isBreathbent(player)) {
|
if (Suffocate.isBreathbent(player)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -1428,7 +1421,7 @@ public class PKListener implements Listener {
|
||||||
} else if (bPlayer.isChiBlocked()) {
|
} else if (bPlayer.isChiBlocked()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
} else if (GeneralMethods.isInteractable(player.getTargetBlock((Set<Material>)null, 5))) {
|
} else if (GeneralMethods.isInteractable(player.getTargetBlock((Set<Material>) null, 5))) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
} else if (player.getItemInHand().getType() == Material.FISHING_ROD) {
|
} else if (player.getItemInHand().getType() == Material.FISHING_ROD) {
|
||||||
|
@ -1440,7 +1433,7 @@ public class PKListener implements Listener {
|
||||||
|
|
||||||
String abil = bPlayer.getBoundAbilityName();
|
String abil = bPlayer.getBoundAbilityName();
|
||||||
CoreAbility coreAbil = bPlayer.getBoundAbility();
|
CoreAbility coreAbil = bPlayer.getBoundAbility();
|
||||||
|
|
||||||
if (coreAbil == null && !MultiAbilityManager.hasMultiAbilityBound(player)) {
|
if (coreAbil == null && !MultiAbilityManager.hasMultiAbilityBound(player)) {
|
||||||
return;
|
return;
|
||||||
} else if (bPlayer.canBendIgnoreCooldowns(coreAbil)) {
|
} else if (bPlayer.canBendIgnoreCooldowns(coreAbil)) {
|
||||||
|
@ -1656,11 +1649,7 @@ public class PKListener implements Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (CoreAbility.hasAbility(player, Tornado.class)
|
if (CoreAbility.hasAbility(player, Tornado.class) || Bloodbending.isBloodbent(player) || Suffocate.isBreathbent(player) || CoreAbility.hasAbility(player, FireJet.class) || CoreAbility.hasAbility(player, AvatarState.class)) {
|
||||||
|| Bloodbending.isBloodbent(player)
|
|
||||||
|| Suffocate.isBreathbent(player)
|
|
||||||
|| CoreAbility.hasAbility(player, FireJet.class)
|
|
||||||
|| CoreAbility.hasAbility(player, AvatarState.class)) {
|
|
||||||
event.setCancelled(player.getGameMode() != GameMode.CREATIVE);
|
event.setCancelled(player.getGameMode() != GameMode.CREATIVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1690,7 +1679,7 @@ public class PKListener implements Listener {
|
||||||
public static ArrayList<UUID> getToggledOut() {
|
public static ArrayList<UUID> getToggledOut() {
|
||||||
return TOGGLED_OUT;
|
return TOGGLED_OUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<Player, Integer> getJumpStatistics() {
|
public static Map<Player, Integer> getJumpStatistics() {
|
||||||
return JUMPS;
|
return JUMPS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import com.projectkorra.projectkorra.util.ClickType;
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterCombo;
|
import com.projectkorra.projectkorra.waterbending.WaterCombo;
|
||||||
|
|
||||||
public class ComboManager {
|
public class ComboManager {
|
||||||
|
|
||||||
private static final long CLEANUP_DELAY = 20 * 600;
|
private static final long CLEANUP_DELAY = 20 * 600;
|
||||||
private static final ConcurrentHashMap<String, ArrayList<AbilityInformation>> RECENTLY_USED = new ConcurrentHashMap<>();
|
private static final ConcurrentHashMap<String, ArrayList<AbilityInformation>> RECENTLY_USED = new ConcurrentHashMap<>();
|
||||||
private static final HashMap<String, ComboAbilityInfo> COMBO_ABILITIES = new HashMap<>();
|
private static final HashMap<String, ComboAbilityInfo> COMBO_ABILITIES = new HashMap<>();
|
||||||
|
@ -34,7 +34,7 @@ public class ComboManager {
|
||||||
COMBO_ABILITIES.clear();
|
COMBO_ABILITIES.clear();
|
||||||
DESCRIPTIONS.clear();
|
DESCRIPTIONS.clear();
|
||||||
INSTRUCTIONS.clear();
|
INSTRUCTIONS.clear();
|
||||||
|
|
||||||
if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Fire.FireCombo.FireKick.Enabled")) {
|
if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Fire.FireCombo.FireKick.Enabled")) {
|
||||||
ArrayList<AbilityInformation> fireKick = new ArrayList<>();
|
ArrayList<AbilityInformation> fireKick = new ArrayList<>();
|
||||||
fireKick.add(new AbilityInformation("FireBlast", ClickType.LEFT_CLICK));
|
fireKick.add(new AbilityInformation("FireBlast", ClickType.LEFT_CLICK));
|
||||||
|
@ -157,15 +157,15 @@ public class ComboManager {
|
||||||
|
|
||||||
if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Chi.ChiCombo.Immobilize.Enabled")) {
|
if (ConfigManager.defaultConfig.get().getBoolean("Abilities.Chi.ChiCombo.Immobilize.Enabled")) {
|
||||||
ArrayList<AbilityInformation> immobilize = new ArrayList<>();
|
ArrayList<AbilityInformation> immobilize = new ArrayList<>();
|
||||||
immobilize.add(new AbilityInformation("QuickStrike", ClickType.LEFT_CLICK));
|
immobilize.add(new AbilityInformation("QuickStrike", ClickType.LEFT_CLICK_ENTITY));
|
||||||
immobilize.add(new AbilityInformation("SwiftKick", ClickType.LEFT_CLICK));
|
immobilize.add(new AbilityInformation("SwiftKick", ClickType.LEFT_CLICK_ENTITY));
|
||||||
immobilize.add(new AbilityInformation("QuickStrike", ClickType.LEFT_CLICK));
|
immobilize.add(new AbilityInformation("QuickStrike", ClickType.LEFT_CLICK_ENTITY));
|
||||||
immobilize.add(new AbilityInformation("QuickStrike", ClickType.LEFT_CLICK));
|
immobilize.add(new AbilityInformation("QuickStrike", ClickType.LEFT_CLICK_ENTITY));
|
||||||
COMBO_ABILITIES.put("Immobilize", new ComboAbilityInfo("Immobilize", immobilize, ChiCombo.class));
|
COMBO_ABILITIES.put("Immobilize", new ComboAbilityInfo("Immobilize", immobilize, ChiCombo.class));
|
||||||
DESCRIPTIONS.put("Immobilize", ConfigManager.languageConfig.get().getString("Abilities.Chi.Combo.Immobilize.Description"));
|
DESCRIPTIONS.put("Immobilize", ConfigManager.languageConfig.get().getString("Abilities.Chi.Combo.Immobilize.Description"));
|
||||||
INSTRUCTIONS.put("Immobilize", "QuickStrike (Left Click) > SwiftKick (Left Click) > QuickStrike (Left Click) > QuickStrike (Left Click)");
|
INSTRUCTIONS.put("Immobilize", "QuickStrike (Left Click) > SwiftKick (Left Click) > QuickStrike (Left Click) > QuickStrike (Left Click)");
|
||||||
}
|
}
|
||||||
|
|
||||||
startCleanupTask();
|
startCleanupTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ public class ComboManager {
|
||||||
if (bPlayer == null) {
|
if (bPlayer == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String abilityName = bPlayer.getBoundAbilityName();
|
String abilityName = bPlayer.getBoundAbilityName();
|
||||||
if (abilityName == null) {
|
if (abilityName == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -247,11 +247,16 @@ public class ComboManager {
|
||||||
|
|
||||||
boolean isValid = true;
|
boolean isValid = true;
|
||||||
for (int i = 1; i <= size; i++) {
|
for (int i = 1; i <= size; i++) {
|
||||||
if (!playerCombo.get(playerCombo.size() - i).equalsWithoutTime(abilityCombo.get(abilityCombo.size() - i))) {
|
AbilityInformation playerInfo = playerCombo.get(playerCombo.size() - i);
|
||||||
|
AbilityInformation comboInfo = abilityCombo.get(abilityCombo.size() - i);
|
||||||
|
if (playerInfo.getAbilityName().equals(comboInfo.getAbilityName()) && playerInfo.getClickType() == ClickType.LEFT_CLICK_ENTITY && comboInfo.getClickType() == ClickType.LEFT_CLICK) {
|
||||||
|
continue;
|
||||||
|
} else if (!playerInfo.equalsWithoutTime(comboInfo)) {
|
||||||
isValid = false;
|
isValid = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
return customAbility;
|
return customAbility;
|
||||||
}
|
}
|
||||||
|
@ -303,7 +308,7 @@ public class ComboManager {
|
||||||
if (coreAbil == null) {
|
if (coreAbil == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Element abilElement = coreAbil.getElement();
|
Element abilElement = coreAbil.getElement();
|
||||||
if (abilElement instanceof SubElement) {
|
if (abilElement instanceof SubElement) {
|
||||||
abilElement = ((SubElement) abilElement).getParentElement();
|
abilElement = ((SubElement) abilElement).getParentElement();
|
||||||
|
@ -324,7 +329,7 @@ public class ComboManager {
|
||||||
}
|
}
|
||||||
}.runTaskTimer(ProjectKorra.plugin, 0, CLEANUP_DELAY);
|
}.runTaskTimer(ProjectKorra.plugin, 0, CLEANUP_DELAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getCleanupDelay() {
|
public static long getCleanupDelay() {
|
||||||
return CLEANUP_DELAY;
|
return CLEANUP_DELAY;
|
||||||
}
|
}
|
||||||
|
@ -345,13 +350,11 @@ public class ComboManager {
|
||||||
return INSTRUCTIONS;
|
return INSTRUCTIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains information on an ability used in a combo.
|
* Contains information on an ability used in a combo.
|
||||||
*
|
*
|
||||||
* @author kingbirdy
|
* @author kingbirdy
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static class AbilityInformation {
|
public static class AbilityInformation {
|
||||||
private String abilityName;
|
private String abilityName;
|
||||||
|
|
|
@ -13,34 +13,36 @@ import java.util.ArrayList;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: Combo classes should eventually be rewritten so that each combo is treated
|
* TODO: Combo classes should eventually be rewritten so that each combo is
|
||||||
* as an individual ability. In the mean time, we will just place "fake"
|
* treated as an individual ability. In the mean time, we will just place "fake"
|
||||||
* classes so that CoreAbility will register each ability.
|
* classes so that CoreAbility will register each ability.
|
||||||
*/
|
*/
|
||||||
public class ChiCombo extends ChiAbility implements ComboAbility {
|
public class ChiCombo extends ChiAbility implements ComboAbility {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a Map containing every entity which is paralyzed, and the time in milliseconds at which they will be unparalyzed.
|
* a Map containing every entity which is paralyzed, and the time in
|
||||||
|
* milliseconds at which they will be unparalyzed.
|
||||||
*/
|
*/
|
||||||
private static final ConcurrentHashMap<Entity, Long> PARALYZED_ENTITIES = new ConcurrentHashMap<>();
|
private static final ConcurrentHashMap<Entity, Long> PARALYZED_ENTITIES = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private long duration;
|
private long duration;
|
||||||
private long cooldown;
|
private long cooldown;
|
||||||
private Entity target;
|
private Entity target;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
public ChiCombo(Player player, String ability) {
|
public ChiCombo(Player player, String ability) {
|
||||||
super(player);
|
super(player);
|
||||||
|
|
||||||
this.name = ability;
|
this.name = ability;
|
||||||
|
|
||||||
if (ability.equalsIgnoreCase("Immobilize")) {
|
if (ability.equalsIgnoreCase("Immobilize")) {
|
||||||
this.cooldown = getConfig().getLong("Abilities.Chi.ChiCombo.Immobilize.Cooldown");
|
this.cooldown = getConfig().getLong("Abilities.Chi.ChiCombo.Immobilize.Cooldown");
|
||||||
this.duration = getConfig().getLong("Abilities.Chi.ChiCombo.Immobilize.ParalyzeDuration");
|
this.duration = getConfig().getLong("Abilities.Chi.ChiCombo.Immobilize.ParalyzeDuration");
|
||||||
target = GeneralMethods.getTargetedEntity(player, 5);
|
target = GeneralMethods.getTargetedEntity(player, 5);
|
||||||
if (!bPlayer.canBendIgnoreBinds(this)) {
|
if (!bPlayer.canBendIgnoreBinds(this)) {
|
||||||
return;
|
return;
|
||||||
} if (target == null){
|
}
|
||||||
|
if (target == null) {
|
||||||
remove();
|
remove();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
@ -52,8 +54,9 @@ public class ChiCombo extends ChiAbility implements ComboAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Paralyzes the target for the given duration. The player will
|
* Paralyzes the target for the given duration. The player will be unable to
|
||||||
* be unable to move or interact for the duration.
|
* move or interact for the duration.
|
||||||
|
*
|
||||||
* @param target The Entity to be paralyzed
|
* @param target The Entity to be paralyzed
|
||||||
* @param duration The time in milliseconds the target will be paralyzed
|
* @param duration The time in milliseconds the target will be paralyzed
|
||||||
*/
|
*/
|
||||||
|
@ -64,15 +67,15 @@ public class ChiCombo extends ChiAbility implements ComboAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience method to see if a Player is paralyzed by a ChiCombo.
|
* Convenience method to see if a Player is paralyzed by a ChiCombo. Calls
|
||||||
* Calls {@link ChiCombo#isParalyzed(Entity)} with the Player casted to an Entity.
|
* {@link ChiCombo#isParalyzed(Entity)} with the Player casted to an Entity.
|
||||||
*
|
*
|
||||||
* @param player The player to check if they're paralyzed
|
* @param player The player to check if they're paralyzed
|
||||||
* @return True if the player is paralyzed, false otherwise
|
* @return True if the player is paralyzed, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isParalyzed(Player player) {
|
public static boolean isParalyzed(Player player) {
|
||||||
return isParalyzed((Entity) player);
|
return isParalyzed((Entity) player);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -86,16 +89,17 @@ public class ChiCombo extends ChiAbility implements ComboAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks the status of all paralyzed entities. If their paralysis has expired,
|
* Checks the status of all paralyzed entities. If their paralysis has
|
||||||
* it removes them from {@link ChiCombo#PARALYZED_ENTITIES paralyzedEntities} and
|
* expired, it removes them from {@link ChiCombo#PARALYZED_ENTITIES
|
||||||
* removes the instance of the combo from {@link ChiCombo#instances instances}.
|
* paralyzedEntities} and removes the instance of the combo from
|
||||||
|
* {@link ChiCombo#instances instances}.
|
||||||
*/
|
*/
|
||||||
public static void handleParalysis() {
|
public static void handleParalysis() {
|
||||||
for (Entity entity : PARALYZED_ENTITIES.keySet()) {
|
for (Entity entity : PARALYZED_ENTITIES.keySet()) {
|
||||||
entity.setFallDistance(0);
|
entity.setFallDistance(0);
|
||||||
if (PARALYZED_ENTITIES.get(entity) <= System.currentTimeMillis()) {
|
if (PARALYZED_ENTITIES.get(entity) <= System.currentTimeMillis()) {
|
||||||
PARALYZED_ENTITIES.remove(entity);
|
PARALYZED_ENTITIES.remove(entity);
|
||||||
|
|
||||||
for (ChiCombo combo : getAbilities(ChiCombo.class)) {
|
for (ChiCombo combo : getAbilities(ChiCombo.class)) {
|
||||||
if (combo.target == null) {
|
if (combo.target == null) {
|
||||||
combo.remove();
|
combo.remove();
|
||||||
|
@ -131,7 +135,7 @@ public class ChiCombo extends ChiAbility implements ComboAbility {
|
||||||
public boolean isHiddenAbility() {
|
public boolean isHiddenAbility() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSneakAbility() {
|
public boolean isSneakAbility() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -142,7 +146,6 @@ public class ChiCombo extends ChiAbility implements ComboAbility {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getInstructions() {
|
public String getInstructions() {
|
||||||
return null;
|
return null;
|
||||||
|
@ -185,13 +188,13 @@ public class ChiCombo extends ChiAbility implements ComboAbility {
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Immobilize extends ChiCombo {
|
public class Immobilize extends ChiCombo {
|
||||||
|
|
||||||
public Immobilize(Player player, String name) {
|
public Immobilize(Player player, String name) {
|
||||||
super(player, "Immobilize");
|
super(player, "Immobilize");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "Immobilize";
|
return "Immobilize";
|
||||||
|
|
|
@ -13,7 +13,7 @@ public class QuickStrike extends ChiAbility {
|
||||||
private int damage;
|
private int damage;
|
||||||
private int blockChance;
|
private int blockChance;
|
||||||
private Entity target;
|
private Entity target;
|
||||||
|
|
||||||
public QuickStrike(Player player) {
|
public QuickStrike(Player player) {
|
||||||
super(player);
|
super(player);
|
||||||
if (!bPlayer.canBend(this)) {
|
if (!bPlayer.canBend(this)) {
|
||||||
|
@ -28,7 +28,6 @@ public class QuickStrike extends ChiAbility {
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void progress() {
|
public void progress() {
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
|
@ -47,7 +46,7 @@ public class QuickStrike extends ChiAbility {
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "QuickStrike";
|
return "QuickStrike";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Location getLocation() {
|
public Location getLocation() {
|
||||||
return player != null ? player.getLocation() : null;
|
return player != null ? player.getLocation() : null;
|
||||||
|
@ -57,7 +56,7 @@ public class QuickStrike extends ChiAbility {
|
||||||
public long getCooldown() {
|
public long getCooldown() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSneakAbility() {
|
public boolean isSneakAbility() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -91,5 +90,5 @@ public class QuickStrike extends ChiAbility {
|
||||||
public void setTarget(Entity target) {
|
public void setTarget(Entity target) {
|
||||||
this.target = target;
|
this.target = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,12 @@ public enum ClickType {
|
||||||
*/
|
*/
|
||||||
LEFT_CLICK,
|
LEFT_CLICK,
|
||||||
/**
|
/**
|
||||||
* For any instance of right clicking that isn't with an entity or a block (Right clicking air will not work).
|
* For any instance of right clicking that isn't with an entity or a block
|
||||||
|
* (Right clicking air will not work).
|
||||||
|
*/
|
||||||
|
LEFT_CLICK_ENTITY,
|
||||||
|
/**
|
||||||
|
* Player has left clicked and hit an entity.
|
||||||
*/
|
*/
|
||||||
RIGHT_CLICK,
|
RIGHT_CLICK,
|
||||||
/**
|
/**
|
||||||
|
@ -27,7 +32,7 @@ public enum ClickType {
|
||||||
/**
|
/**
|
||||||
* The shift key being released.
|
* The shift key being released.
|
||||||
*/
|
*/
|
||||||
SHIFT_DOWN,
|
SHIFT_DOWN,
|
||||||
/**
|
/**
|
||||||
* The shift key being pressed.
|
* The shift key being pressed.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue