Skip to content

Commit

Permalink
Fix issue when changing permission with AnvilGUI first time, shows Pa…
Browse files Browse the repository at this point in the history
…per instead of empty text field.
  • Loading branch information
BONNe committed Jan 1, 2019
1 parent d06a6f7 commit bb553a7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/java/world/bentobox/addons/biomes/panel/BiomesPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,12 @@ private void createBiomeEditPanel(int pageIndex, BiomesObject biome, boolean glo
biome.getFriendlyName(),
(player, reply) ->
{
if (reply.equalsIgnoreCase(Material.PAPER.name()))
{
// Weird anvilGui glitch. Does not allow empty values.
reply = "";
}

biome.setFriendlyName(reply);
this.biomesManager.saveBiome(biome);
this.createBiomeEditPanel(pageIndex, biome, false, false);
Expand Down Expand Up @@ -740,6 +746,12 @@ private void createBiomeEditPanel(int pageIndex, BiomesObject biome, boolean glo
Utils.mergeStringList(biome.getDescription()),
(player, reply) ->
{
if (reply.equalsIgnoreCase(Material.PAPER.name()))
{
// Weird anvilGui glitch. Does not allow empty values.
reply = "";
}

biome.setDescription(Utils.splitString(reply));
this.biomesManager.saveBiome(biome);
this.createBiomeEditPanel(pageIndex, biome, false, false);
Expand Down Expand Up @@ -800,6 +812,15 @@ private void createBiomeEditPanel(int pageIndex, BiomesObject biome, boolean glo
biome.getPermission().isEmpty() ? " " : biome.getPermission(),
(player, reply) ->
{
if (reply.equalsIgnoreCase(Material.PAPER.name()))
{
// Weird anvilGui glitch. Does not allow empty values.
reply = "";
}

// empty spaces is not allowed.
reply = reply.trim();

biome.setPermission(reply);
this.biomesManager.saveBiome(biome);
this.createBiomeEditPanel(pageIndex, biome, false, false);
Expand Down

0 comments on commit bb553a7

Please sign in to comment.