1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
|
--- a/net/minecraft/commands/CommandSourceStack.java
+++ b/net/minecraft/commands/CommandSourceStack.java
@@ -1,7 +1,6 @@
package net.minecraft.commands;
import com.google.common.collect.Lists;
-import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.Message;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.exceptions.CommandExceptionType;
@@ -10,6 +9,7 @@
import com.mojang.brigadier.suggestion.Suggestions;
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import java.util.Collection;
+import java.util.Iterator;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
@@ -26,6 +26,7 @@
import net.minecraft.network.chat.ChatType;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.ComponentUtils;
+import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.OutgoingChatMessage;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
@@ -42,11 +43,13 @@
import net.minecraft.world.level.dimension.DimensionType;
import net.minecraft.world.phys.Vec2;
import net.minecraft.world.phys.Vec3;
+import com.mojang.brigadier.tree.CommandNode; // CraftBukkit
public class CommandSourceStack implements ExecutionCommandSource<CommandSourceStack>, SharedSuggestionProvider {
+
public static final SimpleCommandExceptionType ERROR_NOT_PLAYER = new SimpleCommandExceptionType(Component.translatable("permissions.requires.player"));
public static final SimpleCommandExceptionType ERROR_NOT_ENTITY = new SimpleCommandExceptionType(Component.translatable("permissions.requires.entity"));
- private final CommandSource source;
+ public final CommandSource source;
private final Vec3 worldPosition;
private final ServerLevel level;
private final int permissionLevel;
@@ -61,285 +64,80 @@
private final Vec2 rotation;
private final CommandSigningContext signingContext;
private final TaskChainer chatMessageChainer;
+ public volatile CommandNode currentCommand; // CraftBukkit
- public CommandSourceStack(
- CommandSource source,
- Vec3 worldPosition,
- Vec2 rotation,
- ServerLevel level,
- int permissionLevel,
- String textName,
- Component displayName,
- MinecraftServer server,
- @Nullable Entity entity
- ) {
- this(
- source,
- worldPosition,
- rotation,
- level,
- permissionLevel,
- textName,
- displayName,
- server,
- entity,
- false,
- CommandResultCallback.EMPTY,
- EntityAnchorArgument.Anchor.FEET,
- CommandSigningContext.ANONYMOUS,
- TaskChainer.immediate(server)
- );
+ public CommandSourceStack(CommandSource source, Vec3 worldPosition, Vec2 rotation, ServerLevel level, int permissionLevel, String textName, Component displayName, MinecraftServer server, @Nullable Entity entity) {
+ this(source, worldPosition, rotation, level, permissionLevel, textName, displayName, server, entity, false, CommandResultCallback.EMPTY, EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(server));
}
- protected CommandSourceStack(
- CommandSource commandSource,
- Vec3 vec3,
- Vec2 vec2,
- ServerLevel serverLevel,
- int i,
- String string,
- Component component,
- MinecraftServer minecraftServer,
- @Nullable Entity entity,
- boolean flag,
- CommandResultCallback commandResultCallback,
- EntityAnchorArgument.Anchor anchor,
- CommandSigningContext commandSigningContext,
- TaskChainer taskChainer
- ) {
- this.source = commandSource;
- this.worldPosition = vec3;
- this.level = serverLevel;
+ protected CommandSourceStack(CommandSource icommandlistener, Vec3 vec3d, Vec2 vec2f, ServerLevel worldserver, int i, String s, Component ichatbasecomponent, MinecraftServer minecraftserver, @Nullable Entity entity, boolean flag, CommandResultCallback commandresultcallback, EntityAnchorArgument.Anchor argumentanchor_anchor, CommandSigningContext commandsigningcontext, TaskChainer taskchainer) {
+ this.source = icommandlistener;
+ this.worldPosition = vec3d;
+ this.level = worldserver;
this.silent = flag;
this.entity = entity;
this.permissionLevel = i;
- this.textName = string;
- this.displayName = component;
- this.server = minecraftServer;
- this.resultCallback = commandResultCallback;
- this.anchor = anchor;
- this.rotation = vec2;
- this.signingContext = commandSigningContext;
- this.chatMessageChainer = taskChainer;
+ this.textName = s;
+ this.displayName = ichatbasecomponent;
+ this.server = minecraftserver;
+ this.resultCallback = commandresultcallback;
+ this.anchor = argumentanchor_anchor;
+ this.rotation = vec2f;
+ this.signingContext = commandsigningcontext;
+ this.chatMessageChainer = taskchainer;
}
public CommandSourceStack withSource(CommandSource source) {
- return this.source == source
- ? this
- : new CommandSourceStack(
- source,
- this.worldPosition,
- this.rotation,
- this.level,
- this.permissionLevel,
- this.textName,
- this.displayName,
- this.server,
- this.entity,
- this.silent,
- this.resultCallback,
- this.anchor,
- this.signingContext,
- this.chatMessageChainer
- );
+ return this.source == source ? this : new CommandSourceStack(source, this.worldPosition, this.rotation, this.level, this.permissionLevel, this.textName, this.displayName, this.server, this.entity, this.silent, this.resultCallback, this.anchor, this.signingContext, this.chatMessageChainer);
}
public CommandSourceStack withEntity(Entity entity) {
- return this.entity == entity
- ? this
- : new CommandSourceStack(
- this.source,
- this.worldPosition,
- this.rotation,
- this.level,
- this.permissionLevel,
- entity.getName().getString(),
- entity.getDisplayName(),
- this.server,
- entity,
- this.silent,
- this.resultCallback,
- this.anchor,
- this.signingContext,
- this.chatMessageChainer
- );
+ return this.entity == entity ? this : new CommandSourceStack(this.source, this.worldPosition, this.rotation, this.level, this.permissionLevel, entity.getName().getString(), entity.getDisplayName(), this.server, entity, this.silent, this.resultCallback, this.anchor, this.signingContext, this.chatMessageChainer);
}
public CommandSourceStack withPosition(Vec3 pos) {
- return this.worldPosition.equals(pos)
- ? this
- : new CommandSourceStack(
- this.source,
- pos,
- this.rotation,
- this.level,
- this.permissionLevel,
- this.textName,
- this.displayName,
- this.server,
- this.entity,
- this.silent,
- this.resultCallback,
- this.anchor,
- this.signingContext,
- this.chatMessageChainer
- );
+ return this.worldPosition.equals(pos) ? this : new CommandSourceStack(this.source, pos, this.rotation, this.level, this.permissionLevel, this.textName, this.displayName, this.server, this.entity, this.silent, this.resultCallback, this.anchor, this.signingContext, this.chatMessageChainer);
}
public CommandSourceStack withRotation(Vec2 rotation) {
- return this.rotation.equals(rotation)
- ? this
- : new CommandSourceStack(
- this.source,
- this.worldPosition,
- rotation,
- this.level,
- this.permissionLevel,
- this.textName,
- this.displayName,
- this.server,
- this.entity,
- this.silent,
- this.resultCallback,
- this.anchor,
- this.signingContext,
- this.chatMessageChainer
- );
+ return this.rotation.equals(rotation) ? this : new CommandSourceStack(this.source, this.worldPosition, rotation, this.level, this.permissionLevel, this.textName, this.displayName, this.server, this.entity, this.silent, this.resultCallback, this.anchor, this.signingContext, this.chatMessageChainer);
}
@Override
- public CommandSourceStack withCallback(CommandResultCallback commandResultCallback) {
- return Objects.equals(this.resultCallback, commandResultCallback)
- ? this
- : new CommandSourceStack(
- this.source,
- this.worldPosition,
- this.rotation,
- this.level,
- this.permissionLevel,
- this.textName,
- this.displayName,
- this.server,
- this.entity,
- this.silent,
- commandResultCallback,
- this.anchor,
- this.signingContext,
- this.chatMessageChainer
- );
+ public CommandSourceStack withCallback(CommandResultCallback commandresultcallback) {
+ return Objects.equals(this.resultCallback, commandresultcallback) ? this : new CommandSourceStack(this.source, this.worldPosition, this.rotation, this.level, this.permissionLevel, this.textName, this.displayName, this.server, this.entity, this.silent, commandresultcallback, this.anchor, this.signingContext, this.chatMessageChainer);
}
- public CommandSourceStack withCallback(CommandResultCallback commandResultCallback, BinaryOperator<CommandResultCallback> binaryOperator) {
- CommandResultCallback commandResultCallback1 = binaryOperator.apply(this.resultCallback, commandResultCallback);
- return this.withCallback(commandResultCallback1);
+ public CommandSourceStack withCallback(CommandResultCallback commandresultcallback, BinaryOperator<CommandResultCallback> binaryoperator) {
+ CommandResultCallback commandresultcallback1 = (CommandResultCallback) binaryoperator.apply(this.resultCallback, commandresultcallback);
+
+ return this.withCallback(commandresultcallback1);
}
public CommandSourceStack withSuppressedOutput() {
- return !this.silent && !this.source.alwaysAccepts()
- ? new CommandSourceStack(
- this.source,
- this.worldPosition,
- this.rotation,
- this.level,
- this.permissionLevel,
- this.textName,
- this.displayName,
- this.server,
- this.entity,
- true,
- this.resultCallback,
- this.anchor,
- this.signingContext,
- this.chatMessageChainer
- )
- : this;
+ return !this.silent && !this.source.alwaysAccepts() ? new CommandSourceStack(this.source, this.worldPosition, this.rotation, this.level, this.permissionLevel, this.textName, this.displayName, this.server, this.entity, true, this.resultCallback, this.anchor, this.signingContext, this.chatMessageChainer) : this;
}
public CommandSourceStack withPermission(int permissionLevel) {
- return permissionLevel == this.permissionLevel
- ? this
- : new CommandSourceStack(
- this.source,
- this.worldPosition,
- this.rotation,
- this.level,
- permissionLevel,
- this.textName,
- this.displayName,
- this.server,
- this.entity,
- this.silent,
- this.resultCallback,
- this.anchor,
- this.signingContext,
- this.chatMessageChainer
- );
+ return permissionLevel == this.permissionLevel ? this : new CommandSourceStack(this.source, this.worldPosition, this.rotation, this.level, permissionLevel, this.textName, this.displayName, this.server, this.entity, this.silent, this.resultCallback, this.anchor, this.signingContext, this.chatMessageChainer);
}
public CommandSourceStack withMaximumPermission(int permissionLevel) {
- return permissionLevel <= this.permissionLevel
- ? this
- : new CommandSourceStack(
- this.source,
- this.worldPosition,
- this.rotation,
- this.level,
- permissionLevel,
- this.textName,
- this.displayName,
- this.server,
- this.entity,
- this.silent,
- this.resultCallback,
- this.anchor,
- this.signingContext,
- this.chatMessageChainer
- );
+ return permissionLevel <= this.permissionLevel ? this : new CommandSourceStack(this.source, this.worldPosition, this.rotation, this.level, permissionLevel, this.textName, this.displayName, this.server, this.entity, this.silent, this.resultCallback, this.anchor, this.signingContext, this.chatMessageChainer);
}
public CommandSourceStack withAnchor(EntityAnchorArgument.Anchor anchor) {
- return anchor == this.anchor
- ? this
- : new CommandSourceStack(
- this.source,
- this.worldPosition,
- this.rotation,
- this.level,
- this.permissionLevel,
- this.textName,
- this.displayName,
- this.server,
- this.entity,
- this.silent,
- this.resultCallback,
- anchor,
- this.signingContext,
- this.chatMessageChainer
- );
+ return anchor == this.anchor ? this : new CommandSourceStack(this.source, this.worldPosition, this.rotation, this.level, this.permissionLevel, this.textName, this.displayName, this.server, this.entity, this.silent, this.resultCallback, anchor, this.signingContext, this.chatMessageChainer);
}
public CommandSourceStack withLevel(ServerLevel level) {
if (level == this.level) {
return this;
} else {
- double teleportationScale = DimensionType.getTeleportationScale(this.level.dimensionType(), level.dimensionType());
- Vec3 vec3 = new Vec3(this.worldPosition.x * teleportationScale, this.worldPosition.y, this.worldPosition.z * teleportationScale);
- return new CommandSourceStack(
- this.source,
- vec3,
- this.rotation,
- level,
- this.permissionLevel,
- this.textName,
- this.displayName,
- this.server,
- this.entity,
- this.silent,
- this.resultCallback,
- this.anchor,
- this.signingContext,
- this.chatMessageChainer
- );
+ double d0 = DimensionType.getTeleportationScale(this.level.dimensionType(), level.dimensionType());
+ Vec3 vec3d = new Vec3(this.worldPosition.x * d0, this.worldPosition.y, this.worldPosition.z * d0);
+
+ return new CommandSourceStack(this.source, vec3d, this.rotation, level, this.permissionLevel, this.textName, this.displayName, this.server, this.entity, this.silent, this.resultCallback, this.anchor, this.signingContext, this.chatMessageChainer);
}
}
@@ -348,35 +146,19 @@
}
public CommandSourceStack facing(Vec3 lookPos) {
- Vec3 vec3 = this.anchor.apply(this);
- double d = lookPos.x - vec3.x;
- double d1 = lookPos.y - vec3.y;
- double d2 = lookPos.z - vec3.z;
- double squareRoot = Math.sqrt(d * d + d2 * d2);
- float f = Mth.wrapDegrees((float)(-(Mth.atan2(d1, squareRoot) * 180.0F / (float)Math.PI)));
- float f1 = Mth.wrapDegrees((float)(Mth.atan2(d2, d) * 180.0F / (float)Math.PI) - 90.0F);
+ Vec3 vec3d1 = this.anchor.apply(this);
+ double d0 = lookPos.x - vec3d1.x;
+ double d1 = lookPos.y - vec3d1.y;
+ double d2 = lookPos.z - vec3d1.z;
+ double d3 = Math.sqrt(d0 * d0 + d2 * d2);
+ float f = Mth.wrapDegrees((float) (-(Mth.atan2(d1, d3) * 57.2957763671875D)));
+ float f1 = Mth.wrapDegrees((float) (Mth.atan2(d2, d0) * 57.2957763671875D) - 90.0F);
+
return this.withRotation(new Vec2(f, f1));
}
- public CommandSourceStack withSigningContext(CommandSigningContext commandSigningContext, TaskChainer taskChainer) {
- return commandSigningContext == this.signingContext && taskChainer == this.chatMessageChainer
- ? this
- : new CommandSourceStack(
- this.source,
- this.worldPosition,
- this.rotation,
- this.level,
- this.permissionLevel,
- this.textName,
- this.displayName,
- this.server,
- this.entity,
- this.silent,
- this.resultCallback,
- this.anchor,
- commandSigningContext,
- taskChainer
- );
+ public CommandSourceStack withSigningContext(CommandSigningContext commandsigningcontext, TaskChainer taskchainer) {
+ return commandsigningcontext == this.signingContext && taskchainer == this.chatMessageChainer ? this : new CommandSourceStack(this.source, this.worldPosition, this.rotation, this.level, this.permissionLevel, this.textName, this.displayName, this.server, this.entity, this.silent, this.resultCallback, this.anchor, commandsigningcontext, taskchainer);
}
public Component getDisplayName() {
@@ -389,9 +171,23 @@
@Override
public boolean hasPermission(int level) {
+ // CraftBukkit start
+ CommandNode currentCommand = this.currentCommand;
+ if (currentCommand != null) {
+ return hasPermission(level, org.bukkit.craftbukkit.command.VanillaCommandWrapper.getPermission(currentCommand));
+ }
+ // CraftBukkit end
+
return this.permissionLevel >= level;
}
+ // CraftBukkit start
+ public boolean hasPermission(int i, String bukkitPermission) {
+ // World is null when loading functions
+ return ((getLevel() == null || !getLevel().getCraftServer().ignoreVanillaPermissions) && this.permissionLevel >= i) || getBukkitSender().hasPermission(bukkitPermission);
+ }
+ // CraftBukkit end
+
public Vec3 getPosition() {
return this.worldPosition;
}
@@ -407,24 +203,38 @@
public Entity getEntityOrException() throws CommandSyntaxException {
if (this.entity == null) {
- throw ERROR_NOT_ENTITY.create();
+ throw CommandSourceStack.ERROR_NOT_ENTITY.create();
} else {
return this.entity;
}
}
public ServerPlayer getPlayerOrException() throws CommandSyntaxException {
- Entity var2 = this.entity;
- if (var2 instanceof ServerPlayer) {
- return (ServerPlayer)var2;
+ Entity entity = this.entity;
+
+ if (entity instanceof ServerPlayer) {
+ ServerPlayer entityplayer = (ServerPlayer) entity;
+
+ return entityplayer;
} else {
- throw ERROR_NOT_PLAYER.create();
+ throw CommandSourceStack.ERROR_NOT_PLAYER.create();
}
}
@Nullable
public ServerPlayer getPlayer() {
- return this.entity instanceof ServerPlayer serverPlayer ? serverPlayer : null;
+ Entity entity = this.entity;
+ ServerPlayer entityplayer;
+
+ if (entity instanceof ServerPlayer) {
+ ServerPlayer entityplayer1 = (ServerPlayer) entity;
+
+ entityplayer = entityplayer1;
+ } else {
+ entityplayer = null;
+ }
+
+ return entityplayer;
}
public boolean isPlayer() {
@@ -452,66 +262,81 @@
}
public boolean shouldFilterMessageTo(ServerPlayer receiver) {
- ServerPlayer player = this.getPlayer();
- return receiver != player && (player != null && player.isTextFilteringEnabled() || receiver.isTextFilteringEnabled());
+ ServerPlayer entityplayer1 = this.getPlayer();
+
+ return receiver == entityplayer1 ? false : entityplayer1 != null && entityplayer1.isTextFilteringEnabled() || receiver.isTextFilteringEnabled();
}
public void sendChatMessage(OutgoingChatMessage message, boolean shouldFilter, ChatType.Bound boundChatType) {
if (!this.silent) {
- ServerPlayer player = this.getPlayer();
- if (player != null) {
- player.sendChatMessage(message, shouldFilter, boundChatType);
+ ServerPlayer entityplayer = this.getPlayer();
+
+ if (entityplayer != null) {
+ entityplayer.sendChatMessage(message, shouldFilter, boundChatType);
} else {
this.source.sendSystemMessage(boundChatType.decorate(message.content()));
}
+
}
}
public void sendSystemMessage(Component message) {
if (!this.silent) {
- ServerPlayer player = this.getPlayer();
- if (player != null) {
- player.sendSystemMessage(message);
+ ServerPlayer entityplayer = this.getPlayer();
+
+ if (entityplayer != null) {
+ entityplayer.sendSystemMessage(message);
} else {
this.source.sendSystemMessage(message);
}
+
}
}
public void sendSuccess(Supplier<Component> messageSupplier, boolean allowLogging) {
- boolean flag = this.source.acceptsSuccess() && !this.silent;
- boolean flag1 = allowLogging && this.source.shouldInformAdmins() && !this.silent;
- if (flag || flag1) {
- Component component = messageSupplier.get();
- if (flag) {
- this.source.sendSystemMessage(component);
- }
+ boolean flag1 = this.source.acceptsSuccess() && !this.silent;
+ boolean flag2 = allowLogging && this.source.shouldInformAdmins() && !this.silent;
+ if (flag1 || flag2) {
+ Component ichatbasecomponent = (Component) messageSupplier.get();
+
if (flag1) {
- this.broadcastToAdmins(component);
+ this.source.sendSystemMessage(ichatbasecomponent);
}
+
+ if (flag2) {
+ this.broadcastToAdmins(ichatbasecomponent);
+ }
+
}
}
private void broadcastToAdmins(Component message) {
- Component component = Component.translatable("chat.type.admin", this.getDisplayName(), message).withStyle(ChatFormatting.GRAY, ChatFormatting.ITALIC);
+ MutableComponent ichatmutablecomponent = Component.translatable("chat.type.admin", this.getDisplayName(), message).withStyle(ChatFormatting.GRAY, ChatFormatting.ITALIC);
+
if (this.server.getGameRules().getBoolean(GameRules.RULE_SENDCOMMANDFEEDBACK)) {
- for (ServerPlayer serverPlayer : this.server.getPlayerList().getPlayers()) {
- if (serverPlayer != this.source && this.server.getPlayerList().isOp(serverPlayer.getGameProfile())) {
- serverPlayer.sendSystemMessage(component);
+ Iterator iterator = this.server.getPlayerList().getPlayers().iterator();
+
+ while (iterator.hasNext()) {
+ ServerPlayer entityplayer = (ServerPlayer) iterator.next();
+
+ if (entityplayer != this.source && entityplayer.getBukkitEntity().hasPermission("minecraft.admin.command_feedback")) { // CraftBukkit
+ entityplayer.sendSystemMessage(ichatmutablecomponent);
}
}
}
if (this.source != this.server && this.server.getGameRules().getBoolean(GameRules.RULE_LOGADMINCOMMANDS)) {
- this.server.sendSystemMessage(component);
+ this.server.sendSystemMessage(ichatmutablecomponent);
}
+
}
public void sendFailure(Component message) {
if (this.source.acceptsFailure() && !this.silent) {
this.source.sendSystemMessage(Component.empty().append(message).withStyle(ChatFormatting.RED));
}
+
}
@Override
@@ -545,14 +370,9 @@
}
@Override
- public CompletableFuture<Suggestions> suggestRegistryElements(
- ResourceKey<? extends Registry<?>> resourceKey,
- SharedSuggestionProvider.ElementSuggestionType registryKey,
- SuggestionsBuilder builder,
- CommandContext<?> context
- ) {
- return this.registryAccess().registry(resourceKey).map(registry -> {
- this.suggestRegistryElements((Registry<?>)registry, registryKey, builder);
+ public CompletableFuture<Suggestions> suggestRegistryElements(ResourceKey<? extends Registry<?>> resourceKey, SharedSuggestionProvider.a registryKey, SuggestionsBuilder builder, CommandContext<?> context) {
+ return (CompletableFuture) this.registryAccess().registry(resourceKey).map((iregistry) -> {
+ this.suggestRegistryElements(iregistry, registryKey, builder);
return builder.buildFuture();
}).orElseGet(Suggestions::empty);
}
@@ -573,23 +393,30 @@
}
@Override
- public CommandDispatcher<CommandSourceStack> dispatcher() {
+ public com.mojang.brigadier.CommandDispatcher<CommandSourceStack> dispatcher() {
return this.getServer().getFunctions().getDispatcher();
}
@Override
- public void handleError(CommandExceptionType commandExceptionType, Message message, boolean flag, @Nullable TraceCallbacks traceCallbacks) {
- if (traceCallbacks != null) {
- traceCallbacks.onError(message.getString());
+ public void handleError(CommandExceptionType commandexceptiontype, Message message, boolean flag, @Nullable TraceCallbacks tracecallbacks) {
+ if (tracecallbacks != null) {
+ tracecallbacks.onError(message.getString());
}
if (!flag) {
this.sendFailure(ComponentUtils.fromMessage(message));
}
+
}
@Override
public boolean isSilent() {
return this.silent;
}
+
+ // CraftBukkit start
+ public org.bukkit.command.CommandSender getBukkitSender() {
+ return source.getBukkitSender(this);
+ }
+ // CraftBukkit end
}
|