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

Individual person data by server #21

Open
IronException opened this issue Dec 24, 2019 · 6 comments
Open

Individual person data by server #21

IronException opened this issue Dec 24, 2019 · 6 comments
Assignees
Labels
new-feature New feature request

Comments

@IronException
Copy link
Member

maybe that won't be as easy. but IMO it should be possible to have different friends for different servers. I get that not many players need this but when there are players that play on multiple servers and maybe go full hostile on one it might not be great to have marked your friend as an enemy on another server where you want to be more friendly.

@zeroeightysix zeroeightysix changed the title individual friends for servers Individual person data by server Dec 25, 2019
@zeroeightysix zeroeightysix self-assigned this Dec 25, 2019
@zeroeightysix
Copy link
Collaborator

I feel like this might be out of scope for the library, and should be implemented by the developer using this library, using metadata.

@zeroeightysix zeroeightysix added the new-feature New feature request label Dec 25, 2019
@IronException
Copy link
Member Author

How can this be implemented by the client dev?
I would think about solving this issue by saving the friends in folders specific to the server.

@zeroeightysix
Copy link
Collaborator

How can this be implemented by the client dev?

In the metadata, and by performing checks on the metadata when determining if some is a friend or not.

I would think about solving this issue by saving the friends in folders specific to the server.

No. There's no good way to retain compatibility between clients without either forcing the server-based system on them, making the entire library depend on minecraft and having the user install a separate mod for the mixins needed for this.
Just no.

@IronException
Copy link
Member Author

Okay I get what you mean now. Saving that in meta data will just get way too complicated.
Maybe we could add a way for the client to say what server this is. Of course most clients wont use this (mainly because only 2b clients might see this library). But imo we should make this usable for more utility clients then 2b ones. And it is very likely that when you dont play on 2b that you play on other servers where this might be useful.

Use case:
players play on other servers then 2b2t and have friends on some server that are enemies on other servers.

@zeroeightysix
Copy link
Collaborator

Maybe we could add a way for the client to say what server this is.

In the metadata. It won't get too complicated. In fact, it's extremely easy to do:

// this code is called when a new friend is added
JsonObject meta = new JsonObject();
meta.add("server", Minecraft.getMinecraft().currentServerData.address);
GameProfilePerson person = new GameProfilePerson(gameProfile, value, meta);
UniversalFriends.addPerson(person);
// when looping through friends
UniversalFriends.selector().metadata(meta -> {
    if (meta.has("server") {
        return meta.get("server").getAsString().equals(Minecraft.getMinecraft().currentServerData.address);
    }
    return false;
}.selectMatchingAll().forEach(person -> {
    // perform some action on this person
});

@IronException
Copy link
Member Author

IronException commented Dec 26, 2019

I didn't mean hard to implement. I meant complicated if you store even more values. Of course a client can implement that but my train of thought is that certain attributs have a hirachy. Merging the hirachy might complicate things since you might loose data for example.

use case:
1.server: you have a friend and give him a note (this note is saved in meta data (could be somewhere else too but this is to proove the point since there are more variables then this)).
on the
2. server: this player is your enemy. But also you have another note about him (since it is another environment).

By complicated I mean the way you would be trying to fix this issue. For instance you could save the meta data in a hirachy too. But other clients dont have that. And where would you store variables such as lifetime. Putting it within the sub metadata will make it disappear for other clients when they dont adapt.

Besides this will make it hard to oversee what metadata variables exist.

I also just notice that this might be a bigger problem than just stated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature New feature request
Projects
None yet
Development

No branches or pull requests

2 participants