mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 19:50:37 +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();
|
||||
handleDayNight();
|
||||
Flight.handle();
|
||||
for (Player p : RapidPunch.instance.keySet())
|
||||
RapidPunch.instance.get(p).startPunch(p);
|
||||
for (Player p : RapidPunch.instances.keySet()) {
|
||||
if (p == null) continue;
|
||||
RapidPunch.instances.get(p).startPunch(p);
|
||||
}
|
||||
for (int i : RevertChecker.airRevertQueue.keySet()) {
|
||||
Methods.revertAirBlock(i);
|
||||
RevertChecker.airRevertQueue.remove(i);
|
||||
|
|
|
@ -1778,7 +1778,7 @@ public class Methods {
|
|||
Cook.removeAll();
|
||||
Illumination.removeAll();
|
||||
|
||||
RapidPunch.instance.clear();
|
||||
RapidPunch.instances.clear();
|
||||
|
||||
Flight.removeAll();
|
||||
WaterReturn.removeAll();
|
||||
|
|
|
@ -295,8 +295,7 @@ public class PKListener implements Listener {
|
|||
BendingPlayer.players.remove(event.getPlayer().getName());
|
||||
if (EarthArmor.instances.containsKey(event.getPlayer())) {
|
||||
EarthArmor.removeEffect(event.getPlayer());
|
||||
event.getPlayer().removePotionEffect(
|
||||
PotionEffectType.DAMAGE_RESISTANCE);
|
||||
event.getPlayer().removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ public class TagAPIListener implements Listener {
|
|||
public void onNameTag(AsyncPlayerReceiveNameTagEvent e) {
|
||||
List<Element> elements = Methods.getBendingPlayer(e.getNamedPlayer().getName()).getElements();
|
||||
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());
|
||||
else if (elements.get(0).equals(Element.Earth))
|
||||
e.setTag(ChatColor.GREEN + e.getNamedPlayer().getName());
|
||||
|
|
|
@ -15,7 +15,7 @@ import com.projectkorra.ProjectKorra.ProjectKorra;
|
|||
|
||||
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>();
|
||||
private static Map<String, Long> cooldowns = new HashMap<String, Long>();
|
||||
|
||||
|
@ -29,7 +29,7 @@ public class RapidPunch {
|
|||
private Entity target;
|
||||
|
||||
public RapidPunch(Player p) {// , Entity t) {
|
||||
if (instance.containsKey(p))
|
||||
if (instances.containsKey(p))
|
||||
return;
|
||||
if (cooldowns.containsKey(p.getName())) {
|
||||
if (cooldowns.get(p.getName()) + cooldown >= System.currentTimeMillis()) {
|
||||
|
@ -46,12 +46,12 @@ public class RapidPunch {
|
|||
|
||||
target = t;
|
||||
numpunches = 0;
|
||||
instance.put(p, this);
|
||||
instances.put(p, this);
|
||||
}
|
||||
|
||||
public void startPunch(Player p) {
|
||||
if (numpunches >= punches)
|
||||
instance.remove(p);
|
||||
instances.remove(p);
|
||||
if (target instanceof LivingEntity && target != null) {
|
||||
LivingEntity lt = (LivingEntity) target;
|
||||
Methods.damageEntity(p, target, damage);
|
||||
|
|
Loading…
Reference in a new issue