mirror of
https://github.com/colbster937/originblacklist.git
synced 2026-02-04 11:07:41 +00:00
Compare commits
4 Commits
9985223d22
...
v2.0.2+8f1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f1fd3f1f4 | ||
|
|
50e2a954cd | ||
|
|
a6fb5e379c | ||
|
|
2699ceaeff |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,6 +2,7 @@
|
||||
/.vscode/
|
||||
/gradle/
|
||||
/build/
|
||||
/bin/
|
||||
/run/
|
||||
/gradlew
|
||||
/gradlew.bat
|
||||
@@ -240,7 +240,7 @@ public final class OriginBlacklist {
|
||||
player.getName().replaceAll("_", "\\_"),
|
||||
player.getOrigin(),
|
||||
player.getBrand(),
|
||||
player.getAddr(),
|
||||
this.config.get("discord.send_ips").getAsBoolean() ? player.getAddr() : "*\\*CENSORED\\**",
|
||||
player.getPVN(),
|
||||
userAgent,
|
||||
player.isRewind() ? "YES" : "NO",
|
||||
|
||||
@@ -216,6 +216,7 @@ public final class OriginBlacklistConfig {
|
||||
final Json5Object dobj = new Json5Object();
|
||||
addJSONObj(dobj, "enabled", Json5Primitive.fromBoolean(false), null);
|
||||
addJSONObj(dobj, "webhook_urls", new Json5Array(), null);
|
||||
addJSONObj(dobj, "send_ips", Json5Primitive.fromBoolean(true), null);
|
||||
addJSONObj(obj, "discord", dobj, null);
|
||||
final Json5Object uobj = new Json5Object();
|
||||
addJSONObj(uobj, "enabled", Json5Primitive.fromBoolean(true), null);
|
||||
|
||||
@@ -5,6 +5,7 @@ import xyz.webmc.originblacklist.base.util.OPlayer;
|
||||
|
||||
import net.lax1dude.eaglercraft.backend.server.api.event.IBaseServerEvent;
|
||||
|
||||
@SuppressWarnings({ "rawtypes" })
|
||||
public abstract class OriginBlacklistEvent {
|
||||
private final EnumConnectionType connectionType;
|
||||
private final IBaseServerEvent eaglerEvent;
|
||||
|
||||
@@ -5,6 +5,7 @@ import xyz.webmc.originblacklist.base.util.OPlayer;
|
||||
|
||||
import net.lax1dude.eaglercraft.backend.server.api.event.IEaglercraftLoginEvent;
|
||||
|
||||
@SuppressWarnings({ "rawtypes" })
|
||||
public final class OriginBlacklistLoginEvent extends OriginBlacklistEvent {
|
||||
public OriginBlacklistLoginEvent(final IEaglercraftLoginEvent eaglerEvent, final Object javaEvent,
|
||||
final EnumConnectionType connectionType, final OPlayer player) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import xyz.webmc.originblacklist.base.util.OPlayer;
|
||||
|
||||
import net.lax1dude.eaglercraft.backend.server.api.event.IEaglercraftMOTDEvent;
|
||||
|
||||
@SuppressWarnings({ "rawtypes" })
|
||||
public final class OriginBlacklistMOTDEvent extends OriginBlacklistEvent {
|
||||
public OriginBlacklistMOTDEvent(final IEaglercraftMOTDEvent eaglerEvent, final Object javaEvent,
|
||||
final EnumConnectionType connectionType, final OPlayer player) {
|
||||
|
||||
@@ -78,25 +78,60 @@ public final class OPlayer {
|
||||
}
|
||||
|
||||
private static final String formatIPAddress(String addr) {
|
||||
if (addr.startsWith("/")) {
|
||||
addr = addr.substring(1);
|
||||
}
|
||||
if (addr == null) {
|
||||
addr = OriginBlacklist.UNKNOWN_STR;
|
||||
} else {
|
||||
if (addr.startsWith("/")) {
|
||||
addr = addr.substring(1);
|
||||
}
|
||||
|
||||
int i = addr.lastIndexOf('/');
|
||||
if (i != -1) {
|
||||
addr = addr.substring(i + 1);
|
||||
}
|
||||
int i = addr.lastIndexOf('/');
|
||||
if (i != -1) {
|
||||
addr = addr.substring(i + 1);
|
||||
}
|
||||
|
||||
if (addr.startsWith("[")) {
|
||||
i = addr.indexOf(']');
|
||||
if (i != -1)
|
||||
return addr.substring(1, i);
|
||||
return addr.substring(1);
|
||||
}
|
||||
if (addr.startsWith("[")) {
|
||||
i = addr.indexOf(']');
|
||||
if (i != -1) {
|
||||
addr = addr.substring(1, i);
|
||||
} else {
|
||||
addr = addr.substring(1);
|
||||
}
|
||||
} else {
|
||||
i = addr.lastIndexOf(':');
|
||||
if (i != -1) {
|
||||
String a = addr.substring(0, i);
|
||||
String p = addr.substring(i + 1);
|
||||
|
||||
i = addr.lastIndexOf(':');
|
||||
if (i != -1) {
|
||||
addr = addr.substring(0, i);
|
||||
boolean port = !p.isEmpty();
|
||||
for (int j = 0; j < p.length() && port; j++) {
|
||||
char c = p.charAt(j);
|
||||
port = (c >= '0' && c <= '9');
|
||||
}
|
||||
|
||||
if (port) {
|
||||
if (a.indexOf('.') != -1) {
|
||||
addr = a;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int c = 0;
|
||||
boolean hex = true;
|
||||
for (int j = 0; j < addr.length(); j++) {
|
||||
char ch = addr.charAt(j);
|
||||
if (ch == ':') {
|
||||
c++;
|
||||
} else if (!((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F'))) {
|
||||
hex = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hex && c == 6 && addr.indexOf("::") == -1) {
|
||||
addr = addr + "::";
|
||||
}
|
||||
}
|
||||
|
||||
return addr;
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.util.CachedServerIcon;
|
||||
import org.semver4j.Semver;
|
||||
|
||||
@SuppressWarnings({ "rawtypes" })
|
||||
public final class OriginBlacklistBukkit extends JavaPlugin implements Listener, IOriginBlacklistPlugin {
|
||||
private boolean papiPlaceholdersEnabled;
|
||||
private Object papi;
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.bstats.bungeecord.Metrics;
|
||||
import org.bstats.charts.AdvancedPie;
|
||||
import org.semver4j.Semver;
|
||||
|
||||
@SuppressWarnings({ "deprecation" })
|
||||
@SuppressWarnings({ "deprecation", "rawtypes" })
|
||||
public final class OriginBlacklistBungee extends Plugin implements Listener, IOriginBlacklistPlugin {
|
||||
private ProxyServer proxy;
|
||||
private boolean papiPlaceholdersEnabled;
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.bstats.velocity.Metrics.Factory;
|
||||
import org.semver4j.Semver;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@SuppressWarnings({ "deprecation", "unchecked" })
|
||||
@SuppressWarnings({ "deprecation", "unchecked", "rawtypes" })
|
||||
public final class OriginBlacklistVelocity implements IOriginBlacklistPlugin {
|
||||
private final PluginContainer plugin;
|
||||
private final Factory metricsFactory;
|
||||
|
||||
Reference in New Issue
Block a user