Skip to content

Commit 89c3683

Browse files
committed
Fix version checking; add bStats
1 parent c4c2e65 commit 89c3683

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

build.gradle

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import org.apache.tools.ant.filters.ReplaceTokens
22

33
plugins {
44
id 'java-library'
5+
id("com.github.johnrengelman.shadow") version "8.1.1"
56
}
67

78
group 'me.datatags'
8-
version '1.1'
9+
version '1.1.1'
910

1011
repositories {
1112
mavenLocal()
@@ -25,7 +26,8 @@ repositories {
2526
dependencies {
2627
compileOnly 'org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT'
2728
// TODO: change this to a tag that works
28-
implementation 'com.github.UltraCosmetics:UltraCosmetics:master-SNAPSHOT'
29+
compileOnly 'com.github.UltraCosmetics:UltraCosmetics:master-SNAPSHOT'
30+
implementation 'org.bstats:bstats-bukkit:3.0.2'
2931
}
3032

3133
processResources {
@@ -35,3 +37,9 @@ processResources {
3537
'VERSION' : project.version,
3638
]
3739
}
40+
41+
shadowJar {
42+
minimize()
43+
def path = 'me.datatags.ultracosmeticsguiaddon.shaded'
44+
relocate('org.bstats', path + '.bstats')
45+
}

src/main/java/me/datatags/ultracosmeticsguiaddon/UltraCosmeticsGUIAddon.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,24 @@
22

33
import be.isach.ultracosmetics.UltraCosmetics;
44
import be.isach.ultracosmetics.UltraCosmeticsData;
5+
import org.bstats.bukkit.Metrics;
56
import org.bukkit.plugin.java.JavaPlugin;
67

78
public class UltraCosmeticsGUIAddon extends JavaPlugin {
89
@Override
910
public void onEnable() {
1011
UltraCosmetics ultraCosmetics = UltraCosmeticsData.get().getPlugin();
1112
String version = ultraCosmetics.getDescription().getVersion().split("-")[0];
13+
String minor = version.substring(2);
14+
// If there's more than two components to the version, strip it down to 2 so we can parse it as a number
15+
if (minor.contains(".")) {
16+
version = version.substring(0, 2) + minor.substring(0, minor.indexOf('.'));
17+
}
1218
if (Double.parseDouble(version) < 3.4) {
1319
throw new IllegalStateException("This addon requires UltraCosmetics 3.4 or higher!");
1420
}
1521
// Registers itself in order to avoid assuming the existence of UCAddon at runtime
1622
new GUIAddon(ultraCosmetics, this);
23+
new Metrics(this, 20962);
1724
}
1825
}

0 commit comments

Comments
 (0)