Skip to content

Commit

Permalink
Added back anonymous gui functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ToberoCat committed Aug 12, 2023
1 parent 3f21e1a commit 3ad4c17
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,28 @@
import io.github.toberocat.guiengine.context.GuiContext;
import org.jetbrains.annotations.NotNull;

import java.util.function.BiConsumer;

/**
* Represents a function that can be called on a GUI context.
* <p>
* Created: 29.04.2023
* Author: Tobias Madlberger (Tobias)
*/
public interface GuiFunction {
static @NotNull GuiFunction of(BiConsumer<GuiEngineApi, GuiContext> method) {
return new GuiFunction() {
@Override
public @NotNull String getType() {
return "anonymous";
}

@Override
public void call(@NotNull GuiEngineApi api, @NotNull GuiContext context) {
method.accept(api, context);
}
};
}

@NotNull String getType();

Expand Down

0 comments on commit 3ad4c17

Please sign in to comment.