mirror of
https://github.com/Aizistral-Studios/No-Chat-Restrictions.git
synced 2026-05-14 21:03:32 +08:00
Time to snort some caffeine baby 🚀 🚀 🚀
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
package com.aizistral.nochatrestrictions;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
|
||||
public class NoChatRestrictions implements ModInitializer {
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.aizistral.nochatrestrictions.core;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class NCRCore {
|
||||
public static final Logger LOGGER = LogManager.getLogger("NoChatRestrictions");
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.aizistral.nochatrestrictions.core;
|
||||
|
||||
import java.util.UUID;
|
||||
import com.mojang.authlib.minecraft.SocialInteractionsService;
|
||||
|
||||
public class WrappedSocialInteractionsService implements SocialInteractionsService {
|
||||
private final SocialInteractionsService service;
|
||||
|
||||
public WrappedSocialInteractionsService(SocialInteractionsService service) {
|
||||
if (service == null)
|
||||
throw new NullPointerException("'service' argument cannot be null!");
|
||||
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean serversAllowed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean realmsAllowed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean chatAllowed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockedPlayer(UUID playerID) {
|
||||
return this.service.isBlockedPlayer(playerID);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.aizistral.nochatrestrictions.mixins;
|
||||
|
||||
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;
|
||||
|
||||
import com.aizistral.nochatrestrictions.core.NCRCore;
|
||||
import com.aizistral.nochatrestrictions.core.WrappedSocialInteractionsService;
|
||||
import com.mojang.authlib.minecraft.SocialInteractionsService;
|
||||
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.main.GameConfig;
|
||||
|
||||
@Mixin(Minecraft.class)
|
||||
public class MixinMinecraft {
|
||||
|
||||
@Inject(method = { "func_244735_a", "createSocialInteractions" }, at = @At("RETURN"), cancellable = true)
|
||||
public void onCreateSocialInteractions(YggdrasilAuthenticationService authService, GameConfig gameConfig,
|
||||
CallbackInfoReturnable<SocialInteractionsService> info) {
|
||||
SocialInteractionsService returnedService = info.getReturnValue();
|
||||
assert returnedService != null;
|
||||
info.setReturnValue(new WrappedSocialInteractionsService(returnedService));
|
||||
|
||||
NCRCore.LOGGER.info("Successfully supplanted SocialInteractionsService with a wrapped version.");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user