Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
9 changes: 9 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
</properties>

<dependencies>
<dependency>
<groupId>com.github.Zrips</groupId>
<artifactId>Residence</artifactId>
<version>6.0.0.1</version>
<scope>provided</scope>
</dependency>
Comment thread
Jikoo marked this conversation as resolved.
Outdated
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
Expand Down Expand Up @@ -268,6 +274,9 @@
<includes>
<include>*Hook.class</include>
</includes>
<excludes>
<exclude>ResidenceHook.class</exclude>
</excludes>
Comment thread
Jikoo marked this conversation as resolved.
Outdated
<targetPath>com/github/jikoo/regionerator/hooks</targetPath>
</resource>
</resources>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright (c) 2015-2026 by Jikoo.
*
* Regionerator is licensed under a Creative Commons
* Attribution-ShareAlike 4.0 International License.
*
* You should have received a copy of the license along with this
* work. If not, see <http://creativecommons.org/licenses/by-sa/4.0/>.
*/

package com.github.jikoo.regionerator.hooks;

import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.protection.ClaimedResidence;
import com.github.jikoo.regionerator.world.DummyChunk;
import org.bukkit.World;
import org.jetbrains.annotations.NotNull;

import java.util.List;

/**
* PluginHook for <a href="https://www.spigotmc.org/resources/residence.11480/">Residence</a>.
*/
public class ResidenceHook extends PluginHook {

public ResidenceHook() {
super("Residence");
}

@Override
public boolean isChunkProtected(@NotNull World chunkWorld, int chunkX, int chunkZ) {
try {
List<ClaimedResidence> residences = Residence.getInstance().getResidenceManager()
.getByChunk(new DummyChunk(chunkWorld, chunkX, chunkZ));
return residences != null && !residences.isEmpty();
} catch (RuntimeException e) {
// Fail closed. If Residence cannot answer safely, do not delete the chunk.
return true;
}
}

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

}
Binary file removed src/main/precompiled_hooks/ResidenceHook.class
Binary file not shown.