Skip to content

Commit

Permalink
Update RedProtect hook for changes in 7.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jikoo committed Jun 30, 2018
1 parent 588fe9a commit 5e84739
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
25 changes: 12 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<groupId>com.github.jikoo</groupId>
<artifactId>regionerator</artifactId>
<name>Regionerator</name>
<version>1.5.1</version>
<version>1.5.2</version>

<dependencies>
<dependency>
Expand Down Expand Up @@ -43,6 +43,17 @@
<version>16.5.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.marcelo-mason</groupId>
<artifactId>PreciousStones</artifactId>
<version>24e3d4bf67</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.FabioZumbi12.RedProtect</groupId>
<artifactId>RedProtect-Spigot</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.wasteofplastic</groupId>
<artifactId>askyblock</artifactId>
Expand Down Expand Up @@ -78,18 +89,6 @@
<scope>system</scope>
<systemPath>${project.basedir}/lib/Towny.jar</systemPath>
</dependency>
<dependency>
<groupId>br.net.fabiozumbi12</groupId>
<artifactId>RedProtect</artifactId>
<version>6.6.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/RedProtect.jar</systemPath>
</dependency>
<dependency>
<groupId>com.github.marcelo-mason</groupId>
<artifactId>PreciousStones</artifactId>
<version>24e3d4bf67</version>
</dependency>
<!-- Premium dependencies -->
<dependency>
<groupId>org.kingdoms</groupId>
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/github/jikoo/regionerator/Regionerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ public void onEnable() {
if (debug(DebugLevel.LOW)) {
debug("Protection hook for " + hookName + " is missing dependencies.");
}
if (debug(DebugLevel.MEDIUM)) {
e.printStackTrace();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.jikoo.regionerator.hooks;

import br.net.fabiozumbi12.RedProtect.RedProtect;
import br.net.fabiozumbi12.RedProtect.Region;
import br.net.fabiozumbi12.RedProtect.Bukkit.RedProtect;
import br.net.fabiozumbi12.RedProtect.Bukkit.Region;

import com.github.jikoo.regionerator.CoordinateConversions;
import com.github.jikoo.regionerator.PluginHook;
Expand All @@ -10,7 +10,7 @@

/**
* PluginHook for the plugin <a href=https://www.spigotmc.org/resources/redprotect.15841/>RedProtect</a>.
*
*
* @author Jikoo
*/
public class RedProtectHook extends PluginHook {
Expand All @@ -24,12 +24,12 @@ public boolean isChunkProtected(World chunkWorld, int chunkX, int chunkZ) {
/*
* RedProtectAPI is somewhat lacking. Also, it contains a typo. While I'd bet it's pretty
* efficient and good, the code style is utterly horrifying.
*
*
* API-only solution:
* return RedProtectAPI.getChunkRegions(new DummyChunk(chunkWorld, chunkX, chunkZ)).size() > 0;
* However, that method is new in 6.6.0, and I can perform the needed checks faster avoiding it.
*/
for (Region region : RedProtect.rm.getRegionsByWorld(chunkWorld)) {
for (Region region : RedProtect.get().rm.getRegionsByWorld(chunkWorld)) {
if (CoordinateConversions.blockToChunk(region.getMinMbrX()) > chunkX
|| CoordinateConversions.blockToChunk(region.getMaxMbrX()) < chunkX
|| CoordinateConversions.blockToChunk(region.getMinMbrZ()) > chunkZ
Expand Down

0 comments on commit 5e84739

Please sign in to comment.