Skip to content

Commit

Permalink
Check if stack threshold is disabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
ploppyperson committed Aug 27, 2021
1 parent 30b9c6b commit 066eaed
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/uk/antiperson/stackmob/tasks/MergeTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public void run() {
}
original.setLastLocation(original.getEntity().getLocation());
}
boolean stackThresholdEnabled = sm.getMainConfig().getStackThresholdEnabled(original.getEntity().getType());
Integer[] searchRadius = sm.getMainConfig().getStackRadius(original.getEntity().getType());
Set<StackEntity> matches = new HashSet<>();
for (Entity nearby : original.getEntity().getNearbyEntities(searchRadius[0], searchRadius[1], searchRadius[2])) {
Expand All @@ -56,7 +57,7 @@ public void run() {
if (!original.match(nearbyStack)) {
continue;
}
if (nearbyStack.getSize() > 1 || original.getSize() > 1) {
if (!stackThresholdEnabled || (nearbyStack.getSize() > 1 || original.getSize() > 1)) {
final StackEntity removed = nearbyStack.merge(original, false);
if (removed != null) {
toRemove.add(removed);
Expand All @@ -69,7 +70,7 @@ public void run() {
}
matches.add(nearbyStack);
}
if (!sm.getMainConfig().getStackThresholdEnabled(original.getEntity().getType())) {
if (!stackThresholdEnabled) {
continue;
}
int threshold = sm.getMainConfig().getStackThreshold(original.getEntity().getType()) - 1;
Expand Down

0 comments on commit 066eaed

Please sign in to comment.