Added example docs
Added Commands to plugin.yml to move and evict homes Added floor and road supports to config file and generation
This commit is contained in:
@@ -15,6 +15,7 @@ CONFIG:
|
||||
Edit the config.yml file. You can set the height to clear above roads, the road width, the plot size (incluing half the road width on either side), the road material, and the level at which the road is generated.
|
||||
|
||||
Changelog:
|
||||
v0.5
|
||||
v0.4.6
|
||||
Added optional generation of a sign identifying owner in plots on creation
|
||||
Added a Cuboid constructor that takes a worldedit selection
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.majinnaibu.bukkitplugins</groupId>
|
||||
<artifactId>Metropolis</artifactId>
|
||||
<version>0.4.6-SNAPSHOT</version>
|
||||
<version>0.5-SNAPSHOT</version>
|
||||
<name>Metropolis</name>
|
||||
</project>
|
||||
@@ -35,7 +35,7 @@ import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
|
||||
public class MetropolisPlugin extends JavaPlugin {
|
||||
public static final boolean DEBUG = false;
|
||||
public static final boolean DEBUG = true;
|
||||
public static final Logger log=Logger.getLogger("Minecraft");
|
||||
|
||||
public PluginDescriptionFile pdf = null;
|
||||
@@ -50,20 +50,28 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
|
||||
int size = 1;
|
||||
|
||||
int plotSizeX = 24;
|
||||
int plotSizeZ = 24;
|
||||
int roadWidth = 4;
|
||||
int roadLevel = 62;
|
||||
int spaceAboveRoad = 2;
|
||||
int roadMaterial = 4;
|
||||
String worldName = "world";
|
||||
boolean generateFloor = false;
|
||||
int floorMaterial = 2;
|
||||
boolean generateSign = false;
|
||||
private int plotSizeX = 24;
|
||||
private int plotSizeZ = 24;
|
||||
private int roadWidth = 4;
|
||||
private int roadLevel = 62;
|
||||
private int spaceAboveRoad = 2;
|
||||
private int roadMaterial = 4;
|
||||
private boolean generateRoadSupports = true;
|
||||
private int roadSupportMaterial = 2;
|
||||
private String worldName = "world";
|
||||
private boolean generateFloor = false;
|
||||
private int floorMaterial = 2;
|
||||
private int spaceAboveFloor = 2;
|
||||
private boolean generateSign = false;
|
||||
private boolean generateSpawn = true;
|
||||
private boolean setWorldSpawn = true;
|
||||
private int spawnFloorMaterial = 4;
|
||||
|
||||
private boolean generateFloorSupports = false;
|
||||
private int floorSupportMaterial = 1;
|
||||
private boolean generateWall = false;
|
||||
private int wallMaterial = 20;
|
||||
private int wallHeight = 128;
|
||||
|
||||
private Cuboid _spawnCuboid = null;
|
||||
private Cuboid _cityCuboid = null;
|
||||
private ProtectedRegion _spawnRegion = null;
|
||||
@@ -84,17 +92,25 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
|
||||
plotSizeX = config.getInt("plot.sizeX");
|
||||
plotSizeZ = config.getInt("plot.sizeZ");
|
||||
generateFloor = config.getBoolean("plot.floor.generate");
|
||||
floorMaterial = config.getInt("plot.floor.material");
|
||||
spaceAboveFloor = config.getInt("plot.floor.clearSpaceAbove");
|
||||
generateFloorSupports = config.getBoolean("plot.floor.supports.generate");
|
||||
floorSupportMaterial = config.getInt("plot.floor.supports.material");
|
||||
generateSign = config.getBoolean("plot.sign.generate");
|
||||
roadWidth = config.getInt("road.width");
|
||||
spaceAboveRoad = config.getInt("road.clearSpaceAbove");
|
||||
roadLevel = config.getInt("road.level");
|
||||
roadMaterial = config.getInt("road.material");
|
||||
worldName =config.getString("worldname");
|
||||
generateFloor = config.getBoolean("plot.floor.generate");
|
||||
floorMaterial = config.getInt("plot.floor.material");
|
||||
generateSign = config.getBoolean("plot.sign.generate");
|
||||
generateRoadSupports = config.getBoolean("road.supports.generate");
|
||||
roadSupportMaterial = config.getInt("road.supports.material");
|
||||
generateSpawn = config.getBoolean("spawn.generate");
|
||||
setWorldSpawn = config.getBoolean("spawn.setAsWorldSpawn");
|
||||
spawnFloorMaterial = config.getInt("spawn.material");
|
||||
generateWall = config.getBoolean("wall.generate");
|
||||
wallMaterial = config.getInt("wall.material");
|
||||
wallHeight = config.getInt("wall.material");
|
||||
worldName =config.getString("worldname");
|
||||
saveConfig();
|
||||
|
||||
log.info(String.format("Metropolis: world name is %s", worldName));
|
||||
@@ -249,9 +265,18 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
for(x = plotCuboid.minX + roadWidth/2; x <= plotCuboid.maxX - roadWidth/2; x++){
|
||||
for(z=plotCuboid.minZ + roadWidth/2; z<=plotCuboid.maxZ - roadWidth/2; z++){
|
||||
Block block = world.getBlockAt(x, y, z);
|
||||
//Set the floor block
|
||||
block.setTypeId(floorMaterial);
|
||||
|
||||
for(int i=0; i<spaceAboveRoad; i++){
|
||||
//Set the support
|
||||
if(generateFloorSupports && isPhysicsMaterial(block.getType())){
|
||||
Block blockUnder = world.getBlockAt(x, y-1, z);
|
||||
if(!isSolidMaterial(blockUnder.getType())){
|
||||
blockUnder.setTypeId(floorSupportMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0; i<spaceAboveFloor; i++){
|
||||
block = world.getBlockAt(x, y+1+i, z);
|
||||
block.setTypeId(0);
|
||||
}
|
||||
@@ -275,7 +300,17 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
for(x=plotCuboid.minX; x<plotCuboid.minX + roadWidth/2; x++){
|
||||
for(z=plotCuboid.minZ; z<=plotCuboid.maxZ; z++){
|
||||
Block block = world.getBlockAt(x, y, z);
|
||||
//Set the road block
|
||||
block.setTypeId(roadMaterial);
|
||||
//Set the support
|
||||
if(generateRoadSupports && isPhysicsMaterial(block.getType())){
|
||||
Block blockUnder = world.getBlockAt(x, y-1, z);
|
||||
if(!isSolidMaterial(blockUnder.getType())){
|
||||
blockUnder.setTypeId(roadSupportMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
//Clear the space above
|
||||
for(int y1 = 0; y1 < spaceAboveRoad; y1++){
|
||||
block = world.getBlockAt(x, y+y1+1, z);
|
||||
block.setTypeId(0);
|
||||
@@ -286,7 +321,17 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
for(x=plotCuboid.maxX - roadWidth/2+1; x<=plotCuboid.maxX; x++){
|
||||
for(z=plotCuboid.minZ; z<=plotCuboid.maxZ; z++){
|
||||
Block block = world.getBlockAt(x, y, z);
|
||||
//Set the road block
|
||||
block.setTypeId(roadMaterial);
|
||||
//Set the support
|
||||
if(generateRoadSupports && isPhysicsMaterial(block.getType())){
|
||||
Block blockUnder = world.getBlockAt(x, y-1, z);
|
||||
if(!isSolidMaterial(blockUnder.getType())){
|
||||
blockUnder.setTypeId(roadSupportMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
//Clear the space above
|
||||
for(int y1 = 0; y1 < spaceAboveRoad; y1++){
|
||||
block = world.getBlockAt(x, y+y1+1, z);
|
||||
block.setTypeId(0);
|
||||
@@ -297,7 +342,17 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
for(z=plotCuboid.minZ; z<plotCuboid.minZ + roadWidth/2; z++){
|
||||
for(x=plotCuboid.minX; x<=plotCuboid.maxX; x++){
|
||||
Block block = world.getBlockAt(x, y, z);
|
||||
//Set the road block
|
||||
block.setTypeId(roadMaterial);
|
||||
//Set the support
|
||||
if(generateRoadSupports && isPhysicsMaterial(block.getType())){
|
||||
Block blockUnder = world.getBlockAt(x, y-1, z);
|
||||
if(!isSolidMaterial(blockUnder.getType())){
|
||||
blockUnder.setTypeId(roadSupportMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
//Clear the space above
|
||||
for(int y1 = 0; y1 < spaceAboveRoad; y1++){
|
||||
block = world.getBlockAt(x, y+y1+1, z);
|
||||
block.setTypeId(0);
|
||||
@@ -308,7 +363,17 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
for(z=plotCuboid.maxZ - roadWidth/2+1; z<=plotCuboid.maxZ; z++){
|
||||
for(x=plotCuboid.minX; x<=plotCuboid.maxX; x++){
|
||||
Block block = world.getBlockAt(x, y, z);
|
||||
//Set the road block
|
||||
block.setTypeId(roadMaterial);
|
||||
//Set the support
|
||||
if(generateRoadSupports && isPhysicsMaterial(block.getType())){
|
||||
Block blockUnder = world.getBlockAt(x, y-1, z);
|
||||
if(!isSolidMaterial(blockUnder.getType())){
|
||||
blockUnder.setTypeId(roadSupportMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
//Clear the space above
|
||||
for(int y1 = 0; y1 < spaceAboveRoad; y1++){
|
||||
block = world.getBlockAt(x, y+y1+1, z);
|
||||
block.setTypeId(0);
|
||||
@@ -318,6 +383,19 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSolidMaterial(Material material) {
|
||||
return material != Material.AIR &&
|
||||
material != Material.WATER &&
|
||||
material != Material.LAVA &&
|
||||
material != Material.TORCH &&
|
||||
material != Material.REDSTONE_TORCH_OFF &&
|
||||
material != Material.REDSTONE_TORCH_ON;
|
||||
}
|
||||
|
||||
private boolean isPhysicsMaterial(Material material) {
|
||||
return material == Material.GRAVEL || material == Material.SAND;
|
||||
}
|
||||
|
||||
public boolean isBlockOccupied(int row, int col){
|
||||
Cuboid cuboid = new Cuboid(getPlotMin(row, col), getPlotMax(row, col));
|
||||
for(Plot plot: _occupiedPlots){
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
Goal: Have 1 plot size for mods and 1 plot size for normals.
|
||||
Implementation:
|
||||
1. Set the plotSize in the config to the larger plot size there are other possible sizes but powers of 2 work really well so lets give mods a 64x64 plot. Roads are recomended but will eat into the plot on all sides so the roadsize can be ignored for this example.
|
||||
2. Start the server and run /metropolis-home-generate <username> for each mod.
|
||||
3. If you have not completed a full ring then run /metropolis-home-generate <test n> where n starts at 1 and increases until you have filled a full ring. This will reserve those plots for later or anyone who happens to have that username, but that can be dealth with later.
|
||||
4. Stop the server and change the plotSize to a smaller number like 32.
|
||||
5. Restart the server and let your users log in.
|
||||
|
||||
Notes:
|
||||
All users will be assigned a small plot when they first connect. When you make them a mod just delete their current region and change the name of one of the reserved home regions to h_<their username>.
|
||||
/region remove h_jonnynewadmin
|
||||
/region select test_1
|
||||
/region remove test_1
|
||||
/region define h_johnnynewadmin
|
||||
JohnnyNewAdmin's old home will become available for resettlement. If you want to copy johnny's old blocks into his new home region I'd suggest WorldEdit.
|
||||
This process including optionally copying the blocks will be an upcoming feature. Probably in 0.5.x and maybe in 0.6.
|
||||
|
||||
If you later run out of larger plots you can just set the size back to the larger number and let more generate. Moving and evictions will be coming soon and make this easier.
|
||||
You can manually just create a region for a user before they login named like h_<username> if you want a specific user to have a really big space as well.
|
||||
@@ -4,6 +4,9 @@ plot:
|
||||
floor:
|
||||
generate: true
|
||||
material: 2
|
||||
supports:
|
||||
generate: true
|
||||
material: 1
|
||||
sign:
|
||||
generate: true
|
||||
road:
|
||||
@@ -11,8 +14,15 @@ road:
|
||||
clearSpaceAbove: 66
|
||||
level: 62
|
||||
material: 4
|
||||
supports:
|
||||
generate: true
|
||||
material: 1
|
||||
spawn:
|
||||
generate: true
|
||||
setAsWorldSpawn: true
|
||||
material: 2
|
||||
wall:
|
||||
generate: true
|
||||
material: 7
|
||||
height: 66
|
||||
worldname: world
|
||||
|
||||
@@ -2,7 +2,7 @@ name: Metropolis
|
||||
main: com.majinnaibu.bukkitplugins.metropolis.MetropolisPlugin
|
||||
depend: [WorldGuard]
|
||||
softdepend: [WorldEdit,CommandBook]
|
||||
version: 0.4.6
|
||||
version: 0.5
|
||||
database: false
|
||||
commands:
|
||||
metropolis-home-generate:
|
||||
@@ -20,7 +20,15 @@ commands:
|
||||
metropolis-plot-reserve:
|
||||
description: This command reserves a plot so it won't be assigned as a home.
|
||||
permission: metropolis.plot.reserve
|
||||
usage: /metropolis-plot-reserve <minX> <minY> <minZ> <maxX> <maxY> <maxZ>
|
||||
usage: /metropolis-plot-reserve <name> <minX> <minY> <minZ> <maxX> <maxY> <maxZ>
|
||||
metropolis-home-evict:
|
||||
description: This unassigns a player's current home.
|
||||
permission: metropolis.home.evict
|
||||
usage: /metropolis-home-evict <playerName>
|
||||
metropolis-home-move:
|
||||
description: This command swaps a player's current home with a reserved plot.
|
||||
permission: metropolis.home.move
|
||||
usage: /metropolis-home-move <newRegionName>
|
||||
gentesthomes:
|
||||
description: This command is ignored on non-debug builds.
|
||||
permission: metropolis.debug
|
||||
|
||||
Reference in New Issue
Block a user