mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-10-31 17:43:44 +01:00 
			
		
		
		
	Fix my stupid mistake of using lamdas not creating nested classes when creating schematics. "this" doesn't work like that. Cheers Java.
This commit is contained in:
		| @@ -130,8 +130,7 @@ public abstract class SchematicHandler { | ||||
|                     name = | ||||
|                         plot.getId().x + ";" + plot.getId().y + ',' + plot.getArea() + ',' + owner; | ||||
|                 } else { | ||||
|                     name = namingScheme | ||||
|                         .replaceAll("%id%", plot.getId().toString()) | ||||
|                     name = namingScheme.replaceAll("%id%", plot.getId().toString()) | ||||
|                         .replaceAll("%idx%", plot.getId().x + "") | ||||
|                         .replaceAll("%idy%", plot.getId().y + "") | ||||
|                         .replaceAll("%world%", plot.getArea().toString()); | ||||
| @@ -566,34 +565,42 @@ public abstract class SchematicHandler { | ||||
|                     final int p2z = pos2.getZ(); | ||||
|                     final int ey = pos2.getY(); | ||||
|                     Iterator<Integer> yiter = IntStream.range(sy, ey + 1).iterator(); | ||||
|                     final Runnable yTask = () -> { | ||||
|                     final Runnable yTask = new Runnable() { | ||||
|                         @Override public void run() { | ||||
|                             long ystart = System.currentTimeMillis(); | ||||
|                             while (yiter.hasNext() && System.currentTimeMillis() - ystart < 20) { | ||||
|                                 final int y = yiter.next(); | ||||
|                                 Iterator<Integer> ziter = IntStream.range(p1z, p2z + 1).iterator(); | ||||
|                             final Runnable zTask = () -> { | ||||
|                                 final Runnable zTask = new Runnable() { | ||||
|                                     @Override public void run() { | ||||
|                                         long zstart = System.currentTimeMillis(); | ||||
|                                         while (ziter.hasNext() | ||||
|                                             && System.currentTimeMillis() - zstart < 20) { | ||||
|                                             final int z = ziter.next(); | ||||
|                                             Iterator<Integer> xiter = | ||||
|                                                 IntStream.range(p1x, p2x + 1).iterator(); | ||||
|                                     final Runnable xTask = () -> { | ||||
|                                             final Runnable xTask = new Runnable() { | ||||
|                                                 @Override public void run() { | ||||
|                                                     long xstart = System.currentTimeMillis(); | ||||
|                                                     final int ry = y - sy; | ||||
|                                                     final int rz = z - p1z; | ||||
|                                                     while (xiter.hasNext() | ||||
|                                             && System.currentTimeMillis() - xstart < 20) { | ||||
|                                                         && System.currentTimeMillis() - xstart | ||||
|                                                         < 20) { | ||||
|                                                         final int x = xiter.next(); | ||||
|                                                         final int rx = x - p1x; | ||||
|                                             BlockVector3 point = BlockVector3.at(x, y, z); | ||||
|                                             BaseBlock block = | ||||
|                                                 cuboidRegion.getWorld().getFullBlock(point); | ||||
|                                                         BlockVector3 point = | ||||
|                                                             BlockVector3.at(x, y, z); | ||||
|                                                         BaseBlock block = cuboidRegion.getWorld() | ||||
|                                                             .getFullBlock(point); | ||||
|                                                         if (block.getNbtData() != null) { | ||||
|                                                 Map<String, Tag> values = new HashMap<>(); | ||||
|                                                             Map<String, Tag> values = | ||||
|                                                                 new HashMap<>(); | ||||
|                                                             for (Map.Entry<String, Tag> entry : block | ||||
|                                                     .getNbtData().getValue().entrySet()) { | ||||
|                                                     values.put(entry.getKey(), entry.getValue()); | ||||
|                                                                 .getNbtData().getValue() | ||||
|                                                                 .entrySet()) { | ||||
|                                                                 values.put(entry.getKey(), | ||||
|                                                                     entry.getValue()); | ||||
|                                                             } | ||||
|                                                             // Remove 'id' if it exists. We want 'Id' | ||||
|                                                             values.remove("id"); | ||||
| @@ -603,11 +610,13 @@ public abstract class SchematicHandler { | ||||
|                                                             values.remove("y"); | ||||
|                                                             values.remove("z"); | ||||
|  | ||||
|                                                 values.put("Id", new StringTag(block.getNbtId())); | ||||
|                                                 values.put("Pos", | ||||
|                                                     new IntArrayTag(new int[] {rx, ry, rz})); | ||||
|                                                             values.put("Id", | ||||
|                                                                 new StringTag(block.getNbtId())); | ||||
|                                                             values.put("Pos", new IntArrayTag( | ||||
|                                                                 new int[] {rx, ry, rz})); | ||||
|  | ||||
|                                                 tileEntities.add(new CompoundTag(values)); | ||||
|                                                             tileEntities | ||||
|                                                                 .add(new CompoundTag(values)); | ||||
|                                                         } | ||||
|                                                         String blockKey = | ||||
|                                                             block.toImmutableState().getAsString(); | ||||
| @@ -629,7 +638,8 @@ public abstract class SchematicHandler { | ||||
|                                                             continue; | ||||
|                                                         } | ||||
|                                                         BlockVector2 pt = BlockVector2.at(x, z); | ||||
|                                             BiomeType biome = cuboidRegion.getWorld().getBiome(pt); | ||||
|                                                         BiomeType biome = | ||||
|                                                             cuboidRegion.getWorld().getBiome(pt); | ||||
|                                                         String biomeStr = biome.getId(); | ||||
|                                                         int biomeId; | ||||
|                                                         if (biomePalette.containsKey(biomeStr)) { | ||||
| @@ -647,12 +657,14 @@ public abstract class SchematicHandler { | ||||
|                                                     if (xiter.hasNext()) { | ||||
|                                                         this.run(); | ||||
|                                                     } | ||||
|                                                 } | ||||
|                                             }; | ||||
|                                             xTask.run(); | ||||
|                                         } | ||||
|                                         if (ziter.hasNext()) { | ||||
|                                             this.run(); | ||||
|                                         } | ||||
|                                     } | ||||
|                                 }; | ||||
|                                 zTask.run(); | ||||
|                             } | ||||
| @@ -661,6 +673,7 @@ public abstract class SchematicHandler { | ||||
|                             } else { | ||||
|                                 regionTask.run(); | ||||
|                             } | ||||
|                         } | ||||
|                     }; | ||||
|                     yTask.run(); | ||||
|                 } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 dordsor21
					dordsor21