Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 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(PlayerRespawnEvent e) {
  18. Bukkit.getScheulder().runTaskLater(MAIN KLASSE, new Runnable(){
  19. Player p = e.getEntity(); // Player Check
  20. ConsoleCommandSender cs = Bukkit.getConsoleSender();
  21. Location Spawn = new Location(Bukkit.getWorld("world"), -554.5, 9.0, 445.5, -89, 12);
  22.  
  23. // Back Check
  24. if(p.hasPermission("system.back")) {
  25. p.sendMessage(Main.back1 + "§7Nutze §c/back §7um zu deinem §aTodespunkt §7zu gelangen.");
  26. Main.back.put(p.getName(), p.getLocation());
  27. }
  28. // Instant RespawnCheck
  29. p.teleport(Spawn);
  30. p.playSound(p.getLocation(), Sound.BLOCK_ANVIL_LAND, 0.5F, 1.0F);
  31. p.sendMessage(Main.prefix + "§7Du hast dein ganzes §aGeld §7verloren! §9[§c" +
  32. getFriendlyValue(Main.economy.getBalance(p.getName().toString())) + " §6Gems§9]");
  33.  
  34. Bukkit.dispatchCommand(cs, "essentials:eco set " + p.getName() + " 0");
  35.  
  36.  
  37.  
  38.  
  39.  
  40. }, 20);
  41. }
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement