mirror of
https://github.com/CyberL1/MyMcRealms.git
synced 2024-11-24 15:08:22 -05:00
fix: don't display a server to the player if they're not whitelisted or op
This commit is contained in:
parent
fd688ebc5d
commit
6d1dd06d0f
@ -17,6 +17,8 @@ namespace MyMcRealms.Controllers
|
|||||||
{
|
{
|
||||||
string cookie = Request.Headers.Cookie;
|
string cookie = Request.Headers.Cookie;
|
||||||
|
|
||||||
|
string playerUUID = cookie.Split(";")[0].Split(":")[2];
|
||||||
|
string playerName = cookie.Split(";")[1].Split("=")[1];
|
||||||
string gameVerision = cookie.Split(";")[2].Split("=")[1];
|
string gameVerision = cookie.Split(";")[2].Split("=")[1];
|
||||||
|
|
||||||
List<WorldResponse> allWorlds = [];
|
List<WorldResponse> allWorlds = [];
|
||||||
@ -27,6 +29,11 @@ namespace MyMcRealms.Controllers
|
|||||||
{
|
{
|
||||||
if (world.Online)
|
if (world.Online)
|
||||||
{
|
{
|
||||||
|
if (world.WhitelistEnable && !(world.Whitelist.Any(p => p.Uuid.Replace("-", "") == playerUUID) || world.Ops.Any(p => p.Uuid.Replace("-", "") == playerUUID)))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
int versionsCompared = SemVersion.Parse(gameVerision, SemVersionStyles.OptionalPatch).ComparePrecedenceTo(SemVersion.Parse(world.GameVersion, SemVersionStyles.OptionalPatch));
|
int versionsCompared = SemVersion.Parse(gameVerision, SemVersionStyles.OptionalPatch).ComparePrecedenceTo(SemVersion.Parse(world.GameVersion, SemVersionStyles.OptionalPatch));
|
||||||
string isCompatible = versionsCompared == 0 ? "COMPATIBLE" : versionsCompared < 0 ? "NEEDS_DOWNGRADE" : "NEEDS_UPGRADE";
|
string isCompatible = versionsCompared == 0 ? "COMPATIBLE" : versionsCompared < 0 ? "NEEDS_DOWNGRADE" : "NEEDS_UPGRADE";
|
||||||
|
|
||||||
@ -63,7 +70,7 @@ namespace MyMcRealms.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ServersResponse servers = new()
|
ServersResponse servers = new()
|
||||||
{
|
{
|
||||||
Servers = allWorlds
|
Servers = allWorlds
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user