refactor: updated order of plugins callbacks
This commit is contained in:
@@ -79,9 +79,6 @@ public sealed class RoomCreateOperation : BaseOperation
|
||||
|
||||
var roomPlugin = _serverPlugin.CreateRoomPlugin(information);
|
||||
var room = new RagonRoom(roomId, information, roomPlugin);
|
||||
|
||||
if (!roomPlugin.OnPlayerJoined(roomPlayer))
|
||||
return;
|
||||
|
||||
roomPlayer.OnAttached(room);
|
||||
|
||||
@@ -95,6 +92,8 @@ public sealed class RoomCreateOperation : BaseOperation
|
||||
|
||||
JoinSuccess(roomPlayer, room, Writer);
|
||||
|
||||
roomPlugin.OnPlayerJoined(roomPlayer);
|
||||
|
||||
_logger.Trace($"Player {context.Connection.Id}|{context.LobbyPlayer.Name} joined to room {room.Id}");
|
||||
}
|
||||
|
||||
|
||||
@@ -48,15 +48,14 @@ public sealed class RoomJoinOperation : BaseOperation
|
||||
|
||||
var player = new RagonRoomPlayer(context, lobbyPlayer.Id, lobbyPlayer.Name);
|
||||
context.SetRoom(existsRoom, player);
|
||||
|
||||
if (!existsRoom.Plugin.OnPlayerJoined(player))
|
||||
return;
|
||||
|
||||
|
||||
_webHook.RoomJoined(context, existsRoom, player);
|
||||
|
||||
JoinSuccess(context, existsRoom, Writer);
|
||||
|
||||
existsRoom.RestoreBufferedEvents(player);
|
||||
|
||||
existsRoom.Plugin.OnPlayerJoined(player);
|
||||
|
||||
_logger.Trace($"Player {context.Connection.Id}|{context.LobbyPlayer.Name} joined to {existsRoom.Id}");
|
||||
}
|
||||
|
||||
@@ -54,9 +54,6 @@ public sealed class RoomJoinOrCreateOperation : BaseOperation
|
||||
{
|
||||
var player = new RagonRoomPlayer(context, lobbyPlayer.Id, lobbyPlayer.Name);
|
||||
|
||||
if (!existsRoom.Plugin.OnPlayerJoined(player))
|
||||
return;
|
||||
|
||||
context.SetRoom(existsRoom, player);
|
||||
|
||||
_ragonWebHookPlugin.RoomJoined(context, existsRoom, player);
|
||||
@@ -64,6 +61,8 @@ public sealed class RoomJoinOrCreateOperation : BaseOperation
|
||||
JoinSuccess(player, existsRoom, Writer);
|
||||
|
||||
existsRoom.RestoreBufferedEvents(player);
|
||||
|
||||
existsRoom.Plugin.OnPlayerJoined(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -78,9 +77,6 @@ public sealed class RoomJoinOrCreateOperation : BaseOperation
|
||||
var roomPlugin = _serverPlugin.CreateRoomPlugin(information);
|
||||
var room = new RagonRoom(roomId, information, roomPlugin);
|
||||
|
||||
if (!roomPlugin.OnPlayerJoined(roomPlayer))
|
||||
return;
|
||||
|
||||
_ragonWebHookPlugin.RoomCreated(context, room, roomPlayer);
|
||||
|
||||
context.Lobby.Persist(room);
|
||||
@@ -90,6 +86,8 @@ public sealed class RoomJoinOrCreateOperation : BaseOperation
|
||||
_logger.Trace($"Player {context.Connection.Id}|{context.LobbyPlayer.Name} create room {room.Id} with scene {information.Scene}");
|
||||
|
||||
JoinSuccess(roomPlayer, room, Writer);
|
||||
|
||||
room.Plugin.OnPlayerJoined(roomPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user