geforkt von Mirrors/AxiomPaperPlugin
Dieser Commit ist enthalten in:
Ursprung
8b107c3a9a
Commit
1cead96565
@ -172,7 +172,7 @@ public class AxiomPaper extends JavaPlugin implements Listener {
|
||||
if (properties != null) {
|
||||
ServerWorldProperty<?> property = properties.getById(new ResourceLocation("axiom:pause_weather"));
|
||||
if (property != null) {
|
||||
((ServerWorldProperty<Boolean>)property).setValue(event.getWorld(), Boolean.valueOf(event.getValue()));
|
||||
((ServerWorldProperty<Boolean>)property).setValue(event.getWorld(), !Boolean.parseBoolean(event.getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.GameRules;
|
||||
import org.bukkit.GameRule;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_20_R1.CraftWorld;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -58,7 +59,6 @@ public class ServerWorldPropertiesRegistry {
|
||||
|
||||
public void registerDefault(World world) {
|
||||
ServerLevel serverLevel = ((CraftWorld)world).getHandle();
|
||||
GameRules gameRules = serverLevel.getGameRules();
|
||||
|
||||
// Time
|
||||
WorldPropertyCategory timeCategory = new WorldPropertyCategory("axiom.editorui.window.world_properties.time", true);
|
||||
@ -76,8 +76,8 @@ public class ServerWorldPropertiesRegistry {
|
||||
|
||||
ServerWorldProperty<Boolean> pauseWeather = new ServerWorldProperty<>(new ResourceLocation("axiom:pause_weather"),
|
||||
"axiom.editorui.window.world_properties.pause_weather",
|
||||
true, WorldPropertyWidgetType.CHECKBOX, !gameRules.getRule(GameRules.RULE_WEATHER_CYCLE).get(), bool -> {
|
||||
gameRules.getRule(GameRules.RULE_WEATHER_CYCLE).set(!bool, serverLevel);
|
||||
true, WorldPropertyWidgetType.CHECKBOX, !world.getGameRuleValue(GameRule.DO_WEATHER_CYCLE), bool -> {
|
||||
world.setGameRule(GameRule.DO_WEATHER_CYCLE, !bool);
|
||||
return false;
|
||||
});
|
||||
|
||||
|
@ -50,10 +50,8 @@ public class ServerWorldProperty<T> {
|
||||
}
|
||||
|
||||
public void setValue(World world, T value) {
|
||||
if (!value.equals(this.value)) {
|
||||
this.value = value;
|
||||
this.sync(world);
|
||||
}
|
||||
this.value = value;
|
||||
this.sync(world);
|
||||
}
|
||||
|
||||
public void sync(World world) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren