-
-
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
base: master
Are you sure you want to change the base?
Changes from all commits
6706c98
f3dc9e6
0d0a30d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| 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) { | ||
| 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; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| 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; | ||
|
|
||
| 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) { | ||
| 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 @org.jetbrains.annotations.NotNull HandlerList getHandlers() { | ||
| return HANDLER_LIST; | ||
| } | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| 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; | ||
|
|
||
| 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) { | ||
| 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 @org.jetbrains.annotations.NotNull HandlerList getHandlers() { | ||
| return HANDLER_LIST; | ||
| } | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| package com.eternalcode.parcellockers.parcel.event; | ||
|
|
||
| import com.eternalcode.parcellockers.parcel.Parcel; | ||
| import org.bukkit.event.Cancellable; | ||
| import org.bukkit.event.Event; | ||
| import org.bukkit.event.HandlerList; | ||
| import org.jspecify.annotations.NonNull; | ||
|
|
||
| public class ParcelCollectEvent extends Event implements Cancellable { | ||
|
|
||
| private static final HandlerList HANDLER_LIST = new HandlerList(); | ||
|
|
||
| private final Parcel parcel; | ||
| private boolean cancelled; | ||
|
|
||
| public ParcelCollectEvent(Parcel parcel) { | ||
| this.parcel = parcel; | ||
| } | ||
|
|
||
| public static HandlerList getHandlerList() { | ||
| return HANDLER_LIST; | ||
| } | ||
|
|
||
| public Parcel getParcel() { | ||
| return this.parcel; | ||
| } | ||
|
|
||
| @Override | ||
| public @NonNull HandlerList getHandlers() { | ||
| return HANDLER_LIST; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isCancelled() { | ||
| return this.cancelled; | ||
| } | ||
|
|
||
| @Override | ||
| public void setCancelled(boolean cancel) { | ||
| this.cancelled = cancel; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| package com.eternalcode.parcellockers.parcel.event; | ||
|
|
||
| import com.eternalcode.parcellockers.parcel.Parcel; | ||
| import org.bukkit.event.Cancellable; | ||
| import org.bukkit.event.Event; | ||
| import org.bukkit.event.HandlerList; | ||
| import org.jspecify.annotations.NonNull; | ||
|
|
||
| public class ParcelDeliverEvent extends Event implements Cancellable { | ||
|
|
||
| private static final HandlerList HANDLER_LIST = new HandlerList(); | ||
|
|
||
| private final Parcel parcel; | ||
| private boolean cancelled; | ||
|
|
||
| public ParcelDeliverEvent(Parcel parcel) { | ||
| super(true); | ||
| this.parcel = parcel; | ||
| } | ||
|
Comment on lines
+16
to
+19
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This event is marked as asynchronous by calling public ParcelDeliverEvent(Parcel parcel) {
this.parcel = parcel;
} |
||
|
|
||
| public static HandlerList getHandlerList() { | ||
| return HANDLER_LIST; | ||
| } | ||
|
|
||
| public Parcel getParcel() { | ||
| return this.parcel; | ||
| } | ||
|
|
||
| @Override | ||
| public @NonNull HandlerList getHandlers() { | ||
| return HANDLER_LIST; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isCancelled() { | ||
| return this.cancelled; | ||
| } | ||
|
|
||
| @Override | ||
| public void setCancelled(boolean cancel) { | ||
| this.cancelled = cancel; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| package com.eternalcode.parcellockers.parcel.event; | ||
|
|
||
| import com.eternalcode.parcellockers.parcel.Parcel; | ||
| import org.bukkit.event.Cancellable; | ||
| import org.bukkit.event.Event; | ||
| import org.bukkit.event.HandlerList; | ||
| import org.jspecify.annotations.NonNull; | ||
|
|
||
| public class ParcelSendEvent extends Event implements Cancellable { | ||
|
|
||
| private static final HandlerList HANDLER_LIST = new HandlerList(); | ||
|
|
||
| private final Parcel parcel; | ||
| private boolean cancelled; | ||
|
|
||
| public ParcelSendEvent(Parcel parcel) { | ||
| this.parcel = parcel; | ||
| } | ||
|
|
||
| public static HandlerList getHandlerList() { | ||
| return HANDLER_LIST; | ||
| } | ||
|
|
||
| public Parcel getParcel() { | ||
| return this.parcel; | ||
| } | ||
|
|
||
| @Override | ||
| public @NonNull HandlerList getHandlers() { | ||
| return HANDLER_LIST; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isCancelled() { | ||
| return this.cancelled; | ||
| } | ||
|
|
||
| @Override | ||
| public void setCancelled(boolean cancel) { | ||
| this.cancelled = cancel; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| package com.eternalcode.parcellockers.user.event; | ||
|
|
||
| import com.eternalcode.parcellockers.user.User; | ||
| import org.bukkit.event.Event; | ||
| import org.bukkit.event.HandlerList; | ||
| import org.jspecify.annotations.NonNull; | ||
|
|
||
| public class UserChangeNameEvent extends Event { | ||
|
|
||
| private static final HandlerList HANDLER_LIST = new HandlerList(); | ||
|
|
||
| private final User user; | ||
| private final String oldName; | ||
|
|
||
| public UserChangeNameEvent(User user, String oldName) { | ||
| this.user = user; | ||
| this.oldName = oldName; | ||
| } | ||
|
|
||
| public static HandlerList getHandlerList() { | ||
| return HANDLER_LIST; | ||
| } | ||
|
|
||
| public User getUser() { | ||
| return this.user; | ||
| } | ||
|
|
||
| public String getOldName() { | ||
| return this.oldName; | ||
| } | ||
|
|
||
| @Override | ||
| public @NonNull HandlerList getHandlers() { | ||
| return HANDLER_LIST; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package com.eternalcode.parcellockers.user.event; | ||
|
|
||
| import com.eternalcode.parcellockers.user.User; | ||
| import org.bukkit.event.Event; | ||
| import org.bukkit.event.HandlerList; | ||
| import org.jspecify.annotations.NonNull; | ||
|
|
||
| public class UserCreateEvent extends Event { | ||
|
|
||
| private static final HandlerList HANDLER_LIST = new HandlerList(); | ||
|
|
||
| private final User user; | ||
|
|
||
| public UserCreateEvent(User user) { | ||
| this.user = user; | ||
| } | ||
|
|
||
| public static HandlerList getHandlerList() { | ||
| return HANDLER_LIST; | ||
| } | ||
|
|
||
| public User getUser() { | ||
| return this.user; | ||
| } | ||
|
|
||
| @Override | ||
| public @NonNull HandlerList getHandlers() { | ||
| return HANDLER_LIST; | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.