-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
747 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
mod_name = AcademyCraft | ||
mod_ver = 1.1.1 | ||
mod_ver = 1.1.2 | ||
mod_group = cn.academy | ||
mc_ver = 1.12.2 | ||
forge_ver = 14.23.4.2705-1.12.2 | ||
|
||
nei_ver = 2.4.1.233 | ||
ccl_ver = 3.1.8.341 | ||
|
||
lambdalib_ver = 0.1.8 | ||
lambdalib_ver = 0.1.9 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../cn/academy/analyticUtil/AnalyticDto.java → ...java/cn/academy/analytic/AnalyticDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package cn.academy.analyticUtil; | ||
package cn.academy.analytic; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...yticUtil/events/AnalyticLevelUpEvent.java → ...analytic/events/AnalyticLevelUpEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...alyticUtil/events/AnalyticSkillEvent.java → ...y/analytic/events/AnalyticSkillEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package cn.academy.terminal; | ||
|
||
import cn.academy.AcademyCraft; | ||
import cn.lambdalib2.util.Debug; | ||
import com.google.gson.Gson; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraftforge.common.MinecraftForge; | ||
import net.minecraftforge.fml.common.eventhandler.Event; | ||
import org.apache.commons.io.IOUtils; | ||
|
||
import java.io.InputStream; | ||
import java.net.URL; | ||
import java.net.URLConnection; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
public enum DonatorList { | ||
Instance; | ||
|
||
List<String> _donators = Collections.emptyList(); | ||
|
||
final Gson _gson = new Gson(); | ||
|
||
volatile boolean _requesting = false; | ||
|
||
public boolean isLoaded() { | ||
return _donators.size() > 0; | ||
} | ||
|
||
private class Attributes { | ||
public List<String> list; | ||
} | ||
|
||
private class ResponseData { | ||
public boolean success; | ||
public Attributes attributes; | ||
} | ||
|
||
public List<String> getList() { | ||
return _donators; | ||
} | ||
|
||
public void tryRequest() { | ||
if (!isLoaded() && !_requesting) { | ||
_requesting = true; | ||
new Thread(() -> { | ||
try { | ||
String url = "https://ac.li-dev.cn/donators"; | ||
URLConnection con = new URL(url).openConnection(); | ||
con.setDoInput(true); | ||
|
||
InputStream is = con.getInputStream(); | ||
String text = IOUtils.toString(is, "UTF-8"); | ||
ResponseData rsp = _gson.fromJson(text, ResponseData.class); | ||
|
||
if (rsp.success) { | ||
Debug.assertNotNull(rsp.attributes); | ||
Debug.assertNotNull(rsp.attributes.list); | ||
|
||
// Acknowledge the result in CLIENT thread | ||
Minecraft.getMinecraft().addScheduledTask(() -> { | ||
_donators = rsp.attributes.list; | ||
MinecraftForge.EVENT_BUS.post(new DonatorListRefreshEvent()); | ||
}); | ||
} else { | ||
Debug.error("AcademyCraft failed when requesting donator list."); | ||
if (AcademyCraft.DEBUG_MODE) | ||
Debug.error("Rsp str: " + text); | ||
} | ||
} catch (Exception e) { | ||
if (AcademyCraft.DEBUG_MODE) | ||
Debug.error(e); | ||
} | ||
_requesting = false; | ||
}).start(); | ||
} | ||
} | ||
|
||
public static class DonatorListRefreshEvent extends Event {} | ||
} |
Oops, something went wrong.