Skip to content

Commit

Permalink
Add Terrainer plugin hook (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisrnj authored Jun 20, 2024
1 parent af83441 commit fe459d1
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,18 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.chrisrnj.Terrainer</groupId>
<artifactId>terrainer-core</artifactId>
<version>9ab2f53d41</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Tests -->
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.github.jikoo.regionerator.hooks;

import com.epicnicity322.terrainer.core.terrain.Terrain;
import com.epicnicity322.terrainer.core.terrain.TerrainManager;
import com.epicnicity322.terrainer.core.terrain.WorldTerrain;
import org.bukkit.World;
import org.jetbrains.annotations.NotNull;

/**
* PluginHook for <a href="https://github.com/chrisrnj/Terrainer">Terrainer</a>.
*/
public class TerrainerHook extends PluginHook {

public TerrainerHook() {
super("Terrainer");
}

@Override
public boolean isChunkProtected(@NotNull World chunkWorld, int chunkX, int chunkZ) {
for (Terrain terrain : TerrainManager.terrainsAtChunk(chunkWorld.getUID(), chunkX, chunkZ)) {
if (!(terrain instanceof WorldTerrain)) return true; // Global world terrain is ignored.
}
return false;
}

@Override
public boolean isAsyncCapable() {
return true;
}

}
1 change: 1 addition & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ hooks:
PreciousStones: true
RedProtect: true
Residence: true
Terrainer: true
Towny: true
WorldGuard: true
VanillaSpawnProtection: true
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ softdepend:
- Multiverse-Core
- RedProtect
- Residence
- Terrainer
- Towny
- WorldGuard

Expand Down

0 comments on commit fe459d1

Please sign in to comment.