mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-09 23:00:57 -05:00
refactor some event handling
add concept of blocking events
This commit is contained in:
@ -3,6 +3,13 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace SharedLibraryCore.Commands
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a way for administrators to "unlink" linked accounts
|
||||
/// This problem is common in IW4x where the client identifier is a file
|
||||
/// that is commonly transmitted when uploading and sharing the game files
|
||||
/// This command creates a new link and assigns the guid, and all aliases with the current IP
|
||||
/// associated to the provided client ID to the new link
|
||||
/// </summary>
|
||||
public class UnlinkClientCommand : Command
|
||||
{
|
||||
public UnlinkClientCommand() :
|
||||
|
@ -224,6 +224,10 @@ namespace SharedLibraryCore
|
||||
public long Id { get; private set; }
|
||||
public EventFailReason FailReason { get; set; }
|
||||
public bool Failed => FailReason != EventFailReason.None;
|
||||
/// <summary>
|
||||
/// Indicates if the event should block until it is complete
|
||||
/// </summary>
|
||||
public bool IsBlocking { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// asynchronously wait for GameEvent to be processed
|
||||
|
@ -77,6 +77,13 @@ PRAGMA foreign_keys = 1;
|
||||
", true);
|
||||
}
|
||||
|
||||
else if (migrationBuilder.ActiveProvider == "Pomelo.EntityFrameworkCore.MySql")
|
||||
{
|
||||
migrationBuilder.Sql("ALTER TABLE `EFHitLocationCounts` CHANGE `EFClientStatistics_ClientId` `EFClientStatisticsClientId` INT(11) NOT NULL;");
|
||||
migrationBuilder.Sql("ALTER TABLE `EFHitLocationCounts` CHANGE `EFClientStatistics_ServerId` `EFClientStatisticsServerId` INT(11) NOT NULL;");
|
||||
migrationBuilder.Sql("CREATE INDEX `IX_EFClientStatisticsClientId_EFClientStatisticsServerId` ON `EFHitLocationCounts` (`EFClientStatisticsClientId`, `EFClientStatisticsServerId`);");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
@ -139,61 +146,6 @@ PRAGMA foreign_keys = 1;
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_EFHitLocationCounts_EFClients_EFClientStatisticsClientId",
|
||||
table: "EFHitLocationCounts");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_EFHitLocationCounts_EFServers_EFClientStatisticsServerId",
|
||||
table: "EFHitLocationCounts");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_EFHitLocationCounts_EFClientStatistics_EFClientStatisticsClientId_EFClientStatisticsServerId",
|
||||
table: "EFHitLocationCounts");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "EFClientStatisticsServerId",
|
||||
table: "EFHitLocationCounts",
|
||||
newName: "EFClientStatistics_ServerId");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "EFClientStatisticsClientId",
|
||||
table: "EFHitLocationCounts",
|
||||
newName: "EFClientStatistics_ClientId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_EFHitLocationCounts_EFClientStatisticsClientId_EFClientStatisticsServerId",
|
||||
table: "EFHitLocationCounts",
|
||||
newName: "IX_EFHitLocationCounts_EFClientStatistics_ClientId_EFClientStatistics_ServerId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_EFHitLocationCounts_EFClientStatisticsServerId",
|
||||
table: "EFHitLocationCounts",
|
||||
newName: "IX_EFHitLocationCounts_EFClientStatistics_ServerId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_EFHitLocationCounts_EFClients_EFClientStatistics_ClientId",
|
||||
table: "EFHitLocationCounts",
|
||||
column: "EFClientStatistics_ClientId",
|
||||
principalTable: "EFClients",
|
||||
principalColumn: "ClientId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_EFHitLocationCounts_EFServers_EFClientStatistics_ServerId",
|
||||
table: "EFHitLocationCounts",
|
||||
column: "EFClientStatistics_ServerId",
|
||||
principalTable: "EFServers",
|
||||
principalColumn: "ServerId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_EFHitLocationCounts_EFClientStatistics_EFClientStatistics_ClientId_EFClientStatistics_ServerId",
|
||||
table: "EFHitLocationCounts",
|
||||
columns: new[] { "EFClientStatistics_ClientId", "EFClientStatistics_ServerId" },
|
||||
principalTable: "EFClientStatistics",
|
||||
principalColumns: new[] { "ClientId", "ServerId" },
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -376,6 +376,11 @@ namespace SharedLibraryCore.Database.Models
|
||||
e.FailReason = GameEvent.EventFailReason.Permission;
|
||||
}
|
||||
|
||||
if (Level == Permission.Banned)
|
||||
{
|
||||
e.FailReason = GameEvent.EventFailReason.Invalid;
|
||||
}
|
||||
|
||||
sender.CurrentServer.Manager.GetEventHandler().AddEvent(e);
|
||||
return e;
|
||||
}
|
||||
|
Reference in New Issue
Block a user