-
-
Notifications
You must be signed in to change notification settings - Fork 1k
new sign transaction event #6071
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
Merged
JRoy
merged 25 commits into
EssentialsX:2.x
from
sumsar1812:task/new-sign-transaction-events
Mar 24, 2025
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
d3daf32
Added new SignTransactionEvent to notify external plugins about sign …
sumsar1812 e9c4be3
Fixing checkstyle errors and moving event to aligning with other even…
sumsar1812 76bf7b2
test
sumsar1812 22d5ab1
Update Essentials/src/main/java/com/earth2me/essentials/signs/SignBuy…
sumsar1812 159a302
Update Essentials/src/main/java/com/earth2me/essentials/signs/SignSel…
sumsar1812 88af779
Update Essentials/src/main/java/net/ess3/api/events/SignTransactionEv…
sumsar1812 f98eeaa
Update Essentials/src/main/java/net/ess3/api/events/SignTransactionEv…
sumsar1812 4f90fb3
Update Essentials/src/main/java/net/ess3/api/events/SignTransactionEv…
sumsar1812 6492047
Update Essentials/src/main/java/net/ess3/api/events/SignTransactionEv…
sumsar1812 6405c45
Update Essentials/src/main/java/net/ess3/api/events/SignTransactionEv…
sumsar1812 916db02
Update Essentials/src/main/java/net/ess3/api/events/SignTransactionEv…
sumsar1812 9528361
Update Essentials/src/main/java/net/ess3/api/events/SignTransactionEv…
sumsar1812 d58432f
Update Essentials/src/main/java/net/ess3/api/events/SignTransactionEv…
sumsar1812 cf5b5f4
Merge branch '2.x' into task/new-sign-transaction-events
sumsar1812 92f7273
Merge branch '2.x' into task/new-sign-transaction-events
sumsar1812 aa06180
Merge branch '2.x' into task/new-sign-transaction-events
sumsar1812 db8330c
Merge branch '2.x' into task/new-sign-transaction-events
sumsar1812 cd26703
Merge branch '2.x' into task/new-sign-transaction-events
sumsar1812 1868d03
Merge branch '2.x' into task/new-sign-transaction-events
sumsar1812 626a209
Merge branch '2.x' into task/new-sign-transaction-events
sumsar1812 9066156
Merge branch '2.x' into task/new-sign-transaction-events
sumsar1812 0f6d172
Added HandlerList
sumsar1812 145ee7b
reverted a naming change
sumsar1812 24d5d8b
Merge remote-tracking branch 'origin/task/new-sign-transaction-events…
sumsar1812 c5016ac
Update Essentials/src/main/java/net/ess3/api/events/SignTransactionEv…
JRoy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
Essentials/src/main/java/net/ess3/api/events/SignTransactionEvent.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| package net.ess3.api.events; | ||
|
|
||
| import com.earth2me.essentials.signs.EssentialsSign; | ||
| import net.ess3.api.IUser; | ||
| import org.bukkit.event.Cancellable; | ||
| import org.bukkit.inventory.ItemStack; | ||
| import org.jetbrains.annotations.NotNull; | ||
| import org.bukkit.event.HandlerList; | ||
|
|
||
| import java.math.BigDecimal; | ||
|
|
||
| /** | ||
| * Fired when a player either buys or sells from an Essentials sign | ||
| */ | ||
| public final class SignTransactionEvent extends SignInteractEvent implements Cancellable { | ||
| private static final HandlerList handlers = new HandlerList(); | ||
| private final ItemStack itemStack; | ||
| private final TransactionType transactionType; | ||
| private final BigDecimal transactionValue; | ||
| private boolean isCancelled = false; | ||
|
|
||
| public SignTransactionEvent(EssentialsSign.ISign sign, EssentialsSign essSign, IUser user, ItemStack itemStack, TransactionType transactionType, BigDecimal transactionValue) { | ||
| super(sign, essSign, user); | ||
| this.itemStack = itemStack; | ||
| this.transactionType = transactionType; | ||
| this.transactionValue = transactionValue; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isCancelled() { | ||
| return this.isCancelled; | ||
| } | ||
|
|
||
| @Override | ||
| public void setCancelled(boolean cancelled) { | ||
| this.isCancelled = cancelled; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the ItemStack that is about to be bought or sold in this transition. | ||
| * @return The ItemStack being bought or sold. | ||
| */ | ||
| public @NotNull ItemStack getItemStack() { | ||
| return itemStack.clone(); | ||
| } | ||
|
|
||
| /** | ||
| * Gets the type of transaction, either buy or sell. | ||
| * @return The transaction type. | ||
| */ | ||
| public @NotNull TransactionType getTransactionType() { | ||
| return transactionType; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the value of the item being bought or sold. | ||
| * @return The item's value. | ||
| */ | ||
| public BigDecimal getTransactionValue() { | ||
| return transactionValue; | ||
| } | ||
|
|
||
| /** | ||
| * The type of transaction for this sign transaction. | ||
| */ | ||
| public enum TransactionType { | ||
JRoy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| BUY, | ||
| SELL | ||
| } | ||
|
|
||
| @Override | ||
| public HandlerList getHandlers() { | ||
| return handlers; | ||
| } | ||
|
|
||
| public static HandlerList getHandlerList() { | ||
| return handlers; | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.