"The Last Kill" - Boss Damager Notification

Discussion in 'Archived: Plugin Requests' started by TheLazeboy, Sep 12, 2013.

?

Have you ever fought the dragon with others whom claim they got the last hit and not you?

  1. Yes, and I know I killed it.

    50.0%
  2. Yes, but I definitely didn't.

    0 vote(s)
    0.0%
  3. Yes, but I tried to convince them it was a group kill.

    25.0%
  4. No because I work alone.

    0 vote(s)
    0.0%
  5. No because I never fought the dragon.

    0 vote(s)
    0.0%
  6. No because I am scared of the dragon.

    25.0%
  1. Offline

    TheLazeboy

    Let me set the scene.... A group of players on a server are fighting rigorously to kill the dragon with the last hit. Moments later, the dragon is a mere hit away from death. Some archers shoot a well-aimed shot towards the dragon; meanwhile, some foot soldiers are striking their beefed, enchanted diamonds swords. The sound of victory is played through everyone's headset. And then... it happens. "I did it I killed the dragon!" "bro i got him, you lagged" "Hey my arrow dealt the damage idiots." ... Yeah. The ever unproven bragging right. Until this plugin comes along and shows who killed the dragon (or wither). Perhaps when any dragon or wither is killed on the server, the plugin announces the person who got the last hit. And maybe a list of the players who dealt the most damage and how much damage they dealt. I seriously hope this plugin request is accepted and made by coder(s), on behalf of all Minecraft server players.
     
    Fire_Feather likes this.
  2. Offline

    DarkRiddles

    uhh what?
    Something like a Boss server message?
     
  3. Offline

    TheLazeboy

    *person kills a boss* Chat: "[<plugin name>]: <player who killed the boss> has killed a <boss (dragon or wither)>!" That is what I'm saying would happen. :)
     
  4. Offline

    zack6849

    I actually made something similar to this a while back, here's the source if any of the devs want to modify it for this guys needs.

    Basically, this code listens to when people kill the ender dragon, and it tracks whoever did the most damage to the dragon, and gives them all the xp
    Show Spoiler

    Code:
    package com.zack6849.enderdragon;
    
    import java.io.File;
    import java.util.ArrayList;
    import java.util.Collections;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    import java.util.logging.Logger;
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.World;
    import org.bukkit.entity.Arrow;
    import org.bukkit.entity.EntityType;
    import org.bukkit.entity.Player;
    import org.bukkit.entity.ThrownPotion;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.EntityDamageByEntityEvent;
    import org.bukkit.event.entity.EntityDeathEvent;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.plugin.java.JavaPlugin;
    
    /**
     * Hello world!
     *
     */
    public class App extends JavaPlugin implements Listener
    {
    
        Logger log;
        public static Map<String, Integer> damage = new HashMap<String, Integer>();
    
        @Override
        public void onEnable()
        {
            this.log = getLogger();
            getServer().getPluginManager().registerEvents(this, this);
        }
        @Override
        public void onDisable(){
            damage.clear();
        }
        @EventHandler
        public void onDamage(EntityDamageByEntityEvent event)
        {
            if (event.getDamager() instanceof Player)
            {
                if (event.getEntity().getType() == EntityType.ENDER_DRAGON)
                {
                    Player damager = (Player) event.getDamager();
                    int damaged = event.getDamage();
                    if (!damage.containsKey(damager.getName()))
                    {
                        damage.put(damager.getName(), damaged);
                    } else
                    {
                        damage.put(damager.getName(), damage.get(damager.getName()) + damaged);
                    }
                }
            }
            if (event.getDamager().getType() == EntityType.ARROW)
            {
                if (event.getEntityType() == EntityType.ENDER_DRAGON)
                {
                    Arrow a = (Arrow) event.getDamager();
                    if (a.getShooter() instanceof Player)
                    {
                        Player damager = (Player) a.getShooter();
                        int damaged = event.getDamage();
                        if (!damage.containsKey(damager.getName()))
                        {
                            damage.put(damager.getName(), damaged);
                        } else
                        {
                            damage.put(damager.getName(), damage.get(damager.getName()) + damaged);
                        }
                    }
                }
            }
            if (event.getEntityType() == EntityType.SPLASH_POTION)
            {
                ThrownPotion potion = (ThrownPotion) event.getEntity();
                if (potion.getShooter() instanceof Player)
                {
                    Player damager = (Player) potion.getShooter();
                    int damaged = event.getDamage();
                    if (!damage.containsKey(damager.getName()))
                    {
                        damage.put(damager.getName(), damaged);
                    } else
                    {
                        damage.put(damager.getName(), damage.get(damager.getName()) + damaged);
                    }
                }
            }
        }
    
        @EventHandler
        public void onDeath(EntityDeathEvent event)
        {
            if (event.getEntityType() == EntityType.ENDER_DRAGON)
            {
                int exp = event.getDroppedExp();
                List<ItemStack> drops = event.getDrops();
                event.setDroppedExp(0);
                event.getDrops().clear();
                Object[] damages = damage.values().toArray();
                List<Integer> values = new ArrayList<Integer>();
                for (int i : damage.values())
                {
                    values.add(i);
                }
                int highest = Collections.max(values);
                String winner = "";
                for (String s : damage.keySet())
                {
                    if (damage.get(s) == highest)
                    {
                        winner = s;
                    }
                }
                Player p = getServer().getPlayer(winner);
                for (ItemStack i : drops)
                {
                    p.getInventory().addItem(i);
                }
                p.getInventory().addItem(new ItemStack(Material.DRAGON_EGG));
                p.giveExp(exp);
                p.sendMessage(ChatColor.GREEN + "I see you did most of the work, here's your reward :3");
                damage.clear();
            }
        }
    }
    
    
     
  5. Offline

    TheLazeboy

    Achoo! Aww, it appears I somehow bumped this. Darn.
     
  6. Interesting, I could use this
     
  7. Offline

    Phoenix1123

    I have just created a plugin for this, it does not yet have much customisation, only the prefix at this point, but I will add to it over time.
     
  8. Offline

    MayoDwarf

    Wait so just like a message to who got last hit on the boss and killed it? Boss meaning Ender Dragon?
     
  9. Offline

    TheLazeboy

    Boss meaning boss. Whomever hit it last on a boss gets his/her name announced over the server, so there is no conflict and confusion among the others who claim they got the last hit. Pheonix actually started this idea as "BDAnnouncer" and has potential.
     
  10. Offline

    MayoDwarf

    [quote uid=90643426 name="TheLazeboy" post=1858097]Boss meaning boss. Whomever hit it last on a boss gets his/her name announced over the server, so there is no conflict and confusion among the others who claim they got the last hit. Pheonix actually started this idea as "BDAnnouncer" and has potential.[/quote]
    I could make this if you want? So you just want the server to announce the person who got the last hit on the ender dragon and killed it right? Do they get a reward or no?

    [quote uid=90643426 name="TheLazeboy" post=1858097]Boss meaning boss. Whomever hit it last on a boss gets his/her name announced over the server, so there is no conflict and confusion among the others who claim they got the last hit. Pheonix actually started this idea as "BDAnnouncer" and has potential.[/quote]
    Finished! Just waiting to test it for you! :) ;)

    [quote uid=90643426 name="TheLazeboy" post=1847310]Let me set the scene.... A group of players on a server are fighting rigorously to kill the dragon with the last hit. Moments later, the dragon is a mere hit away from death. Some archers shoot a well-aimed shot towards the dragon; meanwhile, some foot soldiers are striking their beefed, enchanted diamonds swords. The sound of victory is played through everyone's headset. And then... it happens. "I did it I killed the dragon!" "bro i got him, you lagged" "Hey my arrow dealt the damage idiots." ... Yeah. The ever unproven bragging right. Until this plugin comes along and shows who killed the dragon (or wither). Perhaps when any dragon or wither is killed on the server, the plugin announces the person who got the last hit. And maybe a list of the players who dealt the most damage and how much damage they dealt. I seriously hope this plugin request is accepted and made by coder(s), on behalf of all Minecraft server players.[/quote]
    This tells you who the person was who killed the bosses the Wither and Ender Dragon.
    This should suit your needs:
    <Edit by Moderator: Redacted mediafire url>

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Nov 5, 2016
  11. Offline

    Fire_Feather

    TheLazeboy
    That was the most entertaining plugin request I have ever read!

    On another note... Who gets the dragon egg? Maybe cancel the spawning of it and give it to the player who kills/does the most damage to the dragon? To avoid more confusion and unfairness...
     
  12. Offline

    MayoDwarf

    Almost done with adding percentage of damage they did too! :)
    EDIT: Added percentage of damage they do and made it broadcast once boss is killed!
    Uploading soon! :) TheLazeboy
     

Share This Page