Update master #3

Zusammengeführt
YoyoNow hat 7 Commits von Mirrors/AxiomPaperPlugin:master nach master 2023-09-22 17:32:24 +02:00 zusammengeführt
3 geänderte Dateien mit 6 neuen und 8 gelöschten Zeilen
Nur Änderungen aus Commit 1cead96565 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -172,7 +172,7 @@ public class AxiomPaper extends JavaPlugin implements Listener {
if (properties != null) { if (properties != null) {
ServerWorldProperty<?> property = properties.getById(new ResourceLocation("axiom:pause_weather")); ServerWorldProperty<?> property = properties.getById(new ResourceLocation("axiom:pause_weather"));
if (property != null) { if (property != null) {
((ServerWorldProperty<Boolean>)property).setValue(event.getWorld(), Boolean.valueOf(event.getValue())); ((ServerWorldProperty<Boolean>)property).setValue(event.getWorld(), !Boolean.parseBoolean(event.getValue()));
} }
} }
} }

Datei anzeigen

@ -7,6 +7,7 @@ import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.GameRules; import net.minecraft.world.level.GameRules;
import org.bukkit.GameRule;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_20_R1.CraftWorld; import org.bukkit.craftbukkit.v1_20_R1.CraftWorld;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -58,7 +59,6 @@ public class ServerWorldPropertiesRegistry {
public void registerDefault(World world) { public void registerDefault(World world) {
ServerLevel serverLevel = ((CraftWorld)world).getHandle(); ServerLevel serverLevel = ((CraftWorld)world).getHandle();
GameRules gameRules = serverLevel.getGameRules();
// Time // Time
WorldPropertyCategory timeCategory = new WorldPropertyCategory("axiom.editorui.window.world_properties.time", true); 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"), ServerWorldProperty<Boolean> pauseWeather = new ServerWorldProperty<>(new ResourceLocation("axiom:pause_weather"),
"axiom.editorui.window.world_properties.pause_weather", "axiom.editorui.window.world_properties.pause_weather",
true, WorldPropertyWidgetType.CHECKBOX, !gameRules.getRule(GameRules.RULE_WEATHER_CYCLE).get(), bool -> { true, WorldPropertyWidgetType.CHECKBOX, !world.getGameRuleValue(GameRule.DO_WEATHER_CYCLE), bool -> {
gameRules.getRule(GameRules.RULE_WEATHER_CYCLE).set(!bool, serverLevel); world.setGameRule(GameRule.DO_WEATHER_CYCLE, !bool);
return false; return false;
}); });

Datei anzeigen

@ -50,11 +50,9 @@ public class ServerWorldProperty<T> {
} }
public void setValue(World world, T value) { public void setValue(World world, T value) {
if (!value.equals(this.value)) {
this.value = value; this.value = value;
this.sync(world); this.sync(world);
} }
}
public void sync(World world) { public void sync(World world) {
FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer()); FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());