mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-30 00:56:45 +01:00
Refactor
This commit is contained in:
parent
e1c8dcc4be
commit
56970b85e8
@ -7,7 +7,7 @@ import org.bukkit.generator.ChunkGenerator;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.generator.HybridUtils;
|
import com.intellectualcrafters.plot.generator.HybridUtils;
|
||||||
import com.intellectualcrafters.plot.generator.PlotGenerator2;
|
import com.intellectualcrafters.plot.generator.PlotGenerator;
|
||||||
import com.plotsquared.bukkit.listeners.APlotListener;
|
import com.plotsquared.bukkit.listeners.APlotListener;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.BlockManager;
|
import com.intellectualcrafters.plot.util.BlockManager;
|
||||||
@ -71,7 +71,7 @@ public interface IPlotMain {
|
|||||||
|
|
||||||
public void unregister(PlotPlayer player);
|
public void unregister(PlotPlayer player);
|
||||||
|
|
||||||
public PlotGenerator2<?> getGenerator(String world, String name);
|
public PlotGenerator<?> getGenerator(String world, String name);
|
||||||
|
|
||||||
public APlotListener initPlotListener();
|
public APlotListener initPlotListener();
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ import com.intellectualcrafters.plot.flag.FlagValue;
|
|||||||
import com.intellectualcrafters.plot.generator.ClassicPlotWorld;
|
import com.intellectualcrafters.plot.generator.ClassicPlotWorld;
|
||||||
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
|
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
|
||||||
import com.intellectualcrafters.plot.generator.HybridUtils;
|
import com.intellectualcrafters.plot.generator.HybridUtils;
|
||||||
import com.intellectualcrafters.plot.generator.PlotGenerator2;
|
import com.intellectualcrafters.plot.generator.PlotGenerator;
|
||||||
import com.intellectualcrafters.plot.generator.SquarePlotManager;
|
import com.intellectualcrafters.plot.generator.SquarePlotManager;
|
||||||
import com.intellectualcrafters.plot.generator.SquarePlotWorld;
|
import com.intellectualcrafters.plot.generator.SquarePlotWorld;
|
||||||
import com.plotsquared.bukkit.listeners.APlotListener;
|
import com.plotsquared.bukkit.listeners.APlotListener;
|
||||||
@ -749,7 +749,7 @@ public class PS {
|
|||||||
* @param world The world to load
|
* @param world The world to load
|
||||||
* @param generator The generator for that world, or null if no generator
|
* @param generator The generator for that world, or null if no generator
|
||||||
*/
|
*/
|
||||||
public void loadWorld(final String world, PlotGenerator2 generator) {
|
public void loadWorld(final String world, PlotGenerator generator) {
|
||||||
PlotWorld plotWorld = getPlotWorld(world);
|
PlotWorld plotWorld = getPlotWorld(world);
|
||||||
if (plotWorld != null) {
|
if (plotWorld != null) {
|
||||||
if (generator != null) {
|
if (generator != null) {
|
||||||
@ -758,7 +758,7 @@ public class PS {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Set<String> worlds = (config.contains("worlds") ? config.getConfigurationSection("worlds").getKeys(false) : new HashSet<String>());
|
final Set<String> worlds = (config.contains("worlds") ? config.getConfigurationSection("worlds").getKeys(false) : new HashSet<String>());
|
||||||
final PlotGenerator2 plotGenerator;
|
final PlotGenerator plotGenerator;
|
||||||
final PlotManager plotManager;
|
final PlotManager plotManager;
|
||||||
final String path = "worlds." + world;
|
final String path = "worlds." + world;
|
||||||
if (!LOADING_WORLD && (generator.isFull())) {
|
if (!LOADING_WORLD && (generator.isFull())) {
|
||||||
|
@ -4,11 +4,11 @@ import com.intellectualcrafters.plot.object.PlotCluster;
|
|||||||
import com.intellectualcrafters.plot.object.PlotManager;
|
import com.intellectualcrafters.plot.object.PlotManager;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
|
|
||||||
public abstract class PlotGenerator2<T> {
|
public abstract class PlotGenerator<T> {
|
||||||
public final String world;
|
public final String world;
|
||||||
public T generator;
|
public T generator;
|
||||||
|
|
||||||
public PlotGenerator2(String world, T generator) {
|
public PlotGenerator(String world, T generator) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
this.generator = generator;
|
this.generator = generator;
|
||||||
}
|
}
|
@ -10,7 +10,7 @@ import com.plotsquared.bukkit.database.plotme.LikePlotMeConverter;
|
|||||||
import com.plotsquared.bukkit.database.plotme.PlotMeConnector_017;
|
import com.plotsquared.bukkit.database.plotme.PlotMeConnector_017;
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
import com.intellectualcrafters.plot.generator.BukkitHybridUtils;
|
import com.intellectualcrafters.plot.generator.BukkitHybridUtils;
|
||||||
import com.intellectualcrafters.plot.generator.PlotGenerator2;
|
import com.intellectualcrafters.plot.generator.PlotGenerator;
|
||||||
import com.plotsquared.bukkit.generator.BukkitGeneratorWrapper;
|
import com.plotsquared.bukkit.generator.BukkitGeneratorWrapper;
|
||||||
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
||||||
import com.plotsquared.bukkit.generator.HybridGen;
|
import com.plotsquared.bukkit.generator.HybridGen;
|
||||||
|
@ -3,12 +3,12 @@ package com.plotsquared.bukkit.generator;
|
|||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.generator.PlotGenerator2;
|
import com.intellectualcrafters.plot.generator.PlotGenerator;
|
||||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
import com.intellectualcrafters.plot.object.PlotCluster;
|
||||||
import com.intellectualcrafters.plot.object.PlotManager;
|
import com.intellectualcrafters.plot.object.PlotManager;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
|
|
||||||
public class BukkitGeneratorWrapper extends PlotGenerator2<ChunkGenerator> {
|
public class BukkitGeneratorWrapper extends PlotGenerator<ChunkGenerator> {
|
||||||
|
|
||||||
public final boolean full;
|
public final boolean full;
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ public class BukkitGeneratorWrapper extends PlotGenerator2<ChunkGenerator> {
|
|||||||
if (gen_string == null) {
|
if (gen_string == null) {
|
||||||
generator = new HybridGen(world);
|
generator = new HybridGen(world);
|
||||||
} else {
|
} else {
|
||||||
PlotGenerator2<ChunkGenerator> gen_wrapper = (PlotGenerator2<ChunkGenerator>) PS.get().IMP.getGenerator(world, gen_string);
|
PlotGenerator<ChunkGenerator> gen_wrapper = (PlotGenerator<ChunkGenerator>) PS.get().IMP.getGenerator(world, gen_string);
|
||||||
if (gen_wrapper != null) {
|
if (gen_wrapper != null) {
|
||||||
generator = gen_wrapper.generator;
|
generator = gen_wrapper.generator;
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,12 @@ package com.plotsquared.sponge;
|
|||||||
|
|
||||||
import org.spongepowered.api.world.gen.WorldGenerator;
|
import org.spongepowered.api.world.gen.WorldGenerator;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.generator.PlotGenerator2;
|
import com.intellectualcrafters.plot.generator.PlotGenerator;
|
||||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
import com.intellectualcrafters.plot.object.PlotCluster;
|
||||||
import com.intellectualcrafters.plot.object.PlotManager;
|
import com.intellectualcrafters.plot.object.PlotManager;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
|
|
||||||
public class SpongeGeneratorWrapper extends PlotGenerator2<WorldGenerator>{
|
public class SpongeGeneratorWrapper extends PlotGenerator<WorldGenerator>{
|
||||||
|
|
||||||
public SpongeGeneratorWrapper(String world, WorldGenerator generator) {
|
public SpongeGeneratorWrapper(String world, WorldGenerator generator) {
|
||||||
super(world, generator);
|
super(world, generator);
|
||||||
|
Loading…
Reference in New Issue
Block a user