Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. public class Death_Back_Event implements Listener{
  2.  
  3.  
  4. public static Double getFriendlyValue(Double d) {
  5. String[] s = d.toString().split("\\.");
  6.  
  7. if (s[1].length() > 2) {
  8. s[1] = s[1].substring(0, 2);
  9. }
  10.  
  11. return new Double(s[0] + "." + s[1]);
  12. }
  13.  
  14.  
  15. @SuppressWarnings("deprecation")
  16. @EventHandler
  17. public void BackDeath(PlayerDeathEvent e) {
  18. Player p = e.getEntity(); // Player Check
  19. ConsoleCommandSender cs = Bukkit.getConsoleSender();
  20. Location Spawn = new Location(Bukkit.getWorld("world"), -554.5, 9.0, 445.5, -89, 12);
  21.  
  22. // Back Check
  23. if(p.hasPermission("system.back")) {
  24. p.sendMessage(Main.back1 + "§7Nutze §c/back §7um zu deinem §aTodespunkt §7zu gelangen.");
  25. Main.back.put(p.getName(), p.getLocation());
  26. }
  27. // Instant RespawnCheck
  28. p.teleport(Spawn);
  29. p.playSound(p.getLocation(), Sound.BLOCK_ANVIL_LAND, 0.5F, 1.0F);
  30. p.sendMessage(Main.prefix + "§7Du hast dein ganzes §aGeld §7verloren! §9[§c" +
  31. getFriendlyValue(Main.economy.getBalance(p.getName().toString())) + " §6Gems§9]");
  32.  
  33. Bukkit.dispatchCommand(cs, "essentials:eco set " + p.getName() + " 0");
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40. }
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement