From 4fc2a25a9afd9c26f94cb5eca927d0666315b9d7 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sat, 16 Jul 2022 11:08:42 +0200 Subject: [PATCH] Update Upstream d7b3c4c Clone the returned getRegion on BlockArrayClipboard (2144) --- .../extent/clipboard/BlockArrayClipboard.java | 2 +- .../worldedit/internal/util/ErrorReporting.java | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java index ce935754f..7b6be41d2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java @@ -138,7 +138,7 @@ public class BlockArrayClipboard implements Clipboard { @Override public Region getRegion() { - return region; + return region.clone(); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/ErrorReporting.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/ErrorReporting.java index fa5b95868..34d44b3e0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/ErrorReporting.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/ErrorReporting.java @@ -29,15 +29,17 @@ import com.sk89q.worldedit.util.formatting.text.event.HoverEvent; * Simple class for handling error reporting to users. */ public class ErrorReporting { + private ErrorReporting() { } public static void trigger(Actor actor, Throwable error) { actor.printError(Caption.of("worldedit.command.error.report")); - actor.print( - TextComponent.builder(error.getClass().getName() + ": " + error.getMessage()) - .hoverEvent(HoverEvent.showText(TextComponent.of(Throwables.getStackTraceAsString(error)))) - .build() - ); + TextComponent.Builder errorBuilder = TextComponent.builder(error.getClass().getName() + ": " + error.getMessage()); + if (actor.hasPermission("worldedit.error.detailed")) { + errorBuilder = errorBuilder.hoverEvent(HoverEvent.showText(TextComponent.of(Throwables.getStackTraceAsString(error)))); + } + actor.print(errorBuilder.build()); } + }