MrCrayfishDeviceMod icon indicating copy to clipboard operation
MrCrayfishDeviceMod copied to clipboard

Loading Wallpapers on Servers

Open TheCardinalSystem opened this issue 8 years ago • 6 comments

In order for our (myself and Dev's Coffee) import mod to become a pull request, there are a few things we need to discuss. Firstly, the wallpapers field in the laptop class will need to become an instance variable, otherwise adding a wallpaper to one laptop will add it to all laptops. Secondly, in order for this to work on a server, we need to change how wallpapers are loaded. Currently, wallpapers are loaded with resource locations. This is a problem because imported wallpapers are stored locally. If one play opens another player's laptop, the wallpapers will not render due to the fact that only the first player has the wallpaper locally saved. The resource location will point to a nonexistent wallpaper on the second player's client. Perhaps wallpapers would be saved as NBT data? If this is not changed, we will have to fire an event every time a wallpaper is loaded, and event listeners will install that wallpaper locally on every client in a directory set aside for that specific server (which will cause severe lagging).

TheCardinalSystem avatar Feb 05 '18 00:02 TheCardinalSystem

There is Urls, a great invention

FlickySH avatar Feb 05 '18 05:02 FlickySH

Take in mind that if files are going to be sent to other players, that may also create possibilities for exploits.

melluh avatar Feb 05 '18 06:02 melluh

You dont need to send any files :P you can directly use ImageIO and URLStreams to make a direct exchange from a stream to a image and thus no way to exploit that (altho its still exchanging data between computers)

m00nwtchr avatar Feb 08 '18 06:02 m00nwtchr

@Aregev2 I considered that approach, but there is no guarantee that the image will not be removed from whatever website.

TheCardinalSystem avatar Feb 22 '18 20:02 TheCardinalSystem

@MisterMelDev that I have considered, which is why @lukas2005's approach seems more reasonable. Although in the end, sending large amounts of image data through a socket would cause stupid amounts lag, especially on servers with many players.

TheCardinalSystem avatar Feb 22 '18 20:02 TheCardinalSystem

lol i have a random idea how 2 solve this (altho its not really that great XD) let's use IPFS for transferring wallpapers XD https://ipfs.io/

m00nwtchr avatar Mar 01 '18 14:03 m00nwtchr