Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 49ccf1e

Browse files
committed
check if player is a guest
1 parent 2ed2909 commit 49ccf1e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

‎models/player/player.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package player
22

33
import (
4+
"errors"
45
"github.com/blobs-io/blobsgame/database"
56
"github.com/blobs-io/blobsgame/utils"
67
"time"
@@ -58,6 +59,9 @@ type Player struct {
5859
}
5960

6061
func (p *Player) Update(br int, coins int, xp int) error {
62+
if p.Guest {
63+
return errors.New("target is a guest")
64+
}
6165
rows, err := database.Database.Query(`UPDATE accounts SET "br" = "br" + 1,ドル "blobcoins" = "blobcoins" + 2,ドル "xp" = "xp" + 3ドル WHERE "username" = 4ドル`, br, coins, xp, p.Username)
6266
if err != nil {
6367
return err

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /