Skip to content

Commit

Permalink
Add protective code that prevents for setting search radius too large.
Browse files Browse the repository at this point in the history
Now it will be caped at island radius.
  • Loading branch information
BONNe committed Apr 21, 2019
1 parent 6395064 commit 337defb
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -654,8 +654,14 @@ else if (this.challenge.getChallengeType().equals(Challenge.ChallengeType.OTHER)
"[value]", Integer.toString(this.challenge.getSearchRadius())));

icon = new ItemStack(Material.COBBLESTONE_WALL);

// Search radius should not be larger then island radius.
int maxSearchDistance =
this.addon.getPlugin().getIWM().getAddon(this.world).map(gameModeAddon ->
gameModeAddon.getWorldSettings().getIslandDistance()).orElse(100);

clickHandler = (panel, user, clickType, slot) -> {
new NumberGUI(this.user, this.challenge.getSearchRadius(), 0, lineLength, (status, value) -> {
new NumberGUI(this.user, this.challenge.getSearchRadius(), 0, maxSearchDistance, lineLength, (status, value) -> {
if (status)
{
this.challenge.setSearchRadius(value);
Expand Down

0 comments on commit 337defb

Please sign in to comment.