From b9f1015a793ceaa3208a148342557e249f11cadc Mon Sep 17 00:00:00 2001 From: covers1624 Date: Sun, 22 Sep 2024 22:29:14 +0930 Subject: [PATCH] Do nothing when frequency is set with null colours. --- .../enderstorage/api/Frequency.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/java/codechicken/enderstorage/api/Frequency.java b/src/main/java/codechicken/enderstorage/api/Frequency.java index 715e91e..a302b0b 100644 --- a/src/main/java/codechicken/enderstorage/api/Frequency.java +++ b/src/main/java/codechicken/enderstorage/api/Frequency.java @@ -71,18 +71,24 @@ public static Frequency fromString(String left, String middle, String right, UUI return new Frequency(c1, c2, c3, owner, ownerName); } - public Frequency setLeft(EnumColour left) { - this.left = left; + public Frequency setLeft(@Nullable EnumColour left) { + if (left != null) { + this.left = left; + } return this; } - public Frequency setMiddle(EnumColour middle) { - this.middle = middle; + public Frequency setMiddle(@Nullable EnumColour middle) { + if (middle != null) { + this.middle = middle; + } return this; } - public Frequency setRight(EnumColour right) { - this.right = right; + public Frequency setRight(@Nullable EnumColour right) { + if (right != null) { + this.right = right; + } return this; } @@ -102,7 +108,7 @@ public boolean hasOwner() { return owner != null && ownerName != null; } - public Frequency set(EnumColour[] colours) { + public Frequency set(@Nullable EnumColour[] colours) { setLeft(colours[0]); setMiddle(colours[1]); setRight(colours[2]);