Advertisement
retrodaredevil

Hitbox java class

Apr 2nd, 2016
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. package me.retrodaredevil;
  2.  
  3. import org.bukkit.Location;
  4. import org.bukkit.entity.Entity;
  5. import org.bukkit.entity.Player;
  6.  
  7. public class Hitbox { // class made by retrodaredevil. Feel free to use in your own plugin without permission. Feel free to edit this.
  8. Entity e = null;
  9. Location low = null;
  10. Location high = null;
  11.  
  12. public Hitbox(Player p){
  13. e = p;
  14. low = p.getLocation().clone().add(-0.3, 0, -0.3);
  15. high = p.getLocation().clone().add(0.3, 1.8, 0.3);
  16. }
  17. public Hitbox(Location low, Location high){
  18. this.low = low;
  19. this.high = high;
  20. }
  21.  
  22. public boolean contains(Location l){
  23. if(low.getX() <= l.getX() && low.getY() <= l.getY() && l.getZ() <= l.getZ() && high.getX() >= l.getX() && high.getY() >= l.getY() && high.getZ() >= l.getZ()){
  24. return true;
  25. }
  26. return false;
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement