mcAcrobatics.java 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package com.gmail.nossr50;
  2. import org.bukkit.Location;
  3. import org.bukkit.entity.Player;
  4. import org.bukkit.event.entity.EntityDamageEvent;
  5. public class mcAcrobatics {
  6. private static volatile mcAcrobatics instance;
  7. public static mcAcrobatics getInstance() {
  8. if (instance == null) {
  9. instance = new mcAcrobatics();
  10. }
  11. return instance;
  12. }
  13. public void acrobaticsCheck(Player player, EntityDamageEvent event, Location loc, int xx, int y, int z){
  14. if(player != null){
  15. if(Math.random() * 1000 <= mcUsers.getProfile(player).getAcrobaticsInt()){
  16. event.setCancelled(true);
  17. player.sendMessage("**ROLLED**");
  18. if(!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z))
  19. && mcPermissions.getInstance().acrobatics(player)){
  20. mcUsers.getProfile(player).addAcrobaticsGather(event.getDamage() * 8);
  21. mcSkills.getInstance().XpCheck(player);
  22. }
  23. return;
  24. }
  25. }
  26. if(player != null && player.getHealth() - event.getDamage() <= 0)
  27. return;
  28. if(!mcConfig.getInstance().isBlockWatched(loc.getWorld().getBlockAt(xx, y, z))
  29. && mcPermissions.getInstance().acrobatics(player)){
  30. mcUsers.getProfile(player).addAcrobaticsGather(event.getDamage() * 12);
  31. mcSkills.getInstance().XpCheck(player);
  32. mcConfig.getInstance().addBlockWatch(loc.getWorld().getBlockAt(xx, y, z));
  33. if(player.getHealth() - event.getDamage() <= 0){
  34. if(mcUsers.getProfile(player).isDead())
  35. return;
  36. mcUsers.getProfile(player).setDead(true);
  37. }
  38. }
  39. }
  40. }