mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
External generators
Fixed an issue with external generators not working correctly (caused by another "fix"). The following will need to be updated: - AdvPlots - IslandPlots
This commit is contained in:
parent
7d25cccf4a
commit
dcf1475d92
@ -8,7 +8,7 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<artifactId>PlotSquared</artifactId>
|
||||
<version>2.10.6</version>
|
||||
<version>2.10.7</version>
|
||||
<name>PlotSquared</name>
|
||||
<packaging>jar</packaging>
|
||||
<build>
|
||||
|
@ -328,7 +328,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
if (!PlotSquared.setupPlotWorld(world, id)) {
|
||||
return null;
|
||||
}
|
||||
HybridGen result = new HybridGen();
|
||||
HybridGen result = new HybridGen(world);
|
||||
TaskManager.runTaskLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -440,7 +440,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
if ((gen_plugin != null) && gen_plugin.isEnabled()) {
|
||||
return gen_plugin.getDefaultWorldGenerator(world, "");
|
||||
} else {
|
||||
return new HybridGen();
|
||||
return new HybridGen(world);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -350,7 +350,7 @@ public class PlotSquared {
|
||||
try {
|
||||
final String gen_string = config.getString("worlds." + world + "." + "generator.plugin");
|
||||
if (gen_string == null) {
|
||||
generator = new HybridGen();
|
||||
generator = new HybridGen(world);
|
||||
} else {
|
||||
generator = (PlotGenerator) IMP.getGenerator(world, gen_string);
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ import java.util.zip.ZipInputStream;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotSquared;
|
||||
@ -87,7 +88,8 @@ public class Template extends SubCommand {
|
||||
PlotSquared.config.set("worlds." + world, worldConfig.get(""));
|
||||
try {
|
||||
PlotSquared.config.save(PlotSquared.configFile);
|
||||
} catch (IOException e) {
|
||||
PlotSquared.config.load(PlotSquared.configFile);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String manager = worldConfig.getString("generator.plugin");
|
||||
|
@ -266,7 +266,7 @@ public class PlotMeConverter {
|
||||
// Load using Bukkit API
|
||||
// - User must set generator manually
|
||||
Bukkit.getServer().unloadWorld(world, true);
|
||||
final World myworld = WorldCreator.name(actualWorldName).generator(new HybridGen()).createWorld();
|
||||
final World myworld = WorldCreator.name(actualWorldName).generator(new HybridGen(actualWorldName)).createWorld();
|
||||
myworld.save();
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,11 @@ import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
* @author Empire92
|
||||
*/
|
||||
public class HybridGen extends PlotGenerator {
|
||||
|
||||
public HybridGen(String world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set to static to re-use the same managet for all Default World Generators
|
||||
*/
|
||||
|
@ -17,7 +17,7 @@ public class WorldEvents implements Listener {
|
||||
public static String lastWorld = null;
|
||||
|
||||
public static String getName(World world) {
|
||||
if (lastWorld != null) {
|
||||
if (lastWorld != null && !lastWorld.equals("CheckingPlotSquaredGenerator")) {
|
||||
return lastWorld;
|
||||
}
|
||||
else {
|
||||
|
@ -42,6 +42,10 @@ public abstract class PlotGenerator extends ChunkGenerator {
|
||||
public int Z;
|
||||
private PseudoRandom random = new PseudoRandom();
|
||||
|
||||
public PlotGenerator(String world) {
|
||||
WorldEvents.lastWorld = world;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<BlockPopulator> getDefaultPopulators(World world) {
|
||||
|
Loading…
Reference in New Issue
Block a user