crwdns148721:0crwdne148721:0

crwdns148723:0crwdne148723:0

crwdns148725:0:javadoc:crwdne148725:0

crwdns148727:0crwdne148727: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);
    }
}

crwdns148729:0crwdne148729:0

crwdns148731:0crwdne148731:0

crwdns148733:0crwdne148733:0

crwdns148735:0:javadoc:crwdne148735:0

crwdns148737:0:javadoc:crwdne148737:0

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

crwdns148739:0crwdne148739:0

crwdns148741:0crwdne148741:0

crwdns148743:0crwdne148743: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;
        }
    });
}

crwdns148745:0crwdne148745:0

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

crwdns148747:0:javadoc:crwdne148747:0

crwdns148749:0crwdne148749:0

crwdns148751:0:javadoc:crwdnd148751:0:javadoc:crwdne148751:0

crwdns148753:0crwdne148753: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);
    }
}

crwdns148755:0crwdne148755:0