mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-02-13 10:11:36 +01:00
Add convenience methods: isPassable, getVector
This commit is contained in:
parent
8311070902
commit
ded72a5152
@ -16,6 +16,7 @@ import org.bukkit.craftbukkit.CraftWorld;
|
|||||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MM"""""""`YM dP
|
* MM"""""""`YM dP
|
||||||
@ -68,6 +69,9 @@ public class PlayerLocation {
|
|||||||
|
|
||||||
/** Is the player on ladder? */
|
/** Is the player on ladder? */
|
||||||
private Boolean onLadder;
|
private Boolean onLadder;
|
||||||
|
|
||||||
|
/** Simple test if the exact position is passable. */
|
||||||
|
private Boolean passable;
|
||||||
|
|
||||||
/** The bounding box of the player. */
|
/** The bounding box of the player. */
|
||||||
private AxisAlignedBB boundingBox;
|
private AxisAlignedBB boundingBox;
|
||||||
@ -329,6 +333,15 @@ public class PlayerLocation {
|
|||||||
return typeId == Material.LADDER.getId() || typeId == Material.VINE.getId();
|
return typeId == Material.LADDER.getId() || typeId == Material.VINE.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple at the spot passability test, no bounding boxes.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isPassable(){
|
||||||
|
if (passable == null) passable = BlockProperties.isPassable(getBlockAccess(), x, y, z, getTypeId());
|
||||||
|
return passable;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the player location object.
|
* Sets the player location object.
|
||||||
*
|
*
|
||||||
@ -501,4 +514,8 @@ public class PlayerLocation {
|
|||||||
return worldServer;
|
return worldServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Vector getVector() {
|
||||||
|
return new Vector(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user