Class PlayerUtils

java.lang.Object
com.avrix.api.server.PlayerUtils

public class PlayerUtils extends Object
A set of tools for player management, monitoring and analysis
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addItem(zombie.characters.IsoPlayer player, String itemType, int amount)
    Adds a specified amount of an item to a player's inventory by its type.
    static void
    addItem(zombie.characters.IsoPlayer player, zombie.inventory.InventoryItem item, int amount)
    Adds a specified amount of an item to a player's inventory by its InventoryItem.
    static void
    addItem(zombie.core.raknet.UdpConnection connection, String itemType, int amount)
    Adds a specified amount of an item to a player's inventory by its type.
    static void
    addItem(zombie.core.raknet.UdpConnection connection, zombie.inventory.InventoryItem item, int amount)
    Adds a specified amount of an item to a player's inventory by its InventoryItem.
    static void
    banPlayer(zombie.characters.IsoPlayer player, String reason, boolean banIP, boolean banSteamID)
    Bans a player from the server.
    static void
    banPlayer(zombie.core.raknet.UdpConnection connection, String reason, boolean banIP, boolean banSteamID)
    Bans a player from the server.
    getAccessLevel(zombie.characters.IsoPlayer player)
    Retrieves the access level of a player.
    getAccessLevel(zombie.core.raknet.UdpConnection connection)
    Retrieves the access level of a player based on their UdpConnection.
    static zombie.characters.IsoPlayer
    Searches for a player by a full or partial username.
    static zombie.characters.IsoPlayer
    getPlayerByUdpConnection(zombie.core.raknet.UdpConnection udpConnection)
    Getting a player's instance on his connection
    static zombie.characters.IsoPlayer
    Getting a player instance by nickname
    static String
    getPlayerIP(zombie.characters.IsoPlayer player)
    Returns the player's IP address.
    static String
    getPlayerSteamID(zombie.characters.IsoPlayer player)
    Returns the player's SteamID.
    static zombie.core.raknet.UdpConnection
    getUdpConnectionByPlayer(zombie.characters.IsoPlayer player)
    Getting a player's connection based on his character
    static void
    kickPlayer(zombie.characters.IsoPlayer player, String reason)
    Kicks a player from the server.
    static void
    kickPlayer(zombie.core.raknet.UdpConnection connection, String reason)
    Kicks a player from the server.
    static void
    removeItem(zombie.characters.IsoPlayer player, int itemId)
    Removes an item from a player's inventory by its ID.
    static void
    removeItem(zombie.characters.IsoPlayer player, String itemType)
    Removes an item from a player's inventory by its type.
    static void
    removeItem(zombie.characters.IsoPlayer player, zombie.inventory.InventoryItem item)
    Removes the specified item from a player's inventory.
    static void
    removeItem(zombie.core.raknet.UdpConnection connection, int itemId)
    Removes an item from a player's inventory by its ID.
    static void
    removeItem(zombie.core.raknet.UdpConnection connection, String itemType)
    Removes an item from a player's inventory by its type.
    static void
    removeItem(zombie.core.raknet.UdpConnection connection, zombie.inventory.InventoryItem item)
    Removes the specified item from a player's inventory.
    static void
    setAccessLevel(String playerName, AccessLevel accessLevel)
    Sets the AccessLevel of a player by their username.
    static void
    setAccessLevel(zombie.characters.IsoPlayer player, AccessLevel accessLevel)
    Sets the AccessLevel of a player.
    static void
    setAccessLevel(zombie.core.raknet.UdpConnection connection, AccessLevel accessLevel)
    Sets the AccessLevel of a player.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PlayerUtils

      public PlayerUtils()
  • Method Details

    • setAccessLevel

      public static void setAccessLevel(String playerName, AccessLevel accessLevel)
      Sets the AccessLevel of a player by their username.
      Parameters:
      playerName - the username of the player
      accessLevel - the new AccessLevel to set
    • setAccessLevel

      public static void setAccessLevel(zombie.characters.IsoPlayer player, AccessLevel accessLevel)
      Sets the AccessLevel of a player.
      Parameters:
      player - the IsoPlayer object representing the player
      accessLevel - the new AccessLevel to set
    • setAccessLevel

      public static void setAccessLevel(zombie.core.raknet.UdpConnection connection, AccessLevel accessLevel)
      Sets the AccessLevel of a player.
      Parameters:
      connection - the UdpConnection object representing the player's connection
      accessLevel - the new AccessLevel to set
    • getAccessLevel

      public static AccessLevel getAccessLevel(zombie.core.raknet.UdpConnection connection)
      Retrieves the access level of a player based on their UdpConnection.
      Parameters:
      connection - the UdpConnection of the player
      Returns:
      the access level of the player as an AccessLevel enumeration
    • getAccessLevel

      public static AccessLevel getAccessLevel(zombie.characters.IsoPlayer player)
      Retrieves the access level of a player.
      Parameters:
      player - the IsoPlayer whose access level is to be retrieved
      Returns:
      the access level of the player as an AccessLevel enumeration
    • getPlayerByUdpConnection

      public static zombie.characters.IsoPlayer getPlayerByUdpConnection(zombie.core.raknet.UdpConnection udpConnection)
      Getting a player's instance on his connection
      Parameters:
      udpConnection - player connection
      Returns:
      IsoPlayer instance or null if player not found
    • getUdpConnectionByPlayer

      public static zombie.core.raknet.UdpConnection getUdpConnectionByPlayer(zombie.characters.IsoPlayer player)
      Getting a player's connection based on his character
      Parameters:
      player - player instance
      Returns:
      the player's UdpConnection, or null if there is none
    • getPlayerIP

      public static String getPlayerIP(zombie.characters.IsoPlayer player)
      Returns the player's IP address.
      Parameters:
      player - The player instance for which you want to obtain the IP address.
      Returns:
      The player's IP address or null if the address is not found.
    • getPlayerSteamID

      public static String getPlayerSteamID(zombie.characters.IsoPlayer player)
      Returns the player's SteamID.
      Parameters:
      player - The player instance for which you want to obtain a SteamID.
      Returns:
      Player's SteamID or null if Steam mode is disabled or SteamID not found.
    • getPlayerByUsername

      public static zombie.characters.IsoPlayer getPlayerByUsername(String username)
      Getting a player instance by nickname
      Parameters:
      username - player nickname
      Returns:
      IsoPlayer instance, or null if not found
    • getPlayerByPartialUsername

      public static zombie.characters.IsoPlayer getPlayerByPartialUsername(String userName)
      Searches for a player by a full or partial username.
      Parameters:
      userName - The full or partial name of the player to search for.
      Returns:
      The first IsoPlayer object that matches the given username, or null if no match is found.
    • addItem

      public static void addItem(zombie.characters.IsoPlayer player, zombie.inventory.InventoryItem item, int amount)
      Adds a specified amount of an item to a player's inventory by its InventoryItem.
      Parameters:
      player - the IsoPlayer to add the item to
      item - the InventoryItem to add
      amount - the amount of the item to add
    • addItem

      public static void addItem(zombie.characters.IsoPlayer player, String itemType, int amount)
      Adds a specified amount of an item to a player's inventory by its type.
      Parameters:
      player - the IsoPlayer to add the item to
      itemType - the type of the item to add
      amount - the amount of the item to add
    • addItem

      public static void addItem(zombie.core.raknet.UdpConnection connection, zombie.inventory.InventoryItem item, int amount)
      Adds a specified amount of an item to a player's inventory by its InventoryItem.
      Parameters:
      connection - the player's connection
      item - the InventoryItem to add
      amount - the amount of the item to add
    • addItem

      public static void addItem(zombie.core.raknet.UdpConnection connection, String itemType, int amount)
      Adds a specified amount of an item to a player's inventory by its type.
      Parameters:
      connection - the player's UdpConnection
      itemType - the type of the item to add
      amount - the amount of the item to add
    • removeItem

      public static void removeItem(zombie.characters.IsoPlayer player, String itemType)
      Removes an item from a player's inventory by its type.
      Parameters:
      player - the IsoPlayer instance
      itemType - the type of item to remove
    • removeItem

      public static void removeItem(zombie.characters.IsoPlayer player, int itemId)
      Removes an item from a player's inventory by its ID.
      Parameters:
      player - the IsoPlayer instance
      itemId - the ID of the item to remove
    • removeItem

      public static void removeItem(zombie.characters.IsoPlayer player, zombie.inventory.InventoryItem item)
      Removes the specified item from a player's inventory.
      Parameters:
      player - the IsoPlayer from whom the item is to be removed
      item - the InventoryItem to be removed
    • removeItem

      public static void removeItem(zombie.core.raknet.UdpConnection connection, zombie.inventory.InventoryItem item)
      Removes the specified item from a player's inventory.
      Parameters:
      connection - the UdpConnection of the player from whom the item is to be removed
      item - the InventoryItem to be removed
    • removeItem

      public static void removeItem(zombie.core.raknet.UdpConnection connection, String itemType)
      Removes an item from a player's inventory by its type.
      Parameters:
      connection - the player's UdpConnection
      itemType - the type of item to remove
    • removeItem

      public static void removeItem(zombie.core.raknet.UdpConnection connection, int itemId)
      Removes an item from a player's inventory by its ID.
      Parameters:
      connection - the player's UdpConnection
      itemId - the ID of the item to remove
    • kickPlayer

      public static void kickPlayer(zombie.characters.IsoPlayer player, String reason)
      Kicks a player from the server.
      Parameters:
      player - the IsoPlayer instance
      reason - the reason for kicking the player
    • kickPlayer

      public static void kickPlayer(zombie.core.raknet.UdpConnection connection, String reason)
      Kicks a player from the server.
      Parameters:
      connection - the player's UdpConnection
      reason - the reason for kicking the player
    • banPlayer

      public static void banPlayer(zombie.characters.IsoPlayer player, String reason, boolean banIP, boolean banSteamID)
      Bans a player from the server.
      Parameters:
      player - the IsoPlayer instance
      reason - the reason for banning the player
      banIP - whether to ban the player's IP address
      banSteamID - whether to ban the player's SteamID
    • banPlayer

      public static void banPlayer(zombie.core.raknet.UdpConnection connection, String reason, boolean banIP, boolean banSteamID)
      Bans a player from the server.
      Parameters:
      connection - the player's UdpConnection
      reason - the reason for banning the player
      banIP - whether to ban the player's IP address
      banSteamID - whether to ban the player's SteamID