Support Jump potion

This commit is contained in:
H31IX committed 2012-06-10 14:00:23 -04:00
1 parent f70a9ae4da
commit 410211c86e
2 files changed
+12 -4

No files matched your search

@@ -37,6 +37,8 @@ import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.event.player.*;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class PlayerListener extends EventListener
{
@@ -118,6 +120,7 @@ public class PlayerListener extends EventListener
public void onPlayerChat(PlayerChatEvent event)
{
Player player = event.getPlayer();
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 100, 3));
if(checkManager.willCheck(player, CheckType.SPAM) && config.chatSpam())
{
backend.logChat(player);
@@ -269,7 +272,7 @@ public class PlayerListener extends EventListener
if(event.getFrom().getY() < event.getTo().getY() && backend.checkYSpeed(player, y))
{
event.setTo(from);
log("tried to ascend to fast.",player,CheckType.SPEED);
log("tried to ascend too fast.",player,CheckType.SPEED);
}
if(backend.checkXZSpeed(player,x,z))
{
@@ -177,7 +177,7 @@ public class Backend
public boolean checkYSpeed(Player player,double y)
{
if(!player.isInsideVehicle() && y > Y_SPEED_MAX && !isVelocity(player))
if(!player.isInsideVehicle() && y > Y_SPEED_MAX && !isVelocity(player) && !player.hasPotionEffect(PotionEffectType.JUMP))
{
return true;
}
@@ -488,6 +488,11 @@ public class Backend
public boolean checkAscension(Player player, double y1, double y2)
{
int max = ASCENSION_COUNT_MAX;
if(player.hasPotionEffect(PotionEffectType.JUMP))
{
max+=12;
}
Block block = player.getLocation().getBlock();
if(!isMovingExempt(player) && !Utilities.isInWater(player) && !Utilities.isOnLadder(player) && !player.isInsideVehicle())
{
@@ -496,8 +501,8 @@ public class Backend
{
if(!block.getRelative(BlockFace.NORTH).isLiquid() && !block.getRelative(BlockFace.SOUTH).isLiquid() && !block.getRelative(BlockFace.EAST).isLiquid() && !block.getRelative(BlockFace.WEST).isLiquid())
{
increment(player, ascensionCount, ASCENSION_COUNT_MAX);
if(ascensionCount.get(name) >= ASCENSION_COUNT_MAX)
increment(player, ascensionCount, max);
if(ascensionCount.get(name) >= max)
{
return true;
}