Need Help With Manipulating Kit Functions

Discussion in 'Plugin Development' started by ScoobyDoo3, Dec 16, 2017.

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

    ScoobyDoo3

    Does anyone know how I would go about making specific functions for certain kits? For example how would I create a kit that when used when you fall you take less fall damage and you do out going damage to enemies around you. I have tried finding tutorials on youtube and have had no luck. Im just looking for a solution to creating kits with special abilities.
     
  2. I'm assuming you're making a KitPvP server

    Code:
    public HashMap<Player, Kit> playerKits = new HashMap<Player, Kit>();
    
    public void setKit (Player p, Kit kit) {
        playerKits.put(p, kit);
        p.getInventory().clear();
        p.getInventory().addItem(spiderSword);
    }
    
    public void entityDamageEvent(EntityDamageEvent event) {
        if(event.getEntity() instanceof Player) {
            Player p = (Player)event.getEntity();
            if(playerKits.containsKey(p) && playerKits.get(p).equals(Kit.SPIDER)) { // SPIDER kit takes less fall damage
                event.getCause().equals(DamageCause.FALL) {
                    event.setDamage(event.getDamage()*0.25); // 75% Reduced Damage or 25% of the original damage
                }
            }
        }
    }
     
Thread Status:
Not open for further replies.

Share This Page