Skip to content

Commit 4b113a3

Browse files
Removing print text
Remove print text from the player, and switch the error log to console instead
1 parent 3e707c9 commit 4b113a3

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

noteblockplayer.go

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

33
import (
4-
// "fmt"
4+
"fmt"
55
"math"
66
"sync"
77
"time"
@@ -76,16 +76,15 @@ func (c PlayNoteBlockCmd) Run(src cmd.Source, output *cmd.Output, w *world.Tx) {
7676
// If extension is ".nbs" load as NBS, else ".json" or no extension loads as JSON.
7777
song, err := flexSongLoader(c.Filename)
7878
if err != nil {
79-
output.Errorf("Failed to load file: %v", err)
79+
fmt.Printf("Failed to load file: %v\n", err)
8080
return
8181
}
8282
p, ok := src.(*player.Player)
8383
if ok {
84-
output.Printf("Playing %s", c.Filename)
8584
go playSong(p.H(), song)
8685
return
8786
}
88-
output.Printf("Song %s loaded, but playback is only supported for players", c.Filename)
87+
fmt.Printf("Song %s loaded, but playback is only supported for players", c.Filename)
8988
}
9089

9190
// StopNoteBlockCmd is the command to stop any currently playing noteblock song for the player.
@@ -98,13 +97,13 @@ func (StopNoteBlockCmd) AllowConsole() bool { return true }
9897
func (c StopNoteBlockCmd) Run(src cmd.Source, output *cmd.Output, w *world.Tx) {
9998
p, ok := src.(*player.Player)
10099
if !ok {
101-
output.Print("The stopnoteblock command is only valid for players")
100+
fmt.Print("The stopnoteblock command is only valid for players")
102101
return
103102
}
104103
if stopSong(p.H()) {
105-
output.Print("Song playback stopped")
104+
// output.Print("Song playback stopped")
106105
} else {
107-
output.Print("No song is currently playing")
106+
// output.Print("No song is currently playing")
108107
}
109108
}
110109

@@ -177,12 +176,6 @@ func playSong(eh *world.EntityHandle, song *Song) {
177176
}
178177

179178
defer func() {
180-
_ = eh.ExecWorld(func(_ *world.Tx, ent world.Entity) {
181-
pp, ok := ent.(*player.Player)
182-
if ok {
183-
pp.Message("Song playback finished.")
184-
}
185-
})
186179
stopPlayerMtx.Lock()
187180
delete(stopPlayer, eh)
188181
stopPlayerMtx.Unlock()

0 commit comments

Comments
 (0)