mirror of
https://gitlab.com/SamB440/rpgregions-2.git
synced 2025-12-19 14:59:19 +00:00
Update shown text in DependencyRequirement to use region names and consider plurality
This commit is contained in:
@@ -2,6 +2,7 @@ package net.islandearth.rpgregions.requirements;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.islandearth.rpgregions.api.IRPGRegionsAPI;
|
||||
import net.islandearth.rpgregions.api.RPGRegionsAPI;
|
||||
import net.islandearth.rpgregions.gui.GuiEditable;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -49,7 +50,15 @@ public class DependencyRequirement extends RegionRequirement {
|
||||
|
||||
@Override
|
||||
public String getText(Player player) {
|
||||
return "Regions " + String.join(", ", requiredRegions);
|
||||
List<String> convertedIds = new ArrayList<>();
|
||||
for (String requiredRegion : requiredRegions) {
|
||||
RPGRegionsAPI.getAPI().getManagers().getRegionsCache().getConfiguredRegion(requiredRegion).ifPresent(configured -> {
|
||||
convertedIds.add(configured.getCustomName());
|
||||
});
|
||||
}
|
||||
|
||||
final boolean plural = convertedIds.size() > 1;
|
||||
return (plural ? "Regions: " : "Region: ") + String.join(", ", convertedIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user