Skip to content

Conversation

@Thorinwasher
Copy link
Contributor

One for each structure type

@Thorinwasher Thorinwasher changed the title Add event classes for brewing Feat: Add event classes for brewing Nov 13, 2025
@Thorinwasher Thorinwasher force-pushed the feat/api-improvements branch 3 times, most recently from dd384bd to 45dc006 Compare December 4, 2025 08:51
@Thorinwasher Thorinwasher marked this pull request as ready for review December 22, 2025 10:25
@Thorinwasher
Copy link
Contributor Author

(assigning all the team as reviewers, as it's in dupe sensitive territory)

Copy link
Member

@Jsinco Jsinco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ItemTransaction data class kind of scares me. I understand that it has to be exposed to the API but I'd consider marking the next release as experimental at least for a little while


private boolean cancelled = false;
@Getter
private boolean denied = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe don't use lombok here and document what denied is? Not super apparent at a glance, but that could just be me


public interface Permissible extends Cancellable {

boolean isDenied();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like denied and cancelled have too similar of a meaning in these events. Maybe just use cancelled instead of both? Or possibly take a page out of Bukkit's book and use an enumerator to more explicitly declare what is happening

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look again, I changed how it works now.

inventoryAccessible,
new ItemTransaction.RawPosition(event.getRawSlot()),
inventoryPosition,
event.getCurrentItem(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The event.getCurrentItem() and other items referenced by the event are mapped to real items in memory (either items or slots, Spigot docs aren't clear on this), so Spigot could modify the item before the next tick. Is this properly accounted for in the scheduled task? If not, we may need to clone ItemStacks before passing them to ItemSource.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems to be true, as when I cloned it, the issue with items not converting format got fixed. I think not cloning it is just going to cause undefined behavior, which is why it probably worked when I tested it.

@Tisawesomeness
Copy link
Contributor

A small bug: Taking a brew with expanded lore out of a barrel does not reset the lore to how it should appear in-inventory.

@Thorinwasher
Copy link
Contributor Author

A small bug: Taking a brew with expanded lore out of a barrel does not reset the lore to how it should appear in-inventory.

I only tested with a distillery, which is where it looks like it worked, it should be the same with barrels. How did you take out the brew?

@Tisawesomeness
Copy link
Contributor

I only tested with a distillery, which is where it looks like it worked, it should be the same with barrels. How did you take out the brew?

Shift-clicking and left-click pickup both cause the issue. You have to leave the brew in a barrel long enough for it to update and get expanded lore.

@Tisawesomeness Tisawesomeness mentioned this pull request Dec 31, 2025
3 tasks
@Thorinwasher
Copy link
Contributor Author

I forgot to include hopper based inventory transactions as well. Those need to be tracked too 😃

@Thorinwasher
Copy link
Contributor Author

And inventory drag event? It will probably take a while until I would be able to complete this myself, any help is appreciated.

@Thorinwasher Thorinwasher force-pushed the feat/api-improvements branch from c62114a to eda0ec5 Compare January 2, 2026 14:25
@Thorinwasher Thorinwasher force-pushed the feat/api-improvements branch from eda0ec5 to 8f1e111 Compare January 2, 2026 15:23
cauldron extract is not an inventory transaction, a single BrewBasedSource is sufficient
@Tisawesomeness
Copy link
Contributor

Seems like most of the issues have been worked out now. The events need a way to modify the item/brew being inserted or extracted (possibly a simple setBrew(Brew) for brew-based events, and setItem(ItemStack) for item-based events), so addons can add meta and ingredients when necessary.

@Thorinwasher
Copy link
Contributor Author

Seems like most of the issues have been worked out now. The events need a way to modify the item/brew being inserted or extracted (possibly a simple setBrew(Brew) for brew-based events, and setItem(ItemStack) for item-based events), so addons can add meta and ingredients when necessary.

See ItemTransactionSession, or whatever that is called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants