Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Commit

Permalink
Remove unnecessary checks for NonNull variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
Quadragintillion committed Aug 23, 2023
1 parent c38e401 commit c383d43
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 17 deletions.
7 changes: 0 additions & 7 deletions src/main/java/us/teaminceptus/vortexsidebars/Sidebar.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public List<Text> getLines() {
* @param newLine the line to add
*/
public void addLine(@NotNull Text newLine) {
if (newLine == null) throw new IllegalArgumentException("newLine cannot be null");
addLine(newLine, lines.size());
}

Expand All @@ -49,8 +48,6 @@ public void addLine(@NotNull Text newLine) {
* @param index the index (red score on the right)
*/
public void addLine(@NotNull Text newLine, int index) {
if (newLine == null) throw new IllegalArgumentException("newLine cannot be null");

if (lines.contains(newLine)) {
return;
}
Expand Down Expand Up @@ -105,7 +102,6 @@ public void clearLines() {
* @param newTitle what to change the title to (Text)
*/
public void setTitle(@NotNull Text newTitle) {
if (newTitle == null) throw new IllegalArgumentException("newTitle cannot be null");
title = newTitle;
}

Expand Down Expand Up @@ -160,9 +156,6 @@ public Sidebar(@NotNull Plugin plugin, @NotNull Text title) {
* @param lines the lines to display on the sidebar, cannot have duplicates
*/
public Sidebar(@NotNull Plugin plugin, @NotNull Text title, @Nullable List<Text> lines) {
if (plugin == null) throw new IllegalArgumentException("plugin cannot be null");
if (title == null) throw new IllegalArgumentException("title cannot be null");

this.title = title;

assert Bukkit.getScoreboardManager() != null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ public List<String> getTexts() {
* Sets the list of Strings to cycle through when displaying
* @param newTexts the list of Strings to cycle through when displaying
*/
public void setTexts(@Nullable List<String> newTexts) {
texts = new ArrayList<>(newTexts);
}
public void setTexts(@Nullable List<String> newTexts) { texts = new ArrayList<>(newTexts); }

private int delay;

Expand Down Expand Up @@ -79,8 +77,6 @@ public void setIndex(int newIndex) {
*/
public AnimatedText(@NotNull Plugin plugin, @NotNull List<String> texts, int delay) {
super(texts.get(0));

if (plugin == null || texts == null) throw new IllegalArgumentException("plugin and texts cannot be null");

this.texts = texts;
this.delay = delay;
Expand All @@ -105,8 +101,6 @@ public AnimatedText(@NotNull Plugin plugin, @NotNull List<String> texts, int del
this.texts = texts;
this.delay = delay;

if (plugin == null || texts == null) throw new IllegalArgumentException("plugin and texts cannot be null");

new BukkitRunnable() {
@Override
public void run() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public Object getValue() {
* @param function the function to call when the output is requested
*/
public Field(@NotNull Callable<Object> function) {
if (function == null) throw new IllegalArgumentException("function cannot be null");
this.function = function;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public Text getPrefix() {
* @param newPrefix the Text to put before the Field (e.g. "Players: ") when displaying
*/
public void setPrefix(@NotNull Text newPrefix) {
if (newPrefix == null) throw new IllegalArgumentException("newPrefix cannot be null");
prefix = newPrefix;
}

Expand All @@ -33,7 +32,6 @@ public void setPrefix(@NotNull Text newPrefix) {
* @param newSuffix the Text to put after the Field (e.g. "/100") when displaying
*/
public void setSuffix(@NotNull Text newSuffix) {
if (newSuffix == null) throw new IllegalArgumentException("newSuffix cannot be null");
suffix = newSuffix;
}

Expand Down

0 comments on commit c383d43

Please sign in to comment.