diff options
author | md_5 <git@md-5.net> | 2017-05-14 12:00:00 +1000 |
---|---|---|
committer | md_5 <git@md-5.net> | 2017-05-14 12:00:00 +1000 |
commit | eb2c1f23e6e5eb09d118be85c860832c528c78c4 (patch) | |
tree | b0fcaa93f3c2096dc041d77a6b4e2a027f87aace /src/main/java | |
parent | 67628ef9af12eec2b89bc118405531060996a9dd (diff) | |
download | bukkit-eb2c1f23e6e5eb09d118be85c860832c528c78c4.tar bukkit-eb2c1f23e6e5eb09d118be85c860832c528c78c4.tar.gz bukkit-eb2c1f23e6e5eb09d118be85c860832c528c78c4.tar.lz bukkit-eb2c1f23e6e5eb09d118be85c860832c528c78c4.tar.xz bukkit-eb2c1f23e6e5eb09d118be85c860832c528c78c4.zip |
Remove Ebean ORM
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/bukkit/Bukkit.java | 11 | ||||
-rw-r--r-- | src/main/java/org/bukkit/Server.java | 9 | ||||
-rw-r--r-- | src/main/java/org/bukkit/plugin/Plugin.java | 23 | ||||
-rw-r--r-- | src/main/java/org/bukkit/plugin/PluginDescriptionFile.java | 33 | ||||
-rw-r--r-- | src/main/java/org/bukkit/plugin/java/JavaPlugin.java | 64 |
5 files changed, 0 insertions, 140 deletions
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java index cadbbcad..75b0a9a4 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -40,7 +40,6 @@ import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scoreboard.ScoreboardManager; import org.bukkit.util.CachedServerIcon; -import com.avaje.ebean.config.ServerConfig; import com.google.common.collect.ImmutableList; import org.bukkit.generator.ChunkGenerator; @@ -590,16 +589,6 @@ public final class Bukkit { } /** - * Populates a given {@link ServerConfig} with values attributes to this - * server. - * - * @param config the server config to populate - */ - public static void configureDbConfig(ServerConfig config) { - server.configureDbConfig(config); - } - - /** * Adds a recipe to the crafting manager. * * @param recipe the recipe to add diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java index 4c03a997..9468c4a6 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -41,7 +41,6 @@ import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scoreboard.ScoreboardManager; import org.bukkit.util.CachedServerIcon; -import com.avaje.ebean.config.ServerConfig; import com.google.common.collect.ImmutableList; import org.bukkit.generator.ChunkGenerator; @@ -486,14 +485,6 @@ public interface Server extends PluginMessageRecipient { public boolean dispatchCommand(CommandSender sender, String commandLine) throws CommandException; /** - * Populates a given {@link ServerConfig} with values attributes to this - * server. - * - * @param config the server config to populate - */ - public void configureDbConfig(ServerConfig config); - - /** * Adds a recipe to the crafting manager. * * @param recipe the recipe to add diff --git a/src/main/java/org/bukkit/plugin/Plugin.java b/src/main/java/org/bukkit/plugin/Plugin.java index 4357b131..c4e22c62 100644 --- a/src/main/java/org/bukkit/plugin/Plugin.java +++ b/src/main/java/org/bukkit/plugin/Plugin.java @@ -9,8 +9,6 @@ import org.bukkit.command.TabExecutor; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.generator.ChunkGenerator; -import com.avaje.ebean.EbeanServer; - /** * Represents a Plugin * <p> @@ -140,27 +138,6 @@ public interface Plugin extends TabExecutor { public void setNaggable(boolean canNag); /** - * Gets the {@link EbeanServer} tied to this plugin. This will only be - * available if enabled in the {@link - * PluginDescriptionFile#isDatabaseEnabled()} - * <p> - * <i>For more information on the use of <a href="http://www.avaje.org/"> - * Avaje Ebeans ORM</a>, see <a - * href="http://www.avaje.org/ebean/documentation.html">Avaje Ebeans - * Documentation</a></i> - * <p> - * <i>For an example using Ebeans ORM, see <a - * href="https://github.com/Bukkit/HomeBukkit">Bukkit's Homebukkit Plugin - * </a></i> - * - * @return ebean server instance or null if not enabled - * @deprecated all EBean related methods will be removed with Minecraft 1.12 - * - see https://www.spigotmc.org/threads/194144/ - */ - @Deprecated - public EbeanServer getDatabase(); - - /** * Gets a {@link ChunkGenerator} for use in a default world, as specified * in the server configuration * diff --git a/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java b/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java index b93569f3..afd20123 100644 --- a/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java +++ b/src/main/java/org/bukkit/plugin/PluginDescriptionFile.java @@ -221,7 +221,6 @@ public final class PluginDescriptionFile { private List<String> authors = null; private String website = null; private String prefix = null; - private boolean database = false; private PluginLoadOrder order = PluginLoadOrder.POSTWORLD; private List<Permission> permissions = null; private Map<?, ?> lazyPermissions = null; @@ -428,25 +427,6 @@ public final class PluginDescriptionFile { } /** - * Gives if the plugin uses a database. - * <ul> - * <li>Using a database is non-trivial. - * <li>Valid values include <code>true</code> and <code>false</code> - * </ul> - * <p> - * In the plugin.yml, this entry is named <code>database</code>. - * <p> - * Example: - * <blockquote><pre>database: false</pre></blockquote> - * - * @return if this plugin requires a database - * @see Plugin#getDatabase() - */ - public boolean isDatabaseEnabled() { - return database; - } - - /** * Gives a list of other plugins that the plugin requires. * <ul> * <li>Use the value in the {@link #getName()} of the target plugin to @@ -873,10 +853,6 @@ public final class PluginDescriptionFile { return classLoaderOf; } - public void setDatabaseEnabled(boolean database) { - this.database = database; - } - /** * Saves this PluginDescriptionFile to the given writer * @@ -956,14 +932,6 @@ public final class PluginDescriptionFile { softDepend = makePluginNameList(map, "softdepend"); loadBefore = makePluginNameList(map, "loadbefore"); - if (map.get("database") != null) { - try { - database = (Boolean) map.get("database"); - } catch (ClassCastException ex) { - throw new InvalidDescriptionException(ex, "database is of wrong type"); - } - } - if (map.get("website") != null) { website = map.get("website").toString(); } @@ -1061,7 +1029,6 @@ public final class PluginDescriptionFile { map.put("name", name); map.put("main", main); map.put("version", version); - map.put("database", database); map.put("order", order.toString()); map.put("default-permission", defaultPerm.toString()); diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java index bcb8a679..16b1eb37 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java @@ -32,12 +32,6 @@ import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginLoader; import org.bukkit.plugin.PluginLogger; -import com.avaje.ebean.EbeanServer; -import com.avaje.ebean.EbeanServerFactory; -import com.avaje.ebean.config.DataSourceConfig; -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; @@ -54,7 +48,6 @@ public abstract class JavaPlugin extends PluginBase { private File dataFolder = null; private ClassLoader classLoader = null; private boolean naggable = true; - private EbeanServer ebean = null; private FileConfiguration newConfig = null; private File configFile = null; private PluginLogger logger = null; @@ -285,42 +278,6 @@ public abstract class JavaPlugin extends PluginBase { this.classLoader = classLoader; this.configFile = new File(dataFolder, "config.yml"); this.logger = new PluginLogger(this); - - if (description.isDatabaseEnabled()) { - ServerConfig db = new ServerConfig(); - - db.setDefaultServer(false); - db.setRegister(false); - db.setClasses(getDatabaseClasses()); - db.setName(description.getName()); - server.configureDbConfig(db); - - DataSourceConfig ds = db.getDataSourceConfig(); - - ds.setUrl(replaceDatabaseString(ds.getUrl())); - dataFolder.mkdirs(); - - ClassLoader previous = Thread.currentThread().getContextClassLoader(); - - Thread.currentThread().setContextClassLoader(classLoader); - ebean = EbeanServerFactory.create(db); - Thread.currentThread().setContextClassLoader(previous); - } - } - - /** - * Provides a list of all classes that should be persisted in the database - * - * @return List of Classes that are Ebeans - */ - public List<Class<?>> getDatabaseClasses() { - return new ArrayList<Class<?>>(); - } - - private String replaceDatabaseString(String input) { - input = input.replaceAll("\\{DIR\\}", dataFolder.getPath().replaceAll("\\\\", "/") + "/"); - input = input.replaceAll("\\{NAME\\}", description.getName().replaceAll("[^\\w_-]", "")); - return input; } /** @@ -387,27 +344,6 @@ 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; - } - - protected void installDDL() { - SpiEbeanServer serv = (SpiEbeanServer) getDatabase(); - DdlGenerator gen = serv.getDdlGenerator(); - - gen.runScript(false, gen.generateCreateDdl()); - } - - protected void removeDDL() { - SpiEbeanServer serv = (SpiEbeanServer) getDatabase(); - DdlGenerator gen = serv.getDdlGenerator(); - - gen.runScript(true, gen.generateDropDdl()); - } - - @Override public final Logger getLogger() { return logger; } |