InstaKill Sword (EASY)

Discussion in 'Archived: Plugin Requests' started by jujulogey, Apr 18, 2013.

  1. Offline

    jujulogey

    An enchantment that when bind to a sword, instantly kills who it hits. HITS. not touches.

    Once the enchantment is bind to the sword, the sword has a durability of 3 hits.

    I was thinking of selling a sword on my BuyCraft store that would do this. Id like to make it so its not accessible to players unless bought. Any ideas?
     
  2. Offline

    noraver

    there is no instant kill enchantment unless u boost it up to like 10k lol as for durability of 3 hits it's a little harder even thought it be easy to set it to 3 but any player can just easy repair it.
     
  3. Take any sword and set it so it has only 3 uses durability left enchant with sharpness level 100 or 1000 or whatever and you got your sword. Only thing you need is a plugin like TimTheEnchantor or something similar.
     
  4. Offline

    BlueMond416

    A nice way of doing this would be to use spout and create a custom item that only had 3 uses and since it's a custom item it probably wouldn't be accessible to repairs and the only way to get a custom item is to spawn it in or create a recipe for it so therefore that would be good.
     
  5. Offline

    skore87

    Just spawn an itemstack of the desired sword time with 3 durability give it a name and on the damage event set the recipient's health to zero.
     
  6. Offline

    noraver

    i don't think durability would be the way to go maybe having lets say 3 Swords stacks on top of each other and each use Consumes 1 this way it bypasses durability and people trying to repair it
     
  7. Offline

    Rockon999

    Code:
    package es;
     
    import java.util.ArrayList;
     
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.EntityDamageByEntityEvent;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.meta.ItemMeta;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Main extends JavaPlugin implements Listener {
        public void onEnable(){
         getServer().getPluginManager().registerEvents(this, this);
        }
        @EventHandler
        public void onPlayerHitEvent(EntityDamageByEntityEvent event){
            Player player = (Player) event.getDamager();
            ItemStack item = new ItemStack(Material.DIAMOND_SWORD);
            ItemMeta meta = item.getItemMeta();
            meta.setDisplayName("EpicSword");
            ArrayList<String> info = new ArrayList<String>();
            ItemStack hand = player.getItemInHand();
            if(player.getItemInHand().getType() == Material.DIAMOND_SWORD){
            if(player.getItemInHand().getItemMeta().getLore().equals("Uses: 3")){
                info.add("EpicSword");
                info.add("Uses: 2");
                meta.setLore(info);
                hand.setItemMeta(meta);
                player.getInventory().addItem(item);
            }else if(player.getItemInHand().getItemMeta().getLore().equals("Uses: 2")){
                info.add("EpicSword");
                info.add("Uses: 1");
                meta.setLore(info);
                hand.setItemMeta(meta);
                player.getInventory().addItem(item);
            }else if(player.getItemInHand().getItemMeta().getLore().equals("Uses: 1")){
                info.add("EpicSword");
                info.add("Uses: 0");
                meta.setLore(info);
                item.setItemMeta(meta);
                player.getInventory().removeItem(hand);
                player.getInventory().addItem(item);
            }
     
            }
        }
     
    }
    That isn't exact code.. but the just is you set the item lore and name.. then get it when the player uses it. And remove the player who is damaged too :p

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016

Share This Page