mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-09-11 12:49:32 +00:00
RapidPunch
Chi abilities complete.
This commit is contained in:
parent
959664c7b2
commit
003390ac92
|
@ -23,6 +23,7 @@ import com.projectkorra.ProjectKorra.airbending.AirSuction;
|
|||
import com.projectkorra.ProjectKorra.airbending.AirSwipe;
|
||||
import com.projectkorra.ProjectKorra.airbending.Tornado;
|
||||
import com.projectkorra.ProjectKorra.chiblocking.ChiPassive;
|
||||
import com.projectkorra.ProjectKorra.chiblocking.RapidPunch;
|
||||
import com.projectkorra.ProjectKorra.earthbending.Catapult;
|
||||
import com.projectkorra.ProjectKorra.earthbending.CompactColumn;
|
||||
import com.projectkorra.ProjectKorra.earthbending.EarthArmor;
|
||||
|
@ -108,6 +109,9 @@ public class BendingManager implements Runnable {
|
|||
AirSuction.progressAll();
|
||||
Fireball.progressAll();
|
||||
HealingWaters.heal(Bukkit.getServer());
|
||||
|
||||
for (Player p : RapidPunch.instance.keySet())
|
||||
RapidPunch.instance.get(p).startPunch(p);
|
||||
|
||||
for (Block block : RevertChecker.revertQueue.keySet()) {
|
||||
// Tools.removeEarthbendedBlockByIndex(block);
|
||||
|
|
|
@ -380,6 +380,13 @@ public class ConfigManager {
|
|||
config.addDefault("Abilities.Chi.Paralyze.Cooldown", 15000);
|
||||
config.addDefault("Abilities.Chi.Paralyze.Duration", 2000);
|
||||
|
||||
config.addDefault("Abilities.Chi.RapidPunch.Enabled", true);
|
||||
config.addDefault("Abilities.Chi.RapidPunch.Description", "This ability allows the chiblocker to punch rapidly in a short period. To use, simply punch. This has a short cooldown.");
|
||||
config.addDefault("Abilities.Chi.RapidPunch.Damage", 1);
|
||||
config.addDefault("Abilities.Chi.RapidPunch.Distance", 4);
|
||||
config.addDefault("Abilities.Chi.RapidPunch.Cooldown", 15000);
|
||||
config.addDefault("Abilities.Chi.RapidPunch.Punches", 4);
|
||||
|
||||
plugin.getConfig().addDefault("Storage.engine", "sqlite");
|
||||
|
||||
plugin.getConfig().addDefault("Storage.MySQL.host", "localhost");
|
||||
|
|
|
@ -61,6 +61,7 @@ import com.projectkorra.ProjectKorra.airbending.Tornado;
|
|||
import com.projectkorra.ProjectKorra.chiblocking.ChiPassive;
|
||||
import com.projectkorra.ProjectKorra.chiblocking.HighJump;
|
||||
import com.projectkorra.ProjectKorra.chiblocking.Paralyze;
|
||||
import com.projectkorra.ProjectKorra.chiblocking.RapidPunch;
|
||||
import com.projectkorra.ProjectKorra.earthbending.Catapult;
|
||||
import com.projectkorra.ProjectKorra.earthbending.Collapse;
|
||||
import com.projectkorra.ProjectKorra.earthbending.CompactColumn;
|
||||
|
@ -551,6 +552,9 @@ public class PKListener implements Listener {
|
|||
if (abil.equalsIgnoreCase("HighJump")) {
|
||||
new HighJump(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("RapidPunch")) {
|
||||
new RapidPunch(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -698,7 +702,7 @@ public class PKListener implements Listener {
|
|||
}
|
||||
if (damager.getItemInHand() != null && Methods.isWeapon(damager.getItemInHand().getType()) && !ProjectKorra.plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) {
|
||||
// Above method checks if the player has an item in their hand, if it is a weapon, and if they can bend with weapons.
|
||||
if (Methods.getBoundAbility(damager) == null) { // We don't want them to be able to block chi if an ability is bound.
|
||||
if (Methods.getBoundAbility(damager) == null || Methods.getBoundAbility(damager).equalsIgnoreCase("RapidPunch")) { // We don't want them to be able to block chi if an ability is bound.
|
||||
if (ChiPassive.willChiBlock(p)) {
|
||||
ChiPassive.blockChi(p);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
package com.projectkorra.ProjectKorra.chiblocking;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.projectkorra.ProjectKorra.Methods;
|
||||
import com.projectkorra.ProjectKorra.ProjectKorra;
|
||||
|
||||
public class RapidPunch {
|
||||
|
||||
private static int damage = ProjectKorra.plugin.getConfig().getInt("Abilities.Chi.RapidPunch.Damage");
|
||||
private int distance = ProjectKorra.plugin.getConfig().getInt("Abilities.Chi.RapidPunch.Distance");
|
||||
private long cooldown = ProjectKorra.plugin.getConfig().getLong("Abilities.Chi.RapidPunch.Cooldown");
|
||||
private static int punches = ProjectKorra.plugin.getConfig().getInt("Abilities.Chi.RapidPunch.Punches");
|
||||
|
||||
private static Map<String, Long> cooldowns = new HashMap<String, Long>();
|
||||
public static ConcurrentHashMap<Player, RapidPunch> instance = new ConcurrentHashMap<Player, RapidPunch>();
|
||||
private int numpunches;
|
||||
// private long timers;
|
||||
private Entity target;
|
||||
public static List<Player> punching = new ArrayList<Player>();
|
||||
|
||||
public RapidPunch(Player p) {// , Entity t) {
|
||||
if (instance.containsKey(p))
|
||||
return;
|
||||
if (cooldowns.containsKey(p.getName())) {
|
||||
if (cooldowns.get(p.getName()) + cooldown >= System.currentTimeMillis()) {
|
||||
return;
|
||||
} else {
|
||||
cooldowns.remove(p.getName());
|
||||
}
|
||||
}
|
||||
|
||||
Entity t = Methods.getTargetedEntity(p, distance, new ArrayList<Entity>());
|
||||
|
||||
if (t == null)
|
||||
return;
|
||||
|
||||
target = t;
|
||||
numpunches = 0;
|
||||
instance.put(p, this);
|
||||
}
|
||||
|
||||
public void startPunch(Player p) {
|
||||
if (numpunches >= punches)
|
||||
instance.remove(p);
|
||||
if (target instanceof LivingEntity && target != null) {
|
||||
LivingEntity lt = (LivingEntity) target;
|
||||
Methods.damageEntity(p, target, damage);
|
||||
if (target instanceof Player)
|
||||
if (ChiPassive.willChiBlock((Player) target)) {
|
||||
ChiPassive.blockChi((Player) target);
|
||||
}
|
||||
lt.setNoDamageTicks(0);
|
||||
}
|
||||
cooldowns.put(p.getName(), System.currentTimeMillis());
|
||||
swing(p);
|
||||
numpunches++;
|
||||
}
|
||||
|
||||
private void swing(Player p) {
|
||||
}
|
||||
|
||||
public static String getDescription() {
|
||||
return "This ability allows the chiblocker to punch rapidly in a short period. To use, simply punch."
|
||||
+ " This has a short cooldown.";
|
||||
}
|
||||
|
||||
}
|
|
@ -266,6 +266,13 @@ Abilities:
|
|||
Description: "Paralyzes the target, making them unable to do anything for a short period of time. This ability has a long cooldown."
|
||||
Cooldown: 15000
|
||||
Duration: 2000
|
||||
RapidPunch:
|
||||
Enabled: true
|
||||
Description: "This ability allows the chiblocker to punch rapidly in a short period. To use, simply punch. This has a short cooldown."
|
||||
Damage: 1
|
||||
Distance: 4
|
||||
Cooldown: 15000
|
||||
Punches: 4
|
||||
Storage:
|
||||
engine: sqlite
|
||||
MySQL:
|
||||
|
|
Loading…
Reference in a new issue