diff --git a/PlotSquared/pom.xml b/PlotSquared/pom.xml
index 44fae6f26..4a207dfc6 100644
--- a/PlotSquared/pom.xml
+++ b/PlotSquared/pom.xml
@@ -8,7 +8,7 @@
UTF-8
PlotSquared
- 2.9.2
+ 2.9.3
PlotSquared
jar
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Template.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Template.java
index b83d30bd0..7bdab70c1 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Template.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Template.java
@@ -178,6 +178,10 @@ public class Template extends SubCommand {
public static byte[] getBytes(PlotWorld plotworld) {
ConfigurationSection section = PlotSquared.config.getConfigurationSection("worlds." + plotworld.worldname);
YamlConfiguration config = new YamlConfiguration();
+ String generator = SetupUtils.manager.getGenerator(plotworld);
+ if (generator != null) {
+ config.set("generator.plugin", generator);
+ }
for (String key : section.getKeys(true)) {
config.set(key, section.get(key));
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetupUtils.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetupUtils.java
index 7a860d778..f93617e8c 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetupUtils.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetupUtils.java
@@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.Map;
import com.intellectualcrafters.plot.object.PlotGenerator;
+import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.object.SetupObject;
public abstract class SetupUtils {
@@ -15,5 +16,7 @@ public abstract class SetupUtils {
public abstract void updateGenerators();
+ public abstract String getGenerator(PlotWorld plotworld);
+
public abstract String setupWorld(final SetupObject object);
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitSetupUtils.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitSetupUtils.java
index 3ec8fe1e9..2e2f04ae1 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitSetupUtils.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitSetupUtils.java
@@ -1,11 +1,14 @@
package com.intellectualcrafters.plot.util.bukkit;
import java.io.IOException;
+import java.util.List;
+import java.util.Map.Entry;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.WorldCreator;
+import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.Plugin;
@@ -13,6 +16,7 @@ import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.ConfigurationNode;
import com.intellectualcrafters.plot.generator.SquarePlotManager;
import com.intellectualcrafters.plot.object.PlotGenerator;
+import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.object.SetupObject;
import com.intellectualcrafters.plot.util.SetupUtils;
@@ -85,4 +89,24 @@ public class BukkitSetupUtils extends SetupUtils {
return object.world;
}
+ @Override
+ public String getGenerator(PlotWorld plotworld) {
+ if (SetupUtils.generators.size() == 0) {
+ updateGenerators();
+ }
+ World world = Bukkit.getWorld(plotworld.worldname);
+ if (world == null) {
+ return null;
+ }
+ ChunkGenerator generator = world.getGenerator();
+ if (!(generator instanceof PlotGenerator)) {
+ return null;
+ }
+ for (Entry entry : generators.entrySet()) {
+ if (entry.getValue().getClass().getName().equals(generator.getClass().getName())) {
+ return entry.getKey();
+ }
+ }
+ return null;
+ }
}