Merge pull request #165 from j122j/fix-allocation-limit
Fix allocation limit
This commit is contained in:
commit
4938384c5e
|
@ -33,7 +33,8 @@ class Pterodactyl
|
|||
* @param int $pterodactylId
|
||||
* @return mixed
|
||||
*/
|
||||
public function getUser(int $pterodactylId){
|
||||
public function getUser(int $pterodactylId)
|
||||
{
|
||||
$response = self::client()->get("/application/users/{$pterodactylId}");
|
||||
|
||||
if ($response->failed()) return $response->json();
|
||||
|
@ -50,7 +51,7 @@ class Pterodactyl
|
|||
$response = self::getAllocations($node);
|
||||
$freeAllocations = [];
|
||||
|
||||
if(isset($response['data'])){
|
||||
if (isset($response['data'])) {
|
||||
if (!empty($response['data'])) {
|
||||
foreach ($response['data'] as $allocation) {
|
||||
if (!$allocation['attributes']['assigned']) array_push($freeAllocations, $allocation);
|
||||
|
@ -125,7 +126,7 @@ class Pterodactyl
|
|||
*/
|
||||
public static function getAllocations(Node $node)
|
||||
{
|
||||
$per_page = Configuration::getValueByKey('ALLOCATION_LIMIT' , 200);
|
||||
$per_page = Configuration::getValueByKey('ALLOCATION_LIMIT', 200);
|
||||
$response = self::client()->get("/application/nodes/{$node->id}/allocations?per_page={$per_page}");
|
||||
if ($response->failed()) throw self::getException();
|
||||
return $response->json();
|
||||
|
@ -167,7 +168,7 @@ class Pterodactyl
|
|||
"feature_limits" => [
|
||||
"databases" => $server->product->databases,
|
||||
"backups" => $server->product->backups,
|
||||
"allocations" => 1
|
||||
"allocations" => $server->product->allocations,
|
||||
],
|
||||
"allocation" => [
|
||||
"default" => $allocationId
|
||||
|
|
Loading…
Reference in a new issue