mirror of
https://github.com/CyberL1/Minecraft-Realms-Emulator.git
synced 2026-09-15 19:25:48 -04:00
refactor(Core): put Difficulty and GameMode into enums
This commit is contained in:
@@ -120,7 +120,7 @@ public class WorldsController(DataContext context, CookiePlayerData playerData)
|
|||||||
DaysLeft = realm.Subscription.Ended ? -1 : 0,
|
DaysLeft = realm.Subscription.Ended ? -1 : 0,
|
||||||
WorldType = realm.WorldType,
|
WorldType = realm.WorldType,
|
||||||
IsHardcore = realm.ActiveSlot.Settings.Contains("hardcore"),
|
IsHardcore = realm.ActiveSlot.Settings.Contains("hardcore"),
|
||||||
GameMode = realm.ActiveSlot.Options.GameMode,
|
GameMode = (int)realm.ActiveSlot.Options.GameMode,
|
||||||
ActiveSlot = -1,
|
ActiveSlot = -1,
|
||||||
ActiveVersion = realm.ActiveSlot.Options.Version,
|
ActiveVersion = realm.ActiveSlot.Options.Version,
|
||||||
Compatibility = nameof(RealmCompatibility.UNVERIFIABLE)
|
Compatibility = nameof(RealmCompatibility.UNVERIFIABLE)
|
||||||
@@ -203,8 +203,8 @@ public class WorldsController(DataContext context, CookiePlayerData playerData)
|
|||||||
{
|
{
|
||||||
SpawnProtection = slot.Options.SpawnProtection,
|
SpawnProtection = slot.Options.SpawnProtection,
|
||||||
ForceGeeMode = slot.Options.ForceGameMode,
|
ForceGeeMode = slot.Options.ForceGameMode,
|
||||||
Difficulty = slot.Options.Difficulty,
|
Difficulty = (int)slot.Options.Difficulty,
|
||||||
GameMode = slot.Options.GameMode,
|
GameMode = (int)slot.Options.GameMode,
|
||||||
SlotName = slot.Options.SlotName,
|
SlotName = slot.Options.SlotName,
|
||||||
Version = slot.Options.Version,
|
Version = slot.Options.Version,
|
||||||
Compatibility = playerData.Version == slot.Options.Version
|
Compatibility = playerData.Version == slot.Options.Version
|
||||||
@@ -219,7 +219,7 @@ public class WorldsController(DataContext context, CookiePlayerData playerData)
|
|||||||
DaysLeft = realm.Subscription.DaysLeft,
|
DaysLeft = realm.Subscription.DaysLeft,
|
||||||
WorldType = realm.WorldType,
|
WorldType = realm.WorldType,
|
||||||
IsHardcore = realm.ActiveSlot.Settings.Contains("hardcore"),
|
IsHardcore = realm.ActiveSlot.Settings.Contains("hardcore"),
|
||||||
GameMode = realm.ActiveSlot.Options.GameMode,
|
GameMode = (int)realm.ActiveSlot.Options.GameMode,
|
||||||
ActiveSlot = realm.ActiveSlot.SlotId,
|
ActiveSlot = realm.ActiveSlot.SlotId,
|
||||||
ActiveVersion = realm.ActiveSlot.Options.Version,
|
ActiveVersion = realm.ActiveSlot.Options.Version,
|
||||||
Compatibility = nameof(RealmCompatibility.UNVERIFIABLE),
|
Compatibility = nameof(RealmCompatibility.UNVERIFIABLE),
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
using Core.Enums;
|
||||||
|
|
||||||
namespace Core.Entities;
|
namespace Core.Entities;
|
||||||
|
|
||||||
@@ -7,10 +8,10 @@ public class SlotOptions
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int SpawnProtection { get; set; }
|
public int SpawnProtection { get; set; }
|
||||||
public bool ForceGameMode { get; set; }
|
public bool ForceGameMode { get; set; }
|
||||||
public int Difficulty { get; set; }
|
public SlotOptionsDifficulty Difficulty { get; set; }
|
||||||
public int GameMode { get; set; }
|
public SlotOptionsGameMode GameMode { get; set; }
|
||||||
public string SlotName { get; set; } = null!;
|
public string SlotName { get; set; } = null!;
|
||||||
public required string Version { get; set; }
|
public required string Version { get; set; }
|
||||||
[JsonIgnore] public int SlotId { get; set; }
|
[JsonIgnore] public int SlotId { get; set; }
|
||||||
[JsonIgnore] public Slot Slot { get; set; } = null!;
|
[JsonIgnore] public Slot Slot { get; set; } = null!;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Core.Enums;
|
||||||
|
|
||||||
|
public enum SlotOptionsDifficulty
|
||||||
|
{
|
||||||
|
Peaceful,
|
||||||
|
Easy,
|
||||||
|
Normal,
|
||||||
|
Hard
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Core.Enums;
|
||||||
|
|
||||||
|
public enum SlotOptionsGameMode
|
||||||
|
{
|
||||||
|
Survival,
|
||||||
|
Creative,
|
||||||
|
Adventure
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user