mirror of
https://github.com/CyberL1/Minecraft-Realms-Emulator.git
synced 2025-07-01 09:39:44 -04:00
Compare commits
24 Commits
fe1c7aaf63
...
master
Author | SHA1 | Date | |
---|---|---|---|
ff325cf5f6 | |||
484d12463a | |||
0a89b6ade1 | |||
967518dc71 | |||
1dc7194888 | |||
84548585ac | |||
f1a5ddd98c | |||
6cb43fcaa3 | |||
27a5d20888 | |||
b0ed4a50de | |||
8c72940c23 | |||
4605ac5fef | |||
54a05537c4 | |||
d302ea46e2 | |||
92a9177d1f | |||
c2f62fdffb | |||
83c43ce73d | |||
9f64fb6c82 | |||
71db9fc549 | |||
3f100aadf6 | |||
3ef9962bac | |||
22ee98584b | |||
de45bf843e | |||
f133c237ef |
@ -5,7 +5,9 @@ VisualStudioVersion = 17.8.34511.84
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Minecraft-Realms-Emulator", "Minecraft-Realms-Emulator\Minecraft-Realms-Emulator.csproj", "{A9A21AAF-EF1B-4723-9407-51FD6B831B98}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Panel", "Panel\Panel.csproj", "{DDDF0FE0-736D-47D5-8571-3DD7354B7917}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Panel", "Panel\Panel.csproj", "{DDDF0FE0-736D-47D5-8571-3DD7354B7917}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "UnitTests\UnitTests.csproj", "{AFF83C8C-B6CA-4707-A26E-82002822F820}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -21,6 +23,10 @@ Global
|
||||
{DDDF0FE0-736D-47D5-8571-3DD7354B7917}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DDDF0FE0-736D-47D5-8571-3DD7354B7917}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DDDF0FE0-736D-47D5-8571-3DD7354B7917}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AFF83C8C-B6CA-4707-A26E-82002822F820}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AFF83C8C-B6CA-4707-A26E-82002822F820}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AFF83C8C-B6CA-4707-A26E-82002822F820}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AFF83C8C-B6CA-4707-A26E-82002822F820}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -4,7 +4,7 @@ using System.Text.Json;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
@ -14,15 +14,19 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DotNetEnv" Version="3.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.6">
|
||||
<PackageReference Include="DotNetEnv" Version="3.1.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.8">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.8" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<InternalsVisibleTo Include="UnitTests" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -1,6 +1,6 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Responses;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Modes.External
|
||||
{
|
||||
|
@ -1,10 +1,10 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
using Minecraft_Realms_Emulator.Requests;
|
||||
using Minecraft_Realms_Emulator.Responses;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||
using Minecraft_Realms_Emulator.Shared.Requests;
|
||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Modes.External
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Enums;
|
||||
using Minecraft_Realms_Emulator.Helpers;
|
||||
using Minecraft_Realms_Emulator.Responses;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Enums;
|
||||
using Minecraft_Realms_Emulator.Shared.Helpers;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Modes.External
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
using Minecraft_Realms_Emulator.Responses;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Modes.External
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Responses;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Modes.External
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Responses;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Modes.External
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Enums;
|
||||
using Minecraft_Realms_Emulator.Helpers;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Enums;
|
||||
using Minecraft_Realms_Emulator.Shared.Helpers;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Modes.External
|
||||
{
|
||||
|
@ -1,12 +1,12 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
using Minecraft_Realms_Emulator.Enums;
|
||||
using Minecraft_Realms_Emulator.Helpers;
|
||||
using Minecraft_Realms_Emulator.Requests;
|
||||
using Minecraft_Realms_Emulator.Responses;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Enums;
|
||||
using Minecraft_Realms_Emulator.Shared.Helpers;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||
using Minecraft_Realms_Emulator.Shared.Requests;
|
||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Modes.External
|
||||
@ -73,6 +73,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot?.GameMode ?? 0,
|
||||
IsHardcore = activeSlot?.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -114,6 +116,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
IsHardcore = activeSlot.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -154,8 +158,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
string playerName = cookie.Split(";")[1].Split("=")[1];
|
||||
string gameVersion = cookie.Split(";")[2].Split("=")[1];
|
||||
|
||||
var ownedWorlds = await _context.Worlds.Where(w => w.OwnerUUID == playerUUID || w.ParentWorld.OwnerUUID == playerUUID).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.ParentWorld).ToListAsync();
|
||||
var memberWorlds = await _context.Players.Where(p => p.Uuid == playerUUID && p.Accepted).Include(p => p.World.Subscription).Include(p => p.World.Slots).Include(p => p.World.ParentWorld).Select(p => p.World).ToListAsync();
|
||||
var ownedWorlds = await _context.Worlds.Where(w => w.OwnerUUID == playerUUID || w.ParentWorld.OwnerUUID == playerUUID).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.Minigame).Include(w => w.ParentWorld).ToListAsync();
|
||||
var memberWorlds = await _context.Players.Where(p => p.Uuid == playerUUID && p.Accepted).Include(p => p.World.Subscription).Include(p => p.World.Slots).Include(p => p.World.ParentWorld).Include(p => p.World.Minigame).Select(p => p.World).ToListAsync();
|
||||
|
||||
List<WorldResponse> allWorlds = [];
|
||||
|
||||
@ -173,6 +177,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot?.GameMode ?? 0,
|
||||
IsHardcore = activeSlot?.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -227,6 +233,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
IsHardcore = activeSlot.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -280,8 +288,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
string playerName = cookie.Split(";")[1].Split("=")[1];
|
||||
string gameVersion = cookie.Split(";")[2].Split("=")[1];
|
||||
|
||||
var ownedWorlds = await _context.Worlds.Where(w => w.ParentWorld != null && w.ParentWorld.OwnerUUID == playerUUID).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.ParentWorld).ToListAsync();
|
||||
var memberWorlds = await _context.Players.Where(p => p.World.ParentWorld != null && p.Uuid == playerUUID && p.Accepted).Include(p => p.World.Subscription).Include(p => p.World.Slots).Include(p => p.World.ParentWorld).Select(p => p.World).ToListAsync();
|
||||
var ownedWorlds = await _context.Worlds.Where(w => w.ParentWorld != null && w.ParentWorld.OwnerUUID == playerUUID).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.ParentWorld).Include(w => w.Minigame).ToListAsync();
|
||||
var memberWorlds = await _context.Players.Where(p => p.World.ParentWorld != null && p.Uuid == playerUUID && p.Accepted).Include(p => p.World.Subscription).Include(p => p.World.Slots).Include(p => p.World.ParentWorld).Include(p => p.World.Minigame).Select(p => p.World).ToListAsync();
|
||||
|
||||
List<WorldResponse> allWorlds = [];
|
||||
|
||||
@ -325,6 +333,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot?.GameMode ?? 0,
|
||||
IsHardcore = activeSlot?.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -368,6 +378,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
IsHardcore = activeSlot.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -407,7 +419,18 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
string cookie = Request.Headers.Cookie;
|
||||
string gameVersion = cookie.Split(";")[2].Split("=")[1];
|
||||
|
||||
var world = await _context.Worlds.Include(w => w.Players).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.ParentWorld.Subscription).FirstOrDefaultAsync(w => w.Id == wId);
|
||||
var world = await _context.Worlds.Include(w => w.Players).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.ParentWorld.Subscription).Include(w => w.Minigame).FirstOrDefaultAsync(w => w.Id == wId);
|
||||
|
||||
if (world.State == nameof(StateEnum.UNINITIALIZED))
|
||||
{
|
||||
ErrorResponse error = new()
|
||||
{
|
||||
ErrorCode = 400,
|
||||
ErrorMsg = "Initialize the world first"
|
||||
};
|
||||
|
||||
return StatusCode(400, error);
|
||||
}
|
||||
|
||||
Slot activeSlot = world.Slots.Find(s => s.SlotId == world.ActiveSlot);
|
||||
|
||||
@ -425,8 +448,9 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
{
|
||||
slotName = slot.SlotName,
|
||||
gameMode = slot.GameMode,
|
||||
hardcore = slot.Difficulty == 3,
|
||||
difficulty = slot.Difficulty,
|
||||
spawnProtection = slot.SpawnProtection,
|
||||
spawnProection = slot.SpawnProtection,
|
||||
forceGameMode = slot.ForceGameMode,
|
||||
pvp = slot.Pvp,
|
||||
spawnAnimals = slot.SpawnAnimals,
|
||||
@ -453,6 +477,8 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
IsHardcore = activeSlot.GameMode == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -517,7 +543,6 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
var connection = new Connection
|
||||
{
|
||||
World = world,
|
||||
Address = defaultServerAddress.Value
|
||||
};
|
||||
|
||||
Slot slot = new()
|
||||
@ -582,55 +607,9 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
return StatusCode(401, errorResponse);
|
||||
}
|
||||
|
||||
world.Name = $"[PRE] {world.ParentWorld.Name}";
|
||||
world.Motd = $"[PRE] {world.ParentWorld.Motd}";
|
||||
world.State = nameof(StateEnum.OPEN);
|
||||
|
||||
var config = new ConfigHelper(_context);
|
||||
var defaultServerAddress = config.GetSetting(nameof(SettingsEnum.DefaultServerAddress));
|
||||
|
||||
var connection = new Connection
|
||||
{
|
||||
World = world,
|
||||
Address = defaultServerAddress.Value
|
||||
};
|
||||
|
||||
Slot slot = new()
|
||||
{
|
||||
World = world,
|
||||
SlotId = 1,
|
||||
SlotName = "",
|
||||
Version = gameVersion,
|
||||
GameMode = 0,
|
||||
Difficulty = 2,
|
||||
SpawnProtection = 0,
|
||||
ForceGameMode = false,
|
||||
Pvp = true,
|
||||
SpawnAnimals = true,
|
||||
SpawnMonsters = true,
|
||||
SpawnNPCs = true,
|
||||
CommandBlocks = false
|
||||
};
|
||||
|
||||
_context.Worlds.Update(world);
|
||||
|
||||
_context.Connections.Add(connection);
|
||||
_context.Slots.Add(slot);
|
||||
|
||||
_context.SaveChanges();
|
||||
|
||||
return Ok(world);
|
||||
}
|
||||
|
||||
[HttpPost("{wId}/reset")]
|
||||
[CheckForWorld]
|
||||
[CheckRealmOwner]
|
||||
public ActionResult<bool> Reset(int wId)
|
||||
{
|
||||
Console.WriteLine($"Resetting world {wId}");
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
[HttpPut("{wId}/open")]
|
||||
[CheckForWorld]
|
||||
[CheckRealmOwner]
|
||||
@ -679,7 +658,7 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
return BadRequest(errorResponse);
|
||||
}
|
||||
|
||||
if (body.Description.Length > 32)
|
||||
if (body.Description?.Length > 32)
|
||||
{
|
||||
ErrorResponse errorResponse = new()
|
||||
{
|
||||
@ -702,130 +681,13 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
[HttpPost("{wId}/slot/{sId}")]
|
||||
[CheckForWorld]
|
||||
[CheckRealmOwner]
|
||||
public async Task<ActionResult<(bool, ErrorResponse)>> UpdateSlot(int wId, int sId, SlotOptionsRequest body)
|
||||
{
|
||||
if (body.SlotName.Length > 10)
|
||||
{
|
||||
ErrorResponse errorResponse = new()
|
||||
{
|
||||
ErrorCode = 400,
|
||||
ErrorMsg = "Slot name cannot exceed 10 characters"
|
||||
};
|
||||
|
||||
return BadRequest(errorResponse);
|
||||
}
|
||||
|
||||
var slots = await _context.Slots.Where(s => s.World.Id == wId).ToListAsync();
|
||||
var slot = slots.Find(s => s.SlotId == sId);
|
||||
|
||||
slot.SlotName = body.SlotName;
|
||||
slot.GameMode = body.GameMode;
|
||||
slot.Difficulty = body.Difficulty;
|
||||
slot.SpawnProtection = body.SpawnProtection;
|
||||
slot.ForceGameMode = body.ForceGameMode;
|
||||
slot.Pvp = body.Pvp;
|
||||
slot.SpawnAnimals = body.SpawnAnimals;
|
||||
slot.SpawnMonsters = body.SpawnMonsters;
|
||||
slot.SpawnNPCs = body.SpawnNPCs;
|
||||
slot.CommandBlocks = body.CommandBlocks;
|
||||
|
||||
_context.SaveChanges();
|
||||
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
[HttpPut("{wId}/slot/{sId}")]
|
||||
[CheckForWorld]
|
||||
[CheckRealmOwner]
|
||||
public ActionResult<bool> SwitchSlot(int wId, int sId)
|
||||
{
|
||||
var world = _context.Worlds.Include(w => w.Minigame).FirstOrDefault(w => w.Id == wId);
|
||||
var slot = _context.Slots.Where(s => s.World.Id == wId).Where(s => s.SlotId == sId).Any();
|
||||
|
||||
if (!slot)
|
||||
{
|
||||
string cookie = Request.Headers.Cookie;
|
||||
string gameVersion = cookie.Split(";")[2].Split("=")[1];
|
||||
|
||||
_context.Slots.Add(new()
|
||||
{
|
||||
World = world,
|
||||
SlotId = sId,
|
||||
SlotName = "",
|
||||
Version = gameVersion,
|
||||
GameMode = 0,
|
||||
Difficulty = 2,
|
||||
SpawnProtection = 0,
|
||||
ForceGameMode = false,
|
||||
Pvp = true,
|
||||
SpawnAnimals = true,
|
||||
SpawnMonsters = true,
|
||||
SpawnNPCs = true,
|
||||
CommandBlocks = false
|
||||
});
|
||||
|
||||
_context.SaveChanges();
|
||||
}
|
||||
|
||||
world.ActiveSlot = sId;
|
||||
world.Minigame = null;
|
||||
world.WorldType = nameof(WorldTypeEnum.NORMAL);
|
||||
|
||||
_context.SaveChanges();
|
||||
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
[HttpGet("{wId}/backups")]
|
||||
[CheckForWorld]
|
||||
[CheckRealmOwner]
|
||||
public async Task<ActionResult<BackupsResponse>> GetBackups(int wId)
|
||||
{
|
||||
var backups = await _context.Backups.Where(b => b.Slot.World.Id == wId).ToListAsync();
|
||||
|
||||
BackupsResponse worldBackups = new()
|
||||
{
|
||||
Backups = backups
|
||||
};
|
||||
|
||||
return Ok(worldBackups);
|
||||
}
|
||||
|
||||
[HttpGet("{wId}/slot/{sId}/download")]
|
||||
[CheckForWorld]
|
||||
[CheckRealmOwner]
|
||||
public ActionResult<BackupDownloadResponse> GetBackup(int wId, int sId)
|
||||
{
|
||||
Backup backup = _context.Backups.Include(b => b.Slot).FirstOrDefault(b => b.Slot.World.Id == wId && b.Slot.Id == sId);
|
||||
|
||||
if (backup == null)
|
||||
{
|
||||
ErrorResponse errorResponse = new()
|
||||
{
|
||||
ErrorCode = 404,
|
||||
ErrorMsg = "No backup found"
|
||||
};
|
||||
|
||||
return NotFound(errorResponse);
|
||||
}
|
||||
|
||||
BackupDownloadResponse backupDownloadResponse = new()
|
||||
{
|
||||
DownloadLink = backup.DownloadUrl,
|
||||
ResourcePackUrl = backup.ResourcePackUrl,
|
||||
ResourcePackHash = backup.ResourcePackHash,
|
||||
};
|
||||
|
||||
return Ok(backupDownloadResponse);
|
||||
}
|
||||
|
||||
[HttpGet("v1/{wId}/join/pc")]
|
||||
public ActionResult<Connection> Join(int wId)
|
||||
{
|
||||
var connection = _context.Connections.FirstOrDefault(x => x.World.Id == wId);
|
||||
var connection = _context.Connections.Include(c => c.World).FirstOrDefault(x => x.World.Id == wId);
|
||||
|
||||
// Set the server's addrees to its MOTD
|
||||
connection.Address = connection.World.Motd;
|
||||
|
||||
return Ok(connection);
|
||||
}
|
||||
@ -856,38 +718,5 @@ namespace Minecraft_Realms_Emulator.Modes.External
|
||||
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
[HttpGet("templates/{type}")]
|
||||
public ActionResult<TemplatesResponse> GetWorldTemplates(string type, int page, int pageSize)
|
||||
{
|
||||
var totalTemplates = _context.Templates.Where(t => t.Type == type).Count();
|
||||
var templates = _context.Templates.Where(t => t.Type == type).Skip((page - 1) * pageSize).Take(pageSize).ToList();
|
||||
|
||||
TemplatesResponse templatesResponse = new()
|
||||
{
|
||||
Page = page,
|
||||
Size = pageSize,
|
||||
Total = totalTemplates,
|
||||
Templates = templates
|
||||
};
|
||||
|
||||
return Ok(templatesResponse);
|
||||
}
|
||||
|
||||
[HttpPut("minigames/{mId}/{wId}")]
|
||||
[CheckForWorld]
|
||||
[CheckRealmOwner]
|
||||
public ActionResult<bool> SwitchToMinigame(int mId, int wId)
|
||||
{
|
||||
var world = _context.Worlds.Find(wId);
|
||||
var minigame = _context.Templates.FirstOrDefault(t => t.Type == nameof(WorldTemplateTypeEnum.MINIGAME) && t.Id == mId);
|
||||
|
||||
world.Minigame = minigame;
|
||||
world.WorldType = nameof(WorldTypeEnum.MINIGAME);
|
||||
|
||||
_context.SaveChanges();
|
||||
|
||||
return Ok(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Enums;
|
||||
using Minecraft_Realms_Emulator.Helpers;
|
||||
using Minecraft_Realms_Emulator.Responses;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Enums;
|
||||
using Minecraft_Realms_Emulator.Shared.Helpers;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Modes.Realms
|
||||
|
@ -1,10 +1,10 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
using Minecraft_Realms_Emulator.Requests;
|
||||
using Minecraft_Realms_Emulator.Responses;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||
using Minecraft_Realms_Emulator.Shared.Requests;
|
||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Enums;
|
||||
using Minecraft_Realms_Emulator.Helpers;
|
||||
using Minecraft_Realms_Emulator.Responses;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Enums;
|
||||
using Minecraft_Realms_Emulator.Shared.Helpers;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
using Minecraft_Realms_Emulator.Responses;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Responses;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Responses;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Enums;
|
||||
using Minecraft_Realms_Emulator.Helpers;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Enums;
|
||||
using Minecraft_Realms_Emulator.Shared.Helpers;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
{
|
||||
|
@ -1,16 +1,16 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
using Minecraft_Realms_Emulator.Enums;
|
||||
using Minecraft_Realms_Emulator.Helpers;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Enums;
|
||||
using Minecraft_Realms_Emulator.Shared.Helpers;
|
||||
using Minecraft_Realms_Emulator.Modes.Realms.Helpers;
|
||||
using Minecraft_Realms_Emulator.Requests;
|
||||
using Minecraft_Realms_Emulator.Responses;
|
||||
using Newtonsoft.Json;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||
using Minecraft_Realms_Emulator.Shared.Requests;
|
||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
{
|
||||
@ -76,6 +76,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot?.GameMode ?? 0,
|
||||
IsHardcore = activeSlot?.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -117,6 +119,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
IsHardcore = activeSlot.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -157,8 +161,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
string playerName = cookie.Split(";")[1].Split("=")[1];
|
||||
string gameVersion = cookie.Split(";")[2].Split("=")[1];
|
||||
|
||||
var ownedWorlds = await _context.Worlds.Where(w => w.OwnerUUID == playerUUID || w.ParentWorld.OwnerUUID == playerUUID).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.ParentWorld).ToListAsync();
|
||||
var memberWorlds = await _context.Players.Where(p => p.Uuid == playerUUID && p.Accepted).Include(p => p.World.Subscription).Include(p => p.World.Slots).Include(p => p.World.ParentWorld).Select(p => p.World).ToListAsync();
|
||||
var ownedWorlds = await _context.Worlds.Where(w => w.OwnerUUID == playerUUID || w.ParentWorld.OwnerUUID == playerUUID).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.Minigame).Include(w => w.ParentWorld).ToListAsync();
|
||||
var memberWorlds = await _context.Players.Where(p => p.Uuid == playerUUID && p.Accepted).Include(p => p.World.Subscription).Include(p => p.World.Slots).Include(p => p.World.ParentWorld).Include(p => p.World.Minigame).Select(p => p.World).ToListAsync();
|
||||
|
||||
List<WorldResponse> allWorlds = [];
|
||||
|
||||
@ -176,6 +180,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot?.GameMode ?? 0,
|
||||
IsHardcore = activeSlot?.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -230,6 +236,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
IsHardcore = activeSlot.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -283,8 +291,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
string playerName = cookie.Split(";")[1].Split("=")[1];
|
||||
string gameVersion = cookie.Split(";")[2].Split("=")[1];
|
||||
|
||||
var ownedWorlds = await _context.Worlds.Where(w => w.ParentWorld != null && w.ParentWorld.OwnerUUID == playerUUID).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.ParentWorld).ToListAsync();
|
||||
var memberWorlds = await _context.Players.Where(p => p.World.ParentWorld != null && p.Uuid == playerUUID && p.Accepted).Include(p => p.World.Subscription).Include(p => p.World.Slots).Include(p => p.World.ParentWorld).Select(p => p.World).ToListAsync();
|
||||
var ownedWorlds = await _context.Worlds.Where(w => w.ParentWorld != null && w.ParentWorld.OwnerUUID == playerUUID).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.ParentWorld).Include(w => w.Minigame).ToListAsync();
|
||||
var memberWorlds = await _context.Players.Where(p => p.World.ParentWorld != null && p.Uuid == playerUUID && p.Accepted).Include(p => p.World.Subscription).Include(p => p.World.Slots).Include(p => p.World.ParentWorld).Include(p => p.World.Minigame).Select(p => p.World).ToListAsync();
|
||||
|
||||
List<WorldResponse> allWorlds = [];
|
||||
|
||||
@ -328,6 +336,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot?.GameMode ?? 0,
|
||||
IsHardcore = activeSlot?.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -371,6 +381,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
IsHardcore = activeSlot.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -412,6 +424,17 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
|
||||
var world = await _context.Worlds.Include(w => w.Players).Include(w => w.Subscription).Include(w => w.Slots).Include(w => w.ParentWorld.Subscription).FirstOrDefaultAsync(w => w.Id == wId);
|
||||
|
||||
if (world.State == nameof(StateEnum.UNINITIALIZED))
|
||||
{
|
||||
ErrorResponse error = new()
|
||||
{
|
||||
ErrorCode = 400,
|
||||
ErrorMsg = "Initialize the world first"
|
||||
};
|
||||
|
||||
return StatusCode(400, error);
|
||||
}
|
||||
|
||||
Slot activeSlot = world.Slots.Find(s => s.SlotId == world.ActiveSlot);
|
||||
|
||||
List<SlotResponse> slots = [];
|
||||
@ -428,8 +451,9 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
{
|
||||
slotName = slot.SlotName,
|
||||
gameMode = slot.GameMode,
|
||||
hardcore = slot.Difficulty == 3,
|
||||
difficulty = slot.Difficulty,
|
||||
spawnProtection = slot.SpawnProtection,
|
||||
spawnProection = slot.SpawnProtection,
|
||||
forceGameMode = slot.ForceGameMode,
|
||||
pvp = slot.Pvp,
|
||||
spawnAnimals = slot.SpawnAnimals,
|
||||
@ -456,6 +480,8 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
OwnerUUID = world.OwnerUUID,
|
||||
Name = world.Name,
|
||||
Motd = world.Motd,
|
||||
GameMode = activeSlot.GameMode,
|
||||
IsHardcore = activeSlot.Difficulty == 3,
|
||||
State = world.State,
|
||||
WorldType = world.WorldType,
|
||||
MaxPlayers = world.MaxPlayers,
|
||||
@ -597,56 +623,6 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
return StatusCode(401, errorResponse);
|
||||
}
|
||||
|
||||
world.Name = $"[PRE] {world.ParentWorld.Name}";
|
||||
world.Motd = $"[PRE] {world.ParentWorld.Motd}";
|
||||
world.State = nameof(StateEnum.OPEN);
|
||||
|
||||
var config = new ConfigHelper(_context);
|
||||
var defaultServerAddress = config.GetSetting(nameof(SettingsEnum.DefaultServerAddress));
|
||||
|
||||
static int FindFreeTcpPort()
|
||||
{
|
||||
TcpListener l = new(IPAddress.Loopback, 0);
|
||||
l.Start();
|
||||
int port = ((IPEndPoint)l.LocalEndpoint).Port;
|
||||
l.Stop();
|
||||
return port;
|
||||
}
|
||||
|
||||
var port = FindFreeTcpPort();
|
||||
|
||||
var connection = new Connection
|
||||
{
|
||||
World = world,
|
||||
Address = $"{defaultServerAddress.Value}:{port}"
|
||||
};
|
||||
|
||||
new DockerHelper(world).CreateServer(port);
|
||||
|
||||
Slot slot = new()
|
||||
{
|
||||
World = world,
|
||||
SlotId = 1,
|
||||
SlotName = "",
|
||||
Version = gameVersion,
|
||||
GameMode = 0,
|
||||
Difficulty = 2,
|
||||
SpawnProtection = 0,
|
||||
ForceGameMode = false,
|
||||
Pvp = true,
|
||||
SpawnAnimals = true,
|
||||
SpawnMonsters = true,
|
||||
SpawnNPCs = true,
|
||||
CommandBlocks = false
|
||||
};
|
||||
|
||||
_context.Worlds.Update(world);
|
||||
|
||||
_context.Connections.Add(connection);
|
||||
_context.Slots.Add(slot);
|
||||
|
||||
_context.SaveChanges();
|
||||
|
||||
return Ok(world);
|
||||
}
|
||||
|
||||
@ -711,6 +687,15 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
|
||||
_context.SaveChanges();
|
||||
|
||||
var connection = _context.Connections.FirstOrDefault(c => c.World.Id == wId);
|
||||
var query = new MinecraftServerQuery().Query(connection.Address);
|
||||
|
||||
while (query != null)
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
query = new MinecraftServerQuery().Query(connection.Address);
|
||||
}
|
||||
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
@ -731,7 +716,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
return BadRequest(errorResponse);
|
||||
}
|
||||
|
||||
if (body.Description.Length > 32)
|
||||
if (body.Description?.Length > 32)
|
||||
{
|
||||
ErrorResponse errorResponse = new()
|
||||
{
|
||||
@ -917,7 +902,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
[HttpGet("v1/{wId}/join/pc")]
|
||||
public async Task<ActionResult<Connection>> Join(int wId)
|
||||
{
|
||||
var connection = _context.Connections.Include(c => c.World).FirstOrDefault(x => x.World.Id == wId);
|
||||
var connection = _context.Connections.Include(c => c.World).Include(c => c.World.Slots).FirstOrDefault(x => x.World.Id == wId);
|
||||
|
||||
var isRunning = new DockerHelper(connection.World).IsRunning();
|
||||
var query = new MinecraftServerQuery().Query(connection.Address);
|
||||
@ -933,7 +918,17 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
|
||||
query = new MinecraftServerQuery().Query(connection.Address);
|
||||
}
|
||||
|
||||
Slot activeSlot = connection.World.Slots.Find(s => s.SlotId == connection.World.ActiveSlot);
|
||||
|
||||
string cookie = Request.Headers.Cookie;
|
||||
string gameVersion = cookie.Split(";")[2].Split("=")[1];
|
||||
|
||||
if (new MinecraftVersionParser.MinecraftVersion(activeSlot.Version).CompareTo(new MinecraftVersionParser.MinecraftVersion(gameVersion)) < 0 && new DockerHelper(connection.World).RunCommand("! test -f .no-update") == 0)
|
||||
{
|
||||
activeSlot.Version = gameVersion;
|
||||
_context.SaveChanges();
|
||||
}
|
||||
|
||||
string playerUUID = cookie.Split(";")[0].Split(":")[2];
|
||||
|
||||
if (connection.World.OwnerUUID == playerUUID)
|
||||
|
@ -1,4 +1,4 @@
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Modes.Realms.Helpers
|
||||
@ -48,14 +48,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Helpers
|
||||
|
||||
public void StopServer()
|
||||
{
|
||||
ProcessStartInfo serverProcessInfo = new();
|
||||
|
||||
serverProcessInfo.FileName = "docker";
|
||||
serverProcessInfo.Arguments = $"container stop realm-server-{world.Id}";
|
||||
|
||||
Process serverProcess = new();
|
||||
serverProcess.StartInfo = serverProcessInfo;
|
||||
serverProcess.Start();
|
||||
ExecuteCommand("stop");
|
||||
}
|
||||
|
||||
public void RebootServer()
|
||||
@ -75,7 +68,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Helpers
|
||||
ProcessStartInfo serverProcessInfo = new();
|
||||
|
||||
serverProcessInfo.FileName = "docker";
|
||||
serverProcessInfo.Arguments = $"container rm realm-server-{world.Id}";
|
||||
serverProcessInfo.Arguments = $"container rm -f realm-server-{world.Id}";
|
||||
|
||||
Process serverProcess = new();
|
||||
serverProcess.StartInfo = serverProcessInfo;
|
||||
@ -123,7 +116,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Helpers
|
||||
commandProcess.Start();
|
||||
}
|
||||
|
||||
public void RunCommand(string command)
|
||||
public int RunCommand(string command)
|
||||
{
|
||||
ProcessStartInfo commandProcessInfo = new();
|
||||
|
||||
@ -134,6 +127,9 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Helpers
|
||||
commandProcess.StartInfo = commandProcessInfo;
|
||||
|
||||
commandProcess.Start();
|
||||
commandProcess.WaitForExit();
|
||||
|
||||
return commandProcess.ExitCode;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
using Microsoft.AspNetCore.Rewrite;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Enums;
|
||||
using Minecraft_Realms_Emulator.Helpers;
|
||||
using Minecraft_Realms_Emulator.Middlewares;
|
||||
using Minecraft_Realms_Emulator.Shared.Enums;
|
||||
using Minecraft_Realms_Emulator.Shared.Helpers;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Middlewares;
|
||||
using Npgsql;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
@ -33,6 +33,14 @@ builder.Services.AddDbContext<DataContext>(options =>
|
||||
options.UseNpgsql(dataSource);
|
||||
});
|
||||
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddDefaultPolicy(policy =>
|
||||
{
|
||||
policy.WithOrigins("http://localhost:5192");
|
||||
});
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Initialize database
|
||||
@ -48,10 +56,10 @@ if (app.Environment.IsDevelopment())
|
||||
var scope = app.Services.CreateScope();
|
||||
var db = scope.ServiceProvider.GetRequiredService<DataContext>();
|
||||
|
||||
app.UseCors();
|
||||
app.MapControllers();
|
||||
|
||||
var config = new ConfigHelper(db);
|
||||
var mode = config.GetSetting(nameof(SettingsEnum.WorkMode));
|
||||
var mode = Environment.GetEnvironmentVariable("WORKMODE");
|
||||
|
||||
if (mode == null)
|
||||
{
|
||||
@ -59,13 +67,13 @@ if (mode == null)
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
if (!Enum.IsDefined(typeof(WorkModeEnum), mode.Value))
|
||||
if (!Enum.IsDefined(typeof(WorkModeEnum), mode))
|
||||
{
|
||||
Console.WriteLine("Invalid server work mode, exiting");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
if (mode.Value == nameof(WorkModeEnum.REALMS))
|
||||
if (mode == nameof(WorkModeEnum.REALMS))
|
||||
{
|
||||
var resourceNames = Assembly.GetExecutingAssembly().GetManifestResourceNames();
|
||||
|
||||
@ -117,7 +125,7 @@ if (mode.Value == nameof(WorkModeEnum.REALMS))
|
||||
}
|
||||
}
|
||||
|
||||
var rewriteOptions = new RewriteOptions().AddRewrite(@"^(?!api)(.*)$", $"modes/{mode.Value}/$1", true);
|
||||
var rewriteOptions = new RewriteOptions().AddRewrite(@"^(?!api)(.*)$", $"modes/{mode}/$1", true);
|
||||
app.UseRewriter(rewriteOptions);
|
||||
|
||||
app.UseMiddleware<MinecraftCookieMiddleware>();
|
||||
@ -127,5 +135,5 @@ app.UseMiddleware<AdminKeyMiddleware>();
|
||||
app.UseMiddleware<CheckForWorldMiddleware>();
|
||||
app.UseMiddleware<RouteLoggingMiddleware>();
|
||||
|
||||
Console.WriteLine($"Running in {mode.Value} mode");
|
||||
Console.WriteLine($"Running in {mode} mode");
|
||||
app.Run();
|
||||
|
@ -3,7 +3,7 @@ FROM eclipse-temurin:21-jre-alpine
|
||||
COPY . .
|
||||
|
||||
RUN apk upgrade
|
||||
RUN apk add openssl
|
||||
RUN apk add openssl curl jq
|
||||
|
||||
RUN wget -O rcon-cli.tar.gz https://github.com/itzg/rcon-cli/releases/download/1.6.7/rcon-cli_1.6.7_linux_amd64.tar.gz
|
||||
RUN tar xzf rcon-cli.tar.gz
|
||||
@ -12,7 +12,6 @@ RUN rm rcon-cli.tar.gz
|
||||
RUN mv rcon-cli /bin/rcon-cli
|
||||
|
||||
WORKDIR mc
|
||||
RUN wget -O server.jar https://piston-data.mojang.com/v1/objects/450698d1863ab5180c25d7c804ef0fe6369dd1ba/server.jar
|
||||
|
||||
EXPOSE 25565
|
||||
|
||||
ENTRYPOINT ["/entrypoint"]
|
@ -11,4 +11,12 @@ if [ ! -f server.properties ]; then
|
||||
echo "level-name=slot-1" >> server.properties
|
||||
fi
|
||||
|
||||
# Download latest server.jar
|
||||
if [ ! -f .no-update ]; then
|
||||
VERSION_URL=$(curl https://piston-meta.mojang.com/mc/game/version_manifest_v2.json | jq -r '.latest.release as $latest | .versions | to_entries[] | select(.value.id == $latest) | .value.url')
|
||||
SERVER_URL=$(curl $VERSION_URL | jq -r .downloads.server.url)
|
||||
|
||||
wget -O server.jar $SERVER_URL
|
||||
fi
|
||||
|
||||
java -jar server.jar
|
@ -1,9 +0,0 @@
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Responses
|
||||
{
|
||||
public class BackupsResponse
|
||||
{
|
||||
public List<Backup> Backups { get; set; }
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
using Minecraft_Realms_Emulator.Requests;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Responses
|
||||
{
|
||||
public class SlotOptionsResponse : SlotOptionsRequest
|
||||
{
|
||||
public string Compatibility { get; set; } = null!;
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
namespace Minecraft_Realms_Emulator.Responses
|
||||
{
|
||||
public class SlotResponse
|
||||
{
|
||||
public int SlotId { get; set; }
|
||||
public string Options { get; set; } = null!;
|
||||
}
|
||||
}
|
@ -1,6 +1,4 @@
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Attributes
|
||||
namespace Minecraft_Realms_Emulator.Shared.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public class CheckActiveSubscription : Attribute
|
@ -1,6 +1,6 @@
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Attributes
|
||||
namespace Minecraft_Realms_Emulator.Shared.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public class CheckForWorldAttribute : Attribute
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Attributes
|
||||
namespace Minecraft_Realms_Emulator.Shared.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public class CheckRealmOwnerAttribute : Attribute
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Attributes
|
||||
namespace Minecraft_Realms_Emulator.Shared.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class RequireAdminKeyAttribute : Attribute
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Attributes
|
||||
namespace Minecraft_Realms_Emulator.Shared.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class RequireMinecraftCookieAttribute : Attribute
|
@ -1,10 +1,10 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
using Minecraft_Realms_Emulator.Helpers;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Helpers;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Controllers.Admin
|
||||
namespace Minecraft_Realms_Emulator.Shared.Controllers.Admin
|
||||
{
|
||||
[Route("api/admin/[controller]")]
|
||||
[ApiController]
|
@ -1,10 +1,10 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using Minecraft_Realms_Emulator.Modes.Realms.Helpers;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Controllers.Admin
|
||||
namespace Minecraft_Realms_Emulator.Shared.Controllers.Admin
|
||||
{
|
||||
[Route("api/admin/[controller]")]
|
||||
[ApiController]
|
||||
@ -28,7 +28,8 @@ namespace Minecraft_Realms_Emulator.Controllers.Admin
|
||||
|
||||
[HttpGet("{wId}")]
|
||||
[CheckForWorld]
|
||||
public ActionResult<World> GetWorld(int wId) {
|
||||
public ActionResult<World> GetWorld(int wId)
|
||||
{
|
||||
var world = _context.Worlds.ToList().Find(w => w.Id == wId);
|
||||
|
||||
return Ok(world);
|
@ -1,7 +1,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Data
|
||||
namespace Minecraft_Realms_Emulator.Shared.Data
|
||||
{
|
||||
public class DataContext(DbContextOptions<DataContext> options) : DbContext(options)
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Entities
|
||||
namespace Minecraft_Realms_Emulator.Shared.Entities
|
||||
{
|
||||
public class Backup
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Entities
|
||||
namespace Minecraft_Realms_Emulator.Shared.Entities
|
||||
{
|
||||
[PrimaryKey(nameof(Key))]
|
||||
public class Configuration
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Entities
|
||||
namespace Minecraft_Realms_Emulator.Shared.Entities
|
||||
{
|
||||
public class Connection
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Entities
|
||||
namespace Minecraft_Realms_Emulator.Shared.Entities
|
||||
{
|
||||
public class Invite
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Entities
|
||||
namespace Minecraft_Realms_Emulator.Shared.Entities
|
||||
{
|
||||
public class Notification
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Entities
|
||||
namespace Minecraft_Realms_Emulator.Shared.Entities
|
||||
{
|
||||
public class Player
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Entities
|
||||
namespace Minecraft_Realms_Emulator.Shared.Entities
|
||||
{
|
||||
public class SeenNotification
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using Minecraft_Realms_Emulator.Requests;
|
||||
using Minecraft_Realms_Emulator.Shared.Requests;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Entities
|
||||
namespace Minecraft_Realms_Emulator.Shared.Entities
|
||||
{
|
||||
public class Slot : SlotOptionsRequest
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Entities
|
||||
namespace Minecraft_Realms_Emulator.Shared.Entities
|
||||
{
|
||||
public class Subscription
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Entities
|
||||
namespace Minecraft_Realms_Emulator.Shared.Entities
|
||||
{
|
||||
public class Template
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Entities
|
||||
namespace Minecraft_Realms_Emulator.Shared.Entities
|
||||
{
|
||||
public class World
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Enums
|
||||
namespace Minecraft_Realms_Emulator.Shared.Enums
|
||||
{
|
||||
public enum CompatibilityEnum
|
||||
{
|
@ -1,11 +1,10 @@
|
||||
namespace Minecraft_Realms_Emulator.Enums
|
||||
namespace Minecraft_Realms_Emulator.Shared.Enums
|
||||
{
|
||||
public enum SettingsEnum
|
||||
{
|
||||
NewsLink,
|
||||
DefaultServerAddress,
|
||||
TrialMode,
|
||||
WorkMode,
|
||||
OnlineMode,
|
||||
AutomaticRealmsCreation
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Enums
|
||||
namespace Minecraft_Realms_Emulator.Shared.Enums
|
||||
{
|
||||
public enum StateEnum
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Enums
|
||||
namespace Minecraft_Realms_Emulator.Shared.Enums
|
||||
{
|
||||
public enum SubscriptionTypeEnum
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Enums
|
||||
namespace Minecraft_Realms_Emulator.Shared.Enums
|
||||
{
|
||||
public enum VersionCompatibilityEnum
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Enums
|
||||
namespace Minecraft_Realms_Emulator.Shared.Enums
|
||||
{
|
||||
public enum WorkModeEnum
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Enums
|
||||
namespace Minecraft_Realms_Emulator.Shared.Enums
|
||||
{
|
||||
public enum WorldTemplateTypeEnum
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Enums
|
||||
namespace Minecraft_Realms_Emulator.Shared.Enums
|
||||
{
|
||||
public enum WorldTypeEnum
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Helpers
|
||||
namespace Minecraft_Realms_Emulator.Shared.Helpers
|
||||
{
|
||||
public class ConfigHelper
|
||||
{
|
@ -1,13 +1,10 @@
|
||||
using Minecraft_Realms_Emulator.Enums;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Helpers.Config
|
||||
namespace Minecraft_Realms_Emulator.Shared.Helpers.Config
|
||||
{
|
||||
public class Settings
|
||||
{
|
||||
public string DefaultServerAddress { get; set; } = "127.0.0.1";
|
||||
public string NewsLink { get; set; } = "https://github.com/CyberL1/Minecraft-Realms-Emulator";
|
||||
public bool TrialMode { get; set; } = true;
|
||||
public string WorkMode { get; set; } = nameof(WorkModeEnum.EXTERNAL);
|
||||
public bool OnlineMode { get; set; } = false;
|
||||
public bool AutomaticRealmsCreation { get; set; } = true;
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
using Minecraft_Realms_Emulator.Helpers.Config;
|
||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||
using Minecraft_Realms_Emulator.Shared.Helpers.Config;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Helpers
|
||||
namespace Minecraft_Realms_Emulator.Shared.Helpers
|
||||
{
|
||||
public class Database
|
||||
{
|
@ -1,9 +1,9 @@
|
||||
using Minecraft_Realms_Emulator.Responses;
|
||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Helpers
|
||||
namespace Minecraft_Realms_Emulator.Shared.Helpers
|
||||
{
|
||||
public class MinecraftServerQuery
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Helpers
|
||||
namespace Minecraft_Realms_Emulator.Shared.Helpers
|
||||
{
|
||||
public class MinecraftVersionParser
|
||||
{
|
@ -1,9 +1,9 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Middlewares
|
||||
namespace Minecraft_Realms_Emulator.Shared.Middlewares
|
||||
{
|
||||
public class ActiveSubscriptionMiddleware(RequestDelegate next)
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Middlewares
|
||||
namespace Minecraft_Realms_Emulator.Shared.Middlewares
|
||||
{
|
||||
public class AdminKeyMiddleware(RequestDelegate next)
|
||||
{
|
@ -1,9 +1,9 @@
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
using Minecraft_Realms_Emulator.Responses;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||
using Minecraft_Realms_Emulator.Shared.Responses;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Middlewares
|
||||
namespace Minecraft_Realms_Emulator.Shared.Middlewares
|
||||
{
|
||||
public class CheckForWorldMiddleware(RequestDelegate next)
|
||||
{
|
@ -1,9 +1,9 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Data;
|
||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Middlewares
|
||||
namespace Minecraft_Realms_Emulator.Shared.Middlewares
|
||||
{
|
||||
public class CheckRealmOwnerMiddleware(RequestDelegate next)
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using Minecraft_Realms_Emulator.Attributes;
|
||||
using Minecraft_Realms_Emulator.Shared.Attributes;
|
||||
using System.Text;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Middlewares
|
||||
namespace Minecraft_Realms_Emulator.Shared.Middlewares
|
||||
{
|
||||
public class MinecraftCookieMiddleware(RequestDelegate next)
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Middlewares
|
||||
namespace Minecraft_Realms_Emulator.Shared.Middlewares
|
||||
{
|
||||
public class RouteLoggingMiddleware(RequestDelegate next)
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Requests
|
||||
namespace Minecraft_Realms_Emulator.Shared.Requests
|
||||
{
|
||||
public class PlayerRequest
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Requests
|
||||
namespace Minecraft_Realms_Emulator.Shared.Requests
|
||||
{
|
||||
public class SlotOptionsRequest
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Requests
|
||||
namespace Minecraft_Realms_Emulator.Shared.Requests
|
||||
{
|
||||
public class WorldCreateRequest
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Responses
|
||||
namespace Minecraft_Realms_Emulator.Shared.Responses
|
||||
{
|
||||
public class BackupDownloadResponse
|
||||
{
|
@ -0,0 +1,9 @@
|
||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Shared.Responses
|
||||
{
|
||||
public class BackupsResponse
|
||||
{
|
||||
public List<Backup> Backups { get; set; }
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Responses
|
||||
namespace Minecraft_Realms_Emulator.Shared.Responses
|
||||
{
|
||||
public class ErrorResponse
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Responses
|
||||
namespace Minecraft_Realms_Emulator.Shared.Responses
|
||||
{
|
||||
public class InviteList
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Responses
|
||||
namespace Minecraft_Realms_Emulator.Shared.Responses
|
||||
{
|
||||
public class LivePlayerListsResponse
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Responses
|
||||
namespace Minecraft_Realms_Emulator.Shared.Responses
|
||||
{
|
||||
public class MinecraftPlayerInfo
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Responses
|
||||
namespace Minecraft_Realms_Emulator.Shared.Responses
|
||||
{
|
||||
public class MinecraftServerQueryRepsonse
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Responses
|
||||
namespace Minecraft_Realms_Emulator.Shared.Responses
|
||||
{
|
||||
public class NewsResponse
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
using Minecraft_Realms_Emulator.Shared.Entities;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Responses
|
||||
namespace Minecraft_Realms_Emulator.Shared.Responses
|
||||
{
|
||||
public class NotificationsResponse
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Minecraft_Realms_Emulator.Responses
|
||||
namespace Minecraft_Realms_Emulator.Shared.Responses
|
||||
{
|
||||
public class OpsResponse
|
||||
{
|
@ -1,6 +1,4 @@
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Responses
|
||||
namespace Minecraft_Realms_Emulator.Shared.Responses
|
||||
{
|
||||
public class ServersResponse
|
||||
{
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user