mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-23 19:25:12 +01:00
Added in requirement for BsbMongo Plugin
BSkyBlock will disable itself gracefully if this plugin does not exist but the database is sent to MONGO. Finishes up https://github.com/tastybento/bskyblock/issues/155
This commit is contained in:
parent
a19b8bf836
commit
f0d3a9ab5f
@ -49,6 +49,8 @@ general:
|
||||
### Database-related Settings ###
|
||||
database:
|
||||
# FLATFILE, MYSQL, MONGO
|
||||
# if you use MONGO, you must also run the BSBMongo plugin (not addon)
|
||||
# See https://github.com/tastybento/bsbMongo/releases/
|
||||
type: FLATFILE
|
||||
host: localhost
|
||||
# Port 3306 is MySQL's default. Port 27017 is MongoDB's default.
|
||||
|
@ -72,7 +72,12 @@ public class BSkyBlock extends JavaPlugin {
|
||||
getLogger().severe("Settings backup could not be saved" + e.getMessage());
|
||||
}
|
||||
|
||||
// Start Database managers
|
||||
playersManager = new PlayersManager(this);
|
||||
// Check if this plugin is now disabled (due to bad database handling)
|
||||
if (!this.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
islandsManager = new IslandsManager(this);
|
||||
ranksManager = new RanksManager(this);
|
||||
|
||||
@ -140,10 +145,16 @@ public class BSkyBlock extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
addonsManager.disableAddons();
|
||||
if (addonsManager != null) {
|
||||
addonsManager.disableAddons();
|
||||
}
|
||||
// Save data
|
||||
playersManager.shutdown();
|
||||
islandsManager.shutdown();
|
||||
if (playersManager != null) {
|
||||
playersManager.shutdown();
|
||||
}
|
||||
if (islandsManager != null) {
|
||||
islandsManager.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
private void registerCustomCharts(){
|
||||
|
@ -10,6 +10,13 @@ public class MongoDBDatabase extends BSBDatabase{
|
||||
@Override
|
||||
public AbstractDatabaseHandler<?> getHandler(Class<?> type) {
|
||||
BSkyBlock plugin = BSkyBlock.getInstance();
|
||||
// Check if the MongoDB plugin exists
|
||||
if (plugin.getServer().getPluginManager().getPlugin("BsbMongo") == null) {
|
||||
plugin.getLogger().severe("You must install BsbMongo plugin for MongoDB support!");
|
||||
plugin.getLogger().severe("See: https://github.com/tastybento/bsbMongo/releases/");
|
||||
plugin.getServer().getPluginManager().disablePlugin(plugin);
|
||||
return null;
|
||||
}
|
||||
return new MongoDBDatabaseHandler<>(plugin, type, new MongoDBDatabaseConnecter(new DatabaseConnectionSettingsImpl(
|
||||
plugin.getSettings().getDbHost(),
|
||||
plugin.getSettings().getDbPort(),
|
||||
|
Loading…
Reference in New Issue
Block a user