diff --git a/src/messagenametag.ts b/src/messagenametag.ts index d642fb7..a18def4 100644 --- a/src/messagenametag.ts +++ b/src/messagenametag.ts @@ -84,6 +84,11 @@ export class MessageNametagBuffer { return true; } + getNametagPosition(messageNametag: MessageNametag): number { + const index = this.buffer.findIndex((x) => uint8ArrayEquals(x, messageNametag)); + return index; + } + private rotateLeft(k: number): void { if (k < 0 || this.buffer.length == 0) { return; @@ -124,6 +129,10 @@ export class MessageNametagBuffer { console.debug("The message nametags buffer has no secret set"); } } + + getNametagAtPosition(position: number): MessageNametag { + return this.buffer[position]; + } } /**