mirror of
https://github.com/CyberL1/MyMcRealms.git
synced 2024-11-21 21:48:21 -05:00
feat: default if ops empty
This commit is contained in:
parent
3d174846b4
commit
f795ebcf26
@ -33,11 +33,14 @@ namespace MyMcRealms.Controllers
|
|||||||
bool isOlderVersion = SemVersion.Parse(gameVerision, SemVersionStyles.OptionalPatch).ComparePrecedenceTo(SemVersion.Parse("1.20.3", SemVersionStyles.OptionalPatch)) < 0;
|
bool isOlderVersion = SemVersion.Parse(gameVerision, SemVersionStyles.OptionalPatch).ComparePrecedenceTo(SemVersion.Parse("1.20.3", SemVersionStyles.OptionalPatch)) < 0;
|
||||||
string isCompatibleOnOlderVersions = (isOlderVersion && isCompatible.StartsWith("NEEDS_")) ? "CLOSED" : "OPEN";
|
string isCompatibleOnOlderVersions = (isOlderVersion && isCompatible.StartsWith("NEEDS_")) ? "CLOSED" : "OPEN";
|
||||||
|
|
||||||
|
string worldOwnerName = world.Ops.ToArray().Length == 0 ? "Owner" : world.Ops[0].Name;
|
||||||
|
string worldOwnerUuid = world.Ops.ToArray().Length == 0 ? "069a79f444e94726a5befca90e38aaf5" : world.Ops[0].Uuid;
|
||||||
|
|
||||||
WorldResponse response = new()
|
WorldResponse response = new()
|
||||||
{
|
{
|
||||||
Id = AllServers.Servers.IndexOf(world),
|
Id = AllServers.Servers.IndexOf(world),
|
||||||
Owner = world.Ops[0].Name,
|
Owner = worldOwnerName,
|
||||||
OwnerUUID = world.Ops[0].Uuid,
|
OwnerUUID = worldOwnerUuid,
|
||||||
Name = world.ServerName,
|
Name = world.ServerName,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd,
|
||||||
State = isCompatibleOnOlderVersions,
|
State = isCompatibleOnOlderVersions,
|
||||||
@ -73,6 +76,30 @@ namespace MyMcRealms.Controllers
|
|||||||
return NotFound("World not found");
|
return NotFound("World not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [HttpPut("{id}/open")]
|
||||||
|
// public async Task<ActionResult<bool>> Open(int id)
|
||||||
|
// {
|
||||||
|
// var world = worlds.Find(w => w.Id == id);
|
||||||
|
|
||||||
|
// if (world == null) return NotFound("World not found");
|
||||||
|
|
||||||
|
// Turn off whitelist
|
||||||
|
|
||||||
|
// return Ok(true);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// [HttpPut("{id}/close")]
|
||||||
|
// public async Task<ActionResult<bool>> Close(int id)
|
||||||
|
// {
|
||||||
|
// var world = worlds.FirstOrDefault(w => w.Id == id);
|
||||||
|
|
||||||
|
// if (world == null) return NotFound("World not found");
|
||||||
|
|
||||||
|
// Turn on whitelist
|
||||||
|
|
||||||
|
// return Ok(true);
|
||||||
|
// }
|
||||||
|
|
||||||
[HttpGet("v1/{wId}/join/pc")]
|
[HttpGet("v1/{wId}/join/pc")]
|
||||||
public async Task<ActionResult<ConnectionResponse>> Join(int wId)
|
public async Task<ActionResult<ConnectionResponse>> Join(int wId)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user