Updates README, and allows the un-setting of kill plane and obstacle blocks

This commit is contained in:
2024-05-16 15:34:53 +02:00
parent 901b052b25
commit f09dcbe7ff
3 changed files with 35 additions and 25 deletions

View File

@@ -485,8 +485,8 @@ public class ParkourArena implements Arena {
*
* @param killPlaneBlockNames <p>The names of the blocks that will cause players to lose</p>
*/
public boolean setKillPlaneBlocks(@NotNull Set<String> killPlaneBlockNames) {
if (killPlaneBlockNames.isEmpty()) {
public boolean setKillPlaneBlocks(@Nullable Set<String> killPlaneBlockNames) {
if (killPlaneBlockNames == null || killPlaneBlockNames.isEmpty()) {
this.killPlaneBlockNames = null;
this.killPlaneBlocks = null;
} else {
@@ -507,8 +507,8 @@ public class ParkourArena implements Arena {
*
* @param obstacleBlockNames <p>The names of the obstacle blocks</p>
*/
public boolean setObstacleBlocks(@NotNull Set<String> obstacleBlockNames) {
if (obstacleBlockNames.isEmpty()) {
public boolean setObstacleBlocks(@Nullable Set<String> obstacleBlockNames) {
if (obstacleBlockNames == null || obstacleBlockNames.isEmpty()) {
this.obstacleBlockNames = null;
this.obstacleBlocks = null;
} else {

View File

@@ -1,11 +1,13 @@
package net.knarcraft.minigames.command;
import net.knarcraft.minigames.config.DropperConfiguration;
import net.knarcraft.minigames.util.InputValidationHelper;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.command.CommandExecutor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.HashSet;
import java.util.List;
@@ -120,9 +122,13 @@ public abstract class EditArenaCommand implements CommandExecutor {
* @param input <p>The input string to get as a set</p>
* @return <p>The resulting string set</p>
*/
@NotNull
@Nullable
protected Set<String> asSet(@NotNull String input) {
return new HashSet<>(List.of(input.split(",")));
if (InputValidationHelper.isEmptyValue(input)) {
return null;
} else {
return new HashSet<>(List.of(input.split(",")));
}
}
}