Skip to content

Commit

Permalink
feat(server-ui): added Form.close()
Browse files Browse the repository at this point in the history
  • Loading branch information
PMK744 committed Jul 9, 2024
1 parent 7a3fbcb commit ad127b7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/server-ui/src/forms/form.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
ClientboundCloseFormPacket,
ModalFormCanceledReason,
ModalFormRequestPacket,
Packet
Expand Down Expand Up @@ -88,6 +89,18 @@ class Form<T> {
Form.pending.set(this.network, { resolve, reject });
});
}

/**
* Close the form for the player
* @param player The player to close the form for
*/
public close(player: Player): void {
// Create a new ClientboundCloseFormPacket
const packet = new ClientboundCloseFormPacket();

// Send the packet to the player
player.session.send(packet);
}
}

export { Form };

0 comments on commit ad127b7

Please sign in to comment.