Added placement based on bedrock.

This commit is contained in:
tastybento 2018-07-02 22:01:37 -07:00
parent 35247965fa
commit 693625ab9a

View File

@ -179,10 +179,6 @@ public class Clipboard {
maxZ = Math.max(maxZ, z); maxZ = Math.max(maxZ, z);
count ++; count ++;
} }
if (block.getType().equals(Material.BEDROCK)) {
plugin.log("DEBUG: setting bedrock to " + x + "," + y + "," + z);
blockConfig.set("bedrock", x + "," + y + "," + z);
}
} }
} }
} }
@ -230,7 +226,7 @@ public class Clipboard {
Sign sign = (Sign) block.getState(); Sign sign = (Sign) block.getState();
org.bukkit.material.Sign s = (org.bukkit.material.Sign) sign.getData(); org.bukkit.material.Sign s = (org.bukkit.material.Sign) sign.getData();
// Handle spawn sign // Handle spawn sign
if (!lines.isEmpty() && lines.get(0).equalsIgnoreCase(TextVariables.SPAWN_HERE)) { if (island != null && !lines.isEmpty() && lines.get(0).equalsIgnoreCase(TextVariables.SPAWN_HERE)) {
block.setType(Material.AIR); block.setType(Material.AIR);
// Orient to face same direction as sign // Orient to face same direction as sign
Location spawnPoint = new Location(block.getWorld(), block.getX() + 0.5D, block.getY(), Location spawnPoint = new Location(block.getWorld(), block.getX() + 0.5D, block.getY(),
@ -238,15 +234,13 @@ public class Clipboard {
island.setSpawnPoint(block.getWorld().getEnvironment(), spawnPoint); island.setSpawnPoint(block.getWorld().getEnvironment(), spawnPoint);
return; return;
} }
String name = TextVariables.NAME;
if (island != null) {
name = plugin.getPlayers().getName(island.getOwner());
}
// Sub in player's name // Sub in player's name
for (int i = 0 ; i < lines.size(); i++) { for (int i = 0 ; i < lines.size(); i++) {
sign.setLine(i, lines sign.setLine(i, lines.get(i).replace(TextVariables.NAME, name));
.get(i)
.replace(TextVariables.NAME,
plugin
.getPlayers()
.getName(island
.getOwner())));
} }
sign.update(); sign.update();
} }
@ -474,6 +468,9 @@ public class Clipboard {
if (block.getData() != 0) { if (block.getData() != 0) {
s.set("data", block.getData()); s.set("data", block.getData());
} }
if (block.getType().equals(Material.BEDROCK)) {
blockConfig.set("bedrock", x + "," + y + "," + z);
}
// Block state // Block state
BlockState bs = block.getState(); BlockState bs = block.getState();