Skip to content

Commit 2456b5e

Browse files
committed
keep original value on ActionBuilder.Input
1 parent bc440bd commit 2456b5e

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/main/java/me/hsgamer/bettergui/builder/ActionBuilder.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,39 +42,46 @@ private ActionBuilder() {
4242
public List<Action> build(Menu menu, Object object) {
4343
List<Input> inputs = CollectionUtils.createStringListFromObject(object, true)
4444
.stream()
45-
.map(ActionInput::create)
4645
.map(input -> Input.create(menu, input))
4746
.collect(Collectors.toList());
48-
return build(inputs, input -> new PlayerAction(BetterGUI.getInstance(), input.getValue()));
47+
return build(inputs, input -> new PlayerAction(BetterGUI.getInstance(), input.getOriginalValue()));
4948
}
5049

5150
public interface Input extends ActionInput, MenuElement {
52-
static Input create(Menu menu, ActionInput input) {
51+
static Input create(Menu menu, String input) {
52+
ActionInput actionInput = ActionInput.create(input);
5353
return new Input() {
5454
@Override
5555
public String getType() {
56-
return input.getType();
56+
return actionInput.getType();
5757
}
5858

5959
@Override
6060
public String getOption() {
61-
return input.getOption();
61+
return actionInput.getOption();
6262
}
6363

6464
@Override
6565
public String getValue() {
66-
return input.getValue();
66+
return actionInput.getValue();
6767
}
6868

6969
@Override
7070
public Menu getMenu() {
7171
return menu;
7272
}
73+
74+
@Override
75+
public String getOriginalValue() {
76+
return input;
77+
}
7378
};
7479
}
7580

76-
static Input create(MenuElement menuElement, ActionInput input) {
81+
static Input create(MenuElement menuElement, String input) {
7782
return create(menuElement.getMenu(), input);
7883
}
84+
85+
String getOriginalValue();
7986
}
8087
}

0 commit comments

Comments
 (0)