mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-05 22:52:13 -07:00
Finish converting all events to jspecify annotations
This commit is contained in:
@@ -19,23 +19,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Fired when a player receives an item cooldown.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class PlayerItemCooldownEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull
|
||||
+ private final Material type;
|
||||
+ private int cooldown;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerItemCooldownEvent(@NotNull Player player, @NotNull Material type, int cooldown) {
|
||||
+ public PlayerItemCooldownEvent(final Player player, final Material type, final int cooldown) {
|
||||
+ super(player);
|
||||
+ this.type = type;
|
||||
+ this.cooldown = cooldown;
|
||||
@@ -46,7 +46,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ *
|
||||
+ * @return material affected by the cooldown
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Material getType() {
|
||||
+ return this.type;
|
||||
+ }
|
||||
@@ -66,7 +65,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ *
|
||||
+ * @param cooldown cooldown in ticks, has to be a positive number
|
||||
+ */
|
||||
+ public void setCooldown(int cooldown) {
|
||||
+ public void setCooldown(final int cooldown) {
|
||||
+ Preconditions.checkArgument(cooldown >= 0, "The cooldown has to be equal to or greater than 0!");
|
||||
+ this.cooldown = cooldown;
|
||||
+ }
|
||||
@@ -77,17 +76,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
|
Reference in New Issue
Block a user