generated from FabricMC/fabric-example-mod
-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref: #319
- Loading branch information
Showing
3 changed files
with
28 additions
and
12 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
24 changes: 24 additions & 0 deletions
24
src/main/java/pl/skidam/automodpack/modpack/GameHelpers.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,24 @@ | ||
package pl.skidam.automodpack.modpack; | ||
|
||
import com.mojang.authlib.GameProfile; | ||
|
||
import java.net.SocketAddress; | ||
|
||
import static pl.skidam.automodpack.init.Common.server; | ||
|
||
public class GameHelpers { | ||
|
||
// Simpler version of `PlayerManager.checkCanJoin` | ||
public static boolean isPlayerAuthorized(SocketAddress address, GameProfile profile) { | ||
var playerManager = server.getPlayerManager(); | ||
if (playerManager.getUserBanList().contains(profile)) { | ||
return false; | ||
} else if (!playerManager.isWhitelisted(profile)) { | ||
return false; | ||
} else if (playerManager.getIpBanList().isBanned(address)) { | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
} |
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