Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new sign transaction event #6071

Open
wants to merge 15 commits into
base: 2.x
Choose a base branch
from

Conversation

sumsar1812
Copy link

  • Added new SignTransactionEvent to notify external plugins about sign transactions
  • Fixing checkstyle errors and moving event to aligning with other event location.

Information

The feature request is here:
#6070
https://gyazo.com/ba209d0b4dd4e4a032e1e0a390e37157

This PR closes #6070.

Details

Proposed feature:

This feature would introduce one new event for external plugins to listen to.
This event is called SignTransactionEvent and is fired when a user buys or sells something from a sign.
The event includes information about the type of transaction(buy/sell), the item bought/sold, how much it was bought/sold for and the sign it was bought at, the event is cancelable.

Environments tested:

OS: Windows 10

Java version: java version "17.0.7"

  • Most recent Paper version (1.XX.Y, git-Paper-BUILD)
  • CraftBukkit/Spigot/Paper 1.12.2
  • CraftBukkit 1.8.8

Demonstration:

https://gyazo.com/b3ab1a544ae3da83c9dd84556a7db415 - gif in 1.8
https://gyazo.com/ddf184d52fe0144690a49e19de0b2c40 - works in 1.12
https://gyazo.com/b68c7554c5ceb455aaa14fc6b4827c1b - works in 1.21
Code used to test it
https://pastebin.com/rcDJbX6s

Copy link
Member

@JRoy JRoy left a comment

Choose a reason for hiding this comment

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

you need to declare a HandlerList for the SignTransactionEvent and override the getHandlers method + add a static getHandlerList method which also returns it.

otherwise i just left a few slight style/doc changes.

@sumsar1812
Copy link
Author

sumsar1812 commented Feb 28, 2025

you need to declare a HandlerList for the SignTransactionEvent and override the getHandlers method + add a static getHandlerList method which also returns it.

otherwise i just left a few slight style/doc changes.

Are the handerlist not inherited by the other event ? So it should not be needed to declare it again, otherwise I think the event wouldn't have worked.

sumsar1812 and others added 11 commits February 28, 2025 18:44
@sumsar1812
Copy link
Author

sumsar1812 commented Feb 28, 2025

I updated the rest though, thanks :)

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.

Event for buying and selling from signs
2 participants