-
-
Notifications
You must be signed in to change notification settings - Fork 0
Add custom event classes for lockers, parcels, users, and item storage #160
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
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6706c98
Add custom event classes for lockers, parcels, users, and item storage
Jakubk15 f29f0ea
Initial plan
Copilot f3dc9e6
Update src/main/java/com/eternalcode/parcellockers/locker/event/Locke…
Jakubk15 0d0a30d
Update src/main/java/com/eternalcode/parcellockers/locker/event/Locke…
Jakubk15 bbfc01d
Fire event classes in appropriate code sections
Copilot f3141bd
Fix locker deletion event to fire before database deletion
Copilot 461a1fb
Merge branch 'add-events' into copilot/sub-pr-160
Jakubk15 2ee7f3d
Implement event firing for custom event classes (#161)
Copilot 63a7d13
Refactor item storage and locker event handling for improved clarity …
Jakubk15 8ad693a
Merge remote-tracking branch 'origin/add-events' into add-events
Jakubk15 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Empty file.
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
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
50 changes: 50 additions & 0 deletions
50
src/main/java/com/eternalcode/parcellockers/itemstorage/event/ItemStorageUpdateEvent.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,50 @@ | ||
| package com.eternalcode.parcellockers.itemstorage.event; | ||
|
|
||
| import com.eternalcode.parcellockers.itemstorage.ItemStorage; | ||
| import org.bukkit.event.Cancellable; | ||
| import org.bukkit.event.Event; | ||
| import org.bukkit.event.HandlerList; | ||
| import org.jetbrains.annotations.NotNull; | ||
|
|
||
| public class ItemStorageUpdateEvent extends Event implements Cancellable { | ||
|
|
||
| private static final HandlerList HANDLER_LIST = new HandlerList(); | ||
|
|
||
| private final ItemStorage oldItemStorage; | ||
| private final ItemStorage updatedItemStorage; | ||
|
|
||
| private boolean cancelled; | ||
|
|
||
| public ItemStorageUpdateEvent(ItemStorage oldItemStorage, ItemStorage updatedItemStorage) { | ||
| super(true); | ||
| this.oldItemStorage = oldItemStorage; | ||
| this.updatedItemStorage = updatedItemStorage; | ||
| } | ||
|
|
||
| public static HandlerList getHandlerList() { | ||
| return HANDLER_LIST; | ||
| } | ||
|
|
||
| public ItemStorage getOldItemStorage() { | ||
| return this.oldItemStorage; | ||
| } | ||
|
|
||
| public ItemStorage getUpdatedItemStorage() { | ||
| return this.updatedItemStorage; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isCancelled() { | ||
| return this.cancelled; | ||
| } | ||
|
|
||
| @Override | ||
| public void setCancelled(boolean cancel) { | ||
| this.cancelled = cancel; | ||
| } | ||
|
|
||
| @Override | ||
| public @NotNull HandlerList getHandlers() { | ||
| return HANDLER_LIST; | ||
| } | ||
| } | ||
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
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
51 changes: 51 additions & 0 deletions
51
src/main/java/com/eternalcode/parcellockers/locker/event/LockerCreateEvent.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,51 @@ | ||
| package com.eternalcode.parcellockers.locker.event; | ||
|
|
||
| import com.eternalcode.parcellockers.locker.Locker; | ||
| import java.util.UUID; | ||
| import org.bukkit.event.Cancellable; | ||
| import org.bukkit.event.Event; | ||
| import org.bukkit.event.HandlerList; | ||
| import org.jetbrains.annotations.NotNull; | ||
|
|
||
| public class LockerCreateEvent extends Event implements Cancellable { | ||
|
|
||
| private static final HandlerList HANDLER_LIST = new HandlerList(); | ||
|
|
||
| private final Locker locker; | ||
| private final UUID player; | ||
| private boolean cancelled; | ||
|
|
||
| public LockerCreateEvent(Locker locker, UUID player) { | ||
| super(true); | ||
| this.locker = locker; | ||
| this.player = player; | ||
| } | ||
|
|
||
| public static HandlerList getHandlerList() { | ||
| return HANDLER_LIST; | ||
| } | ||
|
|
||
| public Locker getLocker() { | ||
| return this.locker; | ||
| } | ||
|
|
||
| public UUID getPlayer() { | ||
| return this.player; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isCancelled() { | ||
| return this.cancelled; | ||
| } | ||
|
|
||
| @Override | ||
| public void setCancelled(boolean cancel) { | ||
| this.cancelled = cancel; | ||
| } | ||
|
|
||
| @Override | ||
| public @NotNull HandlerList getHandlers() { | ||
| return HANDLER_LIST; | ||
| } | ||
|
|
||
| } |
51 changes: 51 additions & 0 deletions
51
src/main/java/com/eternalcode/parcellockers/locker/event/LockerDeleteEvent.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,51 @@ | ||
| package com.eternalcode.parcellockers.locker.event; | ||
|
|
||
| import com.eternalcode.parcellockers.locker.Locker; | ||
| import java.util.UUID; | ||
| import org.bukkit.event.Cancellable; | ||
| import org.bukkit.event.Event; | ||
| import org.bukkit.event.HandlerList; | ||
| import org.jetbrains.annotations.NotNull; | ||
|
|
||
| public class LockerDeleteEvent extends Event implements Cancellable { | ||
|
|
||
| private static final HandlerList HANDLER_LIST = new HandlerList(); | ||
|
|
||
| private final Locker locker; | ||
| private final UUID player; | ||
| private boolean cancelled; | ||
|
|
||
| public LockerDeleteEvent(Locker locker, UUID player) { | ||
| super(true); | ||
| this.locker = locker; | ||
| this.player = player; | ||
| } | ||
|
|
||
| public static HandlerList getHandlerList() { | ||
| return HANDLER_LIST; | ||
| } | ||
|
|
||
| public Locker getLocker() { | ||
| return this.locker; | ||
| } | ||
|
|
||
| public UUID getPlayer() { | ||
| return this.player; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isCancelled() { | ||
| return this.cancelled; | ||
| } | ||
|
|
||
| @Override | ||
| public void setCancelled(boolean cancel) { | ||
| this.cancelled = cancel; | ||
| } | ||
|
|
||
| @Override | ||
| public @NotNull HandlerList getHandlers() { | ||
| return HANDLER_LIST; | ||
| } | ||
|
|
||
| } |
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.