Skip to content

Commit

Permalink
Fixes bug that prevented to change "enabled by default".
Browse files Browse the repository at this point in the history
Apparently BentoBox API do not use defaultSettings to set enabled/disabled value, but uses -1 and any positive number as rank value to change degault value.
  • Loading branch information
BONNe committed May 12, 2022
1 parent 470d740 commit f57feb0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/world/bentobox/visit/VisitAddon.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public void onLoad()
this.setState(State.DISABLED);
}

ALLOW_VISITS_FLAG = new Flag.Builder("ALLOW_VISITS_FLAG", Material.PUMPKIN_PIE).
type(Flag.Type.SETTING).
defaultRank(this.settings.isDefaultVisitingEnabled() ? 0 : -1).
build();

// Save existing panels.
this.saveResource("panels/main_panel.yml", false);
this.saveResource("panels/manage_panel.yml", false);
Expand Down Expand Up @@ -122,8 +127,6 @@ public void onEnable()
{
// After we added all GameModes into flags, we need to register these flags
// into BentoBox.

ALLOW_VISITS_FLAG.setDefaultSetting(this.settings.isDefaultVisitingEnabled());
this.registerFlag(ALLOW_VISITS_FLAG);

INSTANCE = this;
Expand Down Expand Up @@ -322,8 +325,5 @@ public static VisitAddon getInstance()
* <p>
* By default setting is set to false.
*/
public final static Flag ALLOW_VISITS_FLAG =
new Flag.Builder("ALLOW_VISITS_FLAG", Material.PUMPKIN_PIE).
type(Flag.Type.SETTING).
build();
public static Flag ALLOW_VISITS_FLAG;
}

0 comments on commit f57feb0

Please sign in to comment.