Fixed double jump and entity ground tool.

Fixed isGrounded so that it doesn't return false positives when too
close to a wall.

Added 500ms recharge to double jump, preventing instant recharge
allowing players to jump twice before having to touch the ground again.
This commit is contained in:
xGamingDudex 2015-11-25 16:42:32 +01:00
parent 3b89d65a09
commit 84fde1c087
3 changed files with 17 additions and 5 deletions

View File

@ -537,9 +537,9 @@ public class UtilEnt
return ent.isOnGround();
}
AxisAlignedBB box = ((CraftEntity)ent).getHandle().getBoundingBox();
Location bottom_corner_1 = new Location(ent.getWorld(), box.a, ent.getLocation().getY()-0.1, box.c);
Location bottom_corner_2 = new Location(ent.getWorld(), box.d, ent.getLocation().getY()-0.1, box.f);
AxisAlignedBB box = ((CraftEntity)ent).getHandle().getBoundingBox().shrink(0.05, 0, 0.05);
Location bottom_corner_1 = new Location(ent.getWorld(), box.a, ent.getLocation().getY()-0.05, box.c);
Location bottom_corner_2 = new Location(ent.getWorld(), box.d, ent.getLocation().getY()-0.05, box.f);
for(Block b : UtilBlock.getInBoundingBox(bottom_corner_1, bottom_corner_2)){
if(UtilBlock.solid(b)) return true;

View File

@ -1,5 +1,6 @@
package mineplex.hub.modules;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.block.BlockFace;
@ -18,6 +19,7 @@ import mineplex.core.disguise.disguises.DisguiseBat;
import mineplex.core.disguise.disguises.DisguiseChicken;
import mineplex.core.disguise.disguises.DisguiseEnderman;
import mineplex.core.disguise.disguises.DisguiseWither;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.HubManager;
@ -66,6 +68,8 @@ public class JumpManager extends MiniPlugin
//Sound
player.playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0);
Recharge.Instance.useForce(player, "Double Jump", 500);
}
@EventHandler
@ -94,8 +98,11 @@ public class JumpManager extends MiniPlugin
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
{
player.setAllowFlight(true);
player.setFlying(false);
if(!player.getAllowFlight() && Recharge.Instance.usable(player, "Double Jump"))
{
player.setAllowFlight(true);
player.setFlying(false);
}
}
}
}

View File

@ -101,6 +101,8 @@ public class PerkDoubleJump extends Perk
Recharge.Instance.setDisplayForce(player, GetName(), true);
}
}
Recharge.Instance.useForce(player, "Double Jump", 500);
}
@EventHandler
@ -119,6 +121,9 @@ public class PerkDoubleJump extends Perk
if (_recharge > 0 && !Recharge.Instance.usable(player, GetName()))
continue;
if (!Recharge.Instance.usable(player, "Double Jump"))
continue;
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
player.setAllowFlight(true);