diff --git a/Gamemode.cs b/Gamemode.cs new file mode 100644 index 0000000..c2295e6 --- /dev/null +++ b/Gamemode.cs @@ -0,0 +1,8 @@ +using System; + +public enum Gamemode +{ + survival, + creative, + adventure +} diff --git a/MyMcRealms/Controllers/WorldsController.cs b/MyMcRealms/Controllers/WorldsController.cs index f11e8d8..e0ca433 100644 --- a/MyMcRealms/Controllers/WorldsController.cs +++ b/MyMcRealms/Controllers/WorldsController.cs @@ -90,6 +90,10 @@ namespace MyMcRealms.Controllers ActiveVersion = world.GameVersion }; + if (world.Gamemode == "survival") response.GameMode = 0; + if (world.Gamemode == "creative") response.GameMode = 1; + if (world.Gamemode == "adventure") response.GameMode = 2; + allWorlds.Add(response); } } @@ -185,6 +189,10 @@ namespace MyMcRealms.Controllers ] }; + if (world.Gamemode == "survival") response.GameMode = 0; + if (world.Gamemode == "creative") response.GameMode = 1; + if (world.Gamemode == "adventure") response.GameMode = 2; + return Ok(response); } diff --git a/MyMcRealms/MyMcAPI/Responses/AllServersResponse.cs b/MyMcRealms/MyMcAPI/Responses/AllServersResponse.cs index c0f5dbc..13dff80 100644 --- a/MyMcRealms/MyMcAPI/Responses/AllServersResponse.cs +++ b/MyMcRealms/MyMcAPI/Responses/AllServersResponse.cs @@ -18,6 +18,7 @@ public List Whitelist { get; set; } = null!; public bool WhitelistEnable { get; set; } public string OwnersToken { get; set; } = string.Empty; + public string Gamemode { get; set; } = null!; } public class Op diff --git a/MyMcRealms/Responses/WorldResponse.cs b/MyMcRealms/Responses/WorldResponse.cs index b9783bc..9cf197c 100644 --- a/MyMcRealms/Responses/WorldResponse.cs +++ b/MyMcRealms/Responses/WorldResponse.cs @@ -7,6 +7,8 @@ public string? OwnerUUID { get; set; } public string? Name { get; set; } public string? Motd { get; set; } + public int GameMode { get; set; } + public bool Hardcore { get; set; } public string State { get; set; } = "OPEN"; public string WorldType { get; set; } = "NORMAL"; public List Players { get; set; } = [];