Added optional generation of a sign identifying owner in plots on

creation
This commit is contained in:
2012-02-19 13:26:11 -08:00
parent 8c9c45acbb
commit 2e17ba13c2
5 changed files with 31 additions and 2 deletions

View File

@@ -15,6 +15,9 @@ 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.4.6
Added optional generation of a sign identifying owner in plots on creation
v0.4.5
v0.4.4
Added a welcome message telling players where their home is.
Switched from PlayerLoginEvent to PlayerJoinEvent

View File

@@ -2,6 +2,6 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.majinnaibu.bukkitplugins</groupId>
<artifactId>Metropolis</artifactId>
<version>0.4.5-SNAPSHOT</version>
<version>0.4.6-SNAPSHOT</version>
<name>Metropolis</name>
</project>

View File

@@ -6,8 +6,10 @@ import java.util.Collections;
import java.util.List;
import java.util.logging.Logger;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.configuration.Configuration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
@@ -50,6 +52,7 @@ public class MetropolisPlugin extends JavaPlugin {
String worldName = "world";
boolean generateFloor = false;
int floorMaterial = 2;
boolean generateSign = false;
@Override
public void onDisable() {
@@ -72,6 +75,7 @@ public class MetropolisPlugin extends JavaPlugin {
worldName =config.getString("worldname");
generateFloor = config.getBoolean("plot.floor.generate");
floorMaterial = config.getInt("plot.floor.material");
generateSign = config.getBoolean("plot.sign.generate");
saveConfig();
log.info(String.format("Metropolis: world name is %s", worldName));
@@ -387,11 +391,31 @@ public class MetropolisPlugin extends JavaPlugin {
generateFloor(plotCuboid);
}
log.info(String.format("generateSign: %s", String.valueOf(generateSign)));
if(generateSign){
generateSign(plotCuboid, playerName);
}
log.info(String.format("Done generating home for %s", playerName));
return new PlayerHome(homeRegion);
}
private void generateSign(Cuboid plotCuboid, String playerName) {
Block signBlock = world.getBlockAt(plotCuboid.getCenterX(), roadLevel+1, plotCuboid.getCenterZ());
signBlock.setType(Material.SIGN_POST);
Sign sign = (Sign)signBlock.getState();
sign.setLine(0, "Home of");
sign.setLine(1, playerName.substring(0, Math.min(15, playerName.length())));
if(playerName.length() > 15){
sign.setLine(2, playerName.substring(16, Math.min(30, playerName.length())));
if(playerName.length() > 45){
sign.setLine(3, playerName.substring(31, Math.min(45, playerName.length())));
}
}
}
public List<PlayerHome> getCityBlocks() {
return Collections.unmodifiableList(_occupiedHomes);
}

View File

@@ -4,6 +4,8 @@ plot:
floor:
generate: true
material: 2
sign:
generate: true
road:
width: 4
clearSpaceAbove: 66

View File

@@ -2,7 +2,7 @@ name: Metropolis
main: com.majinnaibu.bukkitplugins.metropolis.MetropolisPlugin
depend: [WorldGuard]
softdepend: [WorldEdit,CommandBook]
version: 0.4.5
version: 0.4.6
database: false
commands:
metropolis-home-generate: