Skip to content

Commit

Permalink
Add DEPLOYED flag that will show biomes which are deployed.
Browse files Browse the repository at this point in the history
  • Loading branch information
BONNe committed Jan 3, 2019
1 parent ec2046e commit dc60d24
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,10 @@ public List<BiomesObject> getBiomes(World world, User user)
* This method returns biomes that is visible for user in given world.
* @param world World in which biomes must be returned.
* @param user User who will see biomes.
* @param visibilityMode active visibilityMode. Only ALL will return all biomes. TOGGLEABLE and ACCESSIBLE
* will return biomes that user has permission to see.
* @param visibilityMode active visibilityMode. Only ALL will return all biomes.
* DEPLOYED will show biomes that has deployedFlag enabled.
* ACCESSIBLE will show biomes that are deployed and user has permission that unlocks biome.
* TOGGLEABLE will work as ACCESSIBLE.
* @return Visible biome list.
*/
public List<BiomesObject> getBiomes(World world, User user, VisibilityMode visibilityMode)
Expand All @@ -413,7 +415,9 @@ public List<BiomesObject> getBiomes(World world, User user, VisibilityMode visib
List<BiomesObject> returnBiomesList = new ArrayList<>(allBiomeList.size());

allBiomeList.forEach(biomesObject -> {
if (user.hasPermission(biomesObject.getPermission()))
if (biomesObject.isDeployed() &&
(visibilityMode.equals(VisibilityMode.DEPLOYED) ||
user.hasPermission(biomesObject.getPermission())))
{
returnBiomesList.add(biomesObject);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,11 @@ public void setVisibilityMode(VisibilityMode visibilityMode)
@ConfigComment("This variable allows to choose which biomes users can see in Biomes GUI.")
@ConfigComment("Valid values are:")
@ConfigComment(" 'ALL' - there will be no hidden biomes. All biomes will be viewable in GUI.")
@ConfigComment(" 'DEPLOYED' - shows all biomes that are deployed.")
@ConfigComment(" 'ACCESSIBLE' - only biomes that is unlocked via permission or other unlock type will be visible in GUI.")
@ConfigComment(" 'TOGGLEABLE' - there will be button in GUI that allows users to switch from ALL to ACCESSIBLE modes.")
@ConfigEntry(path = "biomes-visibility")
private VisibilityMode visibilityMode = VisibilityMode.ALL;
private VisibilityMode visibilityMode = VisibilityMode.DEPLOYED;

/**
* Default variable.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ public enum VisibilityMode
{
ALL,
ACCESSIBLE,
DEPLOYED,
TOGGLEABLE
}
}
3 changes: 2 additions & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ cooldown: 60
# This variable allows to choose which biomes users can see in Biomes GUI.
# Valid values are:
# 'ALL' - there will be no hidden biomes. All biomes will be viewable in GUI.
# 'DEPLOYED' - shows all biomes that are deployed.
# 'ACCESSIBLE' - only biomes that is unlocked via permission or other unlock type will be visible in GUI.
# 'TOGGLEABLE' - there will be button in GUI that allows users to switch from ALL to ACCESSIBLE modes.
biomes-visibility: ALL
biomes-visibility: DEPLOYED
uniqueId: config

0 comments on commit dc60d24

Please sign in to comment.