puzzle-piecePlugin Code

Now that the plugin files are in place, the next step is to modify the required files in your Pterodactyl Panel to enable the Plugin manager. This step involved adding several lines of code in specific files to register the plugin's routes, UI components and logic.

Let's start.

1. Open /var/www/pterodactyl/routes/admin.php

Scroll to the bottom of the file and paste the following code at the end:

/*
|--------------------------------------------------------------------------
| Plugin Manager Routes
|--------------------------------------------------------------------------
|
| Endpoint: /admin/plugin_manager
|
*/
Route::group(['prefix' => 'plugin_manager'], function () {
    Route::get('/', [Admin\PluginManagerController::class, 'index'])->name('admin.plugin_manager');
    Route::post('/', [Admin\PluginManagerController::class, 'update'])->name('admin.plugin_manager.update');
});

Example:

2. Open /var/www/pterodactyl/routes/api-client.php

Find this line:

Directly under it, add:

Search for this block:

Directly under it, add:

The last change will be at the bottom of the file and paste the following code at the end:

Example:

3. Open /var/www/pterodactyl/resources/views/layouts/admin.blade.php

Find this block:

Paste the following right after the </li>

4. Open /var/www/pterodactyl/resources/scripts/state/server/index.ts

Locate this line:

And add this directly below:

Find the following line in the ServerDataStore interface:

Add these lines below it:

Search for:

Below this, add:

5. Open /var/www/pterodactyl/resources/scripts/api/server/getServer.ts

circle-info

We do this to get the egg id in the server information object. If you have already done this please skip.

Find the following line:

Below this, add:

Find the following line:

Below this, add:

6. Open /var/www/pterodactyl/resources/scripts/routers/routes.ts

Search for the following import:

Add this line right below it:

Search for:

Replace with:

Scroll down to the server: [ array. Search for the following route definition:

Directly below it, add the new route:

7. Open /var/www/pterodactyl/resources/scripts/routers/ServerRouter.tsx

Search for the following import:

Add the following line right below:

Search for this line:

Directly below it, add:

Search for the useEffect(() => { that contains getServer(match.params.id)

Insidee it, after:

Add:

Example:

Replace {routes.server with filteredRoutes

Search for this block:

Replace it with:

Search for:

Replace it with:

8. Open /var/www/pterodactyl/app/Transformers/Api/Client/ServerTransformer.php

Search for this line:

Bellow it, add:

And that's it!

Last updated