diff --git a/acf.iml b/acf.iml
index edbef7c7..5ea36671 100644
--- a/acf.iml
+++ b/acf.iml
@@ -4,7 +4,7 @@
- PAPER
+ BUKKIT
@@ -22,18 +22,13 @@
-
+
-
-
-
-
-
-
-
-
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index e096d88d..d5e6f980 100644
--- a/pom.xml
+++ b/pom.xml
@@ -107,9 +107,9 @@
1.0.3
- com.destroystokyo.paper
- paper-api
- 1.11.2-R0.1-SNAPSHOT
+ org.bukkit
+ bukkit
+ 1.12-pre2-SNAPSHOT
provided
diff --git a/src/main/java/co/aikar/commands/BukkitCommandContexts.java b/src/main/java/co/aikar/commands/BukkitCommandContexts.java
index ca3155e9..72b9a89d 100644
--- a/src/main/java/co/aikar/commands/BukkitCommandContexts.java
+++ b/src/main/java/co/aikar/commands/BukkitCommandContexts.java
@@ -34,6 +34,8 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.PlayerInventory;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -104,5 +106,16 @@ public class BukkitCommandContexts extends CommandContexts {
}
return match;
});
+ Pattern versionPattern = Pattern.compile("\\(MC: (\\d)\\.(\\d+)\\.?.*?\\)");
+ Matcher matcher = versionPattern.matcher(Bukkit.getVersion());
+ if (matcher.find()) {
+ int mcMajorVersion = ACFUtil.parseInt(matcher.toMatchResult().group(1), 0);
+ int mcMinorVersion = ACFUtil.parseInt(matcher.toMatchResult().group(2), 0);
+ ACFLog.info("Minecraft Version: " + mcMajorVersion + "." + mcMinorVersion);
+ if (mcMajorVersion >= 1 && mcMinorVersion >= 12) {
+ BukkitCommandContexts_1_12.register(this);
+ }
+ }
+
}
}
diff --git a/src/main/java/co/aikar/commands/BukkitCommandContexts_1_12.java b/src/main/java/co/aikar/commands/BukkitCommandContexts_1_12.java
new file mode 100644
index 00000000..56ed2927
--- /dev/null
+++ b/src/main/java/co/aikar/commands/BukkitCommandContexts_1_12.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package co.aikar.commands;
+
+import org.bukkit.NamespacedKey;
+
+class BukkitCommandContexts_1_12 {
+ static void register(BukkitCommandContexts contexts) {
+ contexts.registerContext(NamespacedKey.class, c -> {
+ String arg = c.popFirstArg();
+ String[] split = ACFPatterns.COLON.split(arg, 2);
+ if (split.length == 1) {
+ String namespace = c.getFlagValue("namespace", (String) null);
+ if (namespace == null) {
+ return NamespacedKey.minecraft(split[0]);
+ } else {
+ //noinspection deprecation
+ return new NamespacedKey(namespace, split[0]);
+ }
+ } else {
+ //noinspection deprecation
+ return new NamespacedKey(split[0], split[1]);
+ }
+ });
+ }
+}