diff --git a/build.gradle.kts b/build.gradle.kts index b90a202be..5e6a17aea 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -25,7 +25,7 @@ var buildNumber = "" var date: String = "" ext { val git: Grgit = Grgit.open { - dir = File(rootDir.toString() + "/.git"); + dir = File("$rootDir/.git"); } ext["date"] = git.head().dateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd")); ext["revision"] = "-${git.head().abbreviatedId}"; @@ -35,7 +35,7 @@ ext { } else { var index = -2109; // Offset to match CI while (parents != null && parents.isNotEmpty()) { - parents = git.getResolve().toCommit(parents.get(0)).getParentIds() + parents = git.resolve.toCommit(parents[0]).parentIds index++; } buildNumber = index.toString(); @@ -50,28 +50,6 @@ allprojects { } } -//def rootVersion = "1.13" -//def revision = "" -//def buildNumber = "" -//def date = "" -//ext { -// git = Grgit.open(dir: new File(rootDir.toString()+"/.git")) -// date = git.head().getDate().format("yy.MM.dd") -// revision = "-${git.head().abbreviatedId}" -// parents = git.head().parentIds; -// if (project.hasProperty("buildnumber")) { -// buildNumber = "$buildnumber" -// } else { -// index = -2109; // Offset to match CI -// for (; parents != null && !parents.isEmpty(); index++) { -// parents = git.getResolve().toCommit(parents.get(0)).getParentIds() -// } -// buildNumber = "${index}" -// } -//} -// -//version = String.format("%s.%s", rootVersion, buildNumber) - version = String.format("%s-%s", rootVersion, buildNumber) if (!project.hasProperty("gitCommitHash")) { diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts index 3dbee6760..83b7e03f6 100644 --- a/worldedit-bukkit/build.gradle.kts +++ b/worldedit-bukkit/build.gradle.kts @@ -16,7 +16,10 @@ repositories { maven { url = uri("http://ci.frostcast.net/plugin/repository/everything") } maven { url = uri("http://dl.bintray.com/tastybento/maven-repo") } maven { url = uri("http://ci.emc.gs/nexus/content/groups/aikar/") } - maven { url = uri("https://jitpack.io") } + maven(fun MavenArtifactRepository.() { + this.name = "JitPack" + this.url = uri("https://jitpack.io") + }) maven { url = uri("https://repo.destroystokyo.com/repository/maven-public//") } maven { url = uri("http://repo.dmulloy2.net/content/groups/public/") } maven { url = uri("https://repo.inventivetalent.org/content/groups/public/")} @@ -30,9 +33,9 @@ configurations.all { } dependencies { - "compile"("net.milkbowl.vault:VaultAPI:1.7") { isTransitive = false } + compile("com.github.MilkBowl:VaultAPI:1.7") { isTransitive = false } "api"(project(":worldedit-core")) - "api"(project(":worldedit-libs:core")) + api(project(":worldedit-libs:core")) "api"(project(":worldedit-libs:bukkit")) "compile"(":worldedit-adapters:") "compile"("org.spigotmcv1_14_r1:spigotmcv1_14_r1:1_14_r1") @@ -48,7 +51,7 @@ dependencies { "compileOnly"("com.sk89q:dummypermscompat:1.10") "implementation"("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1") "testCompile"("org.mockito:mockito-core:1.9.0-rc1") - "compileOnly"("com.sk89q.worldguard:worldguard-bukkit:7.0.1") { + "compileOnly"("com.sk89q.worldguard:worldguard-bukkit:7.0.+") { exclude("com.sk89q.worldedit", "worldedit-bukkit") exclude("com.sk89q.worldedit", "worldedit-core") exclude("com.sk89q.worldedit.worldedit-libs", "bukkit") @@ -56,7 +59,7 @@ dependencies { } "implementation"("org.inventivetalent:mapmanager:1.7.3-SNAPSHOT") { isTransitive = false } - "implementation"("com.github.TechFortress:GriefPrevention:16.12.0") { isTransitive = false } + "implementation"("com.github.TechFortress:GriefPrevention:16.+") { isTransitive = false } "implementation"("com.massivecraft:mcore:7.0.1") { isTransitive = false } "implementation"("com.bekvon.bukkit.residence:Residence:4.5._13.1") { isTransitive = false } "implementation"("com.palmergames.bukkit:towny:0.84.0.9") { isTransitive = false } @@ -93,7 +96,7 @@ tasks.named("shadowJar") { include(dependency("org.apache.logging.log4j:log4j-slf4j-impl")) include(dependency("org.antlr:antlr4-runtime")) relocate("org.bstats", "com.sk89q.worldedit.bukkit.bstats") { - include(dependency("org.bstats:bstats-bukkit:1.5")) + include(dependency("org.bstats:bstats-bukkit:1.7")) } relocate("io.papermc.lib", "com.sk89q.worldedit.bukkit.paperlib") { include(dependency("io.papermc:paperlib:1.0.2")) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index 033775aec..4922ec79a 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -107,7 +107,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter public static final String CUI_PLUGIN_CHANNEL = "worldedit:cui"; private static WorldEditPlugin INSTANCE; ///The BSTATS_ID needs to be modified for FAWE to prevent contaminating WorldEdit stats - private static final int BSTATS_ID = 1403; + private static final int BSTATS_PLUGIN_ID = 1403; private BukkitImplAdapter bukkitAdapter; private BukkitServerInterface server; @@ -230,7 +230,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter } // Enable metrics - new Metrics(this, BSTATS_ID); + new Metrics(this, BSTATS_PLUGIN_ID); PaperLib.suggestPaper(this); } @@ -253,8 +253,8 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter BiomeType biomeType = BiomeType.REGISTRY.register("minecraft:" + lowerCaseBiomeName, new BiomeType("minecraft:" + lowerCaseBiomeName)); if (bukkitAdapter != null) biomeType.setLegacyId(bukkitAdapter.getInternalBiomeId(biomeType)); } - /*// Block & Item - for (Material material : Material.values()) { + // Block & Item + /*for (Material material : Material.values()) { if (material.isBlock() && !material.isLegacy()) { BlockType.REGISTRY.register(material.getKey().toString(), new BlockType(material.getKey().toString(), blockState -> { // TODO Use something way less hacky than this. @@ -466,13 +466,17 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter @Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { - // Add the command to the array because the underlying command handling - // code of WorldEdit expects it - String[] split = new String[args.length + 1]; - System.arraycopy(args, 0, split, 1, args.length); - split[0] = commandLabel; + int plSep = commandLabel.indexOf(":"); + if (plSep >= 0 && plSep < commandLabel.length() + 1) { + commandLabel = commandLabel.substring(plSep + 1); + } - CommandEvent event = new CommandEvent(wrapCommandSender(sender), Joiner.on(" ").join(split)); + StringBuilder sb = new StringBuilder("/").append(commandLabel); + if (args.length > 0) { + sb.append(" "); + } + String arguments = Joiner.on(" ").appendTo(sb, args).toString(); + CommandEvent event = new CommandEvent(wrapCommandSender(sender), arguments); getWorldEdit().getEventBus().post(event); return true; @@ -653,15 +657,24 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter String buffer = event.getBuffer(); int firstSpace = buffer.indexOf(' '); if (firstSpace < 0) return; - String label = buffer.substring(0, firstSpace); + String label = buffer.substring(1, firstSpace); + Plugin owner = server.getDynamicCommands().getCommandOwner(label); + if (owner != WorldEditPlugin.this) { + return; + } + int plSep = label.indexOf(":"); + if (plSep >= 0 && plSep < label.length() + 1) { + label = label.substring(plSep + 1); + buffer = "/" + buffer.substring(plSep + 2); + } final Optional command = WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getCommandManager().getCommand(label); if (!command.isPresent()) return; - CommandSuggestionEvent suggestEvent = new CommandSuggestionEvent(wrapCommandSender(event.getSender()), event.getBuffer()); + CommandSuggestionEvent suggestEvent = new CommandSuggestionEvent(wrapCommandSender(event.getSender()), buffer); getWorldEdit().getEventBus().post(suggestEvent); - event.setCompletions(CommandUtil.fixSuggestions(event.getBuffer(), suggestEvent.getSuggestions())); + event.setCompletions(CommandUtil.fixSuggestions(buffer, suggestEvent.getSuggestions())); event.setHandled(true); } }