PEMapModder / PocketMine-Wrapper

Simple PHP script for controlling the lifecycle of PocketMine servers
GNU Lesser General Public License v3.0
11 stars 1 forks source link

A tutorial? #1

Closed ifvictr closed 9 years ago

ifvictr commented 9 years ago

Can you add a tutorial on how to use the scripts? Thanks, because many people don't know how to use it, including me. :sob:

PEMapModder commented 9 years ago

This is actually a proof of concept. You can run the PHP scripts directly on the PocketMine directory.

ifvictr commented 9 years ago

@PEMapModder So basically just drag and drop it, correct?

PEMapModder commented 9 years ago

Right

ifvictr commented 9 years ago

@PEMapModder I still recommend making a tutorial, because if I don't understand it, I'm pretty sure most if not all the other users wouldn't understand too. Do you have to run a command(shell) to enable it?

PEMapModder commented 9 years ago

I have never tested it. You just need to run, for example on Windows, bin\php\php.exe wrapper.php

ifvictr commented 9 years ago

@PEMapModder Where exactly would I drop the files? This is the part I'm most confused with right now.

PEMapModder commented 9 years ago

@Gamecrafter next to src or PocketMine-MP.phar

ifvictr commented 9 years ago

@PEMapModder Do you just drop the php folder(along with functions.php and wrapper.php in it) or just functions.php and wrapper.php? Sorry if I'm asking too many questions. ;)

PEMapModder commented 9 years ago

Doesn't matter, as long as your cwd is the PocketMine home directory.

ifvictr commented 9 years ago

So after I drag it into the PocketMine home directory. Then you run a command. And then the server will start, correct? Do you run the command from php.exe or just the system's command shell?

PEMapModder commented 9 years ago

Command shell.

ifvictr commented 9 years ago

And you just have to run bin\php\php.exe wrapper.php for it to work? It didn't work for me. I'm pretty sure I'm doing something wrong.

PEMapModder commented 9 years ago

What happened? Using latest version updated yesterday?

ifvictr commented 9 years ago

I just run bin\php\php.exe wrapper.php and it says it can't find that directory. I'm pretty sure it's just the command part now.

PEMapModder commented 9 years ago

Fixed. I have just tested it, and it seems to work well.

PEMapModder commented 9 years ago

Planning to make a PocketMine-GUI in the future, in Java.

ifvictr commented 9 years ago

After you made instructions, I've made progress. But it still keeps saying: [FATAL] No PocketMine installation (source folder or .phar) found in C:\Windows !' when I run it with PHP. And this is when I have functions.php and wrapper.php in the PocketMine-MP directory.

PEMapModder commented 9 years ago

@Gamecrafter run it in the PocketMine-MP directory. Do you have a C:\Windows\PocketMine-MP.phar?

ifvictr commented 9 years ago

I've been running it in the PocketMine directory, refer to the screenshot below. And no, I don't have a C:\Windows\PocketMine-MP.phar. Did it work for you when you were testing it? Maybe add a __DIR__ into the code when looking for the file paths? capture

PEMapModder commented 9 years ago

cd command terminal to that directory, and then run bin\php\php.exe php\wrapper.php?

ifvictr commented 9 years ago

@PEMapModder Thanks, it works now. But it doesn't work if one or more of your directories names have a space in them. No way to fix this, right?

PEMapModder commented 9 years ago

Learn commands. You have to use file\ name or "file name" if you have a space.

PEMapModder commented 9 years ago

And remember, your cwd must be the PocketMine directory.

ifvictr commented 9 years ago

@PEMapModder Yep. I ended up changing the names of my directories. This script works on non-Windows devices too, right?

PEMapModder commented 9 years ago

It should, although it is not necessary, since you can run start.sh on most of other operating systems.

PEMapModder commented 9 years ago

PocketMine is only designed to to be run on Linux, MacOS and Windows, and both Linux and MacOS can run start.sh, which supports the -l option. I suppose the number of loops feature isn't really needed for most users.

ifvictr commented 9 years ago

Would it still be cd on non-Window command shells?

PEMapModder commented 9 years ago

Yes...

ifvictr commented 9 years ago

Would it be okay if I modified the script a little and build it into my RestartMe, but I give you all the credit for the script?

PEMapModder commented 9 years ago

Read the license for this repo.

ifvictr commented 9 years ago

So I can use it in my plugin, but not modify it. And I have to give you credit. Does this sound right? I don't want to get sued.

PEMapModder commented 9 years ago

No guarantees, but I don't think I would sue you :P after all, licenses like this usually don't have a lot legal significance.

PEMapModder commented 9 years ago

but well, I'm ok with that.

ifvictr commented 9 years ago

Would it be okay if I renamed it to "Zap", but still give you all the credit for the script? Just want to make sure.

PEMapModder commented 9 years ago

Sure.

PEMapModder commented 9 years ago

BTW, you can add this script into the RestartMe.phar, and set the stub of RestartMe to <?php require_once "wrapper.php"; __HALT_COMPILER();. In that way people can just run php plugins/RestartMe.phar to run the server with auto restart.

PEMapModder commented 9 years ago

Or just modify start.cmd to run plugins/RestartMe.phar instead of PocketMine-MP.phar

ifvictr commented 9 years ago

Good suggestion, I'll try to add that. But I want it to be as easy as possible for the user, I want to keep the shell commands at the minimal. I'll figure out a way.

PEMapModder commented 9 years ago

BTW, https://github.com/PEMapModder/PocketMine-GUI