satoshinm / WebSandboxMC

Bukkit plugin providing a web-based interface with an interactive WebGL 3D preview or glimpse of your server 🕷⏳📦 ⛺
https://www.spigotmc.org/resources/websandboxmc.39415/
MIT License
19 stars 5 forks source link

WebSandboxMC is too big to upload to Spigot resources, so it cannot be used on Aternos #28

Closed satoshinm closed 7 years ago

satoshinm commented 7 years ago

Spigot Resources maximum plugin file upload size is 4 MB:

https://www.spigotmc.org/resources/websandboxmc.39415/add-version

screen shot 2017-04-16 at 7 58 31 pm

but WebSandboxMC is far bigger:

WebSandboxMC $ ls -lh releases/
total 76776
-rw-r--r--@ 1 admin  staff   7.7M Apr 13 22:50 WebSandboxMC-0.1.jar
-rw-r--r--  1 admin  staff   6.0M Apr 13 22:50 WebSandboxMC-0.2.jar
-rw-r--r--  1 admin  staff   6.0M Apr 14 00:27 WebSandboxMC-0.3.jar
-rw-r--r--  1 admin  staff   6.0M Apr 15 00:06 WebSandboxMC-0.4.jar
-rw-r--r--  1 admin  staff   6.0M Apr 15 21:38 WebSandboxMC-0.5.jar
-rw-r--r--  1 admin  staff   6.0M Apr 16 19:16 WebSandboxMC-0.6.jar

therefore I am hosting it on GitHub releases, posting on Spigot Resources with an external download link. But this creates restrictions not present with a direct upload to spigot.org, such as:

https://board.aternos.org/index.php?thread/7366-how-to-write-a-good-plugin-modpack-mod-request/

Before you request your plugin, please check if your plugin...

  • ... is available on the Bukkit or Spigot plugin index. We won't accept plugins that are not in there!
  • ... is directly available there. If the button looks like the button in the screenshot [download via external site], we won't add the plugin

How big of plugins does https://dev.bukkit.org accept?

Is it even feasible to reduce the size of WebSandboxMC under the limit? The compiled NetCraft output, even with emcc -O3 optimizations, is several megabytes:

WebSandboxMC $ ls -lh src/main/resources/
total 7296
-rw-r--r--  1 admin  staff   101K Apr 16 19:14 craft.html
-rw-r--r--  1 admin  staff    59K Apr 16 19:14 craft.html.mem
-rw-r--r--  1 admin  staff   3.4M Apr 16 19:14 craft.js
satoshinm commented 7 years ago

Dependencies take up 4.9 MB zipped (io/github/satoshinm/WebSandboxMC/dep), see about removing some. Netty is only 1.5 MB zipped. Many Bukkit servers include Netty, but of various versions, and older versions do not, so removing it could introduce incompatibilities. But I likely don't need most of these (where are they even coming from?):

screen shot 2017-04-16 at 8 07 26 pm
satoshinm commented 7 years ago

https://github.com/Bukkit/SamplePlugin/blob/master/pom.xml (submitted PR to fix: https://github.com/Bukkit/SamplePlugin/pull/16) seems to have the wrong scope for the API dependency, they use <scope>compile</scope>, but changing to <scope>provided</scope> prevents it from being included in the jar with the maven-shade-plugin (2.6 MB) -- no exclusions necessary!

But then I do have some unexpected dependencies to resolve:

20:13:00 [WARNING] java.lang.NoClassDefFoundError: io/github/satoshinm/WebSandboxMC/dep/com/google/common/base/Charsets
20:13:00 [WARNING]  at io.github.satoshinm.WebSandboxMC.ws.WebSocketIndexPageHandler.sendTextResource(WebSocketIndexPageHandler.java:84)

Only needed to remove com.google dependency by using java.nio instead for Charset.