@EventHandler public void onPlayerDeath(PlayerDeathEvent event) { if (event.getEntity().getKiller() == null) { return; } else { Player p = event.getEntity(); plugin.punished.put(p, p.getKiller()); p.sendMessage( ChatColor.GRAY + "You have been slain by " + ChatColor.RED + p.getKiller().getName() + ChatColor.GRAY + "!"); if (lastIndict.containsKey(p)) { if (System.currentTimeMillis() < (lastIndict.get(p) + plugin.timeBetweenIndicts)) { p.sendMessage( ChatColor.GRAY + "Not enough time has passed for their karma to be affected again!"); return; } } p.sendMessage( ChatColor.GRAY + "Please use " + ChatColor.RED + "'/indict'" + ChatColor.GRAY + " to punish the crime or " + ChatColor.GREEN + "'/forgive' " + ChatColor.GRAY + "to absolve them!"); lastIndict.put(p, System.currentTimeMillis()); } }
// ================================================================================================ @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerDeath(PlayerDeathEvent event) { if (plugin.playerIsAffected( event .getEntity() .getPlayer())) // TODO this will trigger, regardless of the death cause. Should be // checking if player died from coldDamage! { // TODO make maxJailDuration function. Finally there will be more than one jail! // duration will become higher when a player dies more often. if (Arctica.minJailDuration > 0) { plugin .getServer() .dispatchCommand( plugin.getServer().getConsoleSender(), "tjail " + event.getEntity().getPlayer().getName() + " " + Arctica.jailName + " " + Arctica.minJailDuration + "m"); } } }
public void PlayerDeath(PlayerDeathEvent event) { Entity entity = event.getEntity(); if (entity instanceof TNTPrimed) { TNTPrimed tnt = (TNTPrimed) entity; event.getEntity().getWorld().createExplosion(tnt.getLocation(), 0); } }
// register that we killed the Player who fired this event public void registerKill(PlayerDeathEvent e) { // sanity check... if (e.getEntity().getKiller() != getPlayer()) return; // get the name of the player who died, record one kill against them AutoRefPlayer apl = getTeam().getMatch().getPlayer(e.getEntity()); kills.put(apl, 1 + kills.get(apl)); ++totalKills; }
@EventHandler public void onDeath(PlayerDeathEvent event) { Spellbook spellbook = MagicSpells.getSpellbook(event.getEntity()); for (PassiveSpell spell : spells) { if (spellbook.hasSpell(spell)) { spell.activate(event.getEntity()); } } }
@EventHandler public void onDeath(PlayerDeathEvent event) { _death++; String player = event.getEntity().getName(); _death_players.put( player, _death_players.containsKey(player) ? _death_players.get(player) + 1 : 1); String world = event.getEntity().getWorld().getName(); _death_worlds.put(world, _death_worlds.containsKey(world) ? _death_worlds.get(world) + 1 : 1); }
@EventHandler public void onPlayerDeath(PlayerDeathEvent event) { if (plugin.isBattleNight(event.getEntity())) return; boolean filledDeathChest = false; boolean filledSpawnChest = false; int originalDrops = event.getDrops().size(); if (event.getDrops().isEmpty() && event.getDroppedExp() == 0) return; Player player = (Player) event.getEntity(); int exp = player.getTotalExperience(); LinkedList<ItemStack> toRemove = saveToDeathChest(player); filledDeathChest = !toRemove.isEmpty(); if (exp != player.getTotalExperience()) { event.setDroppedExp(0); } for (ItemStack item : toRemove) event.getDrops().remove(item); if (event.getDrops().isEmpty() && (event.getDroppedExp() == 0 || plugin.getConfigManager().getEXPMulti() == 0)) return; if (!event.getDrops().isEmpty() || player.getTotalExperience() != 0) { toRemove = plugin.interactSpawnContainerController().createSpawnContainer(player); if (plugin.getConfigManager().getSpawnContainerUsage().equals(SpawnSign.class) && player.getTotalExperience() != exp) event.setDroppedExp(0); if (toRemove != null) { filledSpawnChest = !toRemove.isEmpty(); for (ItemStack item : toRemove) event.getDrops().remove(item); } } if (event.getDrops().size() > 0 && filledDeathChest) { int maxTransfer = plugin.getChestContainer().getMaxTransferLimit(player); if (originalDrops > maxTransfer) player.sendMessage( ChatColor.RED + "Only " + maxTransfer + " items could be transfered. The rest is dropped at your death location."); else player.sendMessage( ChatColor.RED + "Your total inventory did not fit in the box. The rest items were dropped at your death location."); } if (!filledDeathChest && !filledSpawnChest && simplePermissionUse(player)) player.sendMessage(ChatColor.RED + "You don't have a Chest set yet. Sorry for you. :("); }
// <Index = 3> @EventHandler public void onPlayerDeath(PlayerDeathEvent event) { Player att = event.getEntity().getKiller(); String pName = event.getEntity().getName(); if (att instanceof Player && att.getEntityId() != event.getEntity().getEntityId()) { String aName = att.getName(); SQL.addKill(aName); SQL.addMoney(aName, SQL.getMoney(pName) > SQL.getMoney(aName) ? 10 : 5); ScoreboardHandler.addKill(aName); } SQL.addDeath(pName); event.getDrops().clear(); }
@EventHandler public void onPlayerDeath(PlayerDeathEvent event) { MinestarPlayer thisPlayer = MinestarCore.getPlayer(event.getEntity().getName()); if (thisPlayer.getMinestarGroup().equals(MinestarGroup.ADMIN) && event.getEntity().getGameMode() != GameMode.ADVENTURE) { // 25 % Drop chance if (randomizer.nextInt(4) == 0) { ItemStack bedrockStack = new ItemStack(Material.BEDROCK); bedrockStack.setAmount(1); event.getEntity().getWorld().dropItem(event.getEntity().getLocation(), bedrockStack); } } }
@EventHandler public void onEntityDeath(PlayerDeathEvent e) { if (e.getEntity() instanceof Player) { Player p = (Player) e.getEntity(); int id = gm.getPlayerGameId(p); if (id != -1) { gm.getPlayerClass(p).PlayerDeath(); gm.getGame(id).killPlayer(p, e.getDeathMessage()); e.setDeathMessage(null); } } }
/** * Handles players deaths. Checks if the the player was killed player. If the player was killed by * the player set the killers name to red. * * @param event The player death event */ @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onPlayerDeath(PlayerDeathEvent event) { Player killer; String nickCommand; if (!(event.getEntity().getKiller() == null)) { killer = event.getEntity().getKiller(); // Sets a player to a PEX group with a red name for 4 hours nickCommand = ("pex user " + killer.getName() + " group add PlayerKiller * 14400"); killer.setCustomNameVisible(true); plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), nickCommand); // Essentials bug workaround, a players name does not change color until /list is called once plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "list"); } }
@EventHandler(priority = EventPriority.HIGHEST) private void onDeath(PlayerDeathEvent evt) { evt.getDrops().clear(); final Player player = evt.getEntity().getPlayer(); final PlayerDataClass playerData = plugin.getPlayerHandler().findPlayer(player.getDisplayName()); if (playerData != null) { setUnscoped(player, playerData); plugin.getPlayerLocationListener().removePlayerFromPoint(playerData); if (evt.getEntity().getKiller() != null) { Player killer = evt.getEntity().getKiller(); PlayerDataClass killerData = plugin.getPlayerHandler().findPlayer(killer.getDisplayName()); playerData.setDeaths(playerData.getDeaths() + 1); if (killer != null) { killerData.setKills(killerData.getKills() + 1); } } if (playerData.getType().equals("spy") && playerData.getDisguised() != null) { playerData.setDisguised(null); } if (player.isDead()) { player.setHealth(20); } plugin .getServer() .getScheduler() .scheduleSyncDelayedTask( plugin, new Runnable() { public void run() { if (plugin.getPlayerHandler().findPlayer(player.getDisplayName()) != null) { plugin.getLogger().info("Respawning: " + player.getName()); plugin.getPlayerHandler().spawnPlayer(playerData); TagAPI.refreshPlayer(player); } } }, 5L); } else { plugin.getGameManager().teleportToSpawn(player); } }
@EventHandler public void DeathEvent(PlayerDeathEvent e) { Player player = e.getEntity(); if (UtilsIceTag.players.contains(player)) { if (UtilsIceTag.started == true) { this.hg.removePlayer(player); hg.broadcastMSG(player.getName() + " Died"); if (UtilsIceTag.players.size() <= 1) { Player winner = null; for (Player pl : UtilsIceTag.players) { winner = pl; } if (winner != null) { hg.broadcastMSG(winner.getName() + " Won!!!"); winner.teleport(winner.getWorld().getSpawnLocation().add(0.50, 0, 0.50)); } hg.stopGame(); } else { hg.broadcastMSG(UtilsIceTag.players.size() + " Remaining"); } } else { this.hg.removePlayer(player); } } }
@EventHandler public void onPlayerDeath(PlayerDeathEvent e) { Player p = e.getEntity(); Player k = p.getKiller(); if (k instanceof Player && p instanceof Player) { if (FileUtils.hasBounty(p.getName())) { p.sendMessage( config .getString("bountyVictim") .replace("%prefix", config.getString("Prefix")) .replace("%target", k.getName()) .replace("&", "¤")); k.sendMessage( config .getString("bountyMurderer") .replace("%prefix", config.getString("Prefix")) .replace("%target", p.getName()) .replace("&", "¤")); Bountys.economy.depositPlayer(k, FileUtils.getBounty(p.getName())); FileUtils.removeBounty(p.getName()); } } }
// register that we just died public void registerDeath(PlayerDeathEvent e) { // sanity check... if (e.getEntity() != getPlayer()) return; // get the last damage cause, and mark that as the cause of one death AutoRefPlayer.DamageCause dc = AutoRefPlayer.DamageCause.fromDamageEvent(e.getEntity().getLastDamageCause()); deaths.put(dc, 1 + deaths.get(dc)); ++totalDeaths; AutoRefMatch match = getTeam().getMatch(); Location loc = e.getEntity().getLocation(); match.addEvent( new TranscriptEvent( match, TranscriptEvent.EventType.PLAYER_DEATH, e.getDeathMessage(), loc, this, dc.p)); }
/** * * When player dies, save their back position, so they can return if they have permissions to do * so. * * @param e * @return */ @EventHandler(priority = EventPriority.NORMAL) public void saveBackPosition(PlayerDeathEvent e) { Player p = e.getEntity(); if (!Permissions.checkPermEx(p, "cex.back.deathcoords")) return; String pName = p.getName(); Command_cex_back.lastLocations.put(pName, p.getLocation()); }
@EventHandler(priority = EventPriority.LOWEST) public void onPlayerDeath(PlayerDeathEvent event) { EntityDamageEvent ede = event.getEntity().getLastDamageCause(); if ((ede != null) && (ede.getCause() != null) && (ede.getCause() == DamageCause.LAVA)) { Player player = event.getEntity(); Location loc = player.getLocation(); LavaTrain lT = LavaTrain.getLavaTrain(loc.getBlock()); if (lT != null) { event.setDeathMessage( player.getName() + " died swimming in " + lT.getPlayer().getName() + "'s lava train"); } } if (ede instanceof BendingDamageEvent) { Player player = event.getEntity(); BendingDamageEvent bede = (BendingDamageEvent) ede; if (bede.getAbility() == null) { event.setDeathMessage(player.getName() + " died from unknown bending"); } else { event.setDeathMessage( ChatColor.DARK_RED + player.getName() + ChatColor.RESET + " died from " + ChatColor.DARK_GREEN + bede.getAbility().getPlayer().getName() + ChatColor.RESET + "'s " + PluginTools.getColor(Settings.getColor(bede.getAbility().getElement())) + bede.getAbility().getName()); } } // Fireblade & Suffocate List<ItemStack> toRemove = new LinkedList<ItemStack>(); for (ItemStack item : event.getDrops()) { if (Suffocate.isTempHelmet(item)) { toRemove.add(item); } } event.getDrops().removeAll(toRemove); if (EntityTools.isGrabed(event.getEntity())) { EntityTools.unGrab(event.getEntity()); } }
@EventHandler(priority = EventPriority.MONITOR) public void onDeath(PlayerDeathEvent e) { final Player ent = (Player) e.getEntity(); Player killer = (Player) e.getEntity().getKiller(); if (ArenaManager.getInstance().getPlayerArena(e.getEntity()) != null) { Arena a = ArenaManager.getInstance() .getArena(ArenaManager.getInstance().getPlayerArena(e.getEntity())); e.getDrops().clear(); e.setDeathMessage(null); e.setDroppedExp(0); if (a.getArenaState() != ArenaState.STARTED) { return; } a.removeLevel(ent); // TODO: Death message. e.setDeathMessage( UGunGame.getInstance().prefix + "§e" + ent.getName() + " killed by " + killer.getName()); MessageManager.good(killer, "You got §6" + a.getCfg().getInt("arena.money.add") + " §aUGP!"); MessageManager.bad(ent, "You lost §6" + a.getCfg().getInt("arena.money.remove") + " §cUGP!"); ScoreboardStats.addMoney(a, killer); ScoreboardStats.removeMoney(a, ent); ScoreboardStats.createScoreboard(killer); ScoreboardStats.createScoreboard(ent); } if (killer == null) { return; } if (ArenaManager.getInstance().getPlayerArena(killer) != null) { Arena a = ArenaManager.getInstance().getArena(ArenaManager.getInstance().getPlayerArena(killer)); if (a.getArenaState() != ArenaState.STARTED) { return; } killer.getInventory().clear(); killer.getInventory().setArmorContents(null); a.addLevel(killer); } }
public static void onPlayerDeath(final PlayerDeathEvent event) { final Player player = event.getEntity(); final Inventory enderChest = player.getEnderChest(); for (final ItemStack item : enderChest.getContents()) ItemUtil.dropItemNaturally(player, item); enderChest.clear(); }
@EventHandler public void onPlayerDeath(PlayerDeathEvent e) { Player p = (Player) e.getEntity(); if (plugin.getArenaManager().isInGame(p)) { if (plugin.ab.getAbilities().containsKey(p)) { if (plugin.ab.getAbilities().get(p).contains("last_revenge")) { Arena a = plugin.getArenaManager().getArena(p); Random ran = new Random(); boolean canSelect = true; int targetTeam = 0; if (a.getPlayers().size() > 1) { do { targetTeam = ran.nextInt(a.getTeamCount()); if (targetTeam != a.getTeam(p)) { for (Player pl : a.getPlayers()) { if (a.getTeam(pl) == targetTeam) { canSelect = false; } } } } while (canSelect); double lightning = Multipliers.getMultiplier( "lightning", plugin.economy.getLevel(p, "explosive", "upgrade"), false); double multiplier = Multipliers.getMultiplier( "debuff", plugin.economy.getLevel(p, "debuff", "upgrade"), false); int duration = (int) (218 * multiplier); for (OfflinePlayer olTarget : a.getTeams()[targetTeam].getPlayers()) { for (Player onlinePlayer : Bukkit.getOnlinePlayers()) { if (onlinePlayer == olTarget) { if (lightning > 0) { World w = onlinePlayer.getLocation().getWorld(); w.createExplosion( onlinePlayer.getLocation().getX(), onlinePlayer.getLocation().getY(), onlinePlayer.getLocation().getZ(), (float) lightning, false, false); } onlinePlayer.getWorld().strikeLightning(onlinePlayer.getLocation()); onlinePlayer.addPotionEffect( new PotionEffect(PotionEffectType.CONFUSION, duration, 1)); } } } } } } } }
@EventHandler public void onPlayerDeath(PlayerDeathEvent event) { SpleefPlayer player = getHeavySpleef().getSpleefPlayer(event.getEntity()); if (!isSpectating(player)) { return; } deadPlayers.add(player); }
@EventHandler(priority = EventPriority.HIGHEST) public void onPlayerDeath(PlayerDeathEvent e) { e.setDroppedExp(0); PlayerDetails p = getPlayerDetails(e.getEntity()); if (p == null) // make way for hacky plugins! return; p.setHealth(0); p.giveMana = false; }
/** * On player death event, check if killers task type is pvp * * @param e */ @EventHandler public void onKill(PlayerDeathEvent e) { if (e.getEntity().getKiller() instanceof Player) { Player killer = e.getEntity().getKiller(); TaskList taskList = new TaskList(suga); // get Player's current task String currentTask = config.getString("player." + killer.getName() + ".task"); // traverse set of tasks in config file for (String task : taskList) { // match task with players current task and check current task is location type if (task.equals(currentTask) && config.getString("task." + task + ".type").equals("pvp")) { PlayerKillTask killTask = new PlayerKillTask(suga, killer); killTask.completeTask(task); } } } }
/** Handles player death events, removes the death message. */ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onPlayerDeath(PlayerDeathEvent event) { String playerName = event.getEntity().getName(); if (ultimateGames.getPlayerManager().isPlayerInArena(playerName)) { Arena arena = ultimateGames.getPlayerManager().getPlayerArena(playerName); arena.getGame().getGamePlugin().onPlayerDeath(arena, event); event.setDeathMessage(""); } }
@EventHandler public void onPlayerDeath(PlayerDeathEvent event) { if (event.getEntity().getKiller() != null) { Player player = event.getEntity(); Player attacker = event.getEntity().getKiller(); NovaPlayer novaPlayer = plugin.getPlayerManager().getPlayer(player); NovaPlayer novaPlayerAttacker = plugin.getPlayerManager().getPlayer(attacker); String tag1 = ""; String tag2 = ""; String tagscheme = plugin.getConfig().getString("guild.tag"); tagscheme = StringUtils.replace(tagscheme, "{RANK}", ""); if (novaPlayer.hasGuild()) { tag1 = StringUtils.replace(tagscheme, "{TAG}", novaPlayer.getGuild().getTag()); } if (novaPlayerAttacker.hasGuild()) { tag2 = StringUtils.replace(tagscheme, "{TAG}", novaPlayerAttacker.getGuild().getTag()); } HashMap<String, String> vars = new HashMap<>(); vars.put("PLAYER1", player.getName()); vars.put("PLAYER2", attacker.getName()); vars.put("TAG1", tag1); vars.put("TAG2", tag2); plugin.getMessageManager().broadcastMessage("broadcast.pvp.killed", vars); if (novaPlayer.hasGuild()) { NovaGuild guildVictim = plugin.getGuildManager().getGuildByPlayer(novaPlayer); guildVictim.takePoints(plugin.getConfig().getInt("guild.deathpoints")); } if (novaPlayerAttacker.hasGuild()) { NovaGuild guildAttacker = plugin.getGuildManager().getGuildByPlayer(novaPlayerAttacker); guildAttacker.addPoints(plugin.getConfig().getInt("guild.killpoints")); } // disable death message event.setDeathMessage(null); } }
@EventHandler public void onDeath(PlayerDeathEvent e) { Player p = (Player) e.getEntity(); if (adminMode.contains(p.getName())) { adminMode.remove(p.getName()); respawn.add(p.getName()); e.getDrops().clear(); } }
@EventHandler(priority = EventPriority.HIGH) public void playerKillPlayer(PlayerDeathEvent event) { if (!(event.getEntity().getKiller() instanceof Player)) { return; } Player killed = event.getEntity(); Player killer = killed.getKiller(); if (vanishNoPacket.isPlayerInvisible(killer)) { return; } Set<Snitch> snitches = snitchManager.findSnitches(killed.getWorld(), killed.getLocation()); for (Snitch snitch : snitches) { if (!isOnSnitch(snitch, killer.getName()) || isDebugging()) { if (checkProximity(snitch, killed.getName()) || checkProximity(snitch, killer.getName())) { plugin.getJaLogger().logSnitchPlayerKill(snitch, killer, killed); } } } }
@EventHandler public void onDeath(PlayerDeathEvent e) throws IOException { Player p = e.getEntity(); if (p.hasPermission("kits.deathinv")) { InventoryNBTSer.setInv(p, plugin.folder); e.getDrops().clear(); } if (p.hasPermission("kits.deathexp")) { e.setDroppedExp(0); } }
/** * Saves the player's death and resets their spawn point to the team spawn * * @param event */ @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onDeath(final PlayerDeathEvent event) { // getLogger().info("DEBUG: death"); Player player = event.getEntity(); // Check if player died in-game if (!player.getWorld().equals(getBeaconzWorld())) { // getLogger().info("DEBUG: not in world"); return; } // If in the lobby, ignore if (getGameMgr().isLocationInLobby(player.getLocation())) { // getLogger().info("DEBUG: died in lobby"); return; } // Get game Game game = getGameMgr().getGame(player.getLocation()); if (game != null) { Team team = game.getScorecard().getTeam(player); // getLogger().info("DEBUG: team is " + team.getDisplayName()); // Store new spawn point Location spawnPoint = game.getScorecard().getTeamSpawnPoint(team); // getLogger().info("DEBUG: new spawn point is " + spawnPoint); if (event.getKeepInventory()) { // Store the inventory for this player because they will get it when they come back // Will also store their exp // getLogger().info("DEBUG: keep inventory is true"); getBeaconzStore().storeInventory(player, game.getName(), spawnPoint); } else { // getLogger().info("DEBUG: keep inventory is false"); // Their inventory is going to get dumped on the floor so they need to have their // possessions removed getBeaconzStore().clearItems(player, game.getName(), spawnPoint); } if (!event.getKeepLevel()) { // getLogger().info("DEBUG: lose level! - new exp = " + event.getNewExp()); // If they don't get to keep their level, their exp needs updating to what they'll get in // this world. getBeaconzStore().setExp(player, game.getName(), event.getNewExp()); } else { // getLogger().info("DEBUG: keep level"); } // They are dead, so when they respawn they need to have full health (otherwise they will die // repeatedly) getBeaconzStore().setHealth(player, game.getName(), player.getMaxHealth()); // They will also get full food level getBeaconzStore().setFood(player, game.getName(), 20); // Make a note of their death status deadPlayers.put(player.getUniqueId(), spawnPoint); } else { // getLogger().info("DEBUG: game is null"); } }
@EventHandler(priority = EventPriority.NORMAL) public void onPlayerDeath(final PlayerDeathEvent event) { if (event.getDeathMessage() == null) { return; } for (final IRCChannel c : Variables.channels) { if (!c.getBlockedEvents().contains("game_death")) { IRC.sendMessageToChannel( c.getChannel(), ColorUtils.formatGametoIRC(event.getEntity().getDisplayName() + " has died.")); } } }