Skip to content

Commit

Permalink
Don't display dependent useless information
Browse files Browse the repository at this point in the history
  • Loading branch information
cerus committed Oct 1, 2022
1 parent 3a74ab5 commit 83ede75
Showing 1 changed file with 14 additions and 4 deletions.
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

0 comments on commit 83ede75

Please sign in to comment.