Remove a thread blocking piece of code.
This commit is contained in:
parent
8d9d792568
commit
bb6fadd717
2 changed files with 1 additions and 16 deletions
|
@ -1,7 +1,6 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:libac_dart/nbt/Stream.dart';
|
|
||||||
import 'package:libac_dart/packets/packets.dart';
|
import 'package:libac_dart/packets/packets.dart';
|
||||||
import 'package:libac_dart/utils/IOTools.dart';
|
import 'package:libac_dart/utils/IOTools.dart';
|
||||||
import 'package:servermanager/game.dart';
|
import 'package:servermanager/game.dart';
|
||||||
|
@ -80,17 +79,7 @@ class StateMachine {
|
||||||
DeadProcKillswitch = Completer();
|
DeadProcKillswitch = Completer();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void onStdOutData(List<int> stdOutData) {
|
|
||||||
StringBuilder builder = StringBuilder();
|
|
||||||
for (int i in stdOutData) {
|
|
||||||
builder.append(String.fromCharCode(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
print(builder.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
static Future<void> monitorProcess() async {
|
static Future<void> monitorProcess() async {
|
||||||
PROC!.stdout.listen(onStdOutData);
|
|
||||||
try {
|
try {
|
||||||
int code = await PROC!.exitCode;
|
int code = await PROC!.exitCode;
|
||||||
DeadProcKillswitch.complete();
|
DeadProcKillswitch.complete();
|
||||||
|
@ -115,6 +104,7 @@ class StateMachine {
|
||||||
return; // Nothing to do here
|
return; // Nothing to do here
|
||||||
} else if (currentState == States.FullStop) {
|
} else if (currentState == States.FullStop) {
|
||||||
Settings settings = Settings();
|
Settings settings = Settings();
|
||||||
|
print("Sending shutdown command to server");
|
||||||
await settings.sendRconCommand("shutdown");
|
await settings.sendRconCommand("shutdown");
|
||||||
|
|
||||||
changeState(States.Inactive);
|
changeState(States.Inactive);
|
||||||
|
|
|
@ -23,10 +23,6 @@ class SettingsEntry {
|
||||||
static SettingsEntry deserialize(CompoundTag tag) {
|
static SettingsEntry deserialize(CompoundTag tag) {
|
||||||
SettingsEntry st = SettingsEntry();
|
SettingsEntry st = SettingsEntry();
|
||||||
|
|
||||||
if (tag.containsKey(Credentials.TAG_NAME)) {
|
|
||||||
st.steam_creds =
|
|
||||||
Credentials.deserialize(tag.get(Credentials.TAG_NAME) as CompoundTag);
|
|
||||||
}
|
|
||||||
st.timer = AutomaticRestartInfo.deserialize(
|
st.timer = AutomaticRestartInfo.deserialize(
|
||||||
tag.get(AutomaticRestartInfo.TAG_NAME) as CompoundTag);
|
tag.get(AutomaticRestartInfo.TAG_NAME) as CompoundTag);
|
||||||
st.serverSettings = ServerSettings.deserialize(
|
st.serverSettings = ServerSettings.deserialize(
|
||||||
|
@ -48,7 +44,6 @@ class SettingsEntry {
|
||||||
|
|
||||||
CompoundTag serialize() {
|
CompoundTag serialize() {
|
||||||
CompoundTag tag = CompoundTag();
|
CompoundTag tag = CompoundTag();
|
||||||
if (steam_creds != null) tag.put(Credentials.TAG_NAME, steam_creds!.save());
|
|
||||||
tag.put(AutomaticRestartInfo.TAG_NAME, timer.serialize());
|
tag.put(AutomaticRestartInfo.TAG_NAME, timer.serialize());
|
||||||
tag.put(ServerSettings.TAG_NAME, serverSettings.serialize());
|
tag.put(ServerSettings.TAG_NAME, serverSettings.serialize());
|
||||||
NbtUtils.writeBoolean(tag, "pterodactyl", pterodactylMode);
|
NbtUtils.writeBoolean(tag, "pterodactyl", pterodactylMode);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue