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

@@ -1,5 +1,7 @@
package io.papermc.paper.command.brigadier;
import com.mojang.brigadier.RedirectModifier;
import com.mojang.brigadier.tree.CommandNode;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
@@ -48,4 +50,24 @@ public interface CommandSourceStack {
* @return entity that executes this command
*/
@Nullable Entity getExecutor();
/**
* Creates a new CommandSourceStack object with a different location for redirecting commands to other nodes.
*
* @param location The location to create a new CommandSourceStack object with
* @return The newly created CommandSourceStack
* @see #getLocation()
* @see com.mojang.brigadier.builder.ArgumentBuilder#fork(CommandNode, RedirectModifier)
*/
CommandSourceStack withLocation(Location location);
/**
* Creates a new CommandSourceStack object with a different executor for redirecting commands to other nodes.
*
* @param executor The executing entity to create a new CommandSourceStack object with
* @return The newly created CommandSourceStack
* @see #getExecutor()
* @see com.mojang.brigadier.builder.ArgumentBuilder#fork(CommandNode, RedirectModifier)
*/
CommandSourceStack withExecutor(Entity executor);
}