Makes the stop command actually functional
This commit is contained in:
parent
46ae60392c
commit
caa5b2bf69
1 changed files with 10 additions and 0 deletions
|
@ -5,6 +5,7 @@ import 'package:servermanager/game.dart';
|
|||
import 'package:servermanager/pathtools.dart';
|
||||
import 'package:servermanager/proton.dart';
|
||||
import 'package:servermanager/settings.dart';
|
||||
import 'package:mc_rcon_dart/mc_rcon_dart.dart';
|
||||
|
||||
enum States {
|
||||
Idle, // For when the state machine is waiting for a state change
|
||||
|
@ -32,6 +33,15 @@ class StateMachine {
|
|||
Future<void> runTask() async {
|
||||
if (currentState == States.Idle) {
|
||||
return; // Nothing to do here
|
||||
} else if (currentState == States.FullStop) {
|
||||
Settings settings = Settings();
|
||||
await createSocket("127.0.0.1",
|
||||
port: settings.inst!.serverSettings.RconPort);
|
||||
login(settings.inst!.serverSettings.RconPassword);
|
||||
|
||||
sendCommand("shutdown");
|
||||
|
||||
changeState(States.Inactive);
|
||||
} else if (currentState == States.Starting) {
|
||||
// Server startup in progress
|
||||
Settings settings = Settings();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue