mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-27 13:15:28 +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-related Settings ###
|
||||||
database:
|
database:
|
||||||
# FLATFILE, MYSQL, MONGO
|
# 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
|
type: FLATFILE
|
||||||
host: localhost
|
host: localhost
|
||||||
# Port 3306 is MySQL's default. Port 27017 is MongoDB's default.
|
# 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());
|
getLogger().severe("Settings backup could not be saved" + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Start Database managers
|
||||||
playersManager = new PlayersManager(this);
|
playersManager = new PlayersManager(this);
|
||||||
|
// Check if this plugin is now disabled (due to bad database handling)
|
||||||
|
if (!this.isEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
islandsManager = new IslandsManager(this);
|
islandsManager = new IslandsManager(this);
|
||||||
ranksManager = new RanksManager(this);
|
ranksManager = new RanksManager(this);
|
||||||
|
|
||||||
@ -140,10 +145,16 @@ public class BSkyBlock extends JavaPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
addonsManager.disableAddons();
|
if (addonsManager != null) {
|
||||||
|
addonsManager.disableAddons();
|
||||||
|
}
|
||||||
// Save data
|
// Save data
|
||||||
playersManager.shutdown();
|
if (playersManager != null) {
|
||||||
islandsManager.shutdown();
|
playersManager.shutdown();
|
||||||
|
}
|
||||||
|
if (islandsManager != null) {
|
||||||
|
islandsManager.shutdown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerCustomCharts(){
|
private void registerCustomCharts(){
|
||||||
|
@ -10,6 +10,13 @@ public class MongoDBDatabase extends BSBDatabase{
|
|||||||
@Override
|
@Override
|
||||||
public AbstractDatabaseHandler<?> getHandler(Class<?> type) {
|
public AbstractDatabaseHandler<?> getHandler(Class<?> type) {
|
||||||
BSkyBlock plugin = BSkyBlock.getInstance();
|
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(
|
return new MongoDBDatabaseHandler<>(plugin, type, new MongoDBDatabaseConnecter(new DatabaseConnectionSettingsImpl(
|
||||||
plugin.getSettings().getDbHost(),
|
plugin.getSettings().getDbHost(),
|
||||||
plugin.getSettings().getDbPort(),
|
plugin.getSettings().getDbPort(),
|
||||||
|
Loading…
Reference in New Issue
Block a user