Add some NotNull annotations

This commit is contained in:
NichtStudioCode 2023-03-20 14:05:54 +01:00
parent 13bef06660
commit 290f9b6ee9
2 changed files with 19 additions and 18 deletions

@ -321,7 +321,7 @@ public abstract class AbstractWindow implements Window, GuiParent {
} }
@Override @Override
public void setOpenHandlers(@NotNull List<@NotNull Runnable> openHandlers) { public void setOpenHandlers(@Nullable List<@NotNull Runnable> openHandlers) {
this.openHandlers = openHandlers; this.openHandlers = openHandlers;
} }
@ -334,7 +334,7 @@ public abstract class AbstractWindow implements Window, GuiParent {
} }
@Override @Override
public void setCloseHandlers(@NotNull List<@NotNull Runnable> closeHandlers) { public void setCloseHandlers(@Nullable List<@NotNull Runnable> closeHandlers) {
this.closeHandlers = closeHandlers; this.closeHandlers = closeHandlers;
} }
@ -353,7 +353,7 @@ public abstract class AbstractWindow implements Window, GuiParent {
} }
@Override @Override
public void setOutsideClickHandlers(@NotNull List<@NotNull Consumer<@NotNull InventoryClickEvent>> outsideClickHandlers) { public void setOutsideClickHandlers(@Nullable List<@NotNull Consumer<@NotNull InventoryClickEvent>> outsideClickHandlers) {
this.outsideClickHandlers = outsideClickHandlers; this.outsideClickHandlers = outsideClickHandlers;
} }
@ -477,13 +477,13 @@ public abstract class AbstractWindow implements Window, GuiParent {
} }
@Override @Override
public @NotNull S setOpenHandlers(List<Runnable> openHandlers) { public @NotNull S setOpenHandlers(@Nullable List<@NotNull Runnable> openHandlers) {
this.openHandlers = openHandlers; this.openHandlers = openHandlers;
return (S) this; return (S) this;
} }
@Override @Override
public @NotNull S addOpenHandler(Runnable openHandler) { public @NotNull S addOpenHandler(@NotNull Runnable openHandler) {
if (openHandlers == null) if (openHandlers == null)
openHandlers = new ArrayList<>(); openHandlers = new ArrayList<>();
@ -492,13 +492,13 @@ public abstract class AbstractWindow implements Window, GuiParent {
} }
@Override @Override
public @NotNull S setCloseHandlers(List<Runnable> closeHandlers) { public @NotNull S setCloseHandlers(@Nullable List<@NotNull Runnable> closeHandlers) {
this.closeHandlers = closeHandlers; this.closeHandlers = closeHandlers;
return (S) this; return (S) this;
} }
@Override @Override
public @NotNull S addCloseHandler(Runnable closeHandler) { public @NotNull S addCloseHandler(@NotNull Runnable closeHandler) {
if (closeHandlers == null) if (closeHandlers == null)
closeHandlers = new ArrayList<>(); closeHandlers = new ArrayList<>();
@ -522,13 +522,13 @@ public abstract class AbstractWindow implements Window, GuiParent {
} }
@Override @Override
public @NotNull S setModifiers(List<Consumer<Window>> modifiers) { public @NotNull S setModifiers(@Nullable List<@NotNull Consumer<@NotNull Window>> modifiers) {
this.modifiers = modifiers; this.modifiers = modifiers;
return (S) this; return (S) this;
} }
@Override @Override
public @NotNull S addModifier(Consumer<Window> modifier) { public @NotNull S addModifier(@NotNull Consumer<@NotNull Window> modifier) {
if (modifiers == null) if (modifiers == null)
modifiers = new ArrayList<>(); modifiers = new ArrayList<>();

@ -167,7 +167,7 @@ public interface Window {
* *
* @param openHandlers The new open handlers * @param openHandlers The new open handlers
*/ */
void setOpenHandlers(@NotNull List<@NotNull Runnable> openHandlers); void setOpenHandlers(@Nullable List<@NotNull Runnable> openHandlers);
/** /**
* Adds an open handler that will be called when this window gets opened. * Adds an open handler that will be called when this window gets opened.
@ -181,7 +181,7 @@ public interface Window {
* *
* @param closeHandlers The new close handlers * @param closeHandlers The new close handlers
*/ */
void setCloseHandlers(@NotNull List<@NotNull Runnable> closeHandlers); void setCloseHandlers(@Nullable List<@NotNull Runnable> closeHandlers);
/** /**
* Adds a close handler that will be called when this window gets closed. * Adds a close handler that will be called when this window gets closed.
@ -199,9 +199,10 @@ public interface Window {
/** /**
* Replaces the currently registered outside click handlers with the given list. * Replaces the currently registered outside click handlers with the given list.
*
* @param outsideClickHandlers The new outside click handlers * @param outsideClickHandlers The new outside click handlers
*/ */
void setOutsideClickHandlers(@NotNull List<@NotNull Consumer<@NotNull InventoryClickEvent>> outsideClickHandlers); void setOutsideClickHandlers(@Nullable List<@NotNull Consumer<@NotNull InventoryClickEvent>> outsideClickHandlers);
/** /**
* Adds an outside click handler that will be called when a player clicks outside the inventory. * Adds an outside click handler that will be called when a player clicks outside the inventory.
@ -277,7 +278,7 @@ public interface Window {
* @return This {@link Builder Window Builder} * @return This {@link Builder Window Builder}
*/ */
@Contract("_ -> this") @Contract("_ -> this")
@NotNull S setOpenHandlers(List<Runnable> openHandlers); @NotNull S setOpenHandlers(@Nullable List<@NotNull Runnable> openHandlers);
/** /**
* Adds an open handler to the {@link Window}. * Adds an open handler to the {@link Window}.
@ -286,7 +287,7 @@ public interface Window {
* @return This {@link Builder Window Builder} * @return This {@link Builder Window Builder}
*/ */
@Contract("_ -> this") @Contract("_ -> this")
@NotNull S addOpenHandler(Runnable openHandler); @NotNull S addOpenHandler(@NotNull Runnable openHandler);
/** /**
* Sets the close handlers of the {@link Window}. * Sets the close handlers of the {@link Window}.
@ -295,7 +296,7 @@ public interface Window {
* @return This {@link Builder Window Builder} * @return This {@link Builder Window Builder}
*/ */
@Contract("_ -> this") @Contract("_ -> this")
@NotNull S setCloseHandlers(List<Runnable> closeHandlers); @NotNull S setCloseHandlers(@Nullable List<@NotNull Runnable> closeHandlers);
/** /**
* Adds a close handler to the {@link Window}. * Adds a close handler to the {@link Window}.
@ -304,7 +305,7 @@ public interface Window {
* @return This {@link Builder Window Builder} * @return This {@link Builder Window Builder}
*/ */
@Contract("_ -> this") @Contract("_ -> this")
@NotNull S addCloseHandler(Runnable closeHandler); @NotNull S addCloseHandler(@NotNull Runnable closeHandler);
/** /**
* Sets the outside click handlers of the {@link Window}. * Sets the outside click handlers of the {@link Window}.
@ -331,7 +332,7 @@ public interface Window {
* @return This {@link Builder Window Builder} * @return This {@link Builder Window Builder}
*/ */
@Contract("_ -> this") @Contract("_ -> this")
@NotNull S setModifiers(List<Consumer<Window>> modifiers); @NotNull S setModifiers(@Nullable List<@NotNull Consumer<@NotNull Window>> modifiers);
/** /**
* Adds a modifier to the {@link Window}. * Adds a modifier to the {@link Window}.
@ -340,7 +341,7 @@ public interface Window {
* @return This {@link Builder Window Builder} * @return This {@link Builder Window Builder}
*/ */
@Contract("_ -> this") @Contract("_ -> this")
@NotNull S addModifier(Consumer<Window> modifier); @NotNull S addModifier(@NotNull Consumer<@NotNull Window> modifier);
/** /**
* Builds the {@link Window}. * Builds the {@link Window}.