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

After safehouse owner dies, allow raid to continue #43

Open
cafestifflered opened this issue Jan 24, 2023 · 1 comment
Open

After safehouse owner dies, allow raid to continue #43

cafestifflered opened this issue Jan 24, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@cafestifflered
Copy link
Collaborator

If a safehouse owner defends their home unsuccessfully and is killed, the raiders currently are not able to finish raiding the safehouse because it is no longer claimed.

The safehouse should still be raidable after the owner dies so that the raiders can claim their spoils.

@cafestifflered cafestifflered added the bug Something isn't working label Jan 24, 2023
@cafestifflered
Copy link
Collaborator Author

Check this section in PlayerInteractListener. Should probably add a tag to a safehouse if the owner dies but still keep the owner active. This would allow the raiders to keep raiding while the owner is online even if they're dead, or the owner to return and reclaim the safehouse and keep their stuff.

    private void startBreakIn(Player intruder, Safehouse safehouse, int breakingInDurationSecond) {
        Optional<Player> houseOwnerOpt = safehouse.getOwnerPlayer();
        // the isPresent check below is not needed. players can break into houses only when the owner is online
        houseOwnerOpt.ifPresent(houseOwner -> {
            // get the character name of the intruder and notify the homeowner
            storyStorage.getActiveStory(intruder.getUniqueId()).thenAccept(storyOpt -> {
                if (storyOpt.isEmpty()) {
                    plugin.getLogger().log(Level.SEVERE, "The player " + intruder.getUniqueId() + " doesn't have an active story and they were able to try breaking into the safehouse " + safehouse.getId());
                    return;
                }
                houseOwner.sendMessage(plugin.getMessage("break-in-started-owner")
                        .replace("{character-name}", storyOpt.get().characterName()));
            });
        });
        breakingInClicks.put(intruder.getUniqueId(), new ClickDuration());
        intruder.sendMessage(plugin.getMessage("break-in-started")
                .replace("{seconds}", Integer.toString(breakingInDurationSecond)));
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant