Skip to content

Commit 707a91f

Browse files
committed
Log stack traces instead of showing them directly.
1 parent f8faa01 commit 707a91f

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/main/java/world/bentobox/bentobox/BentoBox.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public void onEnable(){
194194
completeSetup(loadTime);
195195
} catch (Exception e) {
196196
fireCriticalError(e.getMessage(), "");
197-
e.printStackTrace();
197+
logStacktrace(e);
198198
}
199199
});
200200
}

src/main/java/world/bentobox/bentobox/api/addons/Addon.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ public File saveResource(String jarResource, File destinationFolder, boolean rep
324324
"The embedded resource '" + jarResource + "' cannot be found in " + jar.getName());
325325
}
326326
} catch (IOException e) {
327-
e.printStackTrace();
327+
BentoBox.getInstance().logStacktrace(e);
328328
BentoBox.getInstance().logError(
329329
"Could not save from jar file. From " + jarResource + " to " + destinationFolder.getAbsolutePath());
330330
}

src/main/java/world/bentobox/bentobox/api/configuration/Config.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public T loadConfigObject(String uniqueId) {
6565
| ClassNotFoundException | IntrospectionException | NoSuchMethodException | SecurityException e) {
6666
BentoBox.getInstance().logError("Could not load config object! " + e.getMessage());
6767
// Required for debugging
68-
e.printStackTrace();
68+
BentoBox.getInstance().logStacktrace(e);
6969
}
7070

7171
return null;

src/main/java/world/bentobox/bentobox/nms/PasteHandlerImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import net.minecraft.world.level.block.state.BlockState; // New name for IBlockData
1313
import net.minecraft.world.level.chunk.LevelChunk; // New name for Chunk
1414
import net.minecraft.world.level.Level; // New name for net.minecraft.world.level.World
15-
15+
import world.bentobox.bentobox.BentoBox;
1616
// (Your other imports remain the same)
1717
import world.bentobox.bentobox.blueprints.dataobjects.BlueprintBlock;
1818
import world.bentobox.bentobox.database.objects.Island;
@@ -61,15 +61,15 @@ public Block setBlock(Location location, BlockData bd) {
6161
// Setting to air
6262
nmsChunk.setBlockState(bp, AIR, 0);
6363
} catch (Exception e) {
64-
e.printStackTrace();
64+
BentoBox.getInstance().logStacktrace(e);
6565
// Ignore
6666
}
6767

6868
try {
6969
// Setting the actual block
7070
nmsChunk.setBlockState(bp, nmsBlockState, 0);
7171
} catch (Exception e) {
72-
e.printStackTrace();
72+
BentoBox.getInstance().logStacktrace(e);
7373
// Ignore
7474
}
7575

@@ -78,7 +78,7 @@ public Block setBlock(Location location, BlockData bd) {
7878
try {
7979
block.setBlockData(bd, false);
8080
} catch (Exception e) {
81-
e.printStackTrace();
81+
BentoBox.getInstance().logStacktrace(e);
8282
// Ignore
8383
}
8484

src/main/java/world/bentobox/bentobox/util/Util.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,11 +485,11 @@ public static CompletableFuture<Chunk> getChunkAtAsync(@Nonnull World world, int
485485
return (CompletableFuture<Chunk>) method.invoke(world, x, z, gen);
486486
}
487487
} catch (NoSuchMethodException e) {
488-
// Method does not exist, fallback to Spigot behavior
488+
// Method does not exist, fallback to default behavior
489489
} catch (Exception e) {
490-
e.printStackTrace(); // Handle other exceptions (optional)
490+
BentoBox.getInstance().logStacktrace(e);
491491
}
492-
// Fallback for Spigot servers
492+
// Fallback
493493
return CompletableFuture.completedFuture(world.getChunkAt(x, z, gen));
494494

495495
}

0 commit comments

Comments
 (0)