Advertisement
Guest User

Untitled

a guest
Aug 29th, 2014
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. @EventHandler
  2. public void onPlayerMove(PlayerMoveEvent e){
  3.  
  4. Player p = e.getPlayer();
  5. Vector v = p.getVelocity();
  6. Location l1 = p.getLocation();
  7. Location l2 = new Location(l1.getWorld(), l1.getX(), l1.getY()-1, l1.getZ());
  8. double yaw = Math.toRadians(p.getLocation().getYaw()+90);
  9. double pitch = Math.toRadians(-p.getLocation().getPitch());
  10. double x = 0*Math.cos(yaw)*Math.cos(pitch);
  11. double z = 0*Math.sin(pitch);
  12. double y = 1*Math.sin(yaw)*Math.cos(pitch);
  13. double q = 25*Math.sin(yaw)*Math.cos(pitch);
  14. double w = (q*0)+1.0;
  15. double m = l1.getY();
  16. double j = (m*0)+1;
  17.  
  18.  
  19. if(l2.getBlock().getType()==Material.IRON_BLOCK){
  20.  
  21.  
  22.  
  23. if (j == 1 || y == 0){
  24. p.setVelocity(new Vector(x,j,z));
  25. }
  26. if (j >= 25||y >= 25){
  27. p.setVelocity(new Vector(x,w,z));
  28.  
  29. }
  30. if (j < 25 || y < 25){
  31. if (l2.getBlock().getType() ==Material.IRON_BLOCK);
  32. p.setVelocity(new Vector(x,y,z));
  33.  
  34.  
  35. }
  36.  
  37. }
  38. if (p.isSneaking()) {
  39. p.setVelocity(new Vector (0,0,0));
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement