Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Death_Back_Event implements Listener{
- public static Double getFriendlyValue(Double d) {
- String[] s = d.toString().split("\\.");
- if (s[1].length() > 2) {
- s[1] = s[1].substring(0, 2);
- }
- return new Double(s[0] + "." + s[1]);
- }
- @SuppressWarnings("deprecation")
- @EventHandler
- public void BackDeath(PlayerRespawnEvent e) {
- Bukkit.getScheulder().runTaskLater(MAIN KLASSE, new Runnable(){
- Player p = e.getEntity(); // Player Check
- ConsoleCommandSender cs = Bukkit.getConsoleSender();
- Location Spawn = new Location(Bukkit.getWorld("world"), -554.5, 9.0, 445.5, -89, 12);
- // Back Check
- if(p.hasPermission("system.back")) {
- p.sendMessage(Main.back1 + "§7Nutze §c/back §7um zu deinem §aTodespunkt §7zu gelangen.");
- Main.back.put(p.getName(), p.getLocation());
- }
- // Instant RespawnCheck
- p.teleport(Spawn);
- p.playSound(p.getLocation(), Sound.BLOCK_ANVIL_LAND, 0.5F, 1.0F);
- p.sendMessage(Main.prefix + "§7Du hast dein ganzes §aGeld §7verloren! §9[§c" +
- getFriendlyValue(Main.economy.getBalance(p.getName().toString())) + " §6Gems§9]");
- Bukkit.dispatchCommand(cs, "essentials:eco set " + p.getName() + " 0");
- }, 20);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement