File tree Expand file tree Collapse file tree 2 files changed +8
-11
lines changed
main/java/com/comphenix/protocol/updater
test/java/com/comphenix/protocol/updater Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -88,20 +88,15 @@ public void run() {
88
88
}
89
89
}
90
90
91
- private static final String PROTOCOL = "https://" ;
92
- private static final String RESOURCE_URL = PROTOCOL + "www.spigotmc.org/resources/protocollib.1997/" ;
93
- private static final String API_URL = PROTOCOL + "www.spigotmc.org/api/general.php" ;
94
- private static final String ACTION = "POST" ;
95
-
96
- private static final int ID = 1997 ;
97
- private static final byte [] API_KEY = ("key=98BE0FE67F88AB82B4C197FAF1DC3B69206EFDCC4D3B80FC83A00037510B99B4&resource=" + ID ).getBytes (Charsets .UTF_8 );
91
+ private static final String RESOURCE_URL = "https://www.spigotmc.org/resources/protocollib.1997/" ;
92
+ private static final String UPDATE_URL = "https://api.spigotmc.org/legacy/update.php?resource=1997" ;
93
+ private static final String ACTION = "GET" ;
98
94
99
95
public String getSpigotVersion () throws IOException {
100
96
try (Closer closer = Closer .create ()) {
101
- HttpURLConnection con = (HttpURLConnection ) new URL (API_URL ).openConnection ();
97
+ HttpURLConnection con = (HttpURLConnection ) new URL (UPDATE_URL ).openConnection ();
102
98
con .setDoOutput (true );
103
99
con .setRequestMethod (ACTION );
104
- con .getOutputStream ().write (API_KEY );
105
100
106
101
InputStreamReader isr = closer .register (new InputStreamReader (con .getInputStream ()));
107
102
BufferedReader br = closer .register (new BufferedReader (isr ));
Original file line number Diff line number Diff line change 12
12
import org .bukkit .Server ;
13
13
import org .bukkit .plugin .Plugin ;
14
14
import org .bukkit .plugin .PluginDescriptionFile ;
15
+ import org .junit .BeforeClass ;
16
+ import org .junit .Test ;
15
17
16
18
import com .comphenix .protocol .updater .Updater .UpdateType ;
17
19
@@ -23,14 +25,14 @@ public class UpdaterTest {
23
25
private static final int BUKKIT_DEV_ID = 45564 ;
24
26
private static Plugin plugin ;
25
27
26
- // @BeforeClass
28
+ @ BeforeClass
27
29
public static void preparePlugin () {
28
30
Server server = mock (Server .class );
29
31
when (server .getUpdateFolder ()).thenReturn (null );
30
32
31
33
plugin = mock (Plugin .class );
32
34
String version = System .getProperty ("projectVersion" );
33
- if (version == null ) version = "4.2.1 " ;
35
+ if (version == null ) version = "4.4.0 " ;
34
36
when (plugin .getDescription ()).thenReturn (new PluginDescriptionFile ("ProtocolLib" , version , null ));
35
37
when (plugin .getLogger ()).thenReturn (Logger .getLogger ("ProtocolLib" ));
36
38
when (plugin .getDataFolder ()).thenReturn (null );
You can’t perform that action at this time.
0 commit comments