Added optional generation of a sign identifying owner in plots on
creation
This commit is contained in:
@@ -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.
|
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:
|
Changelog:
|
||||||
|
v0.4.6
|
||||||
|
Added optional generation of a sign identifying owner in plots on creation
|
||||||
|
v0.4.5
|
||||||
v0.4.4
|
v0.4.4
|
||||||
Added a welcome message telling players where their home is.
|
Added a welcome message telling players where their home is.
|
||||||
Switched from PlayerLoginEvent to PlayerJoinEvent
|
Switched from PlayerLoginEvent to PlayerJoinEvent
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.majinnaibu.bukkitplugins</groupId>
|
<groupId>com.majinnaibu.bukkitplugins</groupId>
|
||||||
<artifactId>Metropolis</artifactId>
|
<artifactId>Metropolis</artifactId>
|
||||||
<version>0.4.5-SNAPSHOT</version>
|
<version>0.4.6-SNAPSHOT</version>
|
||||||
<name>Metropolis</name>
|
<name>Metropolis</name>
|
||||||
</project>
|
</project>
|
||||||
@@ -6,8 +6,10 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.configuration.Configuration;
|
import org.bukkit.configuration.Configuration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
@@ -50,6 +52,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
String worldName = "world";
|
String worldName = "world";
|
||||||
boolean generateFloor = false;
|
boolean generateFloor = false;
|
||||||
int floorMaterial = 2;
|
int floorMaterial = 2;
|
||||||
|
boolean generateSign = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
@@ -72,6 +75,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
worldName =config.getString("worldname");
|
worldName =config.getString("worldname");
|
||||||
generateFloor = config.getBoolean("plot.floor.generate");
|
generateFloor = config.getBoolean("plot.floor.generate");
|
||||||
floorMaterial = config.getInt("plot.floor.material");
|
floorMaterial = config.getInt("plot.floor.material");
|
||||||
|
generateSign = config.getBoolean("plot.sign.generate");
|
||||||
saveConfig();
|
saveConfig();
|
||||||
|
|
||||||
log.info(String.format("Metropolis: world name is %s", worldName));
|
log.info(String.format("Metropolis: world name is %s", worldName));
|
||||||
@@ -387,11 +391,31 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
generateFloor(plotCuboid);
|
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));
|
log.info(String.format("Done generating home for %s", playerName));
|
||||||
|
|
||||||
return new PlayerHome(homeRegion);
|
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() {
|
public List<PlayerHome> getCityBlocks() {
|
||||||
return Collections.unmodifiableList(_occupiedHomes);
|
return Collections.unmodifiableList(_occupiedHomes);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ plot:
|
|||||||
floor:
|
floor:
|
||||||
generate: true
|
generate: true
|
||||||
material: 2
|
material: 2
|
||||||
|
sign:
|
||||||
|
generate: true
|
||||||
road:
|
road:
|
||||||
width: 4
|
width: 4
|
||||||
clearSpaceAbove: 66
|
clearSpaceAbove: 66
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ name: Metropolis
|
|||||||
main: com.majinnaibu.bukkitplugins.metropolis.MetropolisPlugin
|
main: com.majinnaibu.bukkitplugins.metropolis.MetropolisPlugin
|
||||||
depend: [WorldGuard]
|
depend: [WorldGuard]
|
||||||
softdepend: [WorldEdit,CommandBook]
|
softdepend: [WorldEdit,CommandBook]
|
||||||
version: 0.4.5
|
version: 0.4.6
|
||||||
database: false
|
database: false
|
||||||
commands:
|
commands:
|
||||||
metropolis-home-generate:
|
metropolis-home-generate:
|
||||||
|
|||||||
Reference in New Issue
Block a user