Remove a thread blocking piece of code.

This commit is contained in:
zontreck 2024-05-24 18:09:51 -07:00
parent 8d9d792568
commit bb6fadd717
2 changed files with 1 additions and 16 deletions

View file

@ -1,7 +1,6 @@
import 'dart:async';
import 'dart:io';
import 'package:libac_dart/nbt/Stream.dart';
import 'package:libac_dart/packets/packets.dart';
import 'package:libac_dart/utils/IOTools.dart';
import 'package:servermanager/game.dart';
@ -80,17 +79,7 @@ class StateMachine {
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 {
PROC!.stdout.listen(onStdOutData);
try {
int code = await PROC!.exitCode;
DeadProcKillswitch.complete();
@ -115,6 +104,7 @@ class StateMachine {
return; // Nothing to do here
} else if (currentState == States.FullStop) {
Settings settings = Settings();
print("Sending shutdown command to server");
await settings.sendRconCommand("shutdown");
changeState(States.Inactive);

View file

@ -23,10 +23,6 @@ class SettingsEntry {
static SettingsEntry deserialize(CompoundTag tag) {
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(
tag.get(AutomaticRestartInfo.TAG_NAME) as CompoundTag);
st.serverSettings = ServerSettings.deserialize(
@ -48,7 +44,6 @@ class SettingsEntry {
CompoundTag serialize() {
CompoundTag tag = CompoundTag();
if (steam_creds != null) tag.put(Credentials.TAG_NAME, steam_creds!.save());
tag.put(AutomaticRestartInfo.TAG_NAME, timer.serialize());
tag.put(ServerSettings.TAG_NAME, serverSettings.serialize());
NbtUtils.writeBoolean(tag, "pterodactyl", pterodactylMode);