-
-
Notifications
You must be signed in to change notification settings - Fork 1
Getting Started
TehBrian edited this page Feb 10, 2021
·
16 revisions
RestrictionHelper is published on Maven Central.
Replace [latest version] with the version found above.
For Maven:
<dependency>
<groupId>xyz.tehbrian</groupId>
<artifactId>restrictionhelper</artifactId>
<version>[latest version]</version>
<scope>provided</scope>
</dependency>For Gradle:
repositories {
mavenCentral()
}
dependencies {
compile 'xyz.tehbrian:restrictionhelper:[latest version]'
}Replace [your plugin package] with your plugin's package.
For Maven:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<configuration>
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml
</dependencyReducedPomLocation>
<relocations>
<relocation>
<pattern>xyz.tehbrian.restrictionhelper</pattern>
<shadedPattern>[your plugin package].restrictionhelper</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>For Gradle, using shadow:
plugins {
id 'com.github.johnrengelman.shadow' version '6.1.0'
}
shadowJar {
relocate 'xyz.tehbrian.restrictionhelper', '[your plugin package].restrictionhelper'
}To get an instance of RestrictionHelper, simply instantiate a new instance with
new and pass in your plugin's logger as the constructor's argument.
class MyPlugin extends JavaPlugin {
private RestrictionHelper restrictionHelper;
public void onEnable() {
this.restrictionHelper = new RestrictionHelper(this.getLogger());
}
public RestrictionHelper getRestrictionHelper() {
return restrictionHelper;
}
}In the future, this may be done automatically for you by RestrictionHelper, but for now, your plugin must do it manually.
All you need to do is check if a specific plugin is