-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1e8e186
commit 11923a1
Showing
28 changed files
with
252 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/ua/mei/minekord/mixin/PlayerManagerMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package ua.mei.minekord.mixin; | ||
|
||
import com.mojang.authlib.GameProfile; | ||
import net.minecraft.server.MinecraftServer; | ||
import net.minecraft.server.PlayerManager; | ||
import net.minecraft.text.Text; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
import ua.mei.minekord.cache.IPCache; | ||
import ua.mei.minekord.config.MinekordConfig; | ||
import ua.mei.minekord.event.IPCheckEvent; | ||
|
||
import java.net.SocketAddress; | ||
|
||
@Mixin(PlayerManager.class) | ||
public abstract class PlayerManagerMixin { | ||
@Shadow | ||
@Final | ||
private MinecraftServer server; | ||
|
||
@Inject(method = "checkCanJoin", at = @At("RETURN"), cancellable = true) | ||
public void minekord$checkCanJoin(SocketAddress socketAddress, GameProfile gameProfile, CallbackInfoReturnable<Text> cir) { | ||
if (cir.getReturnValue() == null) { | ||
if (MinekordConfig.Auth.INSTANCE.getIpBasedLogin() && !IPCache.INSTANCE.containsInCache(socketAddress, gameProfile) && !server.getPlayerManager().getIpBanList().isBanned(socketAddress)) { | ||
if (!IPCache.INSTANCE.isRequested(socketAddress, gameProfile)) { | ||
IPCheckEvent.Companion.getEVENT().invoker().check(socketAddress, gameProfile); | ||
} | ||
cir.setReturnValue(Text.literal(MinekordConfig.Messages.INSTANCE.getIpKickMessage())); | ||
} | ||
} | ||
} | ||
} |
129 changes: 0 additions & 129 deletions
129
src/main/java/ua/mei/minekord/mixin/ServerLoginNetworkHandlerMixin.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.