mirror of
https://github.com/colbster937/originblacklist.git
synced 2026-02-04 19:17:40 +00:00
Compare commits
5 Commits
v2.0.7
...
00b1c99dc4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00b1c99dc4 | ||
|
|
1cd60a4dba | ||
|
|
ebcae682aa | ||
|
|
f22e800439 | ||
|
|
f0274ff4d4 |
@@ -14,7 +14,7 @@ val PLUGIN_NAME = "OriginBlacklist"
|
|||||||
val PLUGIN_IDEN = "originblacklist"
|
val PLUGIN_IDEN = "originblacklist"
|
||||||
val PLUGIN_DOMN = "xyz.webmc.$PLUGIN_IDEN"
|
val PLUGIN_DOMN = "xyz.webmc.$PLUGIN_IDEN"
|
||||||
val PLUGIN_DESC = "An eaglercraft client blacklist plugin."
|
val PLUGIN_DESC = "An eaglercraft client blacklist plugin."
|
||||||
val PLUGIN_VERS = "2.0.7"
|
val PLUGIN_VERS = "2.0.8"
|
||||||
val PLUGIN_SITE = "https://github.com/WebMCDevelopment/$PLUGIN_IDEN"
|
val PLUGIN_SITE = "https://github.com/WebMCDevelopment/$PLUGIN_IDEN"
|
||||||
val PLUGIN_DEPA = listOf("EaglercraftXServer")
|
val PLUGIN_DEPA = listOf("EaglercraftXServer")
|
||||||
val PLUGIN_DEPB = listOf("EaglercraftXServer")
|
val PLUGIN_DEPB = listOf("EaglercraftXServer")
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ public final class OriginBlacklist {
|
|||||||
public static final String UNKNOWN_STR = "UNKNOWN";
|
public static final String UNKNOWN_STR = "UNKNOWN";
|
||||||
public static final String CENSORED_STR = "CENSORED";
|
public static final String CENSORED_STR = "CENSORED";
|
||||||
public static final String PLUGIN_REPO = "WebMCDevelopment/originblacklist";
|
public static final String PLUGIN_REPO = "WebMCDevelopment/originblacklist";
|
||||||
public static final int BSTATS_ID = 28776;
|
|
||||||
|
|
||||||
private final IOriginBlacklistPlugin plugin;
|
private final IOriginBlacklistPlugin plugin;
|
||||||
private final OriginBlacklistConfig config;
|
private final OriginBlacklistConfig config;
|
||||||
@@ -80,7 +79,9 @@ public final class OriginBlacklist {
|
|||||||
|
|
||||||
public final void shutdown() {
|
public final void shutdown() {
|
||||||
this.plugin.log(EnumLogLevel.INFO, "Shutting down...");
|
this.plugin.log(EnumLogLevel.INFO, "Shutting down...");
|
||||||
OriginBlacklistRequestHandler.unRegister(this);
|
if (this.isBlacklistAPIEnabled()) {
|
||||||
|
OriginBlacklistRequestHandler.unRegister(this);
|
||||||
|
}
|
||||||
this.plugin.shutdown();
|
this.plugin.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +114,7 @@ public final class OriginBlacklist {
|
|||||||
}
|
}
|
||||||
this.plugin.kickPlayer(this.getBlacklistedComponent("kick", blacklisted.getArrayString(),
|
this.plugin.kickPlayer(this.getBlacklistedComponent("kick", blacklisted.getArrayString(),
|
||||||
blacklisted.getAltString(), blacklisted.getString(), "not allowed", "not allowed on the server",
|
blacklisted.getAltString(), blacklisted.getString(), "not allowed", "not allowed on the server",
|
||||||
blacklisted_value, blacklisted.getActionString()), event);
|
blacklisted_value, blacklisted.getActionString(), false), event);
|
||||||
this.sendWebhooks(event, blacklisted);
|
this.sendWebhooks(event, blacklisted);
|
||||||
final String name = player.getName();
|
final String name = player.getName();
|
||||||
if (isNonNull(name)) {
|
if (isNonNull(name)) {
|
||||||
@@ -135,9 +136,12 @@ public final class OriginBlacklist {
|
|||||||
} else {
|
} else {
|
||||||
blacklisted_value = UNKNOWN_STR;
|
blacklisted_value = UNKNOWN_STR;
|
||||||
}
|
}
|
||||||
this.plugin.setMOTD(this.getBlacklistedComponent("motd", blacklisted.getArrayString(), blacklisted.getAltString(),
|
if (this.isMOTDEnabled()) {
|
||||||
blacklisted.getString(), "blacklisted", "blacklisted from the server", blacklisted_value,
|
this.plugin
|
||||||
blacklisted.getActionString()), event);
|
.setMOTD(this.getBlacklistedComponent("motd", blacklisted.getArrayString(), blacklisted.getAltString(),
|
||||||
|
blacklisted.getString(), "blacklisted", "blacklisted from the server", blacklisted_value,
|
||||||
|
blacklisted.getActionString(), true), event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,6 +153,14 @@ public final class OriginBlacklist {
|
|||||||
return this.config.getBoolean("bStats");
|
return this.config.getBoolean("bStats");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final boolean isMOTDEnabled() {
|
||||||
|
return this.config.getBoolean("motd.enabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean isWebhooksEnabled() {
|
||||||
|
return this.config.getBoolean("discord.webhook.enabled");
|
||||||
|
}
|
||||||
|
|
||||||
public final boolean isLogFileEnabled() {
|
public final boolean isLogFileEnabled() {
|
||||||
return this.config.getBoolean("logFile");
|
return this.config.getBoolean("logFile");
|
||||||
}
|
}
|
||||||
@@ -164,13 +176,17 @@ public final class OriginBlacklist {
|
|||||||
public final void setEaglerMOTD(final Component comp, final OriginBlacklistMOTDEvent event) {
|
public final void setEaglerMOTD(final Component comp, final OriginBlacklistMOTDEvent event) {
|
||||||
final IMOTDConnection conn = event.getEaglerEvent().getMOTDConnection();
|
final IMOTDConnection conn = event.getEaglerEvent().getMOTDConnection();
|
||||||
final List<String> lst = new ArrayList<>();
|
final List<String> lst = new ArrayList<>();
|
||||||
for (String ln : getComponentString(comp).split("\n")) {
|
for (final String ln : getComponentString(comp).split("\n")) {
|
||||||
lst.add(ln);
|
lst.add(ln);
|
||||||
}
|
}
|
||||||
|
final List<String> pLst = new ArrayList<>();
|
||||||
|
for (final Json5Element ln : this.config.getArray("motd.players.hover").getAsJson5Array()) {
|
||||||
|
pLst.add(getLegacyFromMiniMessage(ln.getAsString().replaceAll("%discord_invite%", this.config.getString("discord.invite"))));
|
||||||
|
}
|
||||||
conn.setServerMOTD(lst);
|
conn.setServerMOTD(lst);
|
||||||
conn.setPlayerTotal(0);
|
conn.setPlayerTotal(this.config.getInteger("motd.players.online"));
|
||||||
conn.setPlayerUnlimited();
|
conn.setPlayerMax(this.config.getInteger("motd.players.max"));
|
||||||
conn.setPlayerList(List.of());
|
conn.setPlayerList(pLst);
|
||||||
conn.setServerIcon(this.config.getIconBytes());
|
conn.setServerIcon(this.config.getIconBytes());
|
||||||
conn.sendToUser();
|
conn.sendToUser();
|
||||||
conn.disconnect();
|
conn.disconnect();
|
||||||
@@ -319,6 +335,7 @@ public final class OriginBlacklist {
|
|||||||
try {
|
try {
|
||||||
final Json5Object obj = new Json5Object();
|
final Json5Object obj = new Json5Object();
|
||||||
obj.addProperty("plugin_version", this.plugin.getPluginVersion().getVersion());
|
obj.addProperty("plugin_version", this.plugin.getPluginVersion().getVersion());
|
||||||
|
obj.addProperty("git_commit", COMMIT_L);
|
||||||
obj.addProperty("blacklist_to_whitelist", this.config.getBoolean("blacklist_to_whitelist"));
|
obj.addProperty("blacklist_to_whitelist", this.config.getBoolean("blacklist_to_whitelist"));
|
||||||
obj.addProperty("block_undefined_origin", this.config.getBoolean("block_undefined_origin"));
|
obj.addProperty("block_undefined_origin", this.config.getBoolean("block_undefined_origin"));
|
||||||
final Json5Object bObj = new Json5Object();
|
final Json5Object bObj = new Json5Object();
|
||||||
@@ -343,8 +360,8 @@ public final class OriginBlacklist {
|
|||||||
|
|
||||||
private final Component getBlacklistedComponent(final String type, final String id, final String blockType,
|
private final Component getBlacklistedComponent(final String type, final String id, final String blockType,
|
||||||
final String blockTypeAlt, final String notAllowed, final String notAllowedAlt, final String blockValue,
|
final String blockTypeAlt, final String notAllowed, final String notAllowedAlt, final String blockValue,
|
||||||
final String action) {
|
final String action, final boolean isMOTD) {
|
||||||
final Json5Array arr = this.config.getArray("messages." + type);
|
final Json5Array arr = this.config.getArray(isMOTD ? (type + ".text") : ("messages." + type));
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
for (int i = 0; i < arr.size(); i++) {
|
for (int i = 0; i < arr.size(); i++) {
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
@@ -357,21 +374,26 @@ public final class OriginBlacklist {
|
|||||||
.replaceAll("%block_type%", blockType)
|
.replaceAll("%block_type%", blockType)
|
||||||
.replaceAll("%not_allowed%", notAllowed)
|
.replaceAll("%not_allowed%", notAllowed)
|
||||||
.replaceAll("%not_allowed_alt%", notAllowedAlt)
|
.replaceAll("%not_allowed_alt%", notAllowedAlt)
|
||||||
.replaceAll("%blocked_value%", blockValue);
|
.replaceAll("%blocked_value%", blockValue)
|
||||||
|
.replaceAll("%discord_invite%", this.config.getString("discord.invite"));
|
||||||
return MiniMessage.miniMessage().deserialize(str);
|
return MiniMessage.miniMessage().deserialize(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final void sendWebhooks(final OriginBlacklistLoginEvent event, final EnumBlacklistType type) {
|
private final void sendWebhooks(final OriginBlacklistLoginEvent event, final EnumBlacklistType type) {
|
||||||
if (this.config.getBoolean("discord.enabled")) {
|
if (this.isWebhooksEnabled()) {
|
||||||
final OPlayer player = event.getPlayer();
|
final OPlayer player = event.getPlayer();
|
||||||
final EnumConnectionType connType = event.getConnectionType();
|
final EnumConnectionType connType = event.getConnectionType();
|
||||||
/* final String userAgent;
|
/*
|
||||||
if (connType == EnumConnectionType.EAGLER) {
|
* final String userAgent;
|
||||||
final IEaglerLoginConnection loginConn = event.getEaglerEvent().getLoginConnection();
|
* if (connType == EnumConnectionType.EAGLER) {
|
||||||
userAgent = loginConn.getWebSocketHeader(EnumWebSocketHeader.HEADER_USER_AGENT);
|
* final IEaglerLoginConnection loginConn =
|
||||||
} else {
|
* event.getEaglerEvent().getLoginConnection();
|
||||||
userAgent = UNKNOWN_STR;
|
* userAgent =
|
||||||
} */
|
* loginConn.getWebSocketHeader(EnumWebSocketHeader.HEADER_USER_AGENT);
|
||||||
|
* } else {
|
||||||
|
* userAgent = UNKNOWN_STR;
|
||||||
|
* }
|
||||||
|
*/
|
||||||
final byte[] payload = String.format(
|
final byte[] payload = String.format(
|
||||||
"""
|
"""
|
||||||
{
|
{
|
||||||
@@ -464,17 +486,17 @@ public final class OriginBlacklist {
|
|||||||
private final void updateLogFile(final OriginBlacklistLoginEvent event, final EnumBlacklistType type) {
|
private final void updateLogFile(final OriginBlacklistLoginEvent event, final EnumBlacklistType type) {
|
||||||
if (this.isLogFileEnabled()) {
|
if (this.isLogFileEnabled()) {
|
||||||
final OPlayer player = event.getPlayer();
|
final OPlayer player = event.getPlayer();
|
||||||
final String txt = Instant.now() + " - [player=" + player.getName() + "," + "blacklist_reason=" + type.toString() + "]";
|
final String txt = Instant.now() + " - [player=" + player.getName() + "," + "blacklist_reason=" + type.toString()
|
||||||
|
+ "]";
|
||||||
final Path dir = Paths.get(this.getDataDir());
|
final Path dir = Paths.get(this.getDataDir());
|
||||||
try {
|
try {
|
||||||
Files.createDirectories(dir);
|
Files.createDirectories(dir);
|
||||||
Files.writeString(
|
Files.writeString(
|
||||||
dir.resolve("blacklist.log"),
|
dir.resolve("blacklist.log"),
|
||||||
txt + "\n",
|
txt + "\n",
|
||||||
StandardOpenOption.CREATE,
|
StandardOpenOption.CREATE,
|
||||||
StandardOpenOption.WRITE,
|
StandardOpenOption.WRITE,
|
||||||
StandardOpenOption.APPEND
|
StandardOpenOption.APPEND);
|
||||||
);
|
|
||||||
} catch (final Throwable t) {
|
} catch (final Throwable t) {
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -500,4 +522,10 @@ public final class OriginBlacklist {
|
|||||||
public static final boolean isNonNull(final String str) {
|
public static final boolean isNonNull(final String str) {
|
||||||
return str != null && !str.isEmpty() && !str.isBlank() && !str.equals("null");
|
return str != null && !str.isEmpty() && !str.isBlank() && !str.equals("null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final class BSTATS {
|
||||||
|
public static final int VELOCITY = 29033;
|
||||||
|
public static final int BUNGEE = 29034;
|
||||||
|
public static final int BUKKIT = 29035;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ import de.marhali.json5.Json5Object;
|
|||||||
import de.marhali.json5.Json5Primitive;
|
import de.marhali.json5.Json5Primitive;
|
||||||
|
|
||||||
public final class OriginBlacklistConfig {
|
public final class OriginBlacklistConfig {
|
||||||
private static final Json5Object DEFAULT_CONFIG = getDefaultConfig();
|
public static final Json5Object DEFAULT_CONFIG = getDefaultConfig();
|
||||||
|
public static final int LATEST_CONFIG_VERSION = 2;
|
||||||
|
|
||||||
private final Json5 json5;
|
private final Json5 json5;
|
||||||
private final File file;
|
private final File file;
|
||||||
@@ -73,6 +74,7 @@ public final class OriginBlacklistConfig {
|
|||||||
Json5Element parsed = this.json5.parse(text);
|
Json5Element parsed = this.json5.parse(text);
|
||||||
if (parsed instanceof Json5Object) {
|
if (parsed instanceof Json5Object) {
|
||||||
this.config = (Json5Object) parsed;
|
this.config = (Json5Object) parsed;
|
||||||
|
this.config = OriginBlacklistConfigTransformer.transformConfig(this.config);
|
||||||
merge(this.config, DEFAULT_CONFIG);
|
merge(this.config, DEFAULT_CONFIG);
|
||||||
} else {
|
} else {
|
||||||
throw new IOException("Config must be an object!");
|
throw new IOException("Config must be an object!");
|
||||||
@@ -262,18 +264,29 @@ public final class OriginBlacklistConfig {
|
|||||||
kick.add("%action%");
|
kick.add("%action%");
|
||||||
kick.add("");
|
kick.add("");
|
||||||
kick.add("<aqua>Think this is a mistake? Join our discord:</aqua>");
|
kick.add("<aqua>Think this is a mistake? Join our discord:</aqua>");
|
||||||
kick.add("<blue>discord.gg/changethisintheconfig</blue>");
|
kick.add("<blue>%discord_invite%</blue>");
|
||||||
addJSONObj(mObj, "kick", kick, null);
|
addJSONObj(mObj, "kick", kick, null);
|
||||||
final Json5Array motd = new Json5Array();
|
|
||||||
motd.add("<red>This %block_type% is %not_allowed%!</red>");
|
|
||||||
motd.add("<dark_gray>»</dark_gray> <gray>%blocked_value%</gray>");
|
|
||||||
addJSONObj(mObj, "motd", motd, null);
|
|
||||||
final Json5Object actions = new Json5Object();
|
final Json5Object actions = new Json5Object();
|
||||||
actions.add("generic", Json5Primitive.fromString("<gold>Please switch to a different %block_type%.</gold>"));
|
actions.add("generic", Json5Primitive.fromString("<gold>Please switch to a different %block_type%.</gold>"));
|
||||||
actions.add("player_name", Json5Primitive.fromString("<gold>Please change your %block_type%.</gold>"));
|
actions.add("player_name", Json5Primitive.fromString("<gold>Please change your %block_type%.</gold>"));
|
||||||
actions.add("ip_address", Json5Primitive.fromString("<gold>Please contact staff for assistance.</gold>"));
|
actions.add("ip_address", Json5Primitive.fromString("<gold>Please contact staff for assistance.</gold>"));
|
||||||
addJSONObj(mObj, "actions", actions, null);
|
addJSONObj(mObj, "actions", actions, null);
|
||||||
addJSONObj(obj, "messages", mObj, null);
|
addJSONObj(obj, "messages", mObj, null);
|
||||||
|
final Json5Object nObj = new Json5Object();
|
||||||
|
addJSONObj(nObj, "enabled", Json5Primitive.fromBoolean(true), null);
|
||||||
|
final Json5Array mArr = new Json5Array();
|
||||||
|
mArr.add("<red>This %block_type% is %not_allowed%!</red>");
|
||||||
|
mArr.add("<dark_gray>»</dark_gray> <gray>%blocked_value%</gray>");
|
||||||
|
addJSONObj(nObj, "text", mArr, null);
|
||||||
|
final Json5Object mPlayers = new Json5Object();
|
||||||
|
addJSONObj(mPlayers, "online", Json5Primitive.fromNumber(0), null);
|
||||||
|
addJSONObj(mPlayers, "max", Json5Primitive.fromNumber(0), null);
|
||||||
|
final Json5Array hArr = new Json5Array();
|
||||||
|
hArr.add("<blue>Join our discord</blue>");
|
||||||
|
hArr.add("<blue>%discord_invite%</blue>");
|
||||||
|
addJSONObj(mPlayers, "hover", hArr, null);
|
||||||
|
addJSONObj(nObj, "players", mPlayers, null);
|
||||||
|
addJSONObj(obj, "motd", nObj, null);
|
||||||
final Json5Object bObj = new Json5Object();
|
final Json5Object bObj = new Json5Object();
|
||||||
final Json5Array origins = new Json5Array();
|
final Json5Array origins = new Json5Array();
|
||||||
origins.add(".*eaglerhackedclients\\.vercel\\.app.*");
|
origins.add(".*eaglerhackedclients\\.vercel\\.app.*");
|
||||||
@@ -302,9 +315,12 @@ public final class OriginBlacklistConfig {
|
|||||||
addJSONObj(bObj, "ip_addresses", ips, null);
|
addJSONObj(bObj, "ip_addresses", ips, null);
|
||||||
addJSONObj(obj, "blacklist", bObj, null);
|
addJSONObj(obj, "blacklist", bObj, null);
|
||||||
final Json5Object dObj = new Json5Object();
|
final Json5Object dObj = new Json5Object();
|
||||||
addJSONObj(dObj, "enabled", Json5Primitive.fromBoolean(false), null);
|
addJSONObj(dObj, "invite", Json5Primitive.fromString("discord.gg/changeme"), null);
|
||||||
addJSONObj(dObj, "webhook_urls", new Json5Array(), null);
|
final Json5Object webhook = new Json5Object();
|
||||||
addJSONObj(dObj, "send_ips", Json5Primitive.fromBoolean(true), null);
|
addJSONObj(webhook, "enabled", Json5Primitive.fromBoolean(false), null);
|
||||||
|
addJSONObj(webhook, "webhook_urls", new Json5Array(), null);
|
||||||
|
addJSONObj(webhook, "send_ips", Json5Primitive.fromBoolean(true), null);
|
||||||
|
addJSONObj(dObj, "webhook", webhook, null);
|
||||||
addJSONObj(obj, "discord", dObj, null);
|
addJSONObj(obj, "discord", dObj, null);
|
||||||
final Json5Object uObj = new Json5Object();
|
final Json5Object uObj = new Json5Object();
|
||||||
addJSONObj(uObj, "enabled", Json5Primitive.fromBoolean(true), null);
|
addJSONObj(uObj, "enabled", Json5Primitive.fromBoolean(true), null);
|
||||||
@@ -317,7 +333,7 @@ public final class OriginBlacklistConfig {
|
|||||||
addJSONObj(obj, "block_undefined_origin", Json5Primitive.fromBoolean(false), null);
|
addJSONObj(obj, "block_undefined_origin", Json5Primitive.fromBoolean(false), null);
|
||||||
addJSONObj(obj, "bStats", Json5Primitive.fromBoolean(true), null);
|
addJSONObj(obj, "bStats", Json5Primitive.fromBoolean(true), null);
|
||||||
addJSONObj(obj, "logFile", Json5Primitive.fromBoolean(true), null);
|
addJSONObj(obj, "logFile", Json5Primitive.fromBoolean(true), null);
|
||||||
addJSONObj(obj, "config_version", Json5Primitive.fromNumber(1), "DO NOT CHANGE");
|
addJSONObj(obj, "config_version", Json5Primitive.fromNumber(LATEST_CONFIG_VERSION), "DO NOT CHANGE");
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package xyz.webmc.originblacklist.base.config;
|
||||||
|
|
||||||
|
import de.marhali.json5.Json5Array;
|
||||||
|
import de.marhali.json5.Json5Object;
|
||||||
|
import de.marhali.json5.Json5Primitive;
|
||||||
|
|
||||||
|
public final class OriginBlacklistConfigTransformer {
|
||||||
|
public static final Json5Object transformConfig(final Json5Object config) {
|
||||||
|
final Json5Object obj = config.deepCopy();
|
||||||
|
final int ver = obj.get("config_version").getAsInt();
|
||||||
|
if (ver <= 1) {
|
||||||
|
final Json5Object mObj = obj.get("messages").getAsJson5Object().deepCopy();
|
||||||
|
final Json5Array motd = mObj.get("motd").getAsJson5Array().deepCopy();
|
||||||
|
mObj.remove("motd");
|
||||||
|
final Json5Object nObj = new Json5Object();
|
||||||
|
nObj.add("text", motd);
|
||||||
|
obj.remove("messages");
|
||||||
|
obj.add("messages", mObj);
|
||||||
|
obj.add("motd", nObj);
|
||||||
|
final Json5Object dObj = obj.get("discord").getAsJson5Object().deepCopy();
|
||||||
|
final Json5Primitive wEnabled = dObj.get("enabled").getAsJson5Primitive();
|
||||||
|
final Json5Array wURLS = dObj.get("webhook_urls").getAsJson5Array().deepCopy();
|
||||||
|
final Json5Primitive wAddrs = dObj.get("send_ips").getAsJson5Primitive();
|
||||||
|
dObj.remove("enabled");
|
||||||
|
dObj.remove("webhook_urls");
|
||||||
|
dObj.remove("send_ips");
|
||||||
|
final Json5Object oObj = new Json5Object();
|
||||||
|
oObj.add("enabled", wEnabled);
|
||||||
|
oObj.add("webhook_urls", wURLS);
|
||||||
|
oObj.add("send_ips", wAddrs);
|
||||||
|
dObj.add("webhook", oObj);
|
||||||
|
obj.remove("discord");
|
||||||
|
obj.add("discord", dObj);
|
||||||
|
}
|
||||||
|
obj.remove("config_version");
|
||||||
|
obj.add("config_version", Json5Primitive.fromNumber(OriginBlacklistConfig.LATEST_CONFIG_VERSION));
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package xyz.webmc.originblacklist.base.util;
|
||||||
|
|
||||||
|
public final class EaglerEventPriority {
|
||||||
|
public static final int EAGLER_MOTD_EVENT = 100;
|
||||||
|
}
|
||||||
@@ -76,7 +76,7 @@ public final class OriginBlacklistBukkit extends JavaPlugin implements Listener,
|
|||||||
this.getServer().getPluginManager().registerEvents(this, this);
|
this.getServer().getPluginManager().registerEvents(this, this);
|
||||||
this.blacklist.init();
|
this.blacklist.init();
|
||||||
if (this.blacklist.isMetricsEnabled()) {
|
if (this.blacklist.isMetricsEnabled()) {
|
||||||
this.metrics = new Metrics(this, OriginBlacklist.BSTATS_ID);
|
this.metrics = new Metrics(this, OriginBlacklist.BSTATS.BUKKIT);
|
||||||
this.metrics.addCustomChart(new AdvancedPie("player_types", () -> {
|
this.metrics.addCustomChart(new AdvancedPie("player_types", () -> {
|
||||||
final Map<String, Integer> playerMap = new HashMap<>();
|
final Map<String, Integer> playerMap = new HashMap<>();
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import xyz.webmc.originblacklist.base.enums.EnumConnectionType;
|
|||||||
import xyz.webmc.originblacklist.base.enums.EnumLogLevel;
|
import xyz.webmc.originblacklist.base.enums.EnumLogLevel;
|
||||||
import xyz.webmc.originblacklist.base.events.OriginBlacklistLoginEvent;
|
import xyz.webmc.originblacklist.base.events.OriginBlacklistLoginEvent;
|
||||||
import xyz.webmc.originblacklist.base.events.OriginBlacklistMOTDEvent;
|
import xyz.webmc.originblacklist.base.events.OriginBlacklistMOTDEvent;
|
||||||
|
import xyz.webmc.originblacklist.base.util.EaglerEventPriority;
|
||||||
import xyz.webmc.originblacklist.base.util.IOriginBlacklistPlugin;
|
import xyz.webmc.originblacklist.base.util.IOriginBlacklistPlugin;
|
||||||
import xyz.webmc.originblacklist.base.util.IncompatibleDependencyException;
|
import xyz.webmc.originblacklist.base.util.IncompatibleDependencyException;
|
||||||
import xyz.webmc.originblacklist.base.util.OPlayer;
|
import xyz.webmc.originblacklist.base.util.OPlayer;
|
||||||
@@ -75,7 +76,7 @@ public final class OriginBlacklistBungee extends Plugin implements Listener, IOr
|
|||||||
this.getProxy().getPluginManager().registerListener(this, this);
|
this.getProxy().getPluginManager().registerListener(this, this);
|
||||||
this.blacklist.init();
|
this.blacklist.init();
|
||||||
if (this.blacklist.isMetricsEnabled()) {
|
if (this.blacklist.isMetricsEnabled()) {
|
||||||
this.metrics = new Metrics(this, OriginBlacklist.BSTATS_ID);
|
this.metrics = new Metrics(this, OriginBlacklist.BSTATS.BUNGEE);
|
||||||
this.metrics.addCustomChart(new AdvancedPie("player_types", () -> {
|
this.metrics.addCustomChart(new AdvancedPie("player_types", () -> {
|
||||||
final Map<String, Integer> playerMap = new HashMap<>();
|
final Map<String, Integer> playerMap = new HashMap<>();
|
||||||
|
|
||||||
@@ -101,7 +102,7 @@ public final class OriginBlacklistBungee extends Plugin implements Listener, IOr
|
|||||||
this.blacklist.handleLogin(new OriginBlacklistLoginEvent(event, null, EnumConnectionType.EAGLER, player));
|
this.blacklist.handleLogin(new OriginBlacklistLoginEvent(event, null, EnumConnectionType.EAGLER, player));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EaglerEventPriority.EAGLER_MOTD_EVENT)
|
||||||
public final void onEaglerMOTD(final EaglercraftMOTDEvent event) {
|
public final void onEaglerMOTD(final EaglercraftMOTDEvent event) {
|
||||||
final OPlayer player = new OPlayer(event.getMOTDConnection(), null, null);
|
final OPlayer player = new OPlayer(event.getMOTDConnection(), null, null);
|
||||||
this.blacklist.handleMOTD(new OriginBlacklistMOTDEvent(event, null, EnumConnectionType.EAGLER, player));
|
this.blacklist.handleMOTD(new OriginBlacklistMOTDEvent(event, null, EnumConnectionType.EAGLER, player));
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import xyz.webmc.originblacklist.base.enums.EnumConnectionType;
|
|||||||
import xyz.webmc.originblacklist.base.enums.EnumLogLevel;
|
import xyz.webmc.originblacklist.base.enums.EnumLogLevel;
|
||||||
import xyz.webmc.originblacklist.base.events.OriginBlacklistLoginEvent;
|
import xyz.webmc.originblacklist.base.events.OriginBlacklistLoginEvent;
|
||||||
import xyz.webmc.originblacklist.base.events.OriginBlacklistMOTDEvent;
|
import xyz.webmc.originblacklist.base.events.OriginBlacklistMOTDEvent;
|
||||||
|
import xyz.webmc.originblacklist.base.util.EaglerEventPriority;
|
||||||
import xyz.webmc.originblacklist.base.util.IOriginBlacklistPlugin;
|
import xyz.webmc.originblacklist.base.util.IOriginBlacklistPlugin;
|
||||||
import xyz.webmc.originblacklist.base.util.IncompatibleDependencyException;
|
import xyz.webmc.originblacklist.base.util.IncompatibleDependencyException;
|
||||||
import xyz.webmc.originblacklist.base.util.OPlayer;
|
import xyz.webmc.originblacklist.base.util.OPlayer;
|
||||||
@@ -91,7 +92,7 @@ public final class OriginBlacklistVelocity implements IOriginBlacklistPlugin {
|
|||||||
this.proxy.getCommandManager().register("originblacklist", new OriginBlacklistCommandVelocity(this.blacklist));
|
this.proxy.getCommandManager().register("originblacklist", new OriginBlacklistCommandVelocity(this.blacklist));
|
||||||
this.blacklist.init();
|
this.blacklist.init();
|
||||||
if (this.blacklist.isMetricsEnabled()) {
|
if (this.blacklist.isMetricsEnabled()) {
|
||||||
this.metrics = this.metricsFactory.make(this, OriginBlacklist.BSTATS_ID);
|
this.metrics = this.metricsFactory.make(this, OriginBlacklist.BSTATS.VELOCITY);
|
||||||
this.metrics.addCustomChart(new AdvancedPie("player_types", () -> {
|
this.metrics.addCustomChart(new AdvancedPie("player_types", () -> {
|
||||||
final Map<String, Integer> playerMap = new HashMap<>();
|
final Map<String, Integer> playerMap = new HashMap<>();
|
||||||
|
|
||||||
@@ -117,7 +118,7 @@ public final class OriginBlacklistVelocity implements IOriginBlacklistPlugin {
|
|||||||
this.blacklist.handleLogin(new OriginBlacklistLoginEvent(event, null, EnumConnectionType.EAGLER, player));
|
this.blacklist.handleLogin(new OriginBlacklistLoginEvent(event, null, EnumConnectionType.EAGLER, player));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(order = PostOrder.LAST)
|
@Subscribe(priority = EaglerEventPriority.EAGLER_MOTD_EVENT, order = PostOrder.LAST)
|
||||||
public final void onEaglerMOTD(final EaglercraftMOTDEvent event) {
|
public final void onEaglerMOTD(final EaglercraftMOTDEvent event) {
|
||||||
final OPlayer player = new OPlayer(event.getMOTDConnection(), null, null);
|
final OPlayer player = new OPlayer(event.getMOTDConnection(), null, null);
|
||||||
this.blacklist.handleMOTD(new OriginBlacklistMOTDEvent(event, null, EnumConnectionType.EAGLER, player));
|
this.blacklist.handleMOTD(new OriginBlacklistMOTDEvent(event, null, EnumConnectionType.EAGLER, player));
|
||||||
|
|||||||
Reference in New Issue
Block a user