crwdns118583:0crwdne118583:0
crwdns118585:0crwdne118585:0
crwdns118587:0:javadoc:crwdne118587:0
crwdns118589:0crwdne118589: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);
}
}
crwdns118591:0crwdne118591:0
crwdns118593:0crwdne118593:0
crwdns118595:0crwdne118595:0
crwdns118597:0:javadoc:crwdne118597:0
crwdns118599:0:javadoc:crwdne118599:0
public void removeName(DataHolder target) {
target.remove(Keys.DISPLAY_NAME);
}
crwdns118601:0crwdne118601:0
crwdns118603:0crwdne118603:0
crwdns118605:0crwdne118605: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;
}
});
}
crwdns118607:0crwdne118607:0
public void buff(DataHolder target) {
target.transform(Keys.MAX_HEALTH, d -> (d == null) ? 0 : 2*d);
}
crwdns118609:0:javadoc:crwdne118609:0
crwdns118611:0crwdne118611:0
crwdns118613:0:javadoc:crwdnd118613:0:javadoc:crwdne118613:0
crwdns118615:0crwdne118615: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);
}
}
crwdns118617:0crwdne118617:0