Resource Spigot API extension zLib

Discussion in 'Spigot Plugin Development' started by uksspy, Apr 26, 2017.

  1. DISCLAIMER: I am not affiliated with this resource in any capacity. I personally found it very useful and have not seen in mentioned on Spigot before. My goal is to give the creators of this API the recognition they deserve.
    Github: https://github.com/zDevelopers/zLib
    Java Docs: https://jenkins.carrade.eu/job/zLib/javadoc/

    Setup Tutorial (Found on their GitHub)
    If you are using Maven to build your plugin, follow these simple steps. Other builds methods are not supported (but you can use them of course).
    Currently, the zLib requires Java 7 or later and Bukkit 1.8.3 or later.


    1. Add our Maven repository to your pom.xml file.
      Code (Text):
      <repository>
              <id>zDevelopers</id>
              <url>http://maven.carrade.eu/artifactory/snapshots</url>
          </repository>
    2. Add zLib as a dependency.
      Code (Text):
          <dependency>
              <groupId>fr.zcraft</groupId>
              <artifactId>zlib</artifactId>
              <version>0.99-SNAPSHOT</version>
          </dependency>
    3. Add the shading plugin to the build. Replace YOUR.OWN.PACKAGE with your own package.
      Code (Text):
           <build>
               ...
               <plugins>
                   ...
                   <plugin>
                       <groupId>org.apache.maven.plugins</groupId>
                       <artifactId>maven-shade-plugin</artifactId>
                       <version>2.3</version>
                       <configuration>
                           <artifactSet>
                               <includes>
                                   <include>fr.zcraft:zlib</include>
                               </includes>
                           </artifactSet>
                           <relocations>
                               <relocation>
                                   <pattern>fr.zcraft.zlib</pattern>
                                   <shadedPattern>YOUR.OWN.PACKAGE</shadedPattern>
                               </relocation>
                           </relocations>
                       </configuration>
                       <executions>
                           <execution>
                               <phase>package</phase>
                               <goals>
                                   <goal>shade</goal>
                               </goals>
                           </execution>
                       </executions>
                   </plugin>
                   ...
               </plugins>
               ...
           </build>
    4. Build your project as usual, as example with the following command from your working directory, or using an integrated tool from your IDE.
      Code (Text):
      mvn clean install
    5. You should also update your code so your main class extends ZPlugin instead of JavaPlugin. No other changes are required. This will allow you to use directly some useful methods to load your plugin's components.

     
    • Informative Informative x 1