Fixed a format
This commit is contained in:
@@ -27,6 +27,7 @@ public final class StreamChatScreen extends Screen {
|
||||
private EditBox tikFinityUrl;
|
||||
private EditBox prefix;
|
||||
private EditBox template;
|
||||
private Platform boxPlatform;
|
||||
private final List<AbstractWidget> scrollable = new ArrayList<>();
|
||||
private final List<Integer> baseY = new ArrayList<>();
|
||||
private int scroll;
|
||||
@@ -41,6 +42,8 @@ public final class StreamChatScreen extends Screen {
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
// Window resizes re-run init(); keep unsaved edits instead of reverting to the stored values.
|
||||
if (prefix != null) commitFormatting();
|
||||
int left = width / 2 - 190;
|
||||
int rowWidth = 380;
|
||||
int buttonWidth = 120;
|
||||
@@ -94,6 +97,7 @@ public final class StreamChatScreen extends Screen {
|
||||
|
||||
prefix = new EditBox(font, left, 230, rowWidth, 20, Component.literal("Platform prefix"));
|
||||
prefix.setValue(config.getPrefix(selectedPlatform));
|
||||
boxPlatform = selectedPlatform;
|
||||
prefix.setMaxLength(128);
|
||||
addRenderableWidget(prefix);
|
||||
template = new EditBox(font, left, 270, rowWidth, 20, Component.literal("Chat message format"));
|
||||
@@ -183,31 +187,30 @@ public final class StreamChatScreen extends Screen {
|
||||
|
||||
@Override
|
||||
public void onClose() {
|
||||
config.streamerBotUrl = streamerBotUrl.getValue().trim();
|
||||
config.streamerBotPassword = streamerBotPassword.getValue();
|
||||
config.tikFinityUrl = tikFinityUrl.getValue().trim();
|
||||
config.prefixes.put(selectedPlatform.name(), prefix.getValue());
|
||||
config.setChatFormat(selectedPlatform, template.getValue());
|
||||
commitFormatting();
|
||||
config.save();
|
||||
connections.configurationChanged();
|
||||
minecraft.setScreen(parent);
|
||||
}
|
||||
|
||||
private void select(Platform platform) {
|
||||
private void commitFormatting() {
|
||||
config.streamerBotUrl = streamerBotUrl.getValue().trim();
|
||||
config.streamerBotPassword = streamerBotPassword.getValue();
|
||||
config.tikFinityUrl = tikFinityUrl.getValue().trim();
|
||||
config.prefixes.put(selectedPlatform.name(), prefix.getValue());
|
||||
config.setChatFormat(selectedPlatform, template.getValue());
|
||||
config.prefixes.put(boxPlatform.name(), prefix.getValue());
|
||||
config.setChatFormat(boxPlatform, template.getValue());
|
||||
}
|
||||
|
||||
private void select(Platform platform) {
|
||||
commitFormatting();
|
||||
selectedPlatform = platform;
|
||||
prefix.setValue(config.getPrefix(platform));
|
||||
template.setValue(config.getChatFormat(platform));
|
||||
rebuildRoutes();
|
||||
}
|
||||
|
||||
private void reloadConfig() {
|
||||
config.reload();
|
||||
connections.configurationChanged();
|
||||
prefix = null;
|
||||
rebuildRoutes();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user