diff --git a/fabric/src/main/java/me/lucko/luckperms/fabric/FabricSenderFactory.java b/fabric/src/main/java/me/lucko/luckperms/fabric/FabricSenderFactory.java index 0da93bef0..57538da83 100644 --- a/fabric/src/main/java/me/lucko/luckperms/fabric/FabricSenderFactory.java +++ b/fabric/src/main/java/me/lucko/luckperms/fabric/FabricSenderFactory.java @@ -29,12 +29,15 @@ import me.lucko.fabric.api.permissions.v0.Permissions; import me.lucko.luckperms.common.locale.TranslationManager; import me.lucko.luckperms.common.sender.Sender; import me.lucko.luckperms.common.sender.SenderFactory; +import me.lucko.luckperms.fabric.mixin.ServerCommandSourceAccessor; import me.lucko.luckperms.fabric.model.MixinUser; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import net.luckperms.api.util.Tristate; +import net.minecraft.server.command.CommandOutput; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.server.rcon.RconCommandOutput; import net.minecraft.text.Text; import java.util.Locale; @@ -107,7 +110,10 @@ public class FabricSenderFactory extends SenderFactory + * Copyright (c) contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package me.lucko.luckperms.fabric.mixin; + +import net.minecraft.server.command.CommandOutput; +import net.minecraft.server.command.ServerCommandSource; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +/** + * Accessor mixin to provide access to the underlying {@link CommandOutput} + */ +@Mixin(ServerCommandSource.class) +public interface ServerCommandSourceAccessor { + + @Accessor("output") + CommandOutput getOutput(); + +} diff --git a/fabric/src/main/resources/luckperms.mixins.json b/fabric/src/main/resources/luckperms.mixins.json index 24634c967..bc4c58c9b 100644 --- a/fabric/src/main/resources/luckperms.mixins.json +++ b/fabric/src/main/resources/luckperms.mixins.json @@ -4,6 +4,7 @@ "compatibilityLevel": "JAVA_8", "mixins": [ "CommandManagerMixin", + "ServerCommandSourceAccessor", "ServerLoginNetworkHandlerAccessor", "ServerPlayerEntityMixin" ], diff --git a/forge/src/main/java/me/lucko/luckperms/forge/ForgeSenderFactory.java b/forge/src/main/java/me/lucko/luckperms/forge/ForgeSenderFactory.java index 911e17d45..83c6fdc19 100644 --- a/forge/src/main/java/me/lucko/luckperms/forge/ForgeSenderFactory.java +++ b/forge/src/main/java/me/lucko/luckperms/forge/ForgeSenderFactory.java @@ -38,8 +38,10 @@ import me.lucko.luckperms.forge.capabilities.UserCapabilityImpl; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import net.luckperms.api.util.Tristate; +import net.minecraft.commands.CommandSource; import net.minecraft.commands.CommandSourceStack; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.rcon.RconConsoleSource; import net.minecraft.world.entity.player.Player; import java.util.Locale; @@ -107,7 +109,10 @@ public class ForgeSenderFactory extends SenderFactory