[ci skip] Cleanup events (#10202)

This commit is contained in:
Lulu13022002
2024-02-01 10:15:57 +01:00
parent d676979ea0
commit f7e469eb2e
187 changed files with 2415 additions and 2258 deletions

View File

@@ -26,21 +26,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Called when a player sets the effect for a beacon
+ */
+public class PlayerChangeBeaconEffectEvent extends PlayerEvent implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ private final Block beacon;
+ private PotionEffectType primary;
+ private PotionEffectType secondary;
+ private final Block beacon;
+ private boolean consumeItem = true;
+
+ private boolean isCancelled;
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public PlayerChangeBeaconEffectEvent(@NotNull Player player, @Nullable PotionEffectType primary, @Nullable PotionEffectType secondary, @NotNull Block beacon) {
+ super(player);
+ this.primary = primary;
+ this.secondary = secondary;
+ this.isCancelled = false;
+ this.beacon = beacon;
+ }
+
@@ -48,7 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @return the primary effect
+ */
+ @Nullable public PotionEffectType getPrimary() {
+ return primary;
+ return this.primary;
+ }
+
+ /**
@@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @return the secondary effect
+ */
+ @Nullable public PotionEffectType getSecondary() {
+ return secondary;
+ return this.secondary;
+ }
+
+ /**
@@ -86,7 +86,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ @NotNull
+ public Block getBeacon() {
+ return beacon;
+ return this.beacon;
+ }
+
+ /**
@@ -95,10 +95,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Independent of {@link #isCancelled()}. If the event is cancelled
+ * the item will <b>NOT</b> be consumed.
+ *
+ * @return true if item will be consumed
+ * @return {@code true} if item will be consumed
+ */
+ public boolean willConsumeItem() {
+ return consumeItem;
+ return this.consumeItem;
+ }
+
+ /**
@@ -107,40 +107,34 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Independent of {@link #isCancelled()}. If the event is cancelled
+ * the item will <b>NOT</b> be consumed.
+ *
+ * @param consumeItem true if item should be consumed
+ * @param consumeItem {@code true} if item should be consumed
+ */
+ public void setConsumeItem(boolean consumeItem) {
+ this.consumeItem = consumeItem;
+ }
+
+ /**
+ * Gets the cancellation state of this event. A cancelled event will not
+ * be executed in the server, but will still pass to other plugins
+ * {@inheritDoc}
+ * <p>
+ * If a {@link PlayerChangeBeaconEffectEvent} is cancelled, the changes will
+ * not take effect
+ *
+ * @return true if this event is cancelled
+ */
+ @Override
+ public boolean isCancelled() {
+ return this.isCancelled;
+ return this.cancelled;
+ }
+
+ /**
+ * Sets the cancellation state of this event. A cancelled event will not
+ * be executed in the server, but will still pass to other plugins
+ * {@inheritDoc}
+ * <p>
+ * If cancelled, the item will <b>NOT</b> be consumed regardless of what {@link #willConsumeItem()} says
+ * <p>
+ * If a {@link PlayerChangeBeaconEffectEvent} is cancelled, the changes will not be applied
+ * or saved.
+ *
+ * @param cancel true if you wish to cancel this event
+ */
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.isCancelled = cancel;
+ this.cancelled = cancel;
+ }
+
+ @Override