Solved Download a plugin with java.net.URL.

Discussion in 'Spigot Plugin Development' started by JoseGamer_PT, May 20, 2016.

  1. Hello spigot community! So i am develoveping an updater for my plugins!
    How i can download my plugin from my resource page?

    Thanks for your time!
    - Jose
     
  2. Just a heads up: spigot uses cloud flare so you might end up downloading the redirect page instead of the file :3
     
    • Winner Winner x 1
  3. Well... by that logic: how are you going to read what we say?
     
    • Agree Agree x 1
    • Funny Funny x 1
  4. I tried this and the jar always came out corrupt and unusable. Just notify the user of a new update and have them do it manually

    Sent from my SGH-I747M using Tapatalk
     
  5. Provided that Spigot is a fork of Bukkit basically anything you can do with Bukkit is possible with Spigot.
     
  6. Not necessarily in the case of the sites

    Sent from my SGH-I747M using Tapatalk
     
    • Agree Agree x 1
  7. First error. yay D:

    Code (Text):

    java.io.IOException: Server returned HTTP response code: 403 for URL: https://www.spigotmc.org/resources/realscoreboard.22928/
    [18:51:01 WARN]:        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
    [18:51:01 WARN]:        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    [18:51:01 WARN]:        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
    [18:51:01 WARN]:        at java.net.URL.openStream(Unknown Source)
    [18:51:01 WARN]:        at org.apache.commons.io.FileUtils.copyURLToFile(FileUtils.java:1460)
    [18:51:01 WARN]:        at pt.josegamerpt.realscoreboard.updater.Updater.downloadUpdate(Updater.java:69)
    [18:51:01 WARN]:        at pt.josegamerpt.realscoreboard.updater.Updater.checkForUpdates(Updater.java:58)
    [18:51:01 WARN]:        at pt.josegamerpt.realscoreboard.cmd.RealScoreBoardCMD.onCommand(RealScoreBoardCMD.java:40)
    [18:51:01 WARN]:        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
    [18:51:01 WARN]:        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141)
    [18:51:01 WARN]:        at org.bukkit.craftbukkit.v1_9_R1.CraftServer.dispatchCommand(CraftServer.java:645)
    [18:51:01 WARN]:        at net.minecraft.server.v1_9_R1.PlayerConnection.handleCommand(PlayerConnection.java:1350)
    [18:51:01 WARN]:        at net.minecraft.server.v1_9_R1.PlayerConnection.a(PlayerConnection.java:1185)
    [18:51:01 WARN]:        at net.minecraft.server.v1_9_R1.PacketPlayInChat.a(PacketPlayInChat.java:45)
    [18:51:01 WARN]:        at net.minecraft.server.v1_9_R1.PacketPlayInChat.a(PacketPlayInChat.java:1)
    [18:51:01 WARN]:        at net.minecraft.server.v1_9_R1.PlayerConnectionUtils$1.run(SourceFile:13)
    [18:51:01 WARN]:        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    [18:51:01 WARN]:        at java.util.concurrent.FutureTask.run(Unknown Source)
    [18:51:01 WARN]:        at net.minecraft.server.v1_9_R1.SystemUtils.a(SourceFile:45)
    [18:51:01 WARN]:        at net.minecraft.server.v1_9_R1.MinecraftServer.D(MinecraftServer.java:721)
    [18:51:01 WARN]:        at net.minecraft.server.v1_9_R1.DedicatedServer.D(DedicatedServer.java:400)
    [18:51:01 WARN]:        at net.minecraft.server.v1_9_R1.MinecraftServer.C(MinecraftServer.java:660)
    [18:51:01 WARN]:        at net.minecraft.server.v1_9_R1.MinecraftServer.run(MinecraftServer.java:559)
    [18:51:01 WARN]:        at java.lang.Thread.run(Unknown Source)
     
     
  8. Host on an external site, you can't access spigot through code

    Sent from my SGH-I747M using Tapatalk
     
  9. I can host in dropbox for example?
     
  10. Yes, but give it the direct download link. Otherwise you'll just get the HTML page

    Sent from my SGH-I747M using Tapatalk
     
  11. SOLVED! THANKS FOR ALL HELP!
     
  12. Considering that this forum can be considered a database for those with the same problem, mind sharing your solution?
     
    • Agree Agree x 1
  13. Oh.. right.
    I used github and i made a download.
     
    • Optimistic Optimistic x 1