HeadHunting Plugin

Discussion in 'Plugin Requests' started by OperationVaas, Nov 28, 2014.

Thread Status:
Not open for further replies.
  1. Offline


    Plugin category: Mechanics

    Suggested name: HeadHunting

    What I want: Kill someone, and then their head will drop. When you pick up their head it will say a value on the bottom, the value would be determined by like some sort of stat. You could sell the head for in game currency.

    Ideas for commands: /hh reload, /hh spawnhead <name>

    Ideas for permissions: Not sure

    When I'd like it by: As soon as possible.
  2. Offline


    OperationVaas "determined by like some sort of stat" gonna need more information than that.
  3. Offline


    I mean determined by like kills, or how much money they have.
    Sil3nt_Aassassin likes this.
  4. Can someone do this?
  5. Offline


    You need to decide what "stat" exactly is going to create this value.
  6. Offline


    @Jayke_ I think he means if you got my head (cucci0) and i have killed 50 players the head is worth $2000. But if i die 50 times the head will be worth $0 because i have 50 kills and 50 deaths. It's almost as a KDR in Call of Duty etc.
    Sil3nt_Aassassin likes this.
  7. Offline


    I'll start on this tonight, I think this is a neat idea.
    completed rough functionality. no frills yet.

    package bmckalip.HeadHunting;
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.SkullType;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.configuration.Configuration;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.PlayerDeathEvent;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.meta.SkullMeta;
    import org.bukkit.plugin.java.JavaPlugin;
    public class HeadHunting extends JavaPlugin implements Listener {
        Configuration config = getConfig();
        ItemStack head = new ItemStack(Material.SKULL_ITEM, 1,(short)SkullType.PLAYER.ordinal());
        public void onEnable(){
            Bukkit.getServer().getPluginManager().registerEvents(this, this);
        public boolean onCommand(CommandSender sender, Command command, String label, String[] args){
            if(!(sender instanceof Player)){
                sender.sendMessage(ChatColor.RED + "Only players can use commands");
                return true;
            if(command.getName().equalsIgnoreCase("collectbounty") && args.length == 1){
                    sender.sendMessage(redeem("hand", (Player)sender));
                }else if(args[0].equalsIgnoreCase("all")){
                    sender.sendMessage(redeem("all", (Player)sender));
                return true;
                sender.sendMessage("Usage: /CollectBounty <hand/all>");
            return true;
        public void awardBounty(PlayerDeathEvent event){
            String killer = event.getEntity().getKiller().getName();
            String victim = event.getEntity().getPlayer().getName();
            Double value = config.getDouble("KillValue") * getKD(victim);
            if(killer != null){
                SkullMeta meta = (SkullMeta) head.getItemMeta();
                meta.setDisplayName(ChatColor.WHITE + victim + "'s head!" + ChatColor.RED + " [$" + value + "]");
        public void addPlayerToBountyList(PlayerJoinEvent event){
            Player player = event.getPlayer();
            config.set("Players." + player.getName(), null);
            config.set("Players." + player.getName() + ".Kills", 0);
            config.set("Players." + player.getName() + ".Deaths", 0);
        public void addKill(String player){
            config.set("Players." + player + ".Kills", config.getInt("Players." + player + ".Kills") + 1);
        public void addDeath(String player){
            config.set("Players." + player + ".Deaths", config.getInt("Players." + player + ".Deaths") + 1);
        public double getKD(String player){
            int kills = config.getInt("Players." + player + ".Kills");
            int deaths = config.getInt("Players." + player + ".Deaths");
            double KD;
            if(deaths != 0){
                KD = kills / deaths;
                KD = kills;
            return KD;
        public String redeem(String type, Player player){
            ItemStack item = player.getInventory().getItemInHand();
            if(item.getAmount() > 1){
            player.setItemInHand(new ItemStack(Material.AIR));
            String message = null;
            String displayName = item.getItemMeta().getDisplayName();
            String value = null;
            if(item.getType().equals(head.getType()) && displayName != null){
                displayName = displayName.replaceAll(".*\\$", "");
                for(int i = 0; i < displayName.length() - 1; i++){
                    value += displayName.charAt(i);
            double bounty = Double.parseDouble(value);
            Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "eco give " + player.getName() + " " + bounty);
            message = ChatColor.GREEN + "Successfully Redeemed Head for $" + value;
                message = ChatColor.RED + "That is not a player head!";
            return message;
    Last edited: Dec 15, 2014
Thread Status:
Not open for further replies.

Share This Page