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

API Usage: Disguise with Skin URL (and Value/Signature) #26

Open
Silthus opened this issue Oct 17, 2018 · 9 comments
Open

API Usage: Disguise with Skin URL (and Value/Signature) #26

Silthus opened this issue Oct 17, 2018 · 9 comments

Comments

@Silthus
Copy link

Silthus commented Oct 17, 2018

First off: thanks for this awesome plugin! I am primarily using it to the directly use the well defined and documented API.

However I am missing a way to define fixed Skins for my Npcs based on a skin value and signature.

Is there a way to use the API to fetch a skin by url or disguise a player/entity by providing the base64 encoded texture and signature strings?

Maybe it would also be possible to provide a skin name and then get and save the texture and signature strings? With that I could make it that our quest writers define the skin name in the config and on first load it will fetch the skin and save it in the config. This way if the skin changes it would not update, since the signature and texture are cached in the config. I think citizens does it this way.

@robingrether
Copy link
Owner

Currently, iDisguise does not provide an API to use skins other than those associated with a paid Minecraft account.

Since the server can in principle send any skin URL to the clients, I could add an API for that if you wish. However, the custom skins need to be hosted externally, because the server only sends URLs to the client no actual textures.

Concerning skin caching: At the moment iDisguise caches skins only at runtime, which means they are loaded once per server run (and reloaded at server reload/restart).
Personally, I think there is no benefit in caching skin URLs in a local file, because most servers have by far a sufficient internet connection to do a few look-ups....
But I'm willing to change my mind about this if you present me any good reasons to do so :)

@Silthus
Copy link
Author

Silthus commented Oct 17, 2018

What I mean by caching is saving the base64 encoded signature and value of a skin. When you query a skin the url in the base64 encoded signature response stays the same for the skin, even if the player changes it.

By caching the base64 response the plugin would be able to create a "Skin Database" that can be populate by a single account chaning skins and saving them into the database.

To clarify: the following base64 values were encoded for my skin.

{"timestamp":1539327650091,"profileId":"e81f7928bfc144bfb57b18ab7a6361e9","profileName":"Silthus","signatureRequired":true,"textures":{"SKIN":{"url":"http://textures.minecraft.net/texture/401300e75d7883829cdc1ed60ed62fa292f21ed002da2f22920023c61b1f9ab3"}}}

If you open the texture URL you will see a Kakaschi skin (green with an eye patch). Afterwards I changed my skin to a new one using this generator: https://mineskin.org/394723

I am now a blue hedgedog and the json encoded skin has changed to:

{"timestamp":1539802492906,"profileId":"e81f7928bfc144bfb57b18ab7a6361e9","profileName":"Silthus","signatureRequired":true,"textures":{"SKIN":{"url":"http://textures.minecraft.net/texture/bad54c9abaadd77c13bbc12e07894c258265f3d27aefbf58af9b9b2f6eff4a76"}}}

As you can see: every skin uploaded gets a unique URL that is saved in the game profile. By caching the signature und texture values (base64) you could setup a database with skins that are not directly connected to players.

@robingrether
Copy link
Owner

Ok, I see what you'd like to have :)

I'll do my best to create an API for this.

@Silthus
Copy link
Author

Silthus commented Oct 17, 2018

Awesome thanks!

If you want you could also provide an interface to implement the skin storage. This way you would not need to setup a database or something and could leave it to users of the API how to store the skins.

@robingrether
Copy link
Owner

Hey, ich hab grad gesehen, dass du auch aus Deutschland kommst :)

Ich hab mir jetzt folgendes gedacht:

  1. Wenn das Plugin einen Skin lädt, wird dieser automatisch gecached.
  2. Zur Zwischenspeicherung erhält dabei jeder Skin einen Key.
  3. Unter diesem Key wird der Skin auch nach Änderung des Account-Skins weiter verfügbar sein.

Beispiel:

  1. Ich führe /disguise player RobinGrether aus
  2. iDisguise speichert die Skin-Info unter Key d4a53adf-2a9e-4d3d-aef6-d37f6287160d
  3. Nachdem ich meinen Account-Skin (RobinGrether) geändert habe, kann ich den vorherigen Skin via /disguise player d4a53adf-2a9e-4d3d-aef6-d37f6287160d weiterverwenden.

@robingrether
Copy link
Owner

Zusätzlich erstelle ich eine API mit der andere Plugins selbst Skin-Infos ablegen können, sodass Skins auch von Nicht-Mojang-Servern geladen werden können.

@robingrether
Copy link
Owner

(Obiges Beispiel ist wirklich als Beispiel zu verstehen. Ob ich tatsächlich UUIDs als Keys verwenden werde, sollte ich mir noch gut überlegen...)

@Silthus
Copy link
Author

Silthus commented Oct 17, 2018

Klingt gut 👍🏻
Man könnte bei dem Command optional einen Namen (und eine Beschreibung) für den Skin mitgeben lassen.

So könnten sich Admins eine Datenbank mit Skins aufbauen. Später könnte man dann ein Chest UI oder ähnliches zum durchsuchen bereitstellen.

Ich fände es außerdem gut wenn es eine Art Storage Provider Interface gibt mit dem man die darunter liegende Skin Storage tauschen kann.

So könnte ich z.b. in meinem Plugin den Skin Cache gegen eine DB tauschen und die Skins in einem Web Interface verwaltbar machen. Damit du aber nicht den ganzen Aufwand hast eben ein Storage Provider Interface das default in flat files oder vielleicht sogar nur dem Cache speichert.

Was meinst du?

Wenn gewünscht kann ich auch gerne einen PR stellen :)

@robingrether
Copy link
Owner

robingrether commented Oct 17, 2018

Ich hab das Konzept noch einmal überdacht, und denke es ist besser wie folgt:

  1. Speichern eines Skins via /disguise saveskin <skin> <key> (d.h. Skins werden nicht automatisch gespeichert)
  2. Danach verfügbar via /disguise player #<key>

Und die Idee mit dem Storage Provider finde ich auch gut.

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

2 participants