25 lines
1.0 KiB
Java
25 lines
1.0 KiB
Java
package party._2a03.mc.mixin;
|
|
|
|
import java.util.Collection;
|
|
import com.mojang.brigadier.context.CommandContext;
|
|
import net.minecraft.server.command.ServerCommandSource;
|
|
import net.minecraft.server.command.GameModeCommand;
|
|
import net.minecraft.server.network.ServerPlayerEntity;
|
|
import net.minecraft.text.Text;
|
|
import net.minecraft.world.GameMode;
|
|
import org.spongepowered.asm.mixin.Mixin;
|
|
import org.spongepowered.asm.mixin.injection.At;
|
|
import org.spongepowered.asm.mixin.injection.Inject;
|
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|
|
|
@Mixin(GameModeCommand.class)
|
|
public class MixinGameModeCommand {
|
|
@Inject(method = "execute", at = @At("HEAD"))
|
|
private static void OnExecute(CommandContext<ServerCommandSource> context, Collection<ServerPlayerEntity> targets, GameMode gameMode, CallbackInfoReturnable cir) {
|
|
if (gameMode == GameMode.CREATIVE) {
|
|
context.getSource().sendFeedback(Text.of("<Server> Creative mode? What are you, a cheater?"), false);
|
|
}
|
|
return;
|
|
}
|
|
}
|