Open cafestifflered opened 1 year ago
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)));
}
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.