From a7e0658387daa046849e44aff8b6444558bd605d Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Sat, 12 Mar 2016 10:50:42 +1100 Subject: [PATCH] SPIGOT-1889: Fail fast when plugin attempts to use database when not enabled. By: md_5 --- paper-api/src/main/java/org/bukkit/plugin/java/JavaPlugin.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/paper-api/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/paper-api/src/main/java/org/bukkit/plugin/java/JavaPlugin.java index 98975d7a02..adbcd83c0a 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/java/JavaPlugin.java +++ b/paper-api/src/main/java/org/bukkit/plugin/java/JavaPlugin.java @@ -39,6 +39,7 @@ import com.avaje.ebean.config.ServerConfig; import com.avaje.ebeaninternal.api.SpiEbeanServer; import com.avaje.ebeaninternal.server.ddl.DdlGenerator; import com.google.common.base.Charsets; +import com.google.common.base.Preconditions; import com.google.common.io.ByteStreams; /** @@ -437,6 +438,8 @@ public abstract class JavaPlugin extends PluginBase { @Override public EbeanServer getDatabase() { + Preconditions.checkState(description.isDatabaseEnabled(), "Plugin does not have database: true in plugin.yml"); + return ebean; }