mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-09-29 23:17:34 +02:00
Add protective code that prevents for setting search radius too large.
Now it will be caped at island radius.
This commit is contained in:
parent
6395064cbb
commit
337defb452
@ -654,8 +654,14 @@ public class EditChallengeGUI extends CommonGUI
|
|||||||
"[value]", Integer.toString(this.challenge.getSearchRadius())));
|
"[value]", Integer.toString(this.challenge.getSearchRadius())));
|
||||||
|
|
||||||
icon = new ItemStack(Material.COBBLESTONE_WALL);
|
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) -> {
|
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)
|
if (status)
|
||||||
{
|
{
|
||||||
this.challenge.setSearchRadius(value);
|
this.challenge.setSearchRadius(value);
|
||||||
|
Loading…
Reference in New Issue
Block a user