Class PlayerApi
java.lang.Object
com.shanebeestudios.nms.api.world.entity.PlayerApi
Api methods pertaining to a
Player-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable FakePlayergetFakePlayer(String name) Get a previously cachedFakePlayerstatic List<FakePlayer>Get all fake playersstatic @NotNull net.minecraft.server.network.ServerGamePacketListenerImplgetPlayerConnection(@NotNull Player player) Get the Player's connection
Useful for sending packetsstatic voidStart the riptide animation for a playerstatic voidsendPacket(@NotNull Player player, @NotNull net.minecraft.network.protocol.Packet<?> packet) Send a Packet to aBukkit Playerstatic FakePlayerspawnFakePlayer(String name, Location loc) Spawn aFakePlayerstatic CompletableFuture<FakePlayer>spawnFakePlayerAsync(String name, Location loc) Spawn aFakePlayerasyncstatic voidMake a player touch an entity
-
Method Details
-
spawnFakePlayer
Spawn aFakePlayerThis will cache the fake player as well for later retrieval
- Parameters:
name- Name of fake playerloc- Location of fake player- Returns:
- FakePlayer instance
-
spawnFakePlayerAsync
Spawn aFakePlayerasyncThis will cache the fake player as well for later retrieval
- Parameters:
name- Name of fake playerloc- Location of fake player- 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
-
riptide
Start the riptide animation for a player- Parameters:
player- Player to riptidetime- Ticks to riptide
-
touch
Make a player touch an entityThis only works on a few entities, ex: touching a dropped item makes the player pick it up
- Parameters:
player- Player to do the touchingentity- Entity to touch
-