mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-24 01:58:39 +01:00
Fixes bedrock placement in blueprint.
Picks highest bedrock block as center block.
This commit is contained in:
parent
775b7f2377
commit
f7ee12527a
@ -37,18 +37,20 @@ public class AdminBlueprintSaveCommand extends ConfirmableCommand {
|
||||
File newFile = new File(parent.getBlueprintsFolder(), args.get(0) + BlueprintsManager.BLUEPRINT_SUFFIX);
|
||||
if (newFile.exists()) {
|
||||
this.askConfirmation(user, user.getTranslation("commands.admin.blueprint.file-exists"), () -> {
|
||||
parent.hideClipboard(user);
|
||||
new BlueprintClipboardManager(getPlugin(), parent.getBlueprintsFolder(), clipboard).save(user, args.get(0));
|
||||
getPlugin().getBlueprintsManager().addBlueprint((GameModeAddon)getAddon(), clipboard.getBlueprint());
|
||||
hideAndSave(user, parent, clipboard, args.get(0));
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
parent.hideClipboard(user);
|
||||
return new BlueprintClipboardManager(getPlugin(), parent.getBlueprintsFolder(), clipboard).save(user, args.get(0));
|
||||
}
|
||||
return hideAndSave(user, parent, clipboard, args.get(0));
|
||||
} else {
|
||||
user.sendMessage("commands.admin.blueprint.copy-first");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hideAndSave(User user, AdminBlueprintCommand parent, BlueprintClipboard clipboard, String string) {
|
||||
parent.hideClipboard(user);
|
||||
getPlugin().getBlueprintsManager().addBlueprint((GameModeAddon)getAddon(), clipboard.getBlueprint());
|
||||
return new BlueprintClipboardManager(getPlugin(), parent.getBlueprintsFolder(), clipboard).save(user, string);
|
||||
}
|
||||
}
|
||||
|
@ -245,7 +245,14 @@ public class BlueprintClipboard {
|
||||
}
|
||||
|
||||
if (block.getType().equals(Material.BEDROCK)) {
|
||||
blueprint.setBedrock(pos);
|
||||
// Find highest bedrock
|
||||
if(blueprint.getBedrock() == null) {
|
||||
blueprint.setBedrock(pos);
|
||||
} else {
|
||||
if (pos.getBlockY() > blueprint.getBedrock().getBlockY()) {
|
||||
blueprint.setBedrock(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Chests
|
||||
|
@ -337,13 +337,12 @@ public class BlueprintPaster {
|
||||
// Sign text must be stored under the addon's name.sign.line0,1,2,3 in the yaml file
|
||||
if (island != null && !lines.isEmpty() && lines.get(0).equalsIgnoreCase(TextVariables.START_TEXT)) {
|
||||
// Get the addon that is operating in this world
|
||||
plugin.getIWM().getAddon(island.getWorld()).ifPresent(addon -> {
|
||||
lines.clear();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
lines.add(ChatColor.translateAlternateColorCodes('&', plugin.getLocalesManager().getOrDefault(User.getInstance(island.getOwner()),
|
||||
addon.getDescription().getName().toLowerCase() + ".sign.line" + i,"")));
|
||||
}
|
||||
});
|
||||
String addonName = plugin.getIWM().getAddon(island.getWorld()).map(addon -> addon.getDescription().getName().toLowerCase()).orElse("");
|
||||
lines.clear();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
lines.add(ChatColor.translateAlternateColorCodes('&', plugin.getLocalesManager().getOrDefault(User.getInstance(island.getOwner()),
|
||||
addonName + ".sign.line" + i,"")));
|
||||
}
|
||||
}
|
||||
// Get the name of the player
|
||||
String name = TextVariables.NAME;
|
||||
|
Loading…
Reference in New Issue
Block a user