@@ -77,6 +77,9 @@ public class BukkitPlayer extends AbstractPlayerActor {
7777 private final WorldEditPlugin plugin ;
7878 //FAWE start
7979 private final PermissionAttachment permAttachment ;
80+ // We require the StackWalker to show hidden frames, due to the usage of the c.sk89q.we...AsyncCommandBuilder in WorldGuard
81+ // (in that case, all WG references are hidden in lambdas and not shown in the default walker)
82+ private final StackWalker stackWalker = StackWalker .getInstance (StackWalker .Option .SHOW_HIDDEN_FRAMES );
8083
8184 /**
8285 * This constructs a new {@link BukkitPlayer} for the given {@link Player}.
@@ -222,7 +225,14 @@ public void printError(String msg) {
222225 @ Override
223226 public void print (Component component ) {
224227 //FAWE start - Add FAWE prefix to all messages
225- component = Caption .color (TranslatableComponent .of ("prefix" , component ), getLocale ());
228+ final boolean isWorldGuardCaller = stackWalker .walk (frames -> frames
229+ .dropWhile (frame -> frame .getClassName ().startsWith ("com.sk89q.worldedit" ))
230+ .takeWhile (frame -> !frame .getClassName ().startsWith ("org.bukkit" ))
231+ .filter (frame -> frame .getClassName ().startsWith ("com.sk89q.worldguard" ))
232+ .findFirst ()).isPresent ();
233+ if (!isWorldGuardCaller ) {
234+ component = Caption .color (TranslatableComponent .of ("prefix" , component ), getLocale ());
235+ }
226236 //FAWE end
227237 TextAdapter .sendMessage (player , WorldEditText .format (component , getLocale ()));
228238 }
0 commit comments