crwdns138211:0crwdne138211:0
Warning
crwdns138213:0crwdne138213:0
crwdns138215:0crwdne138215:0
crwdns138217:0:javadoc:crwdne138217:0
crwdns138219:0crwdne138219: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);
}
}
crwdns138221:0crwdne138221:0
crwdns138223:0crwdne138223:0
crwdns138225:0crwdne138225:0
crwdns138227:0:javadoc:crwdne138227:0
crwdns138229:0:javadoc:crwdne138229:0
public void removeName(DataHolder target) {
target.remove(Keys.DISPLAY_NAME);
}
crwdns138231:0crwdne138231:0
crwdns138233:0crwdne138233:0
crwdns138235:0crwdne138235: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;
}
});
}
crwdns138237:0crwdne138237:0
public void buff(DataHolder target) {
target.transform(Keys.MAX_HEALTH, d -> (d == null) ? 0 : 2*d);
}
crwdns138239:0:javadoc:crwdne138239:0
crwdns138241:0crwdne138241:0
crwdns138243:0:javadoc:crwdnd138243:0:javadoc:crwdne138243:0
crwdns138245:0crwdne138245: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);
}
}
crwdns138247:0crwdne138247:0