Skip to content

Commit

Permalink
Fix version checking; add bStats
Browse files Browse the repository at this point in the history
  • Loading branch information
datatags committed Feb 10, 2024
1 parent c4c2e65 commit 89c3683
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
12 changes: 10 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import org.apache.tools.ant.filters.ReplaceTokens

plugins {
id 'java-library'
id("com.github.johnrengelman.shadow") version "8.1.1"
}

group 'me.datatags'
version '1.1'
version '1.1.1'

repositories {
mavenLocal()
Expand All @@ -25,7 +26,8 @@ repositories {
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT'
// TODO: change this to a tag that works
implementation 'com.github.UltraCosmetics:UltraCosmetics:master-SNAPSHOT'
compileOnly 'com.github.UltraCosmetics:UltraCosmetics:master-SNAPSHOT'
implementation 'org.bstats:bstats-bukkit:3.0.2'
}

processResources {
Expand All @@ -35,3 +37,9 @@ processResources {
'VERSION' : project.version,
]
}

shadowJar {
minimize()
def path = 'me.datatags.ultracosmeticsguiaddon.shaded'
relocate('org.bstats', path + '.bstats')
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,24 @@

import be.isach.ultracosmetics.UltraCosmetics;
import be.isach.ultracosmetics.UltraCosmeticsData;
import org.bstats.bukkit.Metrics;
import org.bukkit.plugin.java.JavaPlugin;

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

0 comments on commit 89c3683

Please sign in to comment.