diff --git a/server/ActionBuffer.js b/server/ActionBuffer.js deleted file mode 100644 index 1d6155f..0000000 --- a/server/ActionBuffer.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = class { - constructor(initialData = Buffer) { - this.actionBuffer; - if (initialData.length == 0) { - this.actionBuffer = Buffer.alloc(0); - } else { - this.actionBuffer = initialData; - } - } - - bufferAction(data = Buffer) { - if (data.length != 0) - this.actionBuffer = Buffer.concat([this.actionBuffer, data], this.actionBuffer.length + data.length); - } - - toBuffer() { - return this.actionBuffer; - } -} \ No newline at end of file diff --git a/server/Packets/TourneyMatchSpecialInfo.js b/server/Packets/TourneyMatchSpecialInfo.js index fea7aad..d537a08 100644 --- a/server/Packets/TourneyMatchSpecialInfo.js +++ b/server/Packets/TourneyMatchSpecialInfo.js @@ -1,7 +1,6 @@ const osu = require("osu-packet"), UserPresence = require("./UserPresence.js"), - StatusUpdate = require("./StatusUpdate.js"), - ActionBuffer = require("../ActionBuffer.js"); + StatusUpdate = require("./StatusUpdate.js"); module.exports = function(CurrentUser, MatchID) { const matchData = global.MultiplayerManager.getMatch(MatchID); @@ -11,13 +10,13 @@ module.exports = function(CurrentUser, MatchID) { osuPacketWriter.MatchUpdate(matchData.createOsuMatchJSON()); - let actions = new ActionBuffer(osuPacketWriter.toBuffer); - + // Queue info on all the users in the match to the client for (let slot in matchData.slots) { - actions.bufferAction(UserPresence(CurrentUser, slot.playerId, false)); - actions.bufferAction(StatusUpdate(CurrentUser, slot.playerId, false)); + CurrentUser.addActionToQueue(UserPresence(CurrentUser, slot.playerId, false)); + CurrentUser.addActionToQueue(StatusUpdate(CurrentUser, slot.playerId, false)); } - CurrentUser.addActionToQueue(actions.toBuffer()); + // Queue data + CurrentUser.addActionToQueue(osuPacketWriter.toBuffer); } } \ No newline at end of file