@@ -153,21 +153,16 @@ private void runStructurePrinter() {
153153 * Build something in the queue. Structures are built one by one
154154 */
155155 private void buildStructure () {
156- //BentoBox.getInstance().logDebug("buildStructure");
157156 // Only kick off a build if there is something to build and something isn't
158157 // already being built
159158 if (!pasting && !itemsToBuild .isEmpty ()) {
160159 // Build item
161- //BentoBox.getInstance().logDebug("Build item");
162160 StructureRecord item = itemsToBuild .poll ();
163161 placeStructure (item );
164- } else {
165- //BentoBox.getInstance().logDebug("Nothing to do");
166162 }
167163 }
168164
169165 private void placeStructure (StructureRecord item ) {
170- //BentoBox.getInstance().logDebug("Placing structure");
171166 // Set the semaphore - only paste one at a time
172167 pasting = true ;
173168 // Place the structure - this cannot be done async
@@ -231,14 +226,13 @@ public void onChunkLoad(ChunkLoadEvent e) {
231226 if (!(addon .inWorld (chunk .getWorld ()))) {
232227 return ;
233228 }
234- //BentoBox.getInstance().logDebug(e.getEventName());
235229 Pair <Integer , Integer > chunkCoords = new Pair <Integer , Integer >(chunk .getX (), chunk .getZ ());
236230 if (pending .containsKey (chunkCoords )) {
237231 Iterator <StructureRecord > it = pending .get (chunkCoords ).iterator ();
238232 while (it .hasNext ()) {
239233 StructureRecord item = it .next ();
240234 if (item .location ().getWorld ().equals (e .getWorld ())) {
241- //BentoBox.getInstance().logDebug(" Placing structure in itemsToBuild " + item);
235+ // Placing structure in itemsToBuild
242236 this .itemsToBuild .add (item );
243237 it .remove ();
244238 }
@@ -247,8 +241,6 @@ public void onChunkLoad(ChunkLoadEvent e) {
247241 ToBePlacedStructures tbd = new ToBePlacedStructures ();
248242 tbd .setReadyToBuild (pending );
249243 toPlace .saveObjectAsync (tbd );
250- } else {
251- //BentoBox.getInstance().logDebug("Nothing to build in this chunk");
252244 }
253245 }
254246
@@ -394,10 +386,9 @@ private void place(ConfigurationSection section, Location center, Environment en
394386 int y = Integer .parseInt (coords [1 ].strip ());
395387 int z = Integer .parseInt (coords [2 ].strip ()) + center .getBlockZ ();
396388 Location location = new Location (world , x , y , z );
397- //BentoBox.getInstance().logDebug(" Structure " + name + " will be placed at " + location);
389+ // Structure will be placed at location
398390 readyToBuild .computeIfAbsent (new Pair <>(x >> 4 , z >> 4 ), k -> new ArrayList <>())
399- .add (new StructureRecord (name , "minecraft:" + name , location ,
400- rotation , mirror , noMobs ));
391+ .add (new StructureRecord (name , "minecraft:" + name , location , rotation , mirror , noMobs ));
401392 this .itemsToBuild
402393 .add (new StructureRecord (name , "minecraft:" + name , location , rotation , mirror , noMobs ));
403394 } else {
@@ -412,8 +403,6 @@ private void place(ConfigurationSection section, Location center, Environment en
412403 return list1 ;
413404 }));
414405
415- //BentoBox.getInstance().logDebug("mergedMap size = " + mergedMap.size());
416- //BentoBox.getInstance().logDebug("readyToBuild size = " + readyToBuild.size());
417406 // Save the list
418407 tbd .setReadyToBuild (mergedMap );
419408 toPlace .saveObjectAsync (tbd );
@@ -508,16 +497,20 @@ private static void processStructureBlock(Block b) {
508497 }
509498
510499 private static void processJigsaw (Block b , StructureRotation structureRotation , boolean pasteMobs ) {
511- String data = nmsData (b );
512- if (data .isEmpty ()) {
513- return ;
514- }
515- BoxedJigsawBlock bjb = gson .fromJson (data , BoxedJigsawBlock .class );
516- String finalState = correctDirection (bjb .getFinal_state (), structureRotation );
517- BlockData bd = Bukkit .createBlockData (finalState );
518- b .setBlockData (bd );
519- if (!bjb .getPool ().equalsIgnoreCase ("minecraft:empty" ) && pasteMobs ) {
520- spawnMob (b , bjb );
500+ try {
501+ String data = nmsData (b );
502+ if (data .isEmpty ()) {
503+ return ;
504+ }
505+ BoxedJigsawBlock bjb = gson .fromJson (data , BoxedJigsawBlock .class );
506+ String finalState = correctDirection (bjb .getFinal_state (), structureRotation );
507+ BlockData bd = Bukkit .createBlockData (finalState );
508+ b .setBlockData (bd );
509+ if (!bjb .getPool ().equalsIgnoreCase ("minecraft:empty" ) && pasteMobs ) {
510+ spawnMob (b , bjb );
511+ }
512+ } catch (Exception e ) {
513+ e .printStackTrace ();
521514 }
522515 }
523516
@@ -549,17 +542,12 @@ private static void spawnMob(Block b, BoxedJigsawBlock bjb) {
549542 } else if (bjb .getPool ().contains ("villagers" )) {
550543 type = EntityType .VILLAGER ;
551544 }
552- // if (type == null) {
553- // BentoBox.getInstance().logDebug(bjb.getPool());
554- // }
555545 // Spawn it
556546 if (type != null ) {
557547 Entity e = b .getWorld ().spawnEntity (b .getRelative (BlockFace .UP ).getLocation (), type );
558548 if (e != null ) {
559549 e .setPersistent (true );
560550 }
561- // BentoBox.getInstance().logDebug("Spawned a " + type + " at " +
562- // b.getRelative(BlockFace.UP).getLocation());
563551 }
564552 }
565553
@@ -646,12 +634,10 @@ private static String nmsData(Block block) {
646634
647635 private ToBePlacedStructures loadToDos () {
648636 if (!toPlace .objectExists (TODO )) {
649- //BentoBox.getInstance().logDebug("No TODO list");
650637 return new ToBePlacedStructures ();
651638 }
652639 ToBePlacedStructures list = toPlace .loadObject (TODO );
653640 if (list == null ) {
654- //BentoBox.getInstance().logDebug("TODO list is null");
655641 return new ToBePlacedStructures ();
656642 }
657643 if (!list .getReadyToBuild ().isEmpty ()) {
0 commit comments