Skip to content

Integrating other plugins with CreeperHeal2

Peter DeVita edited this page Nov 14, 2024 · 4 revisions

This is a small guide to setting up and adding CreeperHeal2 to your build dependencies. The guide uses Maven as I unfortunately do not have much experience with Gradle.

Setup

Since CreeperHeal2's package is hosted on GitHub packages, there is a bit of setup required to build against it. CreeperHeal2's project is also an example of these setup steps if you need help.

In your project:

  1. Add a .mvn folder with a file called maven.config that contains the following
-ssettings.xml
  1. Add a file called settings.xml that contains the following
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">

    <servers>
        <server>
            <id>creeperheal2</id>
            <username>jcansdale-robot</username>
            <!-- Public token with `read:packages` scope -->
            <password>&#50;&#57;&#100;&#55;&#50;&#97;&#49;&#98;&#53;&#54;&#50;&#55;&#48;&#101;&#54;&#97;&#99;&#101;&#53;&#51;&#49;&#55;&#102;&#102;&#49;&#98;&#52;&#52;&#52;&#50;&#97;&#54;&#99;&#51;&#99;&#101;&#100;&#57;&#101;&#100;</password>
        </server>
    </servers>
</settings>
  1. Add to your pom.xml
<repositories>
        ...
        <repository>
            <id>creeperheal2</id>
            <name>CreeperHeal2</name>
            <url>https://maven.pkg.github.com/pmdevita/CreeperHeal2url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        ...
</repositories>
...
<dependencies>
        ...
        <dependency>
            <groupId>net.countercraft</groupId>
            <artifactId>movecraft</artifactId>
            <version>8.0.0_beta-5</version>
            <scope>provided</scope>
        </dependency>
        ...
</dependencies>

This has to be done because GitHub packages requires a login to access even public packages. Kind of annoying but it works once its set up.

What is there to integrate with?

First off, there is automated docs for CreeperHeal2's API, both in Javadocs or Dokka depending on if you are using Java or Kotlin respectively.

Javadocs
Dokka

The API pages are still a mess so this is a brief walkthrough of useful utilities within it.

Before you do anything, you'll need a reference to the main CreeperHeal2 plugin object

Bukkit.getPluginManager().getPlugin("CreeperHeal2");

Events

CHExplosionEvent

An event fired when CreeperHeal2 is about to save an explosion's blocks. Useful for masking out blocks, making sure CreeperHeal ignores them.

It's generally best to mask out blocks you don't want CreeperHeal2 and other plugins to touch by listening to explosion events with a priority of NORMAL, LOW, or LOWEST, but if you're specifically trying to stop CreeperHeal2 from touching certain blocks, this event is for you.

Manager

The explosion manager can be obtained by calling CreeperHeal2.getManager()

Clone this wiki locally