Use XP-Bar as double jump indicator

This commit is contained in:
kaenganxt
2014-10-29 13:05:34 +01:00
parent ff89689b21
commit b08a7bfc02

View File

@@ -93,6 +93,7 @@ public class Features implements Listener {
featureEnabled.get(P).put(f, false);
canDoubleJump.put(P, false);
Core.statusMsg(P, "dbl_jump_off", true);
P.setExp(0);
if (P.getGameMode() != GameMode.CREATIVE) {
P.setAllowFlight(false);
}
@@ -110,6 +111,7 @@ public class Features implements Listener {
}
featureEnabled.get(P).put(f, true);
P.setAllowFlight(true);
P.setExp(1);
canDoubleJump.put(P, true);
Core.statusMsg(P, "dbl_jump_on", true);
}
@@ -144,7 +146,7 @@ public class Features implements Listener {
if (f.equals(Feature.DOUBLE_JUMP)) {
if (!P.getGameMode().equals(GameMode.CREATIVE)) {
P.setAllowFlight(false);
P.setFoodLevel(20);
P.setExp(0);
}
this.canDoubleJump.put(P, false);
}
@@ -159,6 +161,7 @@ public class Features implements Listener {
}
if (f.equals(Feature.DOUBLE_JUMP)) {
P.setAllowFlight(true);
P.setExp(1);
this.canDoubleJump.put(P, true);
}
}
@@ -174,9 +177,9 @@ public class Features implements Listener {
}
Player P = event.getPlayer();
if (this.hasFeature(P, Feature.DOUBLE_JUMP)) {
if (this.canDoubleJump.containsKey(P) && !this.canDoubleJump.get(P) && ((Entity) P).isOnGround()) {
if (this.canDoubleJump.containsKey(P) && !this.canDoubleJump.get(P) && ((Entity) P).isOnGround() && this.featureEnabled.get(P).get(Feature.DOUBLE_JUMP)) {
this.canDoubleJump.put(P, true);
P.setFoodLevel(20);
P.setExp(1);
}
}
}
@@ -191,7 +194,7 @@ public class Features implements Listener {
if (this.hasFeature(P, Feature.DOUBLE_JUMP) && !P.getGameMode().equals(GameMode.CREATIVE)) {
if (this.canDoubleJump.containsKey(P) && this.canDoubleJump.get(P)) {
this.canDoubleJump.put(P, false);
P.setFoodLevel(1);
P.setExp(0);
Vector v = P.getLocation().getDirection();
P.setVelocity(v.multiply(new Vector(1, 2, 1)));
P.setVelocity(P.getVelocity().setY(1));