Skip to content

Commit ae8e5f9

Browse files
committed
Refactored Element Biconsumer function names to be more clear
1 parent 19645d4 commit ae8e5f9

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/main/java/dev/arctic/interactivemenuapi/interfaces/IElement.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ public interface IElement {
7070
*
7171
* @param onInteract BiConsumer that takes a Player and an Object (input).
7272
*/
73-
void setOnInteract(BiConsumer<Player, Object> onInteract);
73+
void setExternalFunction(BiConsumer<Player, Object> onInteract);
7474

7575
/**
7676
* Executes the action defined by the BiConsumer when this element is interacted with.
7777
*
7878
* @param player The player interacting with the element.
7979
* @param input The input object related to the interaction.
8080
*/
81-
void onInteract(Player player, Object input);
81+
void doExternalFunction(Player player, Object input);
8282
}

src/main/java/dev/arctic/interactivemenuapi/objects/Element.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,12 @@ private Vector getAdjustedOffset(Location anchorLocation, Vector offset, float y
8989
}
9090
}
9191

92-
public void setOnInteract(BiConsumer<Player, Object> onInteract) {
92+
public void setExternalFunction(BiConsumer<Player, Object> onInteract) {
9393
this.onInteract = onInteract;
9494
}
9595

96-
public void onInteract(Player player, Object input) {
96+
public void doExternalFunction(Player player, Object input) {
97+
getParentMenu().setLastInteractionTime(System.currentTimeMillis());
9798
if (onInteract != null) {
9899
onInteract.accept(player, input);
99100
}

src/main/java/dev/arctic/interactivemenuapi/objects/Menu.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class Menu implements IMenu {
3939
public Menu (Location rootLocation, int timeoutSeconds, Plugin plugin) {
4040
this.rootLocation = rootLocation;
4141
this.timeoutSeconds = timeoutSeconds;
42-
this.lastInteractionTime = System.currentTimeMillis() / 1000;
42+
this.lastInteractionTime = System.currentTimeMillis();
4343
this.doCleanup = true;
4444
this.plugin = plugin;
4545
initializeMenu();

0 commit comments

Comments
 (0)