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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAdds a specified amount of an item to a player's inventory by its type.static voidaddItem(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 voidAdds a specified amount of an item to a player's inventory by its type.static voidaddItem(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 voidBans a player from the server.static voidbanPlayer(zombie.core.raknet.UdpConnection connection, String reason, boolean banIP, boolean banSteamID) Bans a player from the server.static AccessLevelgetAccessLevel(zombie.characters.IsoPlayer player) Retrieves the access level of a player.static AccessLevelgetAccessLevel(zombie.core.raknet.UdpConnection connection) Retrieves the access level of a player based on theirUdpConnection.static zombie.characters.IsoPlayergetPlayerByPartialUsername(String userName) Searches for a player by a full or partial username.static zombie.characters.IsoPlayergetPlayerByUdpConnection(zombie.core.raknet.UdpConnection udpConnection) Getting a player's instance on his connectionstatic zombie.characters.IsoPlayergetPlayerByUsername(String username) Getting a player instance by nicknamestatic StringgetPlayerIP(zombie.characters.IsoPlayer player) Returns the player's IP address.static StringgetPlayerSteamID(zombie.characters.IsoPlayer player) Returns the player's SteamID.static zombie.core.raknet.UdpConnectiongetUdpConnectionByPlayer(zombie.characters.IsoPlayer player) Getting a player's connection based on his characterstatic voidkickPlayer(zombie.characters.IsoPlayer player, String reason) Kicks a player from the server.static voidkickPlayer(zombie.core.raknet.UdpConnection connection, String reason) Kicks a player from the server.static voidremoveItem(zombie.characters.IsoPlayer player, int itemId) Removes an item from a player's inventory by its ID.static voidremoveItem(zombie.characters.IsoPlayer player, String itemType) Removes an item from a player's inventory by its type.static voidremoveItem(zombie.characters.IsoPlayer player, zombie.inventory.InventoryItem item) Removes the specified item from a player's inventory.static voidremoveItem(zombie.core.raknet.UdpConnection connection, int itemId) Removes an item from a player's inventory by its ID.static voidremoveItem(zombie.core.raknet.UdpConnection connection, String itemType) Removes an item from a player's inventory by its type.static voidremoveItem(zombie.core.raknet.UdpConnection connection, zombie.inventory.InventoryItem item) Removes the specified item from a player's inventory.static voidsetAccessLevel(String playerName, AccessLevel accessLevel) Sets theAccessLevelof a player by their username.static voidsetAccessLevel(zombie.characters.IsoPlayer player, AccessLevel accessLevel) Sets theAccessLevelof a player.static voidsetAccessLevel(zombie.core.raknet.UdpConnection connection, AccessLevel accessLevel) Sets theAccessLevelof a player.
-
Constructor Details
-
PlayerUtils
public PlayerUtils()
-
-
Method Details
-
setAccessLevel
Sets theAccessLevelof a player by their username.- Parameters:
playerName- the username of the playeraccessLevel- the newAccessLevelto set
-
setAccessLevel
Sets theAccessLevelof a player.- Parameters:
player- theIsoPlayerobject representing the playeraccessLevel- the newAccessLevelto set
-
setAccessLevel
public static void setAccessLevel(zombie.core.raknet.UdpConnection connection, AccessLevel accessLevel) Sets theAccessLevelof a player.- Parameters:
connection- theUdpConnectionobject representing the player's connectionaccessLevel- the newAccessLevelto set
-
getAccessLevel
Retrieves the access level of a player based on theirUdpConnection.- Parameters:
connection- theUdpConnectionof the player- Returns:
- the access level of the player as an
AccessLevelenumeration
-
getAccessLevel
Retrieves the access level of a player.- Parameters:
player- theIsoPlayerwhose access level is to be retrieved- Returns:
- the access level of the player as an
AccessLevelenumeration
-
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:
IsoPlayerinstance 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:
IsoPlayerinstance, 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
IsoPlayerobject 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- theIsoPlayerto add the item toitem- theInventoryItemto 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- theIsoPlayerto 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- theInventoryItemto 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'sUdpConnectionitemType- 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- theIsoPlayerinstanceitemType- 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- theIsoPlayerinstanceitemId- 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- theIsoPlayerfrom whom the item is to be removeditem- theInventoryItemto 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- theUdpConnectionof the player from whom the item is to be removeditem- theInventoryItemto be removed
-
removeItem
Removes an item from a player's inventory by its type.- Parameters:
connection- the player'sUdpConnectionitemType- 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'sUdpConnectionitemId- the ID of the item to remove
-
kickPlayer
Kicks a player from the server.- Parameters:
player- theIsoPlayerinstancereason- the reason for kicking the player
-
kickPlayer
Kicks a player from the server.- Parameters:
connection- the player'sUdpConnectionreason- 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- theIsoPlayerinstancereason- 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'sUdpConnectionreason- the reason for banning the playerbanIP- whether to ban the player's IP addressbanSteamID- whether to ban the player's SteamID
-