Adds GameModeAddon method that is called when BentoBox loads all addons.

Required to fix https://github.com/BentoBoxWorld/BentoBox/issues/940
This commit is contained in:
tastybento 2019-09-13 20:43:53 -07:00
parent 5164b1a02d
commit deb21e7ed6
4 changed files with 19 additions and 3 deletions

View File

@ -215,15 +215,17 @@ public class BentoBox extends JavaPlugin {
TextVariables.VERSION, instance.getDescription().getVersion(),
"[time]", String.valueOf(loadTime + enableTime));
// Fire plugin ready event - this should go last after everything else
// Tell all addons that everything is loaded
isLoaded = true;
this.addonsManager.allLoaded();
// Fire plugin ready event - this should go last after everything else
Bukkit.getServer().getPluginManager().callEvent(new BentoBoxReadyEvent());
if (getSettings().getDatabaseType().equals(DatabaseSetup.DatabaseType.YAML)) {
logWarning("*** You're still using YAML database ! ***");
logWarning("This database type is being deprecated from BentoBox as some official addons encountered difficulties supporting it correctly.");
logWarning("You should switch ASAP to an alternative database type. Please refer to the comments in BentoBox's config.yml.");
logWarning("There is NO warranty YAML database will remain properly supported in the following updates, and its usage should as such be considered a non-viable situation.");
logWarning("There is NO guarantee YAML database will remain properly supported in the following updates, and its usage should as such be considered a non-viable situation.");
logWarning("*** *** *** *** *** *** *** *** *** *** ***");
}
});

View File

@ -418,4 +418,10 @@ public abstract class Addon {
public boolean registerFlag(Flag flag) {
return getPlugin().getFlagsManager().registerFlag(this, flag);
}
/**
* Called when all addons have been loaded by BentoBox
* @since 1.8.0
*/
public void allLoaded() {}
}

View File

@ -293,7 +293,7 @@ public class User {
public int getPermissionValue(String permissionPrefix, int defaultValue) {
// If requester is console, then return the default value
if (!isPlayer()) return defaultValue;
int value = defaultValue;
// If there is a dot at the end of the permissionPrefix, remove it

View File

@ -445,4 +445,12 @@ public class AddonsManager {
.collect(Collectors.toList());
}
/**
* Notifies all addons that BentoBox has loaded all addons
* @since 1.8.0
*/
public void allLoaded() {
addons.forEach(Addon::allLoaded);
}
}