Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ public interface ISettings extends IConf {

boolean isWorldHomePermissions();

int getMaxTreeCommandRange();

boolean registerBackInListener();

boolean getDisableItemPickupWhileAfk();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,11 @@ public boolean registerBackInListener() {
return registerBackInListener;
}

@Override
public int getMaxTreeCommandRange() {
return config.getInt("tree-command-range-limit", 300);
}

private boolean _registerBackInListener() {
return config.getBoolean("register-back-in-listener", false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void run(final Server server, final User user, final String commandLabel,
throw new NotEnoughArgumentsException();
}

final Location loc = LocationUtil.getTarget(user.getBase()).add(0, 1, 0);
final Location loc = LocationUtil.getTarget(user.getBase(), ess.getSettings().getMaxTreeCommandRange()).add(0, 1, 0);
if (loc.getBlock().getType().isSolid()) {
throw new Exception(tl("bigTreeFailure"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void run(final Server server, final User user, final String commandLabel,
}
}

final Location loc = LocationUtil.getTarget(user.getBase()).add(0, 1, 0);
final Location loc = LocationUtil.getTarget(user.getBase(), ess.getSettings().getMaxTreeCommandRange()).add(0, 1, 0);
if (loc.getBlock().getType().isSolid()) {
throw new Exception(tl("treeFailure"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,13 @@ public static ItemStack convertBlockToItem(final Block block) {
}

public static Location getTarget(final LivingEntity entity) throws Exception {
return getTarget(entity, 300);
}

public static Location getTarget(final LivingEntity entity, final int maxDistance) throws Exception {
Block block = null;
try {
block = entity.getTargetBlock(TRANSPARENT_MATERIALS, 300);
block = entity.getTargetBlock(TRANSPARENT_MATERIALS, maxDistance);
} catch (final NoSuchMethodError ignored) {
} // failing now :(
if (block == null) {
Expand Down
3 changes: 3 additions & 0 deletions Essentials/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,9 @@ repair-enchanted: true
# Warning: Mixing and overleveling some enchantments can cause issues with clients, servers and plugins.
unsafe-enchantments: false

# The maximum range from the player that the /tree and /bigtree commands can spawn trees.
tree-command-range-limit: 300

#Do you want Essentials to keep track of previous location for /back in the teleport listener?
#If you set this to true any plugin that uses teleport will have the previous location registered.
register-back-in-listener: false
Expand Down