Fix Towny claim check and depend on the Core
This commit is contained in:
parent
bb87385d83
commit
4d3838caa7
2 changed files with 4 additions and 3 deletions
|
@ -15,3 +15,4 @@ commands:
|
||||||
description: A set of commands designed for R and D
|
description: A set of commands designed for R and D
|
||||||
|
|
||||||
softdepend: [Factions]
|
softdepend: [Factions]
|
||||||
|
depend: [ButtonCore]
|
|
@ -63,13 +63,13 @@ public class TownyFactionsComponent extends Component<ButtonPresents> implements
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onTownyClaim(TownPreClaimEvent event) {
|
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();
|
int distance = distance().get();
|
||||||
for (int i = -distance; i <= distance; i++) {
|
for (int i = -distance; i <= distance; i++) {
|
||||||
for (int j = -distance; j <= distance; j++) {
|
for (int j = -distance; j <= distance; j++) {
|
||||||
if (i * i + j * j <= distance * distance) {
|
if (i * i + j * j <= distance * distance) {
|
||||||
PS chunk = PS.valueOf(chunkCoord.getChunkX() + i, chunkCoord.getChunkZ() + j)
|
PS chunk = PS.valueOf(coord.getChunkX(true) + i, coord.getChunkZ(true) + j)
|
||||||
.withWorld(chunkCoord.getWorld()); //TODO: Doesn't have the world for some reason
|
.withWorld(coord.getWorld());
|
||||||
if (!BoardColl.get().getFactionAt(chunk).isNone()) {
|
if (!BoardColl.get().getFactionAt(chunk).isNone()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue