Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix beacon locations not resetting when rerolling #2028

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions common/src/main/java/com/wynntils/models/lootrun/LootrunModel.java
Expand Up @@ -18,6 +18,7 @@
import com.wynntils.features.combat.CustomLootrunBeaconsFeature;
import com.wynntils.handlers.chat.event.ChatMessageReceivedEvent;
import com.wynntils.handlers.chat.type.RecipientType;
import com.wynntils.mc.event.CommandSentEvent;
import com.wynntils.mc.extension.EntityExtension;
import com.wynntils.models.beacons.BeaconModel;
import com.wynntils.models.beacons.event.BeaconEvent;
Expand Down Expand Up @@ -92,6 +93,8 @@ public class LootrunModel extends Model {

private static final Pattern LOOTRUN_FAILED_PATTERN = Pattern.compile("[À\\s]*§c§lLootrun Failed!");

private static final String LOOTRUN_BEACON_REROLL_COMMAND = "rerollbeacon";

private static final float BEACON_REMOVAL_RADIUS = 25f;

// Beacon positions are sometimes off by a few blocks
Expand Down Expand Up @@ -229,6 +232,14 @@ public void onWorldStateChanged(WorldStateEvent event) {
timeLeft = 0;
}

@SubscribeEvent
public void onCommandSent(CommandSentEvent event) {
if (event.getCommand().equals(LOOTRUN_BEACON_REROLL_COMMAND)) {
// Delay the clear to make sure the beacon locations are updated
Managers.TickScheduler.scheduleLater(() -> possibleTaskLocations = new HashSet<>(), 10);
magicus marked this conversation as resolved.
Show resolved Hide resolved
}
}

@SubscribeEvent
public void onBeaconMoved(BeaconEvent.Moved event) {
Beacon beacon = event.getNewBeacon();
Expand Down