Skip to content

Database

TimmyOVO edited this page May 1, 2020 · 3 revisions

Setup database

        try {
            this.databaseManager = DatabaseManager.newBuilder()
                    .withName("onlinereward")
                    .withOwnerPlugin(this)
                    .withSqlConfiguration(DatabaseManager.setupDatabase(this))
                    .withModelClass(Arrays.asList(OnlineModel.class))
                    .build()
                    .openConnection();
        } catch (DatabaseInitException | ConfigurationException e) {
            getLogger().warning("Database failed to connect because " + e.getLocalizedMessage());
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
  • Database configuration will auto create for you, if it dose not exists.
Clone this wiki locally