File tree Expand file tree Collapse file tree 9 files changed +101
-6
lines changed Expand file tree Collapse file tree 9 files changed +101
-6
lines changed Original file line number Diff line number Diff line change 1+ ## v4.2.2 Changelog:
2+ ```
3+ + Added API Update Checker
4+ + Now the API can be added as jar file to the plugins folder
5+ * Fixes with Songoda Update Checker
6+ ```
7+
18## v4.2.1 Changelog:
29```
310+ Now the API check if the MojangAPI (https://sessionserver.mojang.com) is down.
Original file line number Diff line number Diff line change 66
77 <groupId >xyz.theprogramsrc</groupId >
88 <artifactId >SuperCoreAPI</artifactId >
9- <version >4.2.1 </version >
9+ <version >4.2.2 </version >
1010 <packaging >jar</packaging >
1111
1212 <name >SuperCoreAPI</name >
Original file line number Diff line number Diff line change 11package xyz .theprogramsrc ;
22
33
4+ import xyz .theprogramsrc .supercoreapi .SuperPlugin ;
5+ import xyz .theprogramsrc .supercoreapi .global .updater .SpigotUpdateChecker ;
6+
47/**
58 * This is a set of utils that need to be loaded
6- *
7- * TODO
89 */
910public class Base {
1011
11- public Base (){
12+ private final SuperPlugin <?> plugin ;
13+
14+ public Base (SuperPlugin <?> plugin ){
15+ this .plugin = plugin ;
16+ this .loadUpdateChecker ();
17+ }
18+
19+ private void loadUpdateChecker (){
20+ new SpigotUpdateChecker ("77096" ){
21+
22+ @ Override
23+ public void onCheckFail () {
24+ Base .this .plugin .log ("&cError while checking &4SuperCoreAPI &cupdates." );
25+ }
1226
27+ @ Override
28+ public void onCheckSuccess (String lastVersion ) {
29+ String currentVersion = "4.2.2" ;
30+ int latest = Integer .parseInt (lastVersion .split (" " )[0 ].replaceAll ("\\ ." , "" ));
31+ int current = Integer .parseInt (currentVersion .split (" " )[0 ].replaceAll ("\\ ." , "" ));
32+ if (latest > current ){
33+ Base .this .plugin .log ("&cNew update available for &3SuperCoreAPI &7(" +lastVersion +")" );
34+ Base .this .plugin .log ("&cIf you're the developer of the plugin update the API, if you're a customer of a plugin using &3SuperCoreAPI&c please notify to the Developer." );
35+ }else if (latest < current ){
36+ Base .this .plugin .log ("&cIt seems like you're running a non-release version of &3SuperCoreAPI" );
37+ Base .this .plugin .log ("&cUnless you're the developer, you must use the version &7" + lastVersion );
38+ }
39+ }
40+ }.check ();
1341 }
1442}
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ public void checkUpdates(){
1818 if (content == null ){
1919 this .onFailCheck ();
2020 }else {
21- JsonObject data = new JsonParser ().parse (content ).getAsJsonObject ();
21+ JsonObject data = new JsonParser ().parse (content ).getAsJsonObject (). get ( "data" ). getAsJsonObject () ;
2222 JsonObject json = data .get ("versions" ).getAsJsonArray ().get (0 ).getAsJsonObject ();
2323 String version = json .get ("version" ).getAsString ();
2424 this .onSuccessCheck (version );
Original file line number Diff line number Diff line change 1+ package xyz .theprogramsrc .supercoreapi .plugin ;
2+
3+ import net .md_5 .bungee .api .ChatColor ;
4+ import net .md_5 .bungee .api .chat .TextComponent ;
5+ import net .md_5 .bungee .api .plugin .Plugin ;
6+
7+ public class BungeePlugin extends Plugin {
8+
9+ @ Override
10+ public void onEnable () {
11+ this .log ("&3SuperCoreAPI &awas loaded as .jar file" );
12+ }
13+
14+ @ Override
15+ public void onDisable () {
16+ this .log ("&3SuperCoreAPI &awas disabled" );
17+ }
18+
19+ private void log (String s ){
20+ this .getProxy ().getConsole ().sendMessage (new TextComponent (c (s )));
21+ }
22+
23+ private String c (String s ){
24+ return ChatColor .translateAlternateColorCodes ('&' , s );
25+ }
26+ }
Original file line number Diff line number Diff line change 1+ package xyz .theprogramsrc .supercoreapi .plugin ;
2+
3+ import org .bukkit .Bukkit ;
4+ import org .bukkit .ChatColor ;
5+ import org .bukkit .plugin .java .JavaPlugin ;
6+
7+ public class SpigotPlugin extends JavaPlugin {
8+
9+ @ Override
10+ public void onEnable () {
11+ this .log ("&3SuperCoreAPI &awas loaded as .jar file" );
12+ }
13+
14+ @ Override
15+ public void onDisable () {
16+ this .log ("&3SuperCoreAPI &awas disabled" );
17+ }
18+
19+ private void log (String s ){
20+ Bukkit .getConsoleSender ().sendMessage (c (s ));
21+ }
22+
23+ private String c (String s ){
24+ return ChatColor .translateAlternateColorCodes ('&' , s );
25+ }
26+ }
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ public void onLoad() {
5555 long current = System .currentTimeMillis ();
5656 i = this ;
5757 this .emergencyStop = false ;
58- new xyz .theprogramsrc .Base ();
58+ new xyz .theprogramsrc .Base (this );
5959 this .disableHooks = new ArrayList <>();
6060 this .serverFolder = Utils .folder (new File ("." ));
6161 this .firstStart = !this .getDataFolder ().exists ();
Original file line number Diff line number Diff line change 1+ name : SuperCoreAPI
2+ version : ${project.version}
3+ main : xyz.theprogramsrc.supercoreapi.plugin.BungeePlugin
4+ author : TheProgramSrc
Original file line number Diff line number Diff line change 1+ name : SuperCoreAPI
2+ version : ${project.version}
3+ main : xyz.theprogramsrc.supercoreapi.plugin.SpigotPlugin
4+ author : TheProgramSrc
You can’t perform that action at this time.
0 commit comments