docker-minecraft-server icon indicating copy to clipboard operation
docker-minecraft-server copied to clipboard

Better whitelist and ops support in offline mode

Open FedotCompot opened this issue 5 months ago • 1 comments

Enhancement Type

Improve an existing feature

Describe the enhancement

When online-mode=false OPS and WHITELIST users that are not found using playerdb.co should have UUIDs generated offline using something like this.

If necessary i can provide js and bash scripts that generate offline UUID from a nickname, it's some basic bit manipulation of the md5 hash of the nickname

FedotCompot avatar Jun 18 '25 12:06 FedotCompot

Thanks for the suggestion and advice about deriving from the md5. That'll be quite feasible to add here

https://github.com/itzg/mc-image-helper/blob/master/src/main/java/me/itzg/helpers/users/ManageUsersCommand.java

itzg avatar Jun 18 '25 13:06 itzg

Created a PR with implementation and test https://github.com/itzg/mc-image-helper/pull/581

FedotCompot avatar Jun 19 '25 04:06 FedotCompot

Can now bump the version in Dockerfile to pickup

https://github.com/itzg/mc-image-helper/releases/tag/1.44.0

itzg avatar Jun 20 '25 02:06 itzg

https://github.com/itzg/mc-image-helper/pull/581 is a temp solution in my opinion, it's a quickie that allows the server to start with offline players in the white/op list.

But it does not handle properly mixed user, the solution to this in my opinion would be to use per-user flag to mark them as offline


My proposal is to use some kind of delimiter that is not be allowed in a nickname to inject flags directly into the username/uuid Something like this:

  • user:offline,flag1
  • user:offline:flag1
  • user<offline,flag2>
  • user<offline><flag2>
  • user#offline,flag3
  • user#offline#flag3
  • uuid-uuid-uuid-uuid/offline,flag4
  • uuid-uuid-uuid-uuid/offline/flag4

So something like this is possible:

[username, flags] = entry.split(FLAG_DELIM)
...
for flag in flags.split(",") {
   switch flag {
    ...
    case FLAG_OFFLINE:
      return generateOfflineUUID(username)
  }
}

This wound not only allow for offline usernames tagging, but also enables an easy way to implement other per-user functionality.

Also this would not even be a breaking change since a normal nickname entry would just have no tags

FedotCompot avatar Jun 20 '25 03:06 FedotCompot

Your new suggestion makes sense -- colon delimiter is what I'd prefer. How about you open a follow up enhancement issue for this new idea?

But I'm confused, did you not even want to use the "temp solution"? Why did you request I review a temp solution without telling me? To clarify, you have to make changes here in the image to at least pull in that version of the helper.

https://github.com/itzg/docker-minecraft-server/blob/1cf2783daf8c79532df21f3b3e007042061aedeb/Dockerfile#L51

itzg avatar Jun 20 '25 12:06 itzg

At first i thought this was a good solution, but after i did the PR i set up another server for a group of friends and there were both online and offline players, then i realized having either all offline or all online is not enough.

P.S. I just got a couple of weeks ago in hosing mc server on docker, previously i was doing everything by hand using crontab and screen, when i found out about your repos and helm charts i was amazed. And seeing all of this being basically maintained by one person made me want to contribute, but since I'm really new to all of this I may not see all of the use cases, possibilities and potential issues.

FedotCompot avatar Jun 20 '25 14:06 FedotCompot

Ah ok, that's totally fair then. Thanks for clarifying the context.

I'm good if you want to proceed with the follow up PR in image helper to allow for mixed online/offline.

I really appreciate the help you're providing on these features.

itzg avatar Jun 20 '25 15:06 itzg

Is this feature live right now in latest ?

Nsttt avatar Aug 06 '25 16:08 Nsttt

Yes it is. Looks like I forgot to link the closure here.

itzg avatar Aug 06 '25 16:08 itzg