From 970678f8b14a0beb9bc8be3b1105f9ce07728c59 Mon Sep 17 00:00:00 2001 From: Moulberry Date: Thu, 16 Nov 2023 19:59:04 +0800 Subject: [PATCH] Don't allow World Properties to change on worlds you don't have permission to build --- .../axiom/packet/SetWorldPropertyListener.java | 11 +++++++++++ .../world_properties/WorldPropertyWidgetType.java | 1 - 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/moulberry/axiom/packet/SetWorldPropertyListener.java b/src/main/java/com/moulberry/axiom/packet/SetWorldPropertyListener.java index 52d043e..35c70c1 100644 --- a/src/main/java/com/moulberry/axiom/packet/SetWorldPropertyListener.java +++ b/src/main/java/com/moulberry/axiom/packet/SetWorldPropertyListener.java @@ -1,6 +1,7 @@ package com.moulberry.axiom.packet; import com.moulberry.axiom.AxiomPaper; +import com.moulberry.axiom.integration.plotsquared.PlotSquaredIntegration; import com.moulberry.axiom.world_properties.server.ServerWorldPropertiesRegistry; import com.moulberry.axiom.world_properties.server.ServerWorldPropertyHolder; import io.netty.buffer.Unpooled; @@ -23,6 +24,16 @@ public class SetWorldPropertyListener implements PluginMessageListener { return; } + // Call modify world + if (!this.plugin.canModifyWorld(player, player.getWorld())) { + return; + } + + // Don't allow on plot worlds + if (PlotSquaredIntegration.isPlotWorld(player.getWorld())) { + return; + } + FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(Unpooled.wrappedBuffer(message)); ResourceLocation id = friendlyByteBuf.readResourceLocation(); int type = friendlyByteBuf.readVarInt(); diff --git a/src/main/java/com/moulberry/axiom/world_properties/WorldPropertyWidgetType.java b/src/main/java/com/moulberry/axiom/world_properties/WorldPropertyWidgetType.java index 7166324..e274cbb 100644 --- a/src/main/java/com/moulberry/axiom/world_properties/WorldPropertyWidgetType.java +++ b/src/main/java/com/moulberry/axiom/world_properties/WorldPropertyWidgetType.java @@ -60,7 +60,6 @@ public interface WorldPropertyWidgetType { } }; - WorldPropertyWidgetType BUTTON = new WorldPropertyWidgetType<>() { @Override public WorldPropertyDataType dataType() {