This commit is contained in:
boy0001 2014-10-11 19:51:48 +11:00
parent 6b028988b3
commit 79e0459a3a
2 changed files with 28 additions and 24 deletions

View File

@ -20,7 +20,7 @@ import com.intellectualcrafters.plot.PlotWorld;
public class DefaultPlotManager extends PlotManager { public class DefaultPlotManager extends PlotManager {
/* /**
* Default implementation of getting a plot at a given location * Default implementation of getting a plot at a given location
* *
* For a simplified explanation of the math involved: - Get the current * For a simplified explanation of the math involved: - Get the current
@ -80,7 +80,7 @@ public class DefaultPlotManager extends PlotManager {
return new PlotId(dx + 1, dz + 1); return new PlotId(dx + 1, dz + 1);
} }
/* /**
* Some complex stuff for traversing mega plots (return getPlotIdAbs if you * Some complex stuff for traversing mega plots (return getPlotIdAbs if you
* do not support mega plots) * do not support mega plots)
*/ */
@ -169,7 +169,7 @@ public class DefaultPlotManager extends PlotManager {
return PlayerFunctions.getBottomPlot(loc.getWorld(), plot).id; return PlayerFunctions.getBottomPlot(loc.getWorld(), plot).id;
} }
/* /**
* Check if a location is inside a specific plot(non-Javadoc) - For this * Check if a location is inside a specific plot(non-Javadoc) - For this
* implementation, we don't need to do anything fancier than referring to * implementation, we don't need to do anything fancier than referring to
* getPlotIdAbs(...) * getPlotIdAbs(...)
@ -183,7 +183,7 @@ public class DefaultPlotManager extends PlotManager {
return result == plotid; return result == plotid;
} }
/* /**
* Get the bottom plot loc (some basic math) * Get the bottom plot loc (some basic math)
*/ */
@Override @Override
@ -201,7 +201,7 @@ public class DefaultPlotManager extends PlotManager {
return new Location(Bukkit.getWorld(plotworld.worldname), x, 1, z); return new Location(Bukkit.getWorld(plotworld.worldname), x, 1, z);
} }
/* /**
* Get the top plot loc (some basic math) * Get the top plot loc (some basic math)
*/ */
@Override @Override
@ -219,7 +219,7 @@ public class DefaultPlotManager extends PlotManager {
return new Location(Bukkit.getWorld(plotworld.worldname), x, 256, z); return new Location(Bukkit.getWorld(plotworld.worldname), x, 256, z);
} }
/* /**
* Clearing the plot needs to only consider removing the blocks - This * Clearing the plot needs to only consider removing the blocks - This
* implementation has used the SetCuboid function, as it is fast, and uses * implementation has used the SetCuboid function, as it is fast, and uses
* NMS code - It also makes use of the fact that deleting chunks is a lot * NMS code - It also makes use of the fact that deleting chunks is a lot
@ -519,7 +519,7 @@ public class DefaultPlotManager extends PlotManager {
return true; return true;
} }
/* /**
* Remove sign for a plot * Remove sign for a plot
*/ */
@Override @Override
@ -586,7 +586,7 @@ public class DefaultPlotManager extends PlotManager {
return true; return true;
} }
/* /**
* Set a plot biome * Set a plot biome
*/ */
@Override @Override
@ -612,7 +612,7 @@ public class DefaultPlotManager extends PlotManager {
return true; return true;
} }
/* /**
* PLOT MERGING * PLOT MERGING
*/ */
@ -797,7 +797,7 @@ public class DefaultPlotManager extends PlotManager {
return true; return true;
} }
/* /**
* Finishing off plot merging by adding in the walls surrounding the plot * Finishing off plot merging by adding in the walls surrounding the plot
* (OPTIONAL)(UNFINISHED) * (OPTIONAL)(UNFINISHED)
*/ */

View File

@ -27,21 +27,21 @@ import com.intellectualcrafters.plot.PlotWorld;
* *
*/ */
public class WorldGenerator extends PlotGenerator { public class WorldGenerator extends PlotGenerator {
/* /**
* result object is returned for each generated chunk, do stuff to it * result object is returned for each generated chunk, do stuff to it
*/ */
short[][] result; short[][] result;
/* /**
* plotworld object * plotworld object
*/ */
DefaultPlotWorld plotworld; DefaultPlotWorld plotworld;
/* /**
* Set to static to re-use the same managet for all Default World Generators * Set to static to re-use the same managet for all Default World Generators
*/ */
private static PlotManager manager = null; private static PlotManager manager = null;
/* /**
* Some generator specific variables (implementation dependent) * Some generator specific variables (implementation dependent)
*/ */
final int plotsize; final int plotsize;
@ -58,8 +58,9 @@ public class WorldGenerator extends PlotGenerator {
final PlotBlock[] plotfloors; final PlotBlock[] plotfloors;
final PlotBlock[] filling; final PlotBlock[] filling;
/* /**
* Return the plot manager for this type of generator, or create one * Return the plot manager for this type of generator, or create one
* For square plots you may as well use the default plot manager which comes with PlotSquared
*/ */
@Override @Override
public PlotManager getPlotManager() { public PlotManager getPlotManager() {
@ -69,15 +70,18 @@ public class WorldGenerator extends PlotGenerator {
return manager; return manager;
} }
// return the PlotWorld /**
* Get a new plotworld class
* For square plots you can use the DefaultPlotWorld class which comes with PlotSquared
*
*/
@Override @Override
public PlotWorld getNewPlotWorld(String world) { public PlotWorld getNewPlotWorld(String world) {
this.plotworld = new DefaultPlotWorld(world); this.plotworld = new DefaultPlotWorld(world);
return this.plotworld; return this.plotworld;
} }
/* /**
* Faster sudo-random number generator than java.util.random * Faster sudo-random number generator than java.util.random
*/ */
private long state; private long state;
@ -100,7 +104,7 @@ public class WorldGenerator extends PlotGenerator {
return (int) r; return (int) r;
} }
/* /**
* Cuboid based plot generation is quick, as it requires no calculations * Cuboid based plot generation is quick, as it requires no calculations
* inside the loop - You don't have to use this this method, but you may * inside the loop - You don't have to use this this method, but you may
* find it useful. * find it useful.
@ -130,7 +134,7 @@ public class WorldGenerator extends PlotGenerator {
} }
} }
/* /**
* Standard setblock method for world generation * Standard setblock method for world generation
*/ */
private void setBlock(short[][] result, int x, int y, int z, short blkid) { private void setBlock(short[][] result, int x, int y, int z, short blkid) {
@ -140,7 +144,7 @@ public class WorldGenerator extends PlotGenerator {
result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = blkid; result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = blkid;
} }
/* /**
* Initialize variables, and create plotworld object used in calculations * Initialize variables, and create plotworld object used in calculations
*/ */
public WorldGenerator(String world) { public WorldGenerator(String world) {
@ -165,7 +169,7 @@ public class WorldGenerator extends PlotGenerator {
this.biome = this.plotworld.PLOT_BIOME; this.biome = this.plotworld.PLOT_BIOME;
} }
/* /**
* Return the block populator * Return the block populator
*/ */
@Override @Override
@ -183,7 +187,7 @@ public class WorldGenerator extends PlotGenerator {
return Arrays.asList((BlockPopulator) new XPopulator(this.plotworld)); return Arrays.asList((BlockPopulator) new XPopulator(this.plotworld));
} }
/* /**
* Return the default spawn location for this world * Return the default spawn location for this world
*/ */
@Override @Override
@ -191,7 +195,7 @@ public class WorldGenerator extends PlotGenerator {
return new Location(world, 0, this.plotworld.ROAD_HEIGHT + 2, 0); return new Location(world, 0, this.plotworld.ROAD_HEIGHT + 2, 0);
} }
/* /**
* This part is a fucking mess. - Refer to a proper tutorial if you would * This part is a fucking mess. - Refer to a proper tutorial if you would
* like to learn how to make a world generator * like to learn how to make a world generator
*/ */