mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-23 00:15:05 +00:00
Merge pull request #4 from jacklin213/master
Fixed NPE's in Method and small edits to other classes
This commit is contained in:
commit
19cfe223b1
3 changed files with 10 additions and 6 deletions
|
@ -502,6 +502,7 @@ public class Methods {
|
|||
public static boolean canBend(String player, String ability) {
|
||||
BendingPlayer bPlayer = getBendingPlayer(player);
|
||||
Player p = Bukkit.getPlayer(player);
|
||||
if (bPlayer == null) return false;
|
||||
if (!bPlayer.isToggled) return false;
|
||||
if (p == null) return false;
|
||||
if (!p.hasPermission("bending.ability." + ability)) return false;
|
||||
|
@ -539,6 +540,8 @@ public class Methods {
|
|||
public static boolean canBendPassive(String player, Element element) {
|
||||
BendingPlayer bPlayer = getBendingPlayer(player);
|
||||
Player p = Bukkit.getPlayer(player);
|
||||
if (bPlayer == null) return false;
|
||||
if (p == null) return false;
|
||||
if (!p.hasPermission("bending." + element.toString().toLowerCase() + ".passive")) return false;
|
||||
if (!bPlayer.isToggled) return false;
|
||||
if (!bPlayer.hasElement(element)) return false;
|
||||
|
@ -610,6 +613,7 @@ public class Methods {
|
|||
|
||||
public static String getBoundAbility(Player player) {
|
||||
BendingPlayer bPlayer = getBendingPlayer(player.getName());
|
||||
if (bPlayer == null) return null;
|
||||
|
||||
int slot = player.getInventory().getHeldItemSlot() + 1;
|
||||
return bPlayer.abilities.get(slot);
|
||||
|
|
|
@ -274,10 +274,6 @@ public class PKListener implements Listener {
|
|||
|
||||
if (!player.isSneaking() && Methods.canBend(player.getName(), abil)) {
|
||||
|
||||
if (abil.equalsIgnoreCase("AirShield")) {
|
||||
new AirShield(player);
|
||||
}
|
||||
|
||||
if (Methods.isAirAbility(abil)) {
|
||||
if (Methods.isWeapon(player.getItemInHand().getType()) && !plugin.getConfig().getBoolean("Properties.Air.CanBendWithWeapons")) {
|
||||
return;
|
||||
|
@ -297,6 +293,10 @@ public class PKListener implements Listener {
|
|||
if (abil.equalsIgnoreCase("AirSwipe")) {
|
||||
AirSwipe.charge(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("AirShield")) {
|
||||
new AirShield(player);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (Methods.isWaterAbility(abil)) {
|
||||
|
|
|
@ -117,7 +117,7 @@ public class IceSpike {
|
|||
|
||||
public IceSpike(Player player, Location origin, int damage,
|
||||
Vector throwing, long aoecooldown) {
|
||||
this.cooldown = aoecooldown;
|
||||
cooldown = aoecooldown;
|
||||
this.player = player;
|
||||
this.origin = origin;
|
||||
location = origin.clone();
|
||||
|
|
Loading…
Reference in a new issue