Package com.avrix.api.server
Class PlayerUtils
java.lang.Object
com.avrix.api.server.PlayerUtils
A set of tools for player management, monitoring and analysis
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
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 itsInventoryItem
.static void
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 itsInventoryItem
.static void
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.static AccessLevel
getAccessLevel
(zombie.characters.IsoPlayer player) Retrieves the access level of a player.static AccessLevel
getAccessLevel
(zombie.core.raknet.UdpConnection connection) Retrieves the access level of a player based on theirUdpConnection
.static zombie.characters.IsoPlayer
getPlayerByPartialUsername
(String userName) 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 connectionstatic zombie.characters.IsoPlayer
getPlayerByUsername
(String username) Getting a player instance by nicknamestatic 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 characterstatic 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 theAccessLevel
of a player by their username.static void
setAccessLevel
(zombie.characters.IsoPlayer player, AccessLevel accessLevel) Sets theAccessLevel
of a player.static void
setAccessLevel
(zombie.core.raknet.UdpConnection connection, AccessLevel accessLevel) Sets theAccessLevel
of a player.
-
Constructor Details
-
PlayerUtils
public PlayerUtils()
-
-
Method Details
-
setAccessLevel
Sets theAccessLevel
of a player by their username.- Parameters:
playerName
- the username of the playeraccessLevel
- the newAccessLevel
to set
-
setAccessLevel
Sets theAccessLevel
of a player.- Parameters:
player
- theIsoPlayer
object representing the playeraccessLevel
- the newAccessLevel
to set
-
setAccessLevel
public static void setAccessLevel(zombie.core.raknet.UdpConnection connection, AccessLevel accessLevel) Sets theAccessLevel
of a player.- Parameters:
connection
- theUdpConnection
object representing the player's connectionaccessLevel
- the newAccessLevel
to set
-
getAccessLevel
Retrieves the access level of a player based on theirUdpConnection
.- Parameters:
connection
- theUdpConnection
of the player- Returns:
- the access level of the player as an
AccessLevel
enumeration
-
getAccessLevel
Retrieves the access level of a player.- Parameters:
player
- theIsoPlayer
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
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
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
Getting a player instance by nickname- Parameters:
username
- player nickname- Returns:
IsoPlayer
instance, or null if not found
-
getPlayerByPartialUsername
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 itsInventoryItem
.- Parameters:
player
- theIsoPlayer
to add the item toitem
- theInventoryItem
to addamount
- the amount of the item to add
-
addItem
Adds a specified amount of an item to a player's inventory by its type.- Parameters:
player
- theIsoPlayer
to add the item toitemType
- the type of the item to addamount
- 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 itsInventoryItem
.- Parameters:
connection
- the player's connectionitem
- theInventoryItem
to addamount
- 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'sUdpConnection
itemType
- the type of the item to addamount
- the amount of the item to add
-
removeItem
Removes an item from a player's inventory by its type.- Parameters:
player
- theIsoPlayer
instanceitemType
- 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
- theIsoPlayer
instanceitemId
- 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
- theIsoPlayer
from whom the item is to be removeditem
- theInventoryItem
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
- theUdpConnection
of the player from whom the item is to be removeditem
- theInventoryItem
to be removed
-
removeItem
Removes an item from a player's inventory by its type.- Parameters:
connection
- the player'sUdpConnection
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'sUdpConnection
itemId
- the ID of the item to remove
-
kickPlayer
Kicks a player from the server.- Parameters:
player
- theIsoPlayer
instancereason
- the reason for kicking the player
-
kickPlayer
Kicks a player from the server.- Parameters:
connection
- the player'sUdpConnection
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
- theIsoPlayer
instancereason
- the reason for banning the playerbanIP
- whether to ban the player's IP addressbanSteamID
- 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'sUdpConnection
reason
- the reason for banning the playerbanIP
- whether to ban the player's IP addressbanSteamID
- whether to ban the player's SteamID
-