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
|
||||
|
||||
softdepend: [Factions]
|
||||
depend: [ButtonCore]
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue