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

Don't display dependent useless information #16

Merged
merged 1 commit into from
Oct 1, 2022
Merged
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 @@ -57,32 +57,42 @@ public void onVillagerClick(PlayerInteractEntityEvent event) {
event.setCancelled(true);
Location villagerPOI = villager.getMemory(MemoryKey.JOB_SITE);
ArrayList<Component> messageList = new ArrayList<>();

boolean isUseful = villager.getProfession() != Villager.Profession.NONE
&& villager.getProfession() != Villager.Profession.NITWIT;
boolean hasWorkSite = villager.getMemory(MemoryKey.JOB_SITE) != null;
boolean hasBed = villager.getMemory(MemoryKey.HOME) != null;

//profession
if (toggleSettings.get(ConfigValidator.ToggleSetting.PROFESSION)) {
messageList.add(villagerProfession(villager));
}
//job-site
if (toggleSettings.get(ConfigValidator.ToggleSetting.JOB_SITE)) {
// Only show job site and last worked info if the villager has a profession
if (isUseful && toggleSettings.get(ConfigValidator.ToggleSetting.JOB_SITE)) {
messageList.add(villagerJobSite(villager));
}
//last-worked
if (toggleSettings.get(ConfigValidator.ToggleSetting.LAST_WORKED)) {
// Only show last worked info if the villager has a profession and a work site
if (isUseful && hasWorkSite && toggleSettings.get(ConfigValidator.ToggleSetting.LAST_WORKED)) {
messageList.add(villagerLastWorked(villager));
}
//bed-location
if (toggleSettings.get(ConfigValidator.ToggleSetting.BED_LOCATION)) {
messageList.add(villagerBed(villager));
}
//last-slept
if (toggleSettings.get(ConfigValidator.ToggleSetting.LAST_WORKED)) {
// Only show last sleep info if the villager has a bed
if (hasBed && toggleSettings.get(ConfigValidator.ToggleSetting.LAST_SLEPT)) {
messageList.add(villagerLastSlept(villager));
}
//inventory
if (toggleSettings.get(ConfigValidator.ToggleSetting.INVENTORY)) {
messageList.add(villagerInventory(villager));
}
//restocks
if (toggleSettings.get(ConfigValidator.ToggleSetting.RESTOCKS)) {
// Only show restocks info if the villager has a profession and a work site
if (isUseful && hasWorkSite && toggleSettings.get(ConfigValidator.ToggleSetting.RESTOCKS)) {
messageList.add(villagerRestocks(villager));
}
//reputation
Expand Down