mirror of
https://github.com/CyberL1/Minecraft-Realms-Emulator.git
synced 2024-11-24 23:18:23 -05:00
feat: world slots
This commit is contained in:
parent
400187a022
commit
bc86311a09
@ -2,7 +2,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Minecraft_Realms_Emulator.Entities;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Controllers
|
||||
{
|
||||
@ -21,7 +20,7 @@ namespace Minecraft_Realms_Emulator.Controllers
|
||||
public async Task<ActionResult<ServersArray>> GetWorlds()
|
||||
{
|
||||
var worlds = await _context.Worlds.ToListAsync();
|
||||
|
||||
|
||||
string cookie = Request.Headers.Cookie;
|
||||
|
||||
string playerUUID = cookie.Split(";")[0].Split(":")[2];
|
||||
@ -48,7 +47,6 @@ namespace Minecraft_Realms_Emulator.Controllers
|
||||
MinigameId = null,
|
||||
MinigameName = null,
|
||||
MinigameImage = null,
|
||||
Slots = [],
|
||||
ActiveSlot = 1,
|
||||
Member = false
|
||||
};
|
||||
@ -162,5 +160,12 @@ namespace Minecraft_Realms_Emulator.Controllers
|
||||
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
[HttpPost("{wId}/slot/{sId}")]
|
||||
public bool U(int wId, int sId, object o)
|
||||
{
|
||||
Console.WriteLine(o);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
8
Minecraft-Realms-Emulator/Entities/Slot.cs
Normal file
8
Minecraft-Realms-Emulator/Entities/Slot.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace Minecraft_Realms_Emulator.Entities
|
||||
{
|
||||
public class Slot
|
||||
{
|
||||
public int SlotId { get; set; }
|
||||
public string Options { get; set; } = "{}";
|
||||
}
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
namespace Minecraft_Realms_Emulator.Entities
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Entities
|
||||
{
|
||||
public class World
|
||||
{
|
||||
@ -19,7 +21,7 @@
|
||||
public int? MinigameId { get; set; }
|
||||
public string? MinigameImage { get; set; }
|
||||
public int ActiveSlot { get; set; } = 1;
|
||||
public string[] Slots { get; set; } = [];
|
||||
public JsonDocument[] Slots { get; set; } = [];
|
||||
public bool Member { get; set; } = false;
|
||||
}
|
||||
}
|
131
Minecraft-Realms-Emulator/Migrations/20240211135246_Slots.Designer.cs
generated
Normal file
131
Minecraft-Realms-Emulator/Migrations/20240211135246_Slots.Designer.cs
generated
Normal file
@ -0,0 +1,131 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Minecraft_Realms_Emulator.Data;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20240211135246_Slots")]
|
||||
partial class Slots
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.1")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.Subscription", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DaysLeft")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("RemoteId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("StartDate")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("SubscriptionType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Subscriptions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Minecraft_Realms_Emulator.Entities.World", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ActiveSlot")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DaysLeft")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("Expired")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("ExpiredTrial")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("MaxPlayers")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("Member")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("MinigameId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("MinigameImage")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("MinigameName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Motd")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Owner")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("OwnerUUID")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string[]>("Players")
|
||||
.IsRequired()
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.Property<string>("RemoteSubscriptionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<JsonDocument[]>("Slots")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb[]");
|
||||
|
||||
b.Property<string>("State")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("WorldType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Worlds");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
23
Minecraft-Realms-Emulator/Migrations/20240211135246_Slots.cs
Normal file
23
Minecraft-Realms-Emulator/Migrations/20240211135246_Slots.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System.Text.Json;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Minecraft_Realms_Emulator.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Slots : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql("ALTER TABLE \"Worlds\" ALTER COLUMN \"Slots\" TYPE jsonb[] USING \"Slots\"::jsonb[]");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql("ALTER TABLE \"Worlds\" ALTER COLUMN \"Slots\" TYPE text[] USING \"Slots\"::text[]");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
@ -105,9 +106,9 @@ namespace Minecraft_Realms_Emulator.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string[]>("Slots")
|
||||
b.Property<JsonDocument[]>("Slots")
|
||||
.IsRequired()
|
||||
.HasColumnType("text[]");
|
||||
.HasColumnType("jsonb[]");
|
||||
|
||||
b.Property<string>("State")
|
||||
.IsRequired()
|
||||
|
Loading…
Reference in New Issue
Block a user