Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream #20

Merged
merged 3 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ labyMod {
"1.19.2",
"1.19.3",
"1.19.4",
"1.20.1"
"1.20.1",
"1.20.2",
"1.20.4"
) { version, provider ->
configureRun(provider, version)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@
@AutoActivity
public class ShortcutActivity extends Activity {

private static final Pattern SHORTCUT_REGEX = Pattern.compile("[\\w.:]{0,32}");
private static final Pattern SHORTCUT_REGEX = Pattern.compile("[a-zA-Z0-9-.:]{0,32}");
private static final TextColorStripper TEXT_COLOR_STRIPPER = Laby.references()
.textColorStripper();
private final SendServerAddon addon;
private final VerticalListWidget<ShortcutWidget> nameTagList;
private final Map<String, ShortcutWidget> nameTagWidgets;
private ShortcutWidget selectedNameTag;
private ButtonWidget addButton;
private ButtonWidget removeButton;
private ButtonWidget editButton;
private FlexibleContentWidget container;

private FlexibleContentWidget inputWidget;
private String lastUserName;
Expand Down Expand Up @@ -77,7 +79,7 @@ public ShortcutActivity(boolean background) {
public void initialize(Parent parent) {
super.initialize(parent);

FlexibleContentWidget container = new FlexibleContentWidget();
container = new FlexibleContentWidget();
container.addId("name-tag-container");
for (ShortcutWidget shortcutWidget : this.nameTagWidgets.values()) {
this.nameTagList.addChild(shortcutWidget);
Expand All @@ -96,7 +98,8 @@ public void initialize(Parent parent) {
HorizontalListWidget menu = new HorizontalListWidget();
menu.addId("overview-button-menu");

menu.addEntry(ButtonWidget.i18n("labymod.ui.button.add", () -> this.setAction(Action.ADD)));
this.addButton = ButtonWidget.i18n("labymod.ui.button.add", () -> this.setAction(Action.ADD));
menu.addEntry(this.addButton);

this.editButton = ButtonWidget.i18n("labymod.ui.button.edit",
() -> this.setAction(Action.EDIT));
Expand All @@ -112,6 +115,7 @@ public void initialize(Parent parent) {
if (!background) {
this.document().addChild(container);
}

if (this.action == null) {
return;
}
Expand Down Expand Up @@ -139,6 +143,8 @@ public void initialize(Parent parent) {
}

private FlexibleContentWidget initializeRemoveContainer(ShortcutWidget shortcutWidget) {
container.setVisible(false);

this.inputWidget = new FlexibleContentWidget();
this.inputWidget.addId("remove-container");

Expand All @@ -161,6 +167,8 @@ private FlexibleContentWidget initializeRemoveContainer(ShortcutWidget shortcutW
this.nameTagList.session().setSelectedEntry(null);
this.setAction(null);
this.addon.reloadShortcutsList();

container.setVisible(true);
}));

menu.addEntry(ButtonWidget.i18n("labymod.ui.button.cancel", () -> this.setAction(null)));
Expand All @@ -170,6 +178,8 @@ private FlexibleContentWidget initializeRemoveContainer(ShortcutWidget shortcutW
}

private DivWidget initializeManageContainer(ShortcutWidget shortcutWidget) {
container.setVisible(false);

TextFieldWidget customTextField = new TextFieldWidget();
ButtonWidget doneButton = ButtonWidget.i18n("labymod.ui.button.done");

Expand Down Expand Up @@ -248,9 +258,12 @@ private DivWidget initializeManageContainer(ShortcutWidget shortcutWidget) {

shortcutWidget.setShortcut(nameTextField.getText());
shortcutWidget.setCustomTag(customNameTag);

this.setAction(null);

this.addon.reloadShortcutsList();

container.setVisible(true);
});

buttonList.addEntry(doneButton);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ TextField {
alignment-x: center;
alignment-y: center;

background-color: rgba(20, 20, 20, 1.0);
background-color: rgba(20, 20, 20, 0.8);
}

.manage-container {
Expand Down Expand Up @@ -48,7 +48,7 @@ TextField {
}

Shortcut {
background-color: rgba(17,17,17,0.55);
background-color: rgba(17,17,17,0.7);
border-radius: 5;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ TextField {
width: 100%;
height: 100%;

//background-color: #00000;
alignment-x: center;
alignment-y: center;

renderer: "DirtBackground";
background-dirt-brightness: 64;
background-dirt-brightness: 32;
background-always-dirt: true;
}

Expand Down Expand Up @@ -46,9 +45,6 @@ TextField {
bottom: -20;
}
}
renderer: "DirtBackground";
background-dirt-brightness: 64;
background-always-dirt: true;
}

Shortcut {
Expand All @@ -61,7 +57,6 @@ Shortcut:hover {

Shortcut:selected {
border: 1 #aaaaaa;

}


Expand All @@ -87,9 +82,6 @@ Shortcut:selected {

//background-color: rgba(170, 170, 170, 1.0);
padding: 10;
renderer: "DirtBackground";
background-dirt-brightness: 64;
background-always-dirt: true;
}

.remove-confirmation {
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
rootProject.name = "sendserveraddon"

pluginManagement {
val labyGradlePluginVersion = "0.3.28"
val labyGradlePluginVersion = "0.3.44"
plugins {
id("net.labymod.gradle") version (labyGradlePluginVersion)
}
Expand Down
Loading