mirror of
https://github.com/colbster937/originblacklist.git
synced 2026-02-04 19:17:40 +00:00
Compare commits
1 Commits
v2.0.3+581
...
ffdbcfa3b4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ffdbcfa3b4 |
@@ -9,8 +9,6 @@
|
||||
- [x] Client brand based blacklisting
|
||||
- [x] Username based blacklisting
|
||||
- [x] IP based blacklisting
|
||||
- [x] Modular multi-platform support
|
||||
- [x] JSON5 based configuration
|
||||
- [x] Kick message customization
|
||||
- [x] Blacklist MOTD customization
|
||||
- [x] MiniMessage and legacy formattings supported
|
||||
@@ -20,6 +18,11 @@
|
||||
- [ ] Subscribe to an auto-updating blacklist
|
||||
- [ ] Reverse blacklist (whitelist)
|
||||
|
||||
<h2>Changes from v1</h2>
|
||||
|
||||
- [x] Modular multi-platform support
|
||||
- [x] JSON5 based configuration
|
||||
|
||||
<h2>Download</h2>
|
||||
The latest release can be found at <b><a href="https://github.com/WebMCDevelopment/originblacklist/releases/latest/">https://github.com/WebMCDevelopment/originblacklist/releases/latest/</a></b>
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ val PLUGIN_NAME = "OriginBlacklist"
|
||||
val PLUGIN_IDEN = "originblacklist"
|
||||
val PLUGIN_DOMN = "xyz.webmc"
|
||||
val PLUGIN_DESC = "An eaglercraft client blacklist plugin."
|
||||
val PLUGIN_VERS = "2.0.3"
|
||||
val PLUGIN_VERS = "2.0.4"
|
||||
val PLUGIN_SITE = "https://github.com/WebMCDevelopment/$PLUGIN_IDEN"
|
||||
val PLUGIN_DEPA = listOf("EaglercraftXServer")
|
||||
val PLUGIN_DEPB = listOf("EaglercraftXServer")
|
||||
|
||||
@@ -31,42 +31,62 @@ public class UpdateChecker {
|
||||
String ret = null;
|
||||
Json5Element element = json5.parse(reader);
|
||||
reader.close();
|
||||
|
||||
Json5Object rel = null;
|
||||
Json5Object snap = null;
|
||||
|
||||
if (element instanceof Json5Array) {
|
||||
final Json5Array arr = element.getAsJson5Array();
|
||||
if (arr.size() > 0) {
|
||||
for (int i = 0; i < Math.min(2, arr.size()); i++) {
|
||||
element = arr.get(i);
|
||||
if (element instanceof Json5Object) {
|
||||
final Json5Object obj = element.getAsJson5Object();
|
||||
if (allowSnapshots || !obj.get("prerelease").getAsBoolean()) {
|
||||
final String tag = obj.get("tag_name").getAsString();
|
||||
final Semver ver = new Semver(tag.startsWith("v") ? tag.substring(1) : tag);
|
||||
String comm;
|
||||
try {
|
||||
comm = ver.getBuild().get(0).trim();
|
||||
} catch (Throwable t) {
|
||||
comm = "";
|
||||
}
|
||||
if (ver.isGreaterThan(currentVersion) || (allowSnapshots && currentVersion.diff(ver) == VersionDiff.BUILD && OriginBlacklist.isNonNull(comm) && !BuildInfo.get("git_cm_hash").startsWith(comm))) {
|
||||
element = obj.get("assets");
|
||||
if (element instanceof Json5Array) {
|
||||
final Json5Array aArr = element.getAsJson5Array();
|
||||
if (aArr.size() > 0) {
|
||||
element = aArr.get(0);
|
||||
if (element instanceof Json5Object) {
|
||||
final Json5Object vObj = element.getAsJson5Object();
|
||||
ret = vObj.get("browser_download_url").getAsString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
element = arr.get(i);
|
||||
if (element instanceof Json5Object) {
|
||||
final Json5Object obj = element.getAsJson5Object();
|
||||
if (!obj.has("published_at")) {
|
||||
continue;
|
||||
}
|
||||
final boolean pre = obj.get("prerelease").getAsBoolean();
|
||||
if (!pre) {
|
||||
if (rel == null || obj.get("published_at").getAsString().compareTo(rel.get("published_at").getAsString()) > 0) {
|
||||
rel = obj;
|
||||
}
|
||||
} else {
|
||||
if (snap == null || obj.get("published_at").getAsString().compareTo(snap.get("published_at").getAsString()) > 0) {
|
||||
snap = obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
final Json5Object obj = i == 0 ? rel : snap;
|
||||
if (obj == null || (i == 1 && !allowSnapshots)) {
|
||||
continue;
|
||||
}
|
||||
final String tag = obj.get("tag_name").getAsString();
|
||||
final Semver ver = new Semver(tag.startsWith("v") ? tag.substring(1) : tag);
|
||||
String comm;
|
||||
try {
|
||||
comm = ver.getBuild().get(0).trim();
|
||||
} catch (Throwable t) {
|
||||
comm = "";
|
||||
}
|
||||
if (ver.isGreaterThan(currentVersion) || (allowSnapshots && currentVersion.diff(ver) == VersionDiff.BUILD && OriginBlacklist.isNonNull(comm) && !BuildInfo.get("git_cm_hash").startsWith(comm))) {
|
||||
element = obj.get("assets");
|
||||
if (element instanceof Json5Array) {
|
||||
final Json5Array aArr = element.getAsJson5Array();
|
||||
if (aArr.size() > 0) {
|
||||
element = aArr.get(0);
|
||||
if (element instanceof Json5Object) {
|
||||
ret = element.getAsJson5Object().get("browser_download_url").getAsString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
conn.disconnect();
|
||||
return ret;
|
||||
} catch (final Throwable t) {
|
||||
|
||||
Reference in New Issue
Block a user