|Ad5001 3d300bf5a2||3 years ago|
|.github||4 years ago|
|.vscode||3 years ago|
|resources||3 years ago|
|src/Ad5001/Online||3 years ago|
|.gitattributes||4 years ago|
|.gitignore||3 years ago|
|.poggit.yml||3 years ago|
|LICENSE||3 years ago|
|Online-Eclipse-Modified.png||3 years ago|
|README.md||3 years ago|
|config.yml||3 years ago|
|plugin.yml||3 years ago|
Create multiple website for your PocketMine server fully free !
This plugin is under the BoxOfDevs LICENSE v1.0
To create a website, go to the config.yml -> plugins/Online/config.yml
Then add a new website in the “Domains” array (by default, there is localhost) with your website name so it looks like this (for this whole example, we will use example.com but local servers are already here by default. It's if you want to add a new one):
Domains: - localhost - example.com
Restart your server and a new folder in the Online folder will be generated! It will be your new website path.
By default, there will be an index.html, a 404.html and a 403.html.
You can modify them, add more files, ect....
If you're using an external domain, portforward your machine (later on the lesson) , then go to your registar CPanel and go to records -> add new record and then put it to CName to your portforwarded machine. All of this isn't required localy.
After have done this, connect yourself to the website by your browser: http://example.com:Your port (by default 80).
To make everyone able to see your website, you need to port forward your website (if you have port forwared your server, you will also need to do this) . Note that the port forward should be automatized on windows devices using UPnP.
There are tons of tutorials on how to portforward something (google it !) but there are some specific config to do.
And there you go ! You've created your first website with online ! Good job !
Config of the port foreward:
Start port: Your port (by default 80)
End port: Your port (by default 80)
Start your server and profit of your new website !
You've created a website but you want to broadcast it on multiple websites? No problem ! Look at the tutorial below and see how to do this !
parked domain: current domain(there is by default 0.0.0.0 and 127.0.0.1 that points to localhost) So it looks like this (for this example, example.net is the parked domain and example.com is the existing one):
Parked domains: 0.0.0.0: localhost 127.0.0.1: localhost example.net: example.com
You might have seen that the tutorials above haven't covered the whole configs and stuff ! Here are some tips & tricks that what are they here for !
denied-pages: - website/path/to/file
FOR /F "tokens=5" %P IN (\'netstat -a -n -o ^| findstr 0.0.0.0:<PORT>') DO TaskKill.exe /F /PID %P
MACOSX and LINUX:
kill -kill `lsof -t -i tcp:<port`
With 1.6, API has been introduced with many ways to customize and filter requests to your website and interaction with your server.
First feature of the API is to get default infos about pocketmine or any plugin, players, or levels.
This allow recognition from the webserver of the server.
That being said, take a look at saved variables: ####### Pocketmine:
Second API features are variables that you can pass to the webserver. Variables will be passed as $_PLUGINS[“name”][“id of the variable”].
To pass an argument, add this line to your code.
$this->getServer()->getPluginManager()->getPlugin("Online")->setArgument($this, "id of the var", $varToPass);
You can see them by adding this line.
$args = $this->getServer()->getPluginManager()->getPlugin("Online")->getArguments($this);
This gives you the ability to show custom things related to the server on the files.
Please note that all variables passed (default & customs) are refreshed every 10 seconfs.
This is the most powerfull way to customize your webserver.
Custom handlers are PHP files that are executed each time a request to the server is done.
To add a custom handler, create a new PHP file into your plugin src and add this line of code to your main file:
$this->getServer()->getPluginManager()->getPlugin("Online")->addHandler(__DIR__ . "/handler.php");
You can also see all the handlers by doing:
$handlers = $this->getServer()->getPluginManager()->getPlugin("Online")->getHandlers();
======= That's it so I hoope you will enjoy my plugin !
(I know that @Falk created a plugin called Volt that does same but this plugin works in a completly different way (that make a lot less laggy and a lot less heavier in space !) and it's fully coded by myself in PHP7)