Skip to content

Commit 52b6ce2

Browse files
committed
feat. 管理员可直接切歌
1 parent 05a4dd1 commit 52b6ce2

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/main/java/top/gregtao/concerto/command/ConcertoServerCommand.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,17 @@ public static void register(CommandDispatcher<ServerCommandSource> dispatcher, C
8181
return 0;
8282
})
8383
).then(
84-
CommandManager.literal("reset-agent")
85-
.requires(source -> source.hasPermissionLevel(2)).executes(context -> {
84+
CommandManager.literal("agent").requires(source -> source.hasPermissionLevel(2)).then(
85+
CommandManager.literal("reset").executes(context -> {
8686
ServerMusicAgent.INSTANCE.reset();
8787
return 0;
8888
})
89+
).then(
90+
CommandManager.literal("cut").executes(context -> {
91+
ServerMusicAgent.INSTANCE.playNextMusic();
92+
return 0;
93+
})
94+
)
8995
)
9096
);
9197
}

src/main/java/top/gregtao/concerto/network/ServerMusicAgent.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ private synchronized void endVoting() {
9797
this.isVoting = false;
9898
}
9999

100-
private synchronized void playNextMusic() {
100+
public synchronized void playNextMusic() {
101101
this.currentMusic = this.musicQueue.poll();
102102
this.currentSharedMusic = null;
103103
this.totalBytes = 0;
@@ -169,8 +169,6 @@ public synchronized void playerQuit(ServerPlayerEntity player) {
169169
}
170170

171171
public synchronized void reset() {
172-
this.members.clear();
173-
174172
this.voteLock.lock();
175173
this.isVoting = false;
176174
this.yesVoters.clear();

0 commit comments

Comments
 (0)