From 02c6f11bb9125116d0ff6defdc889af1f23414b8 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Thu, 20 Sep 2018 22:59:42 +1000 Subject: [PATCH] Added bStats --- config/checkstyle/import-control.xml | 2 + worldedit-bukkit/build.gradle | 85 ++++++++++--------- .../worldedit/bukkit/WorldEditPlugin.java | 4 + worldedit-sponge/build.gradle | 8 ++ .../worldedit/sponge/SpongeWorldEdit.java | 4 + 5 files changed, 63 insertions(+), 40 deletions(-) diff --git a/config/checkstyle/import-control.xml b/config/checkstyle/import-control.xml index d620978fd..2fe94d97d 100644 --- a/config/checkstyle/import-control.xml +++ b/config/checkstyle/import-control.xml @@ -38,6 +38,7 @@ + @@ -58,6 +59,7 @@ + diff --git a/worldedit-bukkit/build.gradle b/worldedit-bukkit/build.gradle index 5c1a39cd9..8d9ca0eea 100644 --- a/worldedit-bukkit/build.gradle +++ b/worldedit-bukkit/build.gradle @@ -1,40 +1,45 @@ -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'maven' - -repositories { - maven { url "https://hub.spigotmc.org/nexus/content/groups/public" } -} - -dependencies { - compile project(':worldedit-core') - compile 'com.sk89q:dummypermscompat:1.8' - compile 'org.bukkit:bukkit:1.13-R0.1-SNAPSHOT' // zzz - testCompile 'org.mockito:mockito-core:1.9.0-rc1' -} - -processResources { - from (sourceSets.main.resources.srcDirs) { - expand 'internalVersion': project.internalVersion - include 'plugin.yml' - } - - from (sourceSets.main.resources.srcDirs) { - exclude 'plugin.yml' - } -} - -jar { - manifest { - attributes("Class-Path": "truezip.jar WorldEdit/truezip.jar js.jar WorldEdit/js.jar", - "WorldEdit-Version": version) - } -} - -shadowJar { - dependencies { - include(dependency(':worldedit-core')) - } -} - -build.dependsOn(shadowJar) +apply plugin: 'eclipse' +apply plugin: 'idea' +apply plugin: 'maven' + +repositories { + maven { url "https://hub.spigotmc.org/nexus/content/groups/public" } + maven { url "http://repo.bstats.org/content/repositories/releases/" } +} + +dependencies { + compile project(':worldedit-core') + compile 'com.sk89q:dummypermscompat:1.8' + compile 'org.bukkit:bukkit:1.13-R0.1-SNAPSHOT' // zzz + compile 'org.bstats:bstats-bukkit:1.2' + testCompile 'org.mockito:mockito-core:1.9.0-rc1' +} + +processResources { + from (sourceSets.main.resources.srcDirs) { + expand 'internalVersion': project.internalVersion + include 'plugin.yml' + } + + from (sourceSets.main.resources.srcDirs) { + exclude 'plugin.yml' + } +} + +jar { + manifest { + attributes("Class-Path": "truezip.jar WorldEdit/truezip.jar js.jar WorldEdit/js.jar", + "WorldEdit-Version": version) + } +} + +shadowJar { + dependencies { + include(dependency(':worldedit-core')) + relocate ("org.bstats", "com.sk89q.worldedit.bukkit.bstats") { + include(dependency("org.bstats:bstats-bukkit:1.2")) + } + } +} + +build.dependsOn(shadowJar) 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 324babd4f..c4b017e83 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 @@ -37,6 +37,7 @@ import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extent.inventory.BlockBag; +import org.bstats.bukkit.Metrics; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.TabCompleter; @@ -102,6 +103,9 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { // Forge WorldEdit and there's (probably) not going to be any other // platforms to be worried about... at the current time of writing WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent()); + + // Enable metrics + new Metrics(this); } private void loadConfig() { diff --git a/worldedit-sponge/build.gradle b/worldedit-sponge/build.gradle index d068d4804..ec3da06c1 100644 --- a/worldedit-sponge/build.gradle +++ b/worldedit-sponge/build.gradle @@ -12,9 +12,14 @@ plugins { id 'org.spongepowered.plugin' version '0.8.1' } +repositories { + maven { url "http://repo.bstats.org/content/repositories/releases/" } +} + dependencies { compile project(':worldedit-core') compile 'org.spongepowered:spongeapi:7.0.0-SNAPSHOT' + compile 'org.bstats:bstats-sponge:1.2' testCompile group: 'org.mockito', name: 'mockito-core', version:'1.9.0-rc1' } @@ -37,6 +42,9 @@ jar { shadowJar { dependencies { include(dependency(':worldedit-core')) + relocate ("org.bstats", "com.sk89q.worldedit.sponge.bstats") { + include(dependency("org.bstats:bstats-sponge:1.2")) + } } } diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java index d86e77c7c..ea0d2a36e 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java @@ -34,6 +34,7 @@ import com.sk89q.worldedit.sponge.adapter.SpongeImplAdapter; import com.sk89q.worldedit.sponge.adapter.SpongeImplLoader; import com.sk89q.worldedit.sponge.config.SpongeConfiguration; import com.sk89q.worldedit.world.item.ItemTypes; +import org.bstats.sponge.Metrics; import org.slf4j.Logger; import org.spongepowered.api.Sponge; import org.spongepowered.api.block.BlockSnapshot; @@ -75,6 +76,9 @@ public class SpongeWorldEdit { @Inject private Logger logger; + @Inject + private Metrics metrics; + public static final String MOD_ID = "worldedit"; private SpongePermissionsProvider provider;