Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Terrainer plugin hook #253

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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