Skip to content

Commit d780792

Browse files
committed
Updated forms to match the transactions being passed.
1 parent c59d0ba commit d780792

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

dev/Forms.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939
"fmt"
4040
"github.com/df-mc/dragonfly/server/player"
4141
"github.com/df-mc/dragonfly/server/player/form"
42+
"github.com/df-mc/dragonfly/server/world"
4243
)
4344

4445
// SomeForm holds the structure of our form. The order in which elements appear is defined by the order of
@@ -53,7 +54,7 @@ type SomeForm struct {
5354

5455
// Submit is called when the form is submitted. It must have this signature in order to implement the
5556
// form.Submittable interface.
56-
func (f SomeForm) Submit(submitter form.Submitter) {
57+
func (f SomeForm) Submit(submitter form.Submitter, tx *world.Tx) {
5758
// A form.Submitter is guaranteed to be a *player.Player when sent to a player, so we can assert it to a
5859
// player right away.
5960
p := submitter.(*player.Player)

dev/World-Transactions.md

+4
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ Commands now have a transaction passed to them too, and players/entities returne
142142
a `[]Target` parameter will only include those from the same world as the caller of
143143
the command.
144144

145+
### Forms
146+
Like with commands, forms are opened within a transaction now. The transaction is
147+
passed to all Submit methods and Close methods.
148+
145149
### Accepting players
146150
Accepting players was changed from the following:
147151
```go

0 commit comments

Comments
 (0)