Commit Graph

20 Commits

Author SHA1 Message Date
bundabrg 0ca1096f45
Fix Skin Caching and Fix Skin Restorer (#680)
* Fix Skin Caching

Changes:
* Instead of caching a skin based upon the player we cached it based upon the textureURL. This means multiple players with the same skin will benefit from the cache and more importantly will mean a player changing their skin will not get a false cache hit.
* This should fix all issues with SkinRestorer and will now correctly show the skin both to the player themselves and to other players

Closes #518

* Remove duplicated code

* Minimize playerlist updates

Changes:
* All async skin stuff will now just update skins and not be involved with sending the session to the player. This eliminates issues where the player list changes whilst an async task is occuring plus it means no invisible players while retrieving skin.
* Fix bug when retrieving cached skin

* When sending PlayerList packets ensure the skins have appropriate skinIds so the Bedrock client will cache hit/miss as needed

* Make sure to add and remove player when setting skin if they do not belong on the playerlist

* Make use of AuthData UUID when removing the player

* Revert removal of checking if entity is valid when initialized

This section is supposed to send all spawned entities in the java world to a player only after they've initialized. By removing this check it would also be sending entities that exist but are not spawned.

* Optimizations

Changes:
* Check for duplicate requests based on textureURL instead of player ID
* Don't use the PlayerSkinPacket. It duplicates the data sent in the PlayerListPacket and without it the players still get skin updates.

* Support caching of skins to disk based on configuration variable

If a skin is downloaded it will be saved to `cache/skins` using a base64 encoded filename of the textureUrl, if allowed by setting a non 0 value for the configuration variable `cache-skins`

When reading a skin we try load it from a cache file first before trying to download it.

We don't yet expire them but do update their last modification so we know which ones have been accessed.

* Update `config.yml` with cache-skins directive, defaulting to disabled

* Merge Fixes

* Cache all images instead of just skins

Changes:
* Move the image caching from skins to where images may get downloaded so this also covers capes and anything else that uses the same method of image retrieval
* Updated config value from `cache-skins` to `cache-images`
* Updated cache location from `cache/skins` to `cache/images`
* Images are stored in png format with a uuid. This may make debugging easier as they can be directly opened.

* Implement cached image expiry

If `cache-images` is set to a value greater than 0 then a scheduled task will occur once a day that will remove images with a modification date older than the value in days.

* Force skin changes as trusted

* Resolve PR queries

* Fix signed int causing issues calculating expiry time for images

* Reset Defaults to 0 and implement Google Timed Eviction cache for Images

* Add memory cache for Capes

Co-authored-by: Brendan Grieve <brendan.grieve@zepli.com.au>
Co-authored-by: bundabrg <bundabrg@grieve.com.au>
2020-08-07 12:33:21 -04:00
rtm516 5e5e3b0d28
Add a User-Agent to the rest of the web requests (#932) 2020-07-11 12:22:02 -05:00
James Harrison 3cdc208174
Update MinecraftCapes endpoints (#907)
Updates the mccapes endpoints with the new domain.
2020-07-06 09:26:00 -04:00
RednedEpic 6b68bbb413 Large refactoring to item translator and registry/util classes
- Merged ItemTranslator and ItemStackTranslator together.
- Split ItemTranslator into two classes: ItemTranslator and ItemRegistry. The registry is where items are registered, and the translator class is where item translation takes place.
- Made most of ItemTranslator's methods static and removed the initialization in Toolbox.
- Moved a handful of registry classes previously ending with 'Utils' to a 'Registry' class to be more fitting for the term.
- Moved inventory and block entity registration out of Translators.
- Renamed Translators to PacketTranslatorRegistry.
- Yeeted Toolbox.
- Minor cleanups and small refactors.
2020-05-24 20:07:05 -05:00
rtm516 fc6532732d
Adds skin ears from MinecraftCapes.co.uk + Clientside linked account skins + Elytra textures (#539)
* Added ears geometry support

* Added ear fetching from mc capes

* Added support for deadmau5

* Commented, documented and cleaned code

* Allow bedrock players to see their java skin/cape/ears when joining

* Optimised Imports

* Fix missing else statement

* Moved ears and fixed elytra skins

* Added ears config option

* Fixed cape/elytra transparency

* Fixed slim skin geometry

* Fixed async ears request and added alex skin

* Fixed default elytra not showing with no cape

* Moved to normal Base64 functions

Co-authored-by: James Harrison <james@fasttortoise.co.uk>
2020-05-23 16:06:34 -05:00
rtm516 0c60af66b2
Fixed customised skins causing strange display (#534)
* Fixed customised skins causing strange display

* Cleaned up floodgate player checking

* Fixed cape scale

Co-authored-by: James Harrison <james@fasttortoise.co.uk>
2020-05-11 23:45:16 -05:00
rtm516 5ae95433e5
Bedrock to Bedrock legacy skin support (#276)
* Added legacy skin support for bedrock to bedrock clients

* Added bedrock to bedrock cape handling

* Added bedrock geometry support

* Bedrock skins now work in all auth modes

* Tonne of debug info

* Added fix to prevent customised skins from being loaded

* Added skin size to bedrock client data

* Cleaned debugging code

* Made bedrock cape take priority over third party

* Cut the customised skin image in half to hopefully get it to map

* Removed hacky conversion attempt

* Fixed bedrock skin caching on load and 1.14.60 support

* Cleaned up debug messages

* Added linked player ignore
2020-05-06 16:50:01 -05:00
ForceUpdate1 82433f8078
Fix capes (#436)
* fix capes

* remove gson

* clean up

* clean up

* formatting code

* Made the changes fit a bit better into the already existing code

* Throw the nullptr before the download complete message,
making debugging skins less confusing

Co-authored-by: Tim203 <mctim203@gmail.com>
2020-04-29 11:04:45 -05:00
rtm516 4ee95f585d
Move all json to Jackson instead of a mix of 2 libraries (#302)
* Swapped most GSON refrences to Jackson

* Converted FormWindow getJSONData

Co-authored-by: Redned <redned235@gmail.com>
2020-04-20 15:10:30 -05:00
RednedEpic 52b23950ea Merge branch 'master' into plugin (should fix building) 2020-01-18 16:46:07 -06:00
RednedEpic dc594ee22c Update license headers
Certain headers for classes that are to be removed (e.g. plugin api) were not updated to prevent merge conflicts.
2020-01-08 21:05:42 -06:00
RednedEpic e38322a3ec Nuke plugin API
https://media.giphy.com/media/oe33xf3B50fsc/giphy.gif
2019-12-21 11:35:48 -06:00
OnlyBMan afab21695a Update SkinProvider.java
Remove duplicate code
2019-12-16 22:26:35 -05:00
OnlyBMan 203b3b9d46 Update SkinProvider.java
Instead of calling the scale method 3 times, just used a cached scaled image
2019-12-15 19:24:00 -05:00
OnlyBMan 16950bf8f2 Update SkinProvider.java
Fix OptiFine capes and downscales banner capes so they work on PE too.
2019-12-14 21:12:12 -05:00
Tim203 068033aeaa Fixes errors related to skins 2019-11-19 21:31:24 +01:00
Tim203 46cb14fc0a Removed unused class and made PlayerList show every player again 2019-10-10 23:16:07 +02:00
Tim203 15506cf5b4 Edited PlayerInit behavior and updated protocol lib to 2.3.0 2019-10-09 20:39:38 +02:00
Tim203 5eb7565b0a Third party capes, rotation fixed, wait for the client and updated protocol lib 2019-10-02 22:45:29 +02:00
Tim203 0b193c04e7 Players spawn, player skins, scoreboard, bossbar and updated protocol lib 2019-09-25 23:52:28 +02:00