Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cuberite executable arguments #1942

Open
FalkAlexander opened this issue May 5, 2015 · 23 comments
Open

Cuberite executable arguments #1942

FalkAlexander opened this issue May 5, 2015 · 23 comments

Comments

@FalkAlexander
Copy link

I've noticed its not possible to start MCServer with certain arguments e.g."MCServer --slots=12 --port=25566".
This would be useful for setting up servers in a webinterface.
The most webinterfaces have variables who defining slots, port, ip etc. like {slots}, {port} and {ip}.
Anyway, so that the terminal can start the Server like "./MCServer --slots={slots} --port={port}" and the specific options in settings.ini will be ignored.

@worktycho
Copy link
Member

What sort of arguments style should MCServer use? There's already the comms logging arguments which use windows style arguments, but theres an argument to be said for unix style as well.

@FalkAlexander
Copy link
Author

I think the unix way is, that every argument have two forms, short and long + instead of = a space... Did I understand you right?
For Example the slots:
short: MCServer -s 12
long: MCServer --slots 12

@FalkAlexander
Copy link
Author

It's a matter of opinion. You're right, it's possible to write every time with a shell script the data into the settings.ini, to protect the amount of slots buyed by its owner. But the function with arguments would be very sleek and lightweight.

@Woazboat
Copy link
Contributor

Woazboat commented May 5, 2015

"I think the unix way is, that every argument have two forms, short and long + instead of = a space... Did I understand you right?"

Both are actually possible. Pure UNIX/POSIX only has "-abc" for combined flags/options and "--option1 arg1 --option2 arg2" for long form options, while there's a GNU extension that also allows "--option1=arg1".

https://en.wikipedia.org/wiki/Getopt
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html

@dimitrifrom31
Copy link

As a GSP we need this too in order to enforce certain parameters such as max slots and Port.
I did not find a way to force the mcserver to bind on a specific IP. This is a must have for GSP's too.

Any way to get at least command switches support added for slots, port and bind to IP ? If we had that for windows that would be great allowing us to offer the game, allowing users to get a server at a cheap price without the hassle of managing a VPS and getting the software more popular.

@worktycho
Copy link
Member

This disscution is being split between here and the forum http://forum.mc-server.org/showthread.php?tid=1910&page=4

but the other problem with command line options is number. MCServer has approximately 20 settings under the banner of slots, port and bind to IP. And we would need to add more in the future to deal with plugins, along with the possibility that the host might want to control other settings like the deadlock detector. This is unmanageable with command line arguments. What would you think of a second ini file, which could be made read only to the server?

@dimitrifrom31
Copy link

No GSP will ever use all a game options in command line, only a few ones he dont want to be changed such as the ones I mentionned.
Command line is the most used tool to enforce setting but a separate file would do the trick. It does not have to be read-only as we can simply restrict access by file name so as long as it has unique and "uncommon" name that's fine. mcserver_enforcedsettings.ini for example would be perfect.
Any setting added there would be enforced for example, That would be probably easiest solution.

Having IP binding implemented would be a great step towards GSP hosting as we all use machines with multiple IP's unlike home hosted servers and I noticed mcserver binds on all interfaces (not only primary IP).

Thanks for the follow up and quick reply!

@bearbin
Copy link
Member

bearbin commented May 8, 2015

I actually understand what you're saying more now, and CLI options would be a good idea, at least for the basics. But we should promote the config file more than the options, to avoid confusion of users.

@worktycho
Copy link
Member

But what's the basics? Slots I get is simple, but for IP mcservers setup is complicated. We currently have three settings for IP for the main Minecraft protocol to bind to as the user can specify ips that are ipv4 or Ipv6 only.

@dimitrifrom31
Copy link

Well we could do without IP binding as long as we can specify port (and thus increment ports making sure no user can change the port to avoid conflicts) but that would be for sure a plus to get more GSP's to support the game.
I believe ipv4 would be enough to begin with, just to allow us to set servers to bind to a single IP.

@sphinxc0re sphinxc0re changed the title MCServer Executable arguments Cuberite Executable arguments Nov 13, 2015
@sphinxc0re sphinxc0re changed the title Cuberite Executable arguments Cuberite executable arguments Nov 13, 2015
@PhonicUK
Copy link

PhonicUK commented Jun 8, 2016

I'd like to suggest that anything that can be changed in settings.ini also be configurable via command line flags with the following format:

+section.setting Value

E.g.

+Server.Ports 25565 +Server.MaxPlayers 100 +Server.Description "Cuberite - in C++!" +RCON.Enabled 0

@worktycho
Copy link
Member

The idea of being able to set a config setting seems like a good idea, but that syntax would be a pain to implement with our current parser. I'm thinking -c section.setting=value might work and be easy to implement.

@worktycho
Copy link
Member

I'm not sure about how to handle quoted strings.

@PhonicUK
Copy link

Some applications handle quoted strings by putting the entire argument in quotes:

-c "setting.section=Value with some spaces in"

Then you split that entire string by the first = and it works the same way as normal.

@madmaxoft
Copy link
Member

Sounds good and feels reasonably doable.

@PhonicUK
Copy link

Is there any traction on this? I want to integrate Cuberite support into AMP/MCMA3 but it's blocked on this change.

@hansbkk
Copy link

hansbkk commented Jul 16, 2016

AMP/Cuberite would be great, especially on Pi servers! whatever the implementation details are, lets get this support in there. . .

@bearbin
Copy link
Member

bearbin commented Jul 20, 2016

I'm going to work on this next week, so it should be coming soon.

@bearbin bearbin self-assigned this Jul 20, 2016
@Lord-Felidae
Copy link

I know I am a random person. I know this is an impressive piece of work. But I know how to help.
It's just simple c++ combined with .yml formatting and some complicated code. You set the slot amount in the .yml, then call these lines of code.

int ymlslots = "amount from yml";
int players = "online player amount";
if (ymlslots > players){
"Code to kick player who exceeded limit"
}
I hope this helped.🙂

@bearbin
Copy link
Member

bearbin commented Jul 30, 2016

Slots and ports are now completed, that should allow for basic GSP functionality. @PhonicUK are there any other options that you particularly need, otherwise I will add the others slowly.

@PhonicUK
Copy link

those are the main ones

@PhonicUK
Copy link

Any news on expanding this to the rest of the settings? Also IP binding needs to be settable this way.

@yangm97
Copy link

yangm97 commented Nov 30, 2016

This one also helps launching Docker containers using environment variables.

@bearbin bearbin removed their assignment Sep 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests