Skip to content

Commit

Permalink
keep original value on ActionBuilder.Input
Browse files Browse the repository at this point in the history
  • Loading branch information
HSGamer committed Jun 30, 2024
1 parent bc440bd commit 2456b5e
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/main/java/me/hsgamer/bettergui/builder/ActionBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,39 +42,46 @@ private ActionBuilder() {
public List<Action> build(Menu menu, Object object) {
List<Input> inputs = CollectionUtils.createStringListFromObject(object, true)
.stream()
.map(ActionInput::create)
.map(input -> Input.create(menu, input))
.collect(Collectors.toList());
return build(inputs, input -> new PlayerAction(BetterGUI.getInstance(), input.getValue()));
return build(inputs, input -> new PlayerAction(BetterGUI.getInstance(), input.getOriginalValue()));
}

public interface Input extends ActionInput, MenuElement {
static Input create(Menu menu, ActionInput input) {
static Input create(Menu menu, String input) {
ActionInput actionInput = ActionInput.create(input);
return new Input() {
@Override
public String getType() {
return input.getType();
return actionInput.getType();
}

@Override
public String getOption() {
return input.getOption();
return actionInput.getOption();
}

@Override
public String getValue() {
return input.getValue();
return actionInput.getValue();
}

@Override
public Menu getMenu() {
return menu;
}

@Override
public String getOriginalValue() {
return input;
}
};
}

static Input create(MenuElement menuElement, ActionInput input) {
static Input create(MenuElement menuElement, String input) {
return create(menuElement.getMenu(), input);
}

String getOriginalValue();
}
}

0 comments on commit 2456b5e

Please sign in to comment.