From bdf8a1bcc19885f9491f47f63ad569c5e4a4544b Mon Sep 17 00:00:00 2001 From: Sxtanna Date: Tue, 21 Jul 2020 11:56:57 -0400 Subject: [PATCH] reformatted event classes, added nullability annotations, made classes final. --- .../events/ExpansionRegisterEvent.java | 69 ++++++++++++------- .../events/ExpansionUnregisterEvent.java | 49 ++++++++----- .../events/PlaceholderHookUnloadEvent.java | 64 +++++++++++------ 3 files changed, 120 insertions(+), 62 deletions(-) diff --git a/src/main/java/me/clip/placeholderapi/events/ExpansionRegisterEvent.java b/src/main/java/me/clip/placeholderapi/events/ExpansionRegisterEvent.java index f589074..86117cf 100644 --- a/src/main/java/me/clip/placeholderapi/events/ExpansionRegisterEvent.java +++ b/src/main/java/me/clip/placeholderapi/events/ExpansionRegisterEvent.java @@ -24,38 +24,57 @@ import me.clip.placeholderapi.expansion.PlaceholderExpansion; import org.bukkit.event.Cancellable; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; -public class ExpansionRegisterEvent extends Event implements Cancellable { +public final class ExpansionRegisterEvent extends Event implements Cancellable +{ - private static final HandlerList HANDLERS = new HandlerList(); - private final PlaceholderExpansion expansion; - private boolean isCancelled; + @NotNull + private static final HandlerList HANDLERS = new HandlerList(); - public ExpansionRegisterEvent(PlaceholderExpansion expansion) { - this.expansion = expansion; - } + private boolean cancelled; + @NotNull + private final PlaceholderExpansion expansion; - public static HandlerList getHandlerList() { - return HANDLERS; - } + public ExpansionRegisterEvent(@NotNull final PlaceholderExpansion expansion) + { + this.expansion = expansion; + } - @Override - public HandlerList getHandlers() { - return HANDLERS; - } - public PlaceholderExpansion getExpansion() { - return expansion; - } + @NotNull + public PlaceholderExpansion getExpansion() + { + return expansion; + } - @Override - public boolean isCancelled() { - return isCancelled; - } - @Override - public void setCancelled(boolean b) { - this.isCancelled = b; - } + @Override + public boolean isCancelled() + { + return cancelled; + } + + @Override + public void setCancelled(boolean cancelled) + { + this.cancelled = cancelled; + } + + + @NotNull + @Override + public HandlerList getHandlers() + { + return HANDLERS; + } + + + @NotNull + public static HandlerList getHandlerList() + { + return HANDLERS; + } + } diff --git a/src/main/java/me/clip/placeholderapi/events/ExpansionUnregisterEvent.java b/src/main/java/me/clip/placeholderapi/events/ExpansionUnregisterEvent.java index 5db1bb8..296bd50 100644 --- a/src/main/java/me/clip/placeholderapi/events/ExpansionUnregisterEvent.java +++ b/src/main/java/me/clip/placeholderapi/events/ExpansionUnregisterEvent.java @@ -23,26 +23,43 @@ package me.clip.placeholderapi.events; import me.clip.placeholderapi.expansion.PlaceholderExpansion; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; -public class ExpansionUnregisterEvent extends Event { +public final class ExpansionUnregisterEvent extends Event +{ - private static final HandlerList HANDLERS = new HandlerList(); - private final PlaceholderExpansion expansion; + @NotNull + private static final HandlerList HANDLERS = new HandlerList(); - public ExpansionUnregisterEvent(PlaceholderExpansion expansion) { - this.expansion = expansion; - } - public static HandlerList getHandlerList() { - return HANDLERS; - } + @NotNull + private final PlaceholderExpansion expansion; - @Override - public HandlerList getHandlers() { - return HANDLERS; - } + public ExpansionUnregisterEvent(@NotNull final PlaceholderExpansion expansion) + { + this.expansion = expansion; + } + + + @NotNull + public PlaceholderExpansion getExpansion() + { + return expansion; + } + + + @NotNull + @Override + public HandlerList getHandlers() + { + return HANDLERS; + } + + + @NotNull + public static HandlerList getHandlerList() + { + return HANDLERS; + } - public PlaceholderExpansion getExpansion() { - return expansion; - } } diff --git a/src/main/java/me/clip/placeholderapi/events/PlaceholderHookUnloadEvent.java b/src/main/java/me/clip/placeholderapi/events/PlaceholderHookUnloadEvent.java index 307a103..00974b2 100644 --- a/src/main/java/me/clip/placeholderapi/events/PlaceholderHookUnloadEvent.java +++ b/src/main/java/me/clip/placeholderapi/events/PlaceholderHookUnloadEvent.java @@ -23,33 +23,55 @@ package me.clip.placeholderapi.events; import me.clip.placeholderapi.PlaceholderHook; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; +/** + * @deprecated This event is no longer used. + */ @Deprecated -public class PlaceholderHookUnloadEvent extends Event { +public final class PlaceholderHookUnloadEvent extends Event +{ - private static final HandlerList HANDLERS = new HandlerList(); - private final String plugin; - private final PlaceholderHook hook; + @NotNull + private static final HandlerList HANDLERS = new HandlerList(); - public PlaceholderHookUnloadEvent(String plugin, PlaceholderHook placeholderHook) { - this.plugin = plugin; - this.hook = placeholderHook; - } - public static HandlerList getHandlerList() { - return HANDLERS; - } + @NotNull + private final String plugin; + @NotNull + private final PlaceholderHook placeholderHook; - @Override - public HandlerList getHandlers() { - return HANDLERS; - } + public PlaceholderHookUnloadEvent(@NotNull final String plugin, @NotNull final PlaceholderHook placeholderHook) + { + this.plugin = plugin; + this.placeholderHook = placeholderHook; + } - public String getHookName() { - return plugin; - } + @NotNull + public String getHookName() + { + return plugin; + } + + @NotNull + public PlaceholderHook getHook() + { + return placeholderHook; + } + + + @NotNull + @Override + public HandlerList getHandlers() + { + return HANDLERS; + } + + + @NotNull + public static HandlerList getHandlerList() + { + return HANDLERS; + } - public PlaceholderHook getHook() { - return hook; - } }