Skip to content

Commit 8d0e1cf

Browse files
committed
Improve LazyEmbed#invalidArguments(...)
- Removed `#invalidArguments(String, Object...)`, was useless and caused conflict - `#invalidArguments(Object...)` now allows null keys/values
1 parent 37475b2 commit 8d0e1cf

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

src/main/java/xyz/srnyx/lazylibrary/LazyEmbed.java

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -805,26 +805,7 @@ public static LazyEmbed invalidArguments(@NotNull Object... argumentsValues) {
805805
final LazyEmbed embed = new LazyEmbed()
806806
.setColor(Color.RED)
807807
.setTitle("Invalid argument!");
808-
for (int i = 0; i < argumentsValues.length; i += 2) embed.addField(argumentsValues[i].toString(), argumentsValues[i + 1].toString(), true);
809-
return embed;
810-
}
811-
812-
/**
813-
* A pre-built {@link LazyEmbed} for when multiple provided arguments are invalid
814-
*
815-
* @param description the description of the embed
816-
* @param argumentsValues the arguments and values that are invalid (argument1, value1, argument2, value2, ...)
817-
*
818-
* @return the {@link LazyEmbed}
819-
*/
820-
@NotNull
821-
public static LazyEmbed invalidArguments(@NotNull String description, @NotNull Object... argumentsValues) {
822-
if (argumentsValues.length % 2 != 0) throw new IllegalArgumentException("Each argument must have a value!");
823-
final LazyEmbed embed = new LazyEmbed()
824-
.setColor(Color.RED)
825-
.setTitle("Invalid argument!")
826-
.setDescription(description);
827-
for (int i = 0; i < argumentsValues.length; i += 2) embed.addField(argumentsValues[i].toString(), argumentsValues[i + 1].toString(), true);
808+
for (int i = 0; i < argumentsValues.length; i += 2) embed.addField(String.valueOf(argumentsValues[i]), String.valueOf(argumentsValues[i + 1]), true);
828809
return embed;
829810
}
830811
}

0 commit comments

Comments
 (0)