Fix Towny claim check and depend on the Core

This commit is contained in:
Norbi Peti 2019-08-26 00:59:27 +02:00
parent bb87385d83
commit 4d3838caa7
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
2 changed files with 4 additions and 3 deletions

View file

@ -15,3 +15,4 @@ commands:
description: A set of commands designed for R and D
softdepend: [Factions]
depend: [ButtonCore]

View file

@ -63,13 +63,13 @@ public class TownyFactionsComponent extends Component<ButtonPresents> implements
@EventHandler
public void onTownyClaim(TownPreClaimEvent event) {
PS chunkCoord = PS.valueOf(getLocation(event.getTownBlock().getWorldCoord())).getChunkCoords(true);
PS coord = PS.valueOf(getLocation(event.getTownBlock().getWorldCoord()));
int distance = distance().get();
for (int i = -distance; i <= distance; i++) {
for (int j = -distance; j <= distance; j++) {
if (i * i + j * j <= distance * distance) {
PS chunk = PS.valueOf(chunkCoord.getChunkX() + i, chunkCoord.getChunkZ() + j)
.withWorld(chunkCoord.getWorld()); //TODO: Doesn't have the world for some reason
PS chunk = PS.valueOf(coord.getChunkX(true) + i, coord.getChunkZ(true) + j)
.withWorld(coord.getWorld());
if (!BoardColl.get().getFactionAt(chunk).isNone()) {
event.setCancelled(true);
}