Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/main/java/net/coreprotect/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.Map;
import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
import java.util.regex.Pattern;

import org.bukkit.Bukkit;
import org.bukkit.World;
Expand All @@ -30,6 +31,7 @@ public class Config extends Language {
private static final Map<String, String> DEFAULT_VALUES = new LinkedHashMap<>();
private static final Map<String, Config> CONFIG_BY_WORLD_NAME = new HashMap<>();
private static final String DEFAULT_FILE_HEADER = "# CoreProtect Config";
private static final Pattern NON_DIGIT_PATTERN = Pattern.compile("[^0-9]");
public static final String LINE_SEPARATOR = "\n";

private static final Config GLOBAL = new Config();
Expand Down Expand Up @@ -370,7 +372,7 @@ private int getInt(final String key, final int dfl) {
return dfl;
}

configured = configured.replaceAll("[^0-9]", "");
configured = NON_DIGIT_PATTERN.matcher(configured).replaceAll("");

return configured.isEmpty() ? dfl : Integer.parseInt(configured);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ else if (checkType != null && (checkType.equals(Material.AIR) || checkType.equal
}

if (checkType == Material.LECTERN && blockData != null) {
blockData = blockData.replaceFirst("has_book=true", "has_book=false");
blockData = blockData.replace("has_book=true", "has_book=false");
}
else if (checkType != null && (checkType == Material.PAINTING || BukkitAdapter.ADAPTER.isItemFrame(checkType))) {
blockData = overrideData;
Expand Down