Fix the perform restart settings flag not getting honored.
This commit is contained in:
parent
825830dcad
commit
c57382dfa4
3 changed files with 26 additions and 17 deletions
|
@ -295,7 +295,10 @@ class C2SUploadSettingsPacket implements IPacket {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void decodeTag(Tag tag) {
|
void decodeTag(Tag tag) {
|
||||||
srvSettings = tag.asCompoundTag().get("settings")!.asCompoundTag();
|
CompoundTag ct = tag.asCompoundTag();
|
||||||
|
|
||||||
|
srvSettings = ct.get("settings")!.asCompoundTag();
|
||||||
|
performRestart = NbtUtils.readBoolean(ct, "restart");
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -339,13 +342,13 @@ class C2SUploadSettingsPacket implements IPacket {
|
||||||
settings.deserialize(srvSettings);
|
settings.deserialize(srvSettings);
|
||||||
settings.Write();
|
settings.Write();
|
||||||
|
|
||||||
if (!performRestart) {
|
DiscordHookHelper.sendWebHook(
|
||||||
DiscordHookHelper.sendWebHook(
|
settings.inst!.discord,
|
||||||
settings.inst!.discord,
|
DiscordHookProps.ONLINE_ALERT,
|
||||||
DiscordHookProps.ONLINE_ALERT,
|
"Server Wrapper Settings",
|
||||||
"Server Wrapper Settings",
|
"Server wrapper settings have been updated.\n\n${performRestart ? "A restart has been requested" : "A restart is not needed"}");
|
||||||
"Server wrapper settings have been updated.\n\n${performRestart ? "A restart has been requested" : "A restart is not needed"}");
|
|
||||||
|
|
||||||
|
if (!performRestart) {
|
||||||
return PacketResponse.nil;
|
return PacketResponse.nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ class HomePage extends StatefulWidget {
|
||||||
|
|
||||||
class HomePageState extends State<HomePage> {
|
class HomePageState extends State<HomePage> {
|
||||||
Settings settings = Settings();
|
Settings settings = Settings();
|
||||||
bool requireRestart=false;
|
bool requireRestart = false;
|
||||||
|
|
||||||
HomePageState({required this.settings});
|
HomePageState({required this.settings});
|
||||||
|
|
||||||
|
@ -113,23 +113,29 @@ class HomePageState extends State<HomePage> {
|
||||||
|
|
||||||
C2SUploadSettingsPacket upload = C2SUploadSettingsPacket();
|
C2SUploadSettingsPacket upload = C2SUploadSettingsPacket();
|
||||||
upload.srvSettings = settings.serialize();
|
upload.srvSettings = settings.serialize();
|
||||||
upload.performRestart=requireRestart;
|
upload.performRestart = requireRestart;
|
||||||
|
|
||||||
await settings.client!.send(upload, false);
|
await settings.client!.send(upload, !requireRestart);
|
||||||
Settings.Clear();
|
Settings.Clear();
|
||||||
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
|
||||||
if(requireRestart) {
|
if (requireRestart) {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
),
|
||||||
|
SwitchListTile(
|
||||||
|
value: requireRestart,
|
||||||
|
onChanged: (V) {
|
||||||
|
setState(() {
|
||||||
|
requireRestart = V;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
title: Text("Perform Restart"),
|
||||||
|
subtitle: Text(
|
||||||
|
"Whether a immediate server restart should be performed in combination with this wrapper settings update"),
|
||||||
)
|
)
|
||||||
, SwitchListTile(value: requireRestart, onChanged: (V) {
|
|
||||||
setState(() {
|
|
||||||
requireRestart = V;
|
|
||||||
});
|
|
||||||
}, title: Text("Perform Restart"), subtitle: Text("Whether a immediate server restart should be performed in combination with this wrapper settings update"),)
|
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
|
|
|
@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
# In Windows, build-name is used as the major, minor, and patch parts
|
# In Windows, build-name is used as the major, minor, and patch parts
|
||||||
# of the product and file versions while build-number is used as the build suffix.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 1.1.0+34
|
version: 1.1.0+35
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.1.4 <4.0.0'
|
sdk: '>=3.1.4 <4.0.0'
|
||||||
|
|
Loading…
Reference in a new issue