use of org.spongepowered.api.event.world.ChangeWorldGameRuleEvent in project LanternServer by LanternPowered.
the class Rule method setValue0.
private void setValue0(T newValue, @Nullable String newRawValue) {
final Optional<LanternWorld> optWorld = this.rules.getWorld();
if (optWorld.isPresent() && !newValue.equals(this.value)) {
final LanternWorld world = optWorld.get();
if (newRawValue == null) {
newRawValue = this.ruleType.getDataType().serialize(newValue);
}
final Cause cause = CauseStack.current().getCurrentCause();
final ChangeWorldGameRuleEvent event = SpongeEventFactory.createChangeWorldGameRuleEvent(cause, getRawValue(), newRawValue, this.ruleType.getName(), world);
if (Sponge.getEventManager().post(event)) {
return;
}
}
this.value = newValue;
}
Aggregations