crwdns129495:0crwdne129495:0

crwdns129497:0crwdne129497:0

crwdns129499:0:javadoc:crwdne129499:0

crwdns129501:0crwdne129501:0

import org.spongepowered.api.data.DataHolder;
import org.spongepowered.api.data.key.Keys;

public void heal(DataHolder target) {
    if (target.supports(Keys.HEALTH)) {
        double maxHealth = target.get(Keys.MAX_HEALTH).get();
        target.offer(Keys.HEALTH, maxHealth);
    }
}

crwdns129503:0crwdne129503:0

crwdns129505:0crwdne129505:0

crwdns129507:0crwdne129507:0

crwdns129509:0:javadoc:crwdne129509:0

crwdns129511:0:javadoc:crwdne129511:0

public void removeName(DataHolder target) {
    target.remove(Keys.DISPLAY_NAME);
}

crwdns129513:0crwdne129513:0

crwdns129515:0crwdne129515:0

crwdns129517:0crwdne129517:0

import java.util.function.Function;

public void buff(DataHolder target) {
    target.transform(Keys.MAX_HEALTH, new Function<Double,Double>() {
        @Override
        public Double apply(Double input) {
            return (input == null) ? 0 : input * 2;
        }
    });
}

crwdns129519:0crwdne129519:0

public void buff(DataHolder target) {
    target.transform(Keys.MAX_HEALTH, d -> (d == null) ? 0 : 2*d);
}

crwdns129521:0:javadoc:crwdne129521:0

crwdns129523:0crwdne129523:0

crwdns129525:0:javadoc:crwdnd129525:0:javadoc:crwdne129525:0

crwdns129527:0crwdne129527:0

import org.spongepowered.api.data.value.mutable.MutableBoundedValue;

public void scare(DataHolder target) {
    if (target.supports(Keys.HEALTH)) {
        MutableBoundedValue<Double> health = target.getValue(Keys.HEALTH).get();
        double nearDeath = health.getMinValue() + 1;
        health.set(nearDeath);
        target.offer(health);
    }
}

crwdns129529:0crwdne129529:0