Class ClickPreprocessor
java.lang.Object
net.minestom.server.inventory.click.ClickPreprocessor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
isCreativeClick
(@NotNull Click click, boolean hasCursorItem) Determines whether or not a click is creative only.@Nullable Click
processClick
(@NotNull ClientClickWindowPacket packet, @Nullable Integer containerSize) Processes the provided click packet, turning it into aClick
.
-
Constructor Details
-
ClickPreprocessor
public ClickPreprocessor()
-
-
Method Details
-
clearCache
public void clearCache() -
isCreativeClick
Determines whether or not a click is creative only. This should match client behaviour, including edge cases like middle clicks (item clones) being sent in survival when there is an item in the cursor (which would make it a no-op), hence the parameter. This function can be overridden if modifying the creative check logic is desired, sinceWindowListener
directly depends on this.- Parameters:
click
- the click to checkhasCursorItem
- if the client has an item in the cursor (for checkingClick.Middle
)- Returns:
- if the click is creative only
-
processClick
@Nullable public @Nullable Click processClick(@NotNull @NotNull ClientClickWindowPacket packet, @Nullable @Nullable Integer containerSize) Processes the provided click packet, turning it into aClick
.- Parameters:
packet
- the raw click packetcontainerSize
- the size of the open container, or null if the player inventory is open- Returns:
- the processed click, or nothing if the click takes place over multiple packets and this is not the final one (e.g. a drag)
-