mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-15 14:12:27 +00:00
Clamp minimum and maximum players on slot publish
This commit is contained in:
parent
14fa5e9328
commit
84325596ee
1 changed files with 6 additions and 0 deletions
|
@ -229,6 +229,9 @@ public class PublishController : ControllerBase
|
||||||
slot.MaximumPlayers = 4;
|
slot.MaximumPlayers = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slot.MinimumPlayers = Math.Clamp(slot.MinimumPlayers, 1, 4);
|
||||||
|
slot.MaximumPlayers = Math.Clamp(slot.MaximumPlayers, 1, 4);
|
||||||
|
|
||||||
this.database.Entry(oldSlot).CurrentValues.SetValues(slot);
|
this.database.Entry(oldSlot).CurrentValues.SetValues(slot);
|
||||||
await this.database.SaveChangesAsync();
|
await this.database.SaveChangesAsync();
|
||||||
return this.Ok(oldSlot.Serialize(token.GameVersion));
|
return this.Ok(oldSlot.Serialize(token.GameVersion));
|
||||||
|
@ -259,6 +262,9 @@ public class PublishController : ControllerBase
|
||||||
slot.MaximumPlayers = 4;
|
slot.MaximumPlayers = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slot.MinimumPlayers = Math.Clamp(slot.MinimumPlayers, 1, 4);
|
||||||
|
slot.MaximumPlayers = Math.Clamp(slot.MaximumPlayers, 1, 4);
|
||||||
|
|
||||||
this.database.Slots.Add(slot);
|
this.database.Slots.Add(slot);
|
||||||
await this.database.SaveChangesAsync();
|
await this.database.SaveChangesAsync();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue