Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. @EventHandler
  2. public void onMove(PlayerMoveEvent e) {
  3. Player p = e.getPlayer();
  4. Location loc = p.getLocation();
  5.  
  6. if(SpeedRun.preStart.contains(p)) {
  7. e.setCancelled(true);
  8. } else {
  9. e.setCancelled(false);
  10. }
  11. if(SpeedRun.ingame.contains(p)) {
  12. p.setWalkSpeed(0.7F);
  13. Checkpoint(p);
  14.  
  15. if(loc.getY() <= 45) {
  16. Location loca = SpeedRun.checkpoint.get(p.getName());
  17. if(loca == null) {
  18. SpeedRunCommand.tpSpawn(p);
  19. } else {
  20. p.teleport(loca);
  21. }
  22. }
  23. }
  24. }
  25.  
  26. public static void Checkpoint(Player p) {
  27. Location ublock = p.getLocation().subtract(0, 1, 0);
  28. Location loc = p.getLocation();
  29. SpeedRun.checkpoint.keySet().
  30.  
  31. if(ublock.getBlock().getType() == Material.GOLD_BLOCK) {
  32. if(SpeedRun.checkpoint.get(p.getName()) == null) {
  33. if(loc != SpeedRun.checkpoint.get(p.getName())) {
  34. p.sendMessage(SpeedRun.Prefix + " §3Du hast den ersten §eCheckpoint §aerreicht");
  35. SpeedRun.checkpoint.put(p.getName(), loc);
  36. }
  37. } else if(SpeedRun.checkpoint.get(p.getName()) != null) {
  38. if(loc != SpeedRun.checkpoint.get(p.getName())) {
  39. p.sendMessage(SpeedRun.Prefix + " §3Du hast den nächsten §eCheckpoint §aerreicht");
  40. SpeedRun.checkpoint.remove(p.getName());
  41. SpeedRun.checkpoint.put(p.getName(), loc);
  42. }
  43. }
  44. }
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement