mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 11:40:40 +00:00
Merge pull request #20 from jacklin213/bugfix
Fixed Exceptions dealing with RapidPunch and TagAPIListener
This commit is contained in:
commit
f0f9ff9082
5 changed files with 11 additions and 10 deletions
|
@ -92,8 +92,10 @@ public class BendingManager implements Runnable {
|
||||||
TempPotionEffect.progressAll();
|
TempPotionEffect.progressAll();
|
||||||
handleDayNight();
|
handleDayNight();
|
||||||
Flight.handle();
|
Flight.handle();
|
||||||
for (Player p : RapidPunch.instance.keySet())
|
for (Player p : RapidPunch.instances.keySet()) {
|
||||||
RapidPunch.instance.get(p).startPunch(p);
|
if (p == null) continue;
|
||||||
|
RapidPunch.instances.get(p).startPunch(p);
|
||||||
|
}
|
||||||
for (int i : RevertChecker.airRevertQueue.keySet()) {
|
for (int i : RevertChecker.airRevertQueue.keySet()) {
|
||||||
Methods.revertAirBlock(i);
|
Methods.revertAirBlock(i);
|
||||||
RevertChecker.airRevertQueue.remove(i);
|
RevertChecker.airRevertQueue.remove(i);
|
||||||
|
|
|
@ -1778,7 +1778,7 @@ public class Methods {
|
||||||
Cook.removeAll();
|
Cook.removeAll();
|
||||||
Illumination.removeAll();
|
Illumination.removeAll();
|
||||||
|
|
||||||
RapidPunch.instance.clear();
|
RapidPunch.instances.clear();
|
||||||
|
|
||||||
Flight.removeAll();
|
Flight.removeAll();
|
||||||
WaterReturn.removeAll();
|
WaterReturn.removeAll();
|
||||||
|
|
|
@ -295,8 +295,7 @@ public class PKListener implements Listener {
|
||||||
BendingPlayer.players.remove(event.getPlayer().getName());
|
BendingPlayer.players.remove(event.getPlayer().getName());
|
||||||
if (EarthArmor.instances.containsKey(event.getPlayer())) {
|
if (EarthArmor.instances.containsKey(event.getPlayer())) {
|
||||||
EarthArmor.removeEffect(event.getPlayer());
|
EarthArmor.removeEffect(event.getPlayer());
|
||||||
event.getPlayer().removePotionEffect(
|
event.getPlayer().removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE);
|
||||||
PotionEffectType.DAMAGE_RESISTANCE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class TagAPIListener implements Listener {
|
||||||
public void onNameTag(AsyncPlayerReceiveNameTagEvent e) {
|
public void onNameTag(AsyncPlayerReceiveNameTagEvent e) {
|
||||||
List<Element> elements = Methods.getBendingPlayer(e.getNamedPlayer().getName()).getElements();
|
List<Element> elements = Methods.getBendingPlayer(e.getNamedPlayer().getName()).getElements();
|
||||||
if (elements!=null && plugin.getConfig().getBoolean("Properties.TagAPI.Enabled")) {
|
if (elements!=null && plugin.getConfig().getBoolean("Properties.TagAPI.Enabled")) {
|
||||||
if (elements.size() > 1)
|
if (elements.size() < 1)
|
||||||
e.setTag(ChatColor.LIGHT_PURPLE + e.getNamedPlayer().getName());
|
e.setTag(ChatColor.LIGHT_PURPLE + e.getNamedPlayer().getName());
|
||||||
else if (elements.get(0).equals(Element.Earth))
|
else if (elements.get(0).equals(Element.Earth))
|
||||||
e.setTag(ChatColor.GREEN + e.getNamedPlayer().getName());
|
e.setTag(ChatColor.GREEN + e.getNamedPlayer().getName());
|
||||||
|
|
|
@ -15,7 +15,7 @@ import com.projectkorra.ProjectKorra.ProjectKorra;
|
||||||
|
|
||||||
public class RapidPunch {
|
public class RapidPunch {
|
||||||
|
|
||||||
public static ConcurrentHashMap<Player, RapidPunch> instance = new ConcurrentHashMap<Player, RapidPunch>();
|
public static ConcurrentHashMap<Player, RapidPunch> instances = new ConcurrentHashMap<Player, RapidPunch>();
|
||||||
public static List<Player> punching = new ArrayList<Player>();
|
public static List<Player> punching = new ArrayList<Player>();
|
||||||
private static Map<String, Long> cooldowns = new HashMap<String, Long>();
|
private static Map<String, Long> cooldowns = new HashMap<String, Long>();
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ public class RapidPunch {
|
||||||
private Entity target;
|
private Entity target;
|
||||||
|
|
||||||
public RapidPunch(Player p) {// , Entity t) {
|
public RapidPunch(Player p) {// , Entity t) {
|
||||||
if (instance.containsKey(p))
|
if (instances.containsKey(p))
|
||||||
return;
|
return;
|
||||||
if (cooldowns.containsKey(p.getName())) {
|
if (cooldowns.containsKey(p.getName())) {
|
||||||
if (cooldowns.get(p.getName()) + cooldown >= System.currentTimeMillis()) {
|
if (cooldowns.get(p.getName()) + cooldown >= System.currentTimeMillis()) {
|
||||||
|
@ -46,12 +46,12 @@ public class RapidPunch {
|
||||||
|
|
||||||
target = t;
|
target = t;
|
||||||
numpunches = 0;
|
numpunches = 0;
|
||||||
instance.put(p, this);
|
instances.put(p, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startPunch(Player p) {
|
public void startPunch(Player p) {
|
||||||
if (numpunches >= punches)
|
if (numpunches >= punches)
|
||||||
instance.remove(p);
|
instances.remove(p);
|
||||||
if (target instanceof LivingEntity && target != null) {
|
if (target instanceof LivingEntity && target != null) {
|
||||||
LivingEntity lt = (LivingEntity) target;
|
LivingEntity lt = (LivingEntity) target;
|
||||||
Methods.damageEntity(p, target, damage);
|
Methods.damageEntity(p, target, damage);
|
||||||
|
|
Loading…
Reference in a new issue