mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-03 09:30:17 +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);
|
File newFile = new File(parent.getBlueprintsFolder(), args.get(0) + BlueprintsManager.BLUEPRINT_SUFFIX);
|
||||||
if (newFile.exists()) {
|
if (newFile.exists()) {
|
||||||
this.askConfirmation(user, user.getTranslation("commands.admin.blueprint.file-exists"), () -> {
|
this.askConfirmation(user, user.getTranslation("commands.admin.blueprint.file-exists"), () -> {
|
||||||
parent.hideClipboard(user);
|
hideAndSave(user, parent, clipboard, args.get(0));
|
||||||
new BlueprintClipboardManager(getPlugin(), parent.getBlueprintsFolder(), clipboard).save(user, args.get(0));
|
|
||||||
getPlugin().getBlueprintsManager().addBlueprint((GameModeAddon)getAddon(), clipboard.getBlueprint());
|
|
||||||
});
|
});
|
||||||
return false;
|
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 {
|
} else {
|
||||||
user.sendMessage("commands.admin.blueprint.copy-first");
|
user.sendMessage("commands.admin.blueprint.copy-first");
|
||||||
return false;
|
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)) {
|
if (block.getType().equals(Material.BEDROCK)) {
|
||||||
|
// Find highest bedrock
|
||||||
|
if(blueprint.getBedrock() == null) {
|
||||||
blueprint.setBedrock(pos);
|
blueprint.setBedrock(pos);
|
||||||
|
} else {
|
||||||
|
if (pos.getBlockY() > blueprint.getBedrock().getBlockY()) {
|
||||||
|
blueprint.setBedrock(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Chests
|
// 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
|
// 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)) {
|
if (island != null && !lines.isEmpty() && lines.get(0).equalsIgnoreCase(TextVariables.START_TEXT)) {
|
||||||
// Get the addon that is operating in this world
|
// Get the addon that is operating in this world
|
||||||
plugin.getIWM().getAddon(island.getWorld()).ifPresent(addon -> {
|
String addonName = plugin.getIWM().getAddon(island.getWorld()).map(addon -> addon.getDescription().getName().toLowerCase()).orElse("");
|
||||||
lines.clear();
|
lines.clear();
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
lines.add(ChatColor.translateAlternateColorCodes('&', plugin.getLocalesManager().getOrDefault(User.getInstance(island.getOwner()),
|
lines.add(ChatColor.translateAlternateColorCodes('&', plugin.getLocalesManager().getOrDefault(User.getInstance(island.getOwner()),
|
||||||
addon.getDescription().getName().toLowerCase() + ".sign.line" + i,"")));
|
addonName + ".sign.line" + i,"")));
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
// Get the name of the player
|
// Get the name of the player
|
||||||
String name = TextVariables.NAME;
|
String name = TextVariables.NAME;
|
||||||
|
Loading…
Reference in New Issue
Block a user