You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val name = description.name ?:throwInvalidPluginDescriptionException("Plugin name is not set")
38
46
if (!VALID_NAME.matches(name)) throwInvalidPluginDescriptionException("Invalid plugin name: should match $VALID_NAME")
47
+
if (description.apiVersion !=null) {
48
+
val apiVersion = description.apiVersion!!
49
+
val splitVersion = apiVersion.split("\\.").map { v -> v.toInt() }
50
+
if (splitVersion.size ==2) {
51
+
if (!VALID_API_VERSION.matches(apiVersion)) throwInvalidPluginDescriptionException("Invalid api version: should match $VALID_API_VERSION")
52
+
if (apiVersion <"1.13") throwInvalidPluginDescriptionException("Invalid api version: should be at least 1.13")
53
+
} elseif (splitVersion.size ==3) {
54
+
if (splitVersion[1] <20) throwInvalidPluginDescriptionException("Invalid api version: Minor versions are not supported before 1.20.5")
55
+
if (splitVersion[1] ==20&& splitVersion[2] <5) throwInvalidPluginDescriptionException("Invalid api version: Minor versions are not supported before 1.20.5")
56
+
} else {
57
+
throwInvalidPluginDescriptionException("Invalid api version: $VALID_API_VERSION")
58
+
}
59
+
}
39
60
40
61
if (description.version.isNullOrEmpty()) throwInvalidPluginDescriptionException("Plugin version is not set")
41
62
42
63
val main = description.main ?:throwInvalidPluginDescriptionException("Main class is not defined")
43
64
if (main.isEmpty()) throwInvalidPluginDescriptionException("Main class cannot be empty")
44
-
if(main.startsWith("org.bukkit.")) throwInvalidPluginDescriptionException("Main may not be within the org.bukkit namespace")
65
+
validateNamespace(main, "Main")
45
66
46
67
for (command in description.commands) {
47
68
if (command.name.contains(':')) throwInvalidPluginDescriptionException("Command '${command.name}' cannot contain ':'")
@@ -55,4 +76,11 @@ class BukkitPlugin : PlatformPlugin<BukkitPluginDescription>("Bukkit", "plugin.y
0 commit comments