https://github.com/dosmike/spongepluginversionchecker
Minimalistinc include for fully automatic version checking agains the sponge ore repository
https://github.com/dosmike/spongepluginversionchecker
Last synced: 3 days ago
JSON representation
Minimalistinc include for fully automatic version checking agains the sponge ore repository
- Host: GitHub
- URL: https://github.com/dosmike/spongepluginversionchecker
- Owner: DosMike
- License: mit
- Created: 2019-08-07T14:28:41.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-12-18T16:15:23.000Z (over 6 years ago)
- Last Synced: 2025-03-01T15:16:12.782Z (over 1 year ago)
- Language: Java
- Size: 66.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SpongePluginVersionChecker
Minimalistinc include for fully automatic version checking agains the sponge ore repository
# How to use
## Add the dependency
To use this with gradle you should be able to just add the following to your **build.gradle**:
```
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '5.1.0'
}
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
shadow 'com.github.DosMike:SpongePluginVersionChecker:master-SNAPSHOT'
}
//from personal experience use this task to build your jar:
task uberJar(type:ShadowJar, group:'_Plugin', dependsOn:removeOldVersions) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
exclude 'META-INF/**'
manifest {
attributes('Implementation-Title': project.name,
'Implementation-Version': project.version)
}
configurations = [project.configurations.shadow]
//relocate the version checker to avoid problems with different versions of versionChecker in different plugins
//conveniently the plugin id supports a limited character set that can be used as package name
relocate('de.dosmike.sponge', 'shadow.dosmike.versionchecker.'+pluginid) {
//don't relocate my actual plugins - yes, includes are paths!
include "de/dosmike/sponge/VersionChecker"
include "de/dosmike/sponge/VersionChecker\$Version"
}
from(sourceSets.main.resources)
from(sourceSets.main.output) //.output would not capture mcmod.info for me
classifier = null
}
//if you want your plugin to be jitpack-able, you'll have to add the shadow jar as artifact:
artifacts {
archives uberJar
...
}
```
## Usage example
Once the dependency is added you just need to call one method.
It's recommended to call this method after all plugins are loaded by Spoge.
This method checks if the specified config allows version checking. If so, it performs version check on the provided executor.
`VersionChecker.conformAuto(instance:Object, configDir:Path, configName:String)`
**instance**: the plugin instance to check for updates, usually `this`
**configDir**: where to search for the configuration (private plugin directory is recommended)
**configName**: the name of the config file, if configDir is the public config dir it's recommended to start the filename with the plugin id
Alternatively you can use
`VersionChecker.setVersionCheckingEnabled(pluginId:String, allowVersionChecking:boolean);`
followed by
`VersionChecker.checkVersion(instance:Object)` or
`VersionChecker.checkPluginVersion(container:PluginContainer)`
**pluginId**: This should be your plugin id
**allowVersionChecking**: `true` if version checking is allowed. *To follow Ore Guidelines, this value may **ONLY** be set true from a config node like `node.getBoolean(false)`*
**instance**: Your plugin instance
**container**: Your plugin container
## Debgging
If the property VerboseVersionChecker is set to true VersionChecker will print additional information to
the console.
# License
MIT licensed, see the LICENSE file.