mirror of
https://github.com/CyberL1/MyMcRealms.git
synced 2025-07-04 11:09:43 -04:00
Compare commits
6 Commits
2245a95d55
...
main
Author | SHA1 | Date | |
---|---|---|---|
eb5f50be7b | |||
15af6a794a | |||
67d324971e | |||
0e06049d6e | |||
8f94aa8bdd | |||
ef35843140 |
8
Gamemode.cs
Normal file
8
Gamemode.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
public enum Gamemode
|
||||||
|
{
|
||||||
|
survival,
|
||||||
|
creative,
|
||||||
|
adventure
|
||||||
|
}
|
@ -1,9 +0,0 @@
|
|||||||
namespace MyMcRealms
|
|
||||||
{
|
|
||||||
public enum Compatility
|
|
||||||
{
|
|
||||||
COMPATIBLE,
|
|
||||||
OTHER,
|
|
||||||
OUTDATED
|
|
||||||
}
|
|
||||||
}
|
|
@ -45,7 +45,7 @@ namespace MyMcRealms.Controllers
|
|||||||
ErrorResponse errorResponse = new()
|
ErrorResponse errorResponse = new()
|
||||||
{
|
{
|
||||||
ErrorCode = 400,
|
ErrorCode = 400,
|
||||||
ErrorMsg = "Player already whitelisteed"
|
ErrorMsg = "Player already whitelisted"
|
||||||
};
|
};
|
||||||
|
|
||||||
return BadRequest(errorResponse);
|
return BadRequest(errorResponse);
|
||||||
|
@ -18,7 +18,7 @@ namespace MyMcRealms.Controllers
|
|||||||
[HttpGet("client/compatible")]
|
[HttpGet("client/compatible")]
|
||||||
public string GetCompatible()
|
public string GetCompatible()
|
||||||
{
|
{
|
||||||
return Compatility.COMPATIBLE.ToString();
|
return "COMPATIBLE";
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("v1/news")]
|
[HttpGet("v1/news")]
|
||||||
@ -26,7 +26,7 @@ namespace MyMcRealms.Controllers
|
|||||||
{
|
{
|
||||||
var news = new NewsResponse
|
var news = new NewsResponse
|
||||||
{
|
{
|
||||||
NewsLink = "https://github.com/CyberL1/Minecraft-Realms-Emulator",
|
NewsLink = "https://github.com/CyberL1/MyMcRealms",
|
||||||
};
|
};
|
||||||
|
|
||||||
return news;
|
return news;
|
||||||
|
@ -75,6 +75,7 @@ namespace MyMcRealms.Controllers
|
|||||||
OwnerUUID = worldOwnerUuid,
|
OwnerUUID = worldOwnerUuid,
|
||||||
Name = worldName,
|
Name = worldName,
|
||||||
Motd = world.Motd.Replace("<22>", "§").Replace("&", "§"),
|
Motd = world.Motd.Replace("<22>", "§").Replace("&", "§"),
|
||||||
|
IsHardcore = world.Hardcore,
|
||||||
State = worldState,
|
State = worldState,
|
||||||
WorldType = "NORMAL",
|
WorldType = "NORMAL",
|
||||||
MaxPlayers = 10,
|
MaxPlayers = 10,
|
||||||
@ -90,6 +91,10 @@ namespace MyMcRealms.Controllers
|
|||||||
ActiveVersion = world.GameVersion
|
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);
|
allWorlds.Add(response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -156,7 +161,8 @@ namespace MyMcRealms.Controllers
|
|||||||
Owner = worldOwnerName,
|
Owner = worldOwnerName,
|
||||||
OwnerUUID = worldOwnerUuid,
|
OwnerUUID = worldOwnerUuid,
|
||||||
Name = worldName,
|
Name = worldName,
|
||||||
Motd = world.Motd,
|
Motd = world.Motd.Replace("<22>", "§"),
|
||||||
|
IsHardcore = world.Hardcore,
|
||||||
State = whitelist.Enabled ? "CLOSED" : "OPEN",
|
State = whitelist.Enabled ? "CLOSED" : "OPEN",
|
||||||
WorldType = "NORMAL",
|
WorldType = "NORMAL",
|
||||||
MaxPlayers = 10,
|
MaxPlayers = 10,
|
||||||
@ -185,6 +191,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);
|
return Ok(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
public List<Whitelist> Whitelist { get; set; } = null!;
|
public List<Whitelist> Whitelist { get; set; } = null!;
|
||||||
public bool WhitelistEnable { get; set; }
|
public bool WhitelistEnable { get; set; }
|
||||||
public string OwnersToken { get; set; } = string.Empty;
|
public string OwnersToken { get; set; } = string.Empty;
|
||||||
|
public string Gamemode { get; set; } = null!;
|
||||||
|
public bool Hardcore { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Op
|
public class Op
|
||||||
|
@ -3,6 +3,12 @@
|
|||||||
public class SlotResponse
|
public class SlotResponse
|
||||||
{
|
{
|
||||||
public int SlotId { get; set; }
|
public int SlotId { get; set; }
|
||||||
|
public SlotSettingsResponse Settings { get; set; } = null!;
|
||||||
public string Options { get; set; } = null!;
|
public string Options { get; set; } = null!;
|
||||||
|
|
||||||
|
public SlotResponse()
|
||||||
|
{
|
||||||
|
Settings = new SlotSettingsResponse();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
7
MyMcRealms/Responses/SlotSettingsResponse.cs
Normal file
7
MyMcRealms/Responses/SlotSettingsResponse.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
namespace MyMcRealms.Responses
|
||||||
|
{
|
||||||
|
public class SlotSettingsResponse
|
||||||
|
{
|
||||||
|
public bool Hardcore = false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,15 +1,14 @@
|
|||||||
using System.Text.Json;
|
namespace MyMcRealms.Responses
|
||||||
|
|
||||||
namespace MyMcRealms.Responses
|
|
||||||
{
|
{
|
||||||
public class WorldResponse
|
public class WorldResponse
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
// public Subscription? Subscription { get; set; }
|
|
||||||
public string? Owner { get; set; }
|
public string? Owner { get; set; }
|
||||||
public string? OwnerUUID { get; set; }
|
public string? OwnerUUID { get; set; }
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
public string? Motd { get; set; }
|
public string? Motd { get; set; }
|
||||||
|
public int GameMode { get; set; }
|
||||||
|
public bool IsHardcore { get; set; }
|
||||||
public string State { get; set; } = "OPEN";
|
public string State { get; set; } = "OPEN";
|
||||||
public string WorldType { get; set; } = "NORMAL";
|
public string WorldType { get; set; } = "NORMAL";
|
||||||
public List<PlayerResponse> Players { get; set; } = [];
|
public List<PlayerResponse> Players { get; set; } = [];
|
||||||
|
Binary file not shown.
Reference in New Issue
Block a user