From 22bfa512a90d27700a1867d53e740a36733f05dd Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Wed, 22 Jun 2011 18:26:32 +0100 Subject: [PATCH] Added new getDefaultWorldGenerator method to Plugin By: Dinnerbone --- paper-api/src/main/java/org/bukkit/plugin/Plugin.java | 10 ++++++++++ .../main/java/org/bukkit/plugin/java/JavaPlugin.java | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/paper-api/src/main/java/org/bukkit/plugin/Plugin.java b/paper-api/src/main/java/org/bukkit/plugin/Plugin.java index 908c5b84ad..05c6eee4db 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/Plugin.java +++ b/paper-api/src/main/java/org/bukkit/plugin/Plugin.java @@ -4,6 +4,7 @@ import com.avaje.ebean.EbeanServer; import java.io.File; import org.bukkit.Server; import org.bukkit.command.CommandExecutor; +import org.bukkit.generator.ChunkGenerator; import org.bukkit.util.config.Configuration; /** @@ -88,4 +89,13 @@ public interface Plugin extends CommandExecutor { * @return Ebean server instance */ public EbeanServer getDatabase(); + + /** + * Gets a {@link ChunkGenerator} for use in a default world, as specified in the server configuration + * + * @param worldName Name of the world that this will be applied to + * @param id Unique ID, if any, that was specified to indicate which generator was requested + * @return ChunkGenerator for use in the default world generation + */ + public ChunkGenerator getDefaultWorldGenerator(String worldName, String id); } 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 3609fdc5fe..81f0ed53f7 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 @@ -13,6 +13,7 @@ import org.bukkit.Server; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.PluginCommand; +import org.bukkit.generator.ChunkGenerator; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginLoader; @@ -232,6 +233,11 @@ public abstract class JavaPlugin implements Plugin { public void onLoad() {} // Empty! + public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) { + getServer().getLogger().severe("Plugin " + getDescription().getFullName() + " does not contain any generators that may be used in the default world!"); + return null; + } + public final boolean isNaggable() { return naggable; }