Class PlayerApi

java.lang.Object
com.shanebeestudios.nms.api.world.entity.PlayerApi

public class PlayerApi extends Object
Api methods pertaining to a Player
  • Method Details

    • spawnFakePlayer

      public static FakePlayer spawnFakePlayer(String name, Location loc)
      Spawn a FakePlayer

      This will cache the fake player as well for later retrieval

      Parameters:
      name - Name of fake player
      loc - Location of fake player
      Returns:
      FakePlayer instance
    • spawnFakePlayerAsync

      public static CompletableFuture<FakePlayer> spawnFakePlayerAsync(String name, Location loc)
      Spawn a FakePlayer async

      This will cache the fake player as well for later retrieval

      Parameters:
      name - Name of fake player
      loc - Location of fake player
      Returns:
      FakePlayer instance
    • getFakePlayer

      @Nullable public static @Nullable FakePlayer getFakePlayer(String name)
      Get a previously cached FakePlayer
      Parameters:
      name - Name of fake player
      Returns:
      FakePlayer if cached otherwise null
    • getFakePlayers

      public static List<FakePlayer> 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 a Bukkit Player
      Parameters:
      player - Player to send packet to
      packet - Packet to send
    • riptide

      public static void riptide(@NotNull @NotNull Player player, int time)
      Start the riptide animation for a player
      Parameters:
      player - Player to riptide
      time - Ticks to riptide
    • touch

      public static void touch(@NotNull @NotNull Player player, @NotNull @NotNull Entity entity)
      Make a player touch an entity

      This only works on a few entities, ex: touching a dropped item makes the player pick it up

      Parameters:
      player - Player to do the touching
      entity - Entity to touch