Package appeng.api.networking.security
Interface IActionSource
public interface IActionSource
The source of any action.
This can either be a
Player
or an IActionHost
.
In most cases this is used for security checks, but can be used to validate the source itself.-
Method Summary
Modifier and TypeMethodDescription<T> Optional
<T> AnIActionSource
can have multiple optional contexts.static IActionSource
empty()
Create a new empty source.machine()
If present, it indicates theIActionHost
of the source.static IActionSource
ofMachine
(IActionHost machine) Create a source for a machine.static IActionSource
ofPlayer
(net.minecraft.world.entity.player.Player player) Create a source for a player.static IActionSource
ofPlayer
(net.minecraft.world.entity.player.Player player, @Nullable IActionHost maybeHost) Create a source for a player and optionally a machine too (the machine the request is happening through).Optional
<net.minecraft.world.entity.player.Player> player()
If present, AE will consider the player being the source for the action.
-
Method Details
-
empty
Create a new empty source. -
ofPlayer
Create a source for a player. -
ofPlayer
static IActionSource ofPlayer(net.minecraft.world.entity.player.Player player, @Nullable @Nullable IActionHost maybeHost) Create a source for a player and optionally a machine too (the machine the request is happening through). -
ofMachine
Create a source for a machine. -
player
Optional<net.minecraft.world.entity.player.Player> player()If present, AE will consider the player being the source for the action. This will take precedence overmachine()
in any case.- Returns:
- An optional player issuing the action.
-
machine
Optional<IActionHost> machine()If present, it indicates theIActionHost
of the source. Shouldplayer()
be absent, it will consider a machine as source. It is recommended to include the machine even when a player is present.- Returns:
- An optional machine issuing the action or acting as proxy for a player.
-
context
AnIActionSource
can have multiple optional contexts. It is strongly recommended to limit the uses for absolutely necessary cases. Currently there are no public contexts made available by AE. An example would be the context interfaces use internally to avoid looping items between each other.
-