Skip to content
Snippets Groups Projects
Commit 1cf0f0af authored by Tobias Ullerich's avatar Tobias Ullerich
Browse files

#187 - Add new stop-action method to web api

parent 7eb19951
Branches
Tags
No related merge requests found
......@@ -21,7 +21,8 @@ class WebSocketHandler {
"pad-status-change" -> new PadStatusChangeMethod,
"cart-action" -> new CartActionMethod,
"page-action" -> new PageActionMethod,
"navigate-action" -> new NavigateActionMethod
"navigate-action" -> new NavigateActionMethod,
"stop-action" -> new StopActionMethod
)
@OnWebSocketConnect def connected(session: Session): Unit = {
......
package de.tobias.playpad.plugin.api.websocket.methods
import com.google.gson.JsonObject
import de.tobias.playpad.PlayPadPlugin
import de.tobias.playpad.pad.PadStatus
import de.tobias.playpad.plugin.api.websocket.MethodExecutable
import de.tobias.playpad.plugin.api.websocket.message.Message
import org.eclipse.jetty.websocket.api.Session
class StopActionMethod extends MethodExecutable {
override def execute(session: Session, message: Message): JsonObject = {
val project = PlayPadPlugin.getInstance.getCurrentProject
project.getPads.stream().forEach(pad => {
if ((pad.getStatus eq PadStatus.PLAY) || (pad.getStatus eq PadStatus.PAUSE)) pad.setStatus(PadStatus.STOP, true)
})
null
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment