-
Notifications
You must be signed in to change notification settings - Fork 1
TradeManager Guides
Wenox edited this page Oct 25, 2025
·
1 revision
The TradeManager class is a static manager responsible for handling trade requests between players in the Skyblock plugin. It allows players to send trade requests to other players, which automatically expire after 60 seconds if not accepted. The class uses an in-memory array to store active trade requests and integrates with the plugin's scheduler for expiration handling.
Adds a trade request from the specified player to the victim player.
-
Parameters:
-
$player(Player): The player sending the trade request. -
$victimName(string): The name of the player to whom the trade request is being sent.
-
-
Behavior:
- Prevents self-trade requests and duplicate requests.
- Stores the request in the internal
$tradesarray. - Schedules an automatic removal of the request after 60 seconds (1200 ticks).
- Notifies the victim if the request expires without acceptance.
Checks if a trade request exists from the specified player to the victim.
-
Parameters:
-
$player(Player): The player who sent the trade request. -
$victimName(string): The name of the player to whom the request was sent.
-
-
Returns:
trueif the request exists,falseotherwise.
Retrieves all active trade requests sent by the specified player.
-
Parameters:
-
$player(Player): The player whose trade requests to retrieve.
-
- Returns: An array of victim names (strings) representing active trade requests.
Removes a specific trade request from the specified player to the victim.
-
Parameters:
-
$player(Player): The player who sent the trade request. -
$victimName(string): The name of the player to whom the request was sent.
-
-
Behavior: Removes the request from the internal
$tradesarray if it exists.
use Biswajit\Core\Managers\TradeManager;
use Biswajit\Core\Player;
// Assuming $player is a Player instance and $victimName is a string
TradeManager::addTradeRequest($player, $victimName);if (TradeManager::hasTradeRequest($player, $victimName)) {
// Handle existing request
}$requests = TradeManager::getTradeRequests($player);
foreach ($requests as $victim) {
// Process each request
}TradeManager::removeTradeRequest($player, $victimName);For support with the SkyblockCore, you can join our Discord.
Copyright © 2025 PixelForge-Studios