placing farms and tilling farms will now respect region permissions.

This commit is contained in:
Brianna O'Keefe 2018-12-29 12:01:01 -05:00
parent bd977b6f60
commit 4d28df97b0
2 changed files with 4 additions and 0 deletions

View File

@ -246,6 +246,7 @@ public class EFarm implements Farm {
private static final Random random = new Random();
public boolean tillLand(Location location) {
Player player = Bukkit.getPlayer(placedBy);
EpicFarmingPlugin instance = EpicFarmingPlugin.getInstance();
if (instance.getConfig().getBoolean("Main.Disable Auto Til Land")) return true;
Block block = location.getBlock();
@ -256,6 +257,7 @@ public class EFarm implements Farm {
for (int fx = -radius; fx <= radius; fx++) {
for (int fy = -2; fy <= 1; fy++) {
for (int fz = -radius; fz <= radius; fz++) {
if (!instance.canBuild(player, location)) continue;
Block b2 = block.getWorld().getBlockAt(bx + fx, by + fy, bz + fz);
// ToDo: enum for all flowers.

View File

@ -77,6 +77,8 @@ public class BlockListeners implements Listener {
if (e.getBlockAgainst().getType() == farmBlock) e.setCancelled(true);
if (!instance.canBuild(e.getPlayer(), e.getBlock().getLocation())) return;
int amt = 0;
for (Farm farmm : instance.getFarmManager().getFarms().values()) {
if (!farmm.getPlacedBy().equals(e.getPlayer().getUniqueId())) continue;