Feat: Add 'with' methods to CommandSourceStack (#11868)

This commit is contained in:
Strokkur24
2025-01-11 22:29:16 +01:00
committed by GitHub
parent c94922514a
commit c2f24e1567
4 changed files with 67 additions and 6 deletions

View File

@@ -18,6 +18,37 @@
public CommandSourceStack(
CommandSource source,
@@ -187,6 +_,30 @@
this.chatMessageChainer
);
}
+
+ // Paper start - Expose 'with' functions from the CommandSourceStack
+ @Override
+ public CommandSourceStack withLocation(org.bukkit.Location location) {
+ return this.getLocation().equals(location)
+ ? this
+ : new CommandSourceStack(
+ this.source,
+ new Vec3(location.x(), location.y(), location.z()),
+ new Vec2(location.getPitch(), location.getYaw()),
+ ((org.bukkit.craftbukkit.CraftWorld) location.getWorld()).getHandle(),
+ this.permissionLevel,
+ this.textName,
+ this.displayName,
+ this.server,
+ this.entity,
+ this.silent,
+ this.resultCallback,
+ this.anchor,
+ this.signingContext,
+ this.chatMessageChainer
+ );
+ }
+ // Paper end - Expose 'with' functions from the CommandSourceStack
public CommandSourceStack withRotation(Vec2 rotation) {
return this.rotation.equals(rotation)
@@ -391,9 +_,44 @@
@Override