Skip to content

Commit

Permalink
Update main.go
Browse files Browse the repository at this point in the history
  • Loading branch information
fangliuyu authored Sep 3, 2023
1 parent ac26687 commit 8f29c2a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugin/mcfish/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,10 @@ func (sql *fishdb) pickFishFor(uid int64, number int) (fishNames map[string]int,
}
for i := number; i > 0; i-- {
randNumber := rand.Intn(len(fishTypes))
if fishTypes[randNumber].Number <= 0 {
i++
continue
}
fishTypes[randNumber].Number--
err = sql.db.Insert(name, &fishTypes[randNumber])
if err != nil {
Expand Down

0 comments on commit 8f29c2a

Please sign in to comment.