Class PlayerApi
Player
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable FakePlayer
getFakePlayer
(String name) Get a previously cachedFakePlayer
static List
<FakePlayer> Get all fake playersstatic @NotNull net.minecraft.server.network.ServerGamePacketListenerImpl
getPlayerConnection
(@NotNull Player player) Get the Player's connection
Useful for sending packetsstatic void
sendPacket
(@NotNull Player player, @NotNull net.minecraft.network.protocol.Packet<?> packet) Send a Packet to aBukkit Player
static FakePlayer
spawnFakePlayer
(@NotNull String name, @NotNull Location loc, @Nullable EntityType attachType) Spawn aFakePlayer
static FakePlayer
spawnFakePlayer
(@NotNull String name, @NotNull Location loc, @Nullable EntityType attachType, boolean update) Spawn aFakePlayer
static FakePlayer
spawnFakePlayer
(String name, Location loc) Spawn aFakePlayer
static CompletableFuture
<FakePlayer> spawnFakePlayerAsync
(@NotNull String name, @NotNull Location loc, @Nullable EntityType attachType) Spawn aFakePlayer
asyncstatic CompletableFuture
<FakePlayer> spawnFakePlayerAsync
(@NotNull String name, @NotNull Location loc, @Nullable EntityType attachType, boolean update) Spawn aFakePlayer
asyncstatic CompletableFuture
<FakePlayer> spawnFakePlayerAsync
(String name, Location loc) Spawn aFakePlayer
async
-
Method Details
-
spawnFakePlayer
Spawn aFakePlayer
This will cache the fake player as well for later retrieval
- Parameters:
name
- Name of fake playerloc
- Location of fake player- Returns:
- FakePlayer instance
-
spawnFakePlayer
public static FakePlayer spawnFakePlayer(@NotNull @NotNull String name, @NotNull @NotNull Location loc, @Nullable @Nullable EntityType attachType) Spawn aFakePlayer
This will cache the fake player as well for later retrieval
NOTE: The attached entity will spawn, and the player will take over its AI, This may cause some client lag depending on the chosen entity.
Will automatically update to all players
- Parameters:
name
- Name of fake playerloc
- Location of fake playerattachType
- Type of entity to spawn and attach the player to- Returns:
- FakePlayer instance
-
spawnFakePlayer
public static FakePlayer spawnFakePlayer(@NotNull @NotNull String name, @NotNull @NotNull Location loc, @Nullable @Nullable EntityType attachType, boolean update) Spawn aFakePlayer
This will cache the fake player as well for later retrieval
NOTE: The attached entity will spawn, and the player will take over its AI, This may cause some client lag depending on the chosen entity.
If not using update, use
FakePlayer.update()
orFakePlayer.update(Player)
to update to players.- Parameters:
name
- Name of fake playerloc
- Location of fake playerattachType
- Type of entity to spawn and attach the player toupdate
- Whether to update the fake player to all online players- Returns:
- FakePlayer instance
-
spawnFakePlayerAsync
Spawn aFakePlayer
asyncThis will cache the fake player as well for later retrieval
- Parameters:
name
- Name of fake playerloc
- Location of fake player- Returns:
- FakePlayer instance
-
spawnFakePlayerAsync
public static CompletableFuture<FakePlayer> spawnFakePlayerAsync(@NotNull @NotNull String name, @NotNull @NotNull Location loc, @Nullable @Nullable EntityType attachType) Spawn aFakePlayer
asyncThis will cache the fake player as well for later retrieval
NOTE: The attached entity will spawn, and the player will take over its AI, This may cause some client lag depending on the chosen entity.
Will automatically update to all players.
- Parameters:
name
- Name of fake playerloc
- Location of fake playerattachType
- Type of entity to spawn and attach the player to- Returns:
- FakePlayer instance
-
spawnFakePlayerAsync
public static CompletableFuture<FakePlayer> spawnFakePlayerAsync(@NotNull @NotNull String name, @NotNull @NotNull Location loc, @Nullable @Nullable EntityType attachType, boolean update) Spawn aFakePlayer
asyncThis will cache the fake player as well for later retrieval
NOTE: The attached entity will spawn, and the player will take over its AI, This may cause some client lag depending on the chosen entity.
If not using update, use
FakePlayer.update()
orFakePlayer.update(Player)
to update to players.- Parameters:
name
- Name of fake playerloc
- Location of fake playerattachType
- Type of entity to spawn and attach the player toupdate
- Whether to update the fake player to all online players- Returns:
- FakePlayer instance
-
getFakePlayer
Get a previously cachedFakePlayer
- Parameters:
name
- Name of fake player- Returns:
- FakePlayer if cached otherwise null
-
getFakePlayers
Get all fake players- Returns:
- List of all fake players
-
getPlayerConnection
@NotNull public static @NotNull net.minecraft.server.network.ServerGamePacketListenerImpl getPlayerConnection(@NotNull @NotNull Player player) Get the Player's connection
Useful for sending packets- Parameters:
player
- Bukkit Player to get connection from- Returns:
- Connection from Player
-
sendPacket
public static void sendPacket(@NotNull @NotNull Player player, @NotNull @NotNull net.minecraft.network.protocol.Packet<?> packet) Send a Packet to aBukkit Player
- Parameters:
player
- Player to send packet topacket
- Packet to send
-