Per player schematic listing

This commit is contained in:
Jesse Boyd 2017-03-27 08:13:14 +11:00
parent 0e33b1f06d
commit 7926b5a3f6
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 21 additions and 9 deletions

View File

@ -48,12 +48,17 @@ public class HeightMapMCAGenerator implements Extent {
private boolean modifiedMain = false;
public HeightMapMCAGenerator(BufferedImage img, File regionFolder) {
this(img.getWidth(), img.getHeight(), regionFolder);
setHeight(img);
}
public HeightMapMCAGenerator(int width, int length, File regionFolder) {
if (!regionFolder.exists()) {
regionFolder.mkdirs();
}
this.folder = regionFolder;
this.width = img.getWidth();
this.length = img.getHeight();
this.width = width;
this.length = length;
this.area = width * length;
heights = new byte[area];
biomes = new byte[area];
@ -63,6 +68,9 @@ public class HeightMapMCAGenerator implements Extent {
char grass = (char) FaweCache.getCombined(2, 0);
Arrays.fill(main, stone);
Arrays.fill(floor, grass);
}
public void setHeight(BufferedImage img) {
int index = 0;
for (int z = 0; z < length; z++) {
for (int x = 0; x < width; x++, index++){

View File

@ -308,14 +308,18 @@ public class SchematicCommands {
)
@CommandPermissions("worldedit.schematic.list")
public void list(Actor actor, CommandContext args, @Switch('p') @Optional("1") int page) throws WorldEditException {
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS) {
}
File dir = worldEdit.getWorkingDirectoryFile(worldEdit.getConfiguration().saveDir);
List<File> fileList = allFiles(dir, true);
if (fileList == null || fileList.isEmpty()) {
List<File> fileList = new ArrayList<>();
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS) {
File playerDir = new File(dir, actor.getUniqueId().toString());
if (playerDir.exists()) {
fileList.addAll(allFiles(playerDir, true));
}
fileList.addAll(allFiles(dir, false));
} else {
fileList.addAll(allFiles(dir, true));
}
if (fileList.isEmpty()) {
BBC.SCHEMATIC_NONE.send(actor);
return;
}