Always look at the same literal data packet in getText() and verify()

This commit is contained in:
Daniel Huigens
2018-12-11 18:40:06 +01:00
parent 8720adcf65
commit e727097bb0
2 changed files with 8 additions and 19 deletions

View File

@@ -168,24 +168,10 @@ List.prototype.filterByTag = function (...args) {
/**
* Traverses packet tree and returns first matching packet
* @param {module:enums.packet} type The packet type
* @returns {module:packet/packet|null}
* @returns {module:packet/packet|undefined}
*/
List.prototype.findPacket = function (type) {
const packetlist = this.filterByTag(type);
if (packetlist.length) {
return packetlist[0];
}
let found = null;
for (let i = 0; i < this.length; i++) {
if (this[i].packets.length) {
found = this[i].packets.findPacket(type);
if (found) {
return found;
}
}
}
return null;
return this.find(packet => packet.tag === type);
};
/**