diff --git a/src/main/java/me/fallenbreath/tweakermore/impl/mod_tweaks/serverDataSyncer/ServerDataSyncer.java b/src/main/java/me/fallenbreath/tweakermore/impl/mod_tweaks/serverDataSyncer/ServerDataSyncer.java index 21c591ee..e3de2b94 100644 --- a/src/main/java/me/fallenbreath/tweakermore/impl/mod_tweaks/serverDataSyncer/ServerDataSyncer.java +++ b/src/main/java/me/fallenbreath/tweakermore/impl/mod_tweaks/serverDataSyncer/ServerDataSyncer.java @@ -25,6 +25,7 @@ import me.fallenbreath.tweakermore.TweakerMoreMod; import me.fallenbreath.tweakermore.config.TweakerMoreConfigs; import me.fallenbreath.tweakermore.mixins.tweaks.mod_tweaks.serverDataSyncer.DoubleInventoryAccessor; +import me.fallenbreath.tweakermore.util.compat.carpettisaddition.CarpetTISAdditionAccess; import me.fallenbreath.tweakermore.util.event.TweakerMoreEvents; import net.minecraft.block.entity.BlockEntity; import net.minecraft.client.MinecraftClient; @@ -81,7 +82,11 @@ public DataQueryHandlerPro getQueryHandler() public static boolean hasEnoughPermission() { MinecraftClient mc = MinecraftClient.getInstance(); - return mc.player != null && mc.player.allowsPermissionLevel(2); + if (mc.player != null && mc.player.allowsPermissionLevel(2)) + { + return true; + } + return CarpetTISAdditionAccess.getBooleanRule("debugNbtQueryNoPermission").orElse(false); } public void resetSyncLimiter() diff --git a/src/main/java/me/fallenbreath/tweakermore/util/compat/carpettisaddition/CarpetTISAdditionAccess.java b/src/main/java/me/fallenbreath/tweakermore/util/compat/carpettisaddition/CarpetTISAdditionAccess.java new file mode 100644 index 00000000..cb2f02fa --- /dev/null +++ b/src/main/java/me/fallenbreath/tweakermore/util/compat/carpettisaddition/CarpetTISAdditionAccess.java @@ -0,0 +1,36 @@ +/* + * This file is part of the TweakerMore project, licensed under the + * GNU Lesser General Public License v3.0 + * + * Copyright (C) 2024 Fallen_Breath and contributors + * + * TweakerMore is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * TweakerMore is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with TweakerMore. If not, see . + */ + +package me.fallenbreath.tweakermore.util.compat.carpettisaddition; + +import me.fallenbreath.tweakermore.util.ReflectionUtil; + +import java.util.Optional; + +public class CarpetTISAdditionAccess +{ + public static Optional getBooleanRule(String ruleName) + { + return ReflectionUtil.getClass("carpettisaddition.CarpetTISAdditionSettings") + .map(clazz -> ReflectionUtil.getStaticField(clazz, ruleName)) + .map(vw -> vw.isPresent() ? vw.get() : null) + .map(value -> value instanceof Boolean ? (Boolean)value : null); + } +}