Merge branch 'develop' of https://github.com/BentoBoxWorld/BentoBox.git into develop

This commit is contained in:
tastybento 2021-02-15 15:50:45 -08:00
commit 69b40ee141

View File

@ -17,6 +17,7 @@ import org.bukkit.plugin.InvalidDescriptionException;
import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.exceptions.InvalidAddonDescriptionException; import world.bentobox.bentobox.api.addons.exceptions.InvalidAddonDescriptionException;
import world.bentobox.bentobox.api.addons.exceptions.InvalidAddonFormatException; import world.bentobox.bentobox.api.addons.exceptions.InvalidAddonFormatException;
import world.bentobox.bentobox.api.addons.exceptions.InvalidAddonInheritException; import world.bentobox.bentobox.api.addons.exceptions.InvalidAddonInheritException;
@ -95,9 +96,12 @@ public class AddonClassLoader extends URLClassLoader {
String apiVersion = data.getString("api-version"); String apiVersion = data.getString("api-version");
if (apiVersion != null) { if (apiVersion != null) {
if (!apiVersion.matches("^(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)$")) { if (!apiVersion.replace("-SNAPSHOT", "").matches("^(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)$")) {
throw new InvalidAddonDescriptionException("Provided API version '" + apiVersion + "' is not valid. It must only contain digits and dots and not end with a dot."); throw new InvalidAddonDescriptionException("Provided API version '" + apiVersion + "' is not valid. It must only contain digits and dots and not end with a dot.");
} }
if (apiVersion.contains("-SNAPSHOT")) {
BentoBox.getInstance().logWarning(data.getString("name") + " addon depends on development version of BentoBox plugin. Some functions may be not implemented.");
}
builder.apiVersion(apiVersion); builder.apiVersion(apiVersion);
} }
// Set permissions // Set permissions
@ -162,5 +166,4 @@ public class AddonClassLoader extends URLClassLoader {
public Set<String> getClasses() { public Set<String> getClasses() {
return classes.keySet(); return classes.keySet();
} }
} }