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:
parent
3b89d65a09
commit
84fde1c087
@ -537,9 +537,9 @@ public class UtilEnt
|
|||||||
return ent.isOnGround();
|
return ent.isOnGround();
|
||||||
}
|
}
|
||||||
|
|
||||||
AxisAlignedBB box = ((CraftEntity)ent).getHandle().getBoundingBox();
|
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.1, box.c);
|
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.1, box.f);
|
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)){
|
for(Block b : UtilBlock.getInBoundingBox(bottom_corner_1, bottom_corner_2)){
|
||||||
if(UtilBlock.solid(b)) return true;
|
if(UtilBlock.solid(b)) return true;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package mineplex.hub.modules;
|
package mineplex.hub.modules;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.block.BlockFace;
|
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.DisguiseChicken;
|
||||||
import mineplex.core.disguise.disguises.DisguiseEnderman;
|
import mineplex.core.disguise.disguises.DisguiseEnderman;
|
||||||
import mineplex.core.disguise.disguises.DisguiseWither;
|
import mineplex.core.disguise.disguises.DisguiseWither;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.hub.HubManager;
|
import mineplex.hub.HubManager;
|
||||||
@ -66,6 +68,8 @@ public class JumpManager extends MiniPlugin
|
|||||||
|
|
||||||
//Sound
|
//Sound
|
||||||
player.playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0);
|
player.playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0);
|
||||||
|
|
||||||
|
Recharge.Instance.useForce(player, "Double Jump", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -94,8 +98,11 @@ public class JumpManager extends MiniPlugin
|
|||||||
|
|
||||||
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
|
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
|
||||||
{
|
{
|
||||||
player.setAllowFlight(true);
|
if(!player.getAllowFlight() && Recharge.Instance.usable(player, "Double Jump"))
|
||||||
player.setFlying(false);
|
{
|
||||||
|
player.setAllowFlight(true);
|
||||||
|
player.setFlying(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,6 +101,8 @@ public class PerkDoubleJump extends Perk
|
|||||||
Recharge.Instance.setDisplayForce(player, GetName(), true);
|
Recharge.Instance.setDisplayForce(player, GetName(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Recharge.Instance.useForce(player, "Double Jump", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -119,6 +121,9 @@ public class PerkDoubleJump extends Perk
|
|||||||
|
|
||||||
if (_recharge > 0 && !Recharge.Instance.usable(player, GetName()))
|
if (_recharge > 0 && !Recharge.Instance.usable(player, GetName()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!Recharge.Instance.usable(player, "Double Jump"))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
|
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
|
||||||
player.setAllowFlight(true);
|
player.setAllowFlight(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user