|
25 | 25 | } |
26 | 26 | } catch (Throwable var8) { |
27 | 27 | CrashReport crashReport = CrashReport.forThrowable(var8, "Executing command block"); |
| 28 | +@@ -133,9 +_,8 @@ |
| 29 | + } |
| 30 | + } |
| 31 | + |
| 32 | +- @Nullable |
| 33 | +- private BaseCommandBlock.CloseableCommandBlockSource createSource() { |
| 34 | +- return this.trackOutput ? new BaseCommandBlock.CloseableCommandBlockSource() : null; |
| 35 | ++ public BaseCommandBlock.CloseableCommandBlockSource createSource() { // Paper - public, remove nullable |
| 36 | ++ return new BaseCommandBlock.CloseableCommandBlockSource(this.trackOutput); // Paper - add back source when output disabled |
| 37 | + } |
| 38 | + |
| 39 | + public Component getName() { |
28 | 40 | @@ -168,7 +_,7 @@ |
29 | 41 | } |
30 | 42 |
|
|
34 | 46 | return InteractionResult.PASS; |
35 | 47 | } else { |
36 | 48 | if (player.level().isClientSide()) { |
37 | | -@@ -185,7 +_,7 @@ |
| 49 | +@@ -185,10 +_,21 @@ |
38 | 50 |
|
39 | 51 | public abstract boolean isValid(); |
40 | 52 |
|
|
43 | 55 | private static final DateTimeFormatter TIME_FORMAT = DateTimeFormatter.ofPattern("HH:mm:ss", Locale.ROOT); |
44 | 56 | private boolean closed; |
45 | 57 |
|
46 | | -@@ -207,6 +_,7 @@ |
| 58 | ++ // Paper start - add back source when output disabled |
| 59 | ++ private final boolean trackOutput; |
| 60 | ++ public CloseableCommandBlockSource(final boolean trackOutput) { |
| 61 | ++ this.trackOutput = trackOutput; |
| 62 | ++ } |
| 63 | ++ @io.papermc.paper.annotation.DoNotUse @Deprecated |
| 64 | ++ public CloseableCommandBlockSource() { |
| 65 | ++ this(true); |
| 66 | ++ } |
| 67 | ++ // Paper end - add back source when output disabled |
| 68 | ++ |
| 69 | + @Override |
| 70 | + public boolean acceptsSuccess() { |
| 71 | + return !this.closed && BaseCommandBlock.this.getLevel().getGameRules().getBoolean(GameRules.RULE_SENDCOMMANDFEEDBACK); |
| 72 | +@@ -196,7 +_,7 @@ |
| 73 | + |
| 74 | + @Override |
| 75 | + public boolean acceptsFailure() { |
| 76 | +- return !this.closed; |
| 77 | ++ return this.trackOutput && !this.closed; // Paper - add back source when output disabled |
| 78 | + } |
| 79 | + |
| 80 | + @Override |
| 81 | +@@ -206,7 +_,8 @@ |
| 82 | + |
47 | 83 | @Override |
48 | 84 | public void sendSystemMessage(Component message) { |
49 | | - if (!this.closed) { |
| 85 | +- if (!this.closed) { |
| 86 | ++ if (this.trackOutput && !this.closed) { // Paper - add back source when output disabled |
50 | 87 | + org.spigotmc.AsyncCatcher.catchOp("sendSystemMessage to a command block"); // Paper - Don't broadcast messages to command blocks |
51 | 88 | BaseCommandBlock.this.lastOutput = Component.literal("[" + TIME_FORMAT.format(ZonedDateTime.now()) + "] ").append(message); |
52 | 89 | BaseCommandBlock.this.onUpdated(); |
|
0 commit comments