mirror of
https://github.com/colbster937/originblacklist.git
synced 2025-12-14 23:07:42 +00:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0ab221ff7 | ||
|
|
ec6f618971 | ||
|
|
a417fa7281 | ||
|
|
c62cdb8a7e | ||
|
|
c33107030a | ||
|
|
7af25a04e4 | ||
|
|
69950dc4c5 | ||
|
|
662c9b0041 | ||
|
|
80f5ab62b3 | ||
|
|
44a0bce586 | ||
|
|
80ac845cb5 | ||
|
|
fafd02b7a1 | ||
|
|
1c008bdd57 | ||
|
|
e2ec629d8c | ||
|
|
1e55bc0ecd | ||
|
|
7de763e640 | ||
|
|
3a7b88f362 |
76
.github/workflows/build.yml
vendored
Normal file
76
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
name: Build Plugin
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Java
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'temurin'
|
||||||
|
java-version: '17'
|
||||||
|
|
||||||
|
- name: Build Jar
|
||||||
|
run: |
|
||||||
|
gradle wrapper
|
||||||
|
./gradlew shadowJar
|
||||||
|
|
||||||
|
- name: Publish Jar
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: OriginBlacklist
|
||||||
|
path: build/libs/OriginBlacklist.jar
|
||||||
|
|
||||||
|
- name: Extract Version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
VERSION=$(grep "^version" build.gradle | head -n 1 | cut -d\' -f2)
|
||||||
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Remove Existing Release
|
||||||
|
run: |
|
||||||
|
gh release delete v${{ steps.version.outputs.version }} -y || true
|
||||||
|
git push origin :refs/tags/v${{ steps.version.outputs.version }} || true
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
id: create_release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
tag_name: v${{ steps.version.outputs.version }}
|
||||||
|
name: ${{ steps.version.outputs.version }}
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- uses: actions/upload-release-asset@v1.0.1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ./build/libs/OriginBlacklist.jar
|
||||||
|
asset_name: OriginBlacklist_${{ steps.version.outputs.version }}.jar
|
||||||
|
asset_content_type: application/java-archive
|
||||||
|
|
||||||
|
- uses: eregon/publish-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
release_id: ${{ steps.create_release.outputs.id }}
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,7 @@
|
|||||||
**/.DS_Store
|
**/.DS_Store
|
||||||
.idea
|
.idea
|
||||||
.gradle
|
.gradle
|
||||||
|
gradle
|
||||||
build
|
build
|
||||||
run
|
run
|
||||||
gradlew
|
gradlew
|
||||||
|
|||||||
20
README.md
20
README.md
@@ -5,11 +5,27 @@ basically just a reimplementation of originblacklist but for eaglerxserver
|
|||||||
> [!WARNING]
|
> [!WARNING]
|
||||||
> **Velocity is the main platform I'm developing this for, bungee & bukkit will still work but will probably have some bugs and will receive less support!**
|
> **Velocity is the main platform I'm developing this for, bungee & bukkit will still work but will probably have some bugs and will receive less support!**
|
||||||
|
|
||||||
|
### Features
|
||||||
|
- [x] Origin Blacklisting
|
||||||
|
- [x] Brand Blacklisting
|
||||||
|
- [x] Custom kick message
|
||||||
|
- [x] Custom blacklist MOTD
|
||||||
|
- [x] MiniMessage formatting for messages
|
||||||
|
- [x] Velocity, *Bungee, and *Bukkit support
|
||||||
|
<br>_<sub><span style="color:gray">Bungee and Bukkit are should work, but have bugs.</span></sub>_
|
||||||
|
- [x] Send blacklists to a discord webhook
|
||||||
|
- [ ] Blacklist subscription URLs
|
||||||
|
- [ ] Simple blacklist command
|
||||||
|
- [ ] Blacklist -> Whitelist
|
||||||
|
- [ ] IP blacklisting
|
||||||
|
|
||||||
### Download
|
### Download
|
||||||
**[https://github.com/colbster937/originblacklist/releases](https://github.com/colbster937/originblacklist/releases)**
|
**[https://github.com/colbster937/originblacklist/releases/latest/](https://github.com/colbster937/originblacklist/releases/latest/)**
|
||||||
|
|
||||||
### Building
|
### Building
|
||||||
```
|
```
|
||||||
|
$ git clone https://github.com/colbster937/originblacklist.git
|
||||||
|
$ cd originblacklist
|
||||||
$ gradle wrapper
|
$ gradle wrapper
|
||||||
$ ./gradle.<bat|sh> shadowJar
|
$ ./gradlew shadowJar
|
||||||
```
|
```
|
||||||
37
build.gradle
37
build.gradle
@@ -8,7 +8,9 @@ plugins {
|
|||||||
|
|
||||||
|
|
||||||
group = 'dev.colbster937'
|
group = 'dev.colbster937'
|
||||||
version = '1.0.0'
|
version = '1.0.2'
|
||||||
|
description = 'A reimplementation of OriginBlacklist for EaglerXServer'
|
||||||
|
def targetJavaVersion = 17
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@@ -47,47 +49,36 @@ dependencies {
|
|||||||
compileOnly("net.lax1dude.eaglercraft.backend:api-bungee:1.0.0")
|
compileOnly("net.lax1dude.eaglercraft.backend:api-bungee:1.0.0")
|
||||||
compileOnly("net.lax1dude.eaglercraft.backend:api-bukkit:1.0.0")
|
compileOnly("net.lax1dude.eaglercraft.backend:api-bukkit:1.0.0")
|
||||||
implementation("org.yaml:snakeyaml:2.2")
|
implementation("org.yaml:snakeyaml:2.2")
|
||||||
implementation("net.kyori:adventure-api:4.20.0")
|
|
||||||
implementation("net.kyori:adventure-text-serializer-legacy:4.20.0")
|
implementation("net.kyori:adventure-text-serializer-legacy:4.20.0")
|
||||||
implementation("net.kyori:adventure-text-minimessage:4.20.0")
|
implementation("net.kyori:adventure-text-minimessage:4.20.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
runVelocity {
|
runVelocity {
|
||||||
// Configure the Velocity version for our task.
|
|
||||||
// This is the only required configuration besides applying the plugin.
|
|
||||||
// Your plugin's jar (or shadowJar if present) will be used automatically.
|
|
||||||
velocityVersion("3.3.0-SNAPSHOT")
|
velocityVersion("3.3.0-SNAPSHOT")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def targetJavaVersion = 17
|
|
||||||
java {
|
java {
|
||||||
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
|
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
filesMatching(['plugin.yml', 'bungee.yml', 'velocity-plugin.json']) {
|
||||||
|
expand(
|
||||||
|
version: project.version,
|
||||||
|
description: project.description
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
relocate 'org.yaml.snakeyaml', 'dev.colbster937.shaded.snakeyaml'
|
relocate 'org.yaml.snakeyaml', 'dev.colbster937.shaded.snakeyaml'
|
||||||
archiveClassifier.set('all')
|
archiveVersion.set('')
|
||||||
|
archiveClassifier.set('')
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(JavaCompile).configureEach {
|
tasks.withType(JavaCompile).configureEach {
|
||||||
options.encoding = 'UTF-8'
|
options.encoding = 'UTF-8'
|
||||||
options.release.set(targetJavaVersion)
|
options.release.set(targetJavaVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*def templateSource = file('src/main/templates')
|
|
||||||
def templateDest = layout.buildDirectory.dir('generated/sources/templates')
|
|
||||||
def generateTemplates = tasks.register('generateTemplates', Copy) { task ->
|
|
||||||
def props = ['version': project.version]
|
|
||||||
task.inputs.properties props
|
|
||||||
|
|
||||||
task.from templateSource
|
|
||||||
task.into templateDest
|
|
||||||
task.expand props
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets.main.java.srcDir(generateTemplates.map { it.outputs })
|
|
||||||
|
|
||||||
project.idea.project.settings.taskTriggers.afterSync generateTemplates
|
|
||||||
project.eclipse.synchronizationTasks(generateTemplates)*/
|
|
||||||
|
|||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
7
gradle/wrapper/gradle-wrapper.properties
vendored
7
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,7 +0,0 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
|
||||||
distributionPath=wrapper/dists
|
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
|
||||||
networkTimeout=10000
|
|
||||||
validateDistributionUrl=true
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
|
||||||
@@ -1,14 +1,25 @@
|
|||||||
package dev.colbster937.originblacklist.base;
|
package dev.colbster937.originblacklist.base;
|
||||||
|
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
import net.lax1dude.eaglercraft.backend.server.api.IEaglerXServerAPI;
|
import net.lax1dude.eaglercraft.backend.server.api.*;
|
||||||
import net.lax1dude.eaglercraft.backend.server.api.IEaglerPlayer;
|
import net.lax1dude.eaglercraft.backend.server.api.event.IEaglercraftLoginEvent;
|
||||||
import net.lax1dude.eaglercraft.backend.server.api.EnumWebSocketHeader;
|
import net.lax1dude.eaglercraft.backend.server.api.event.IEaglercraftMOTDEvent;
|
||||||
import net.lax1dude.eaglercraft.backend.server.api.event.IEaglercraftInitializePlayerEvent;
|
import net.lax1dude.eaglercraft.backend.server.api.query.IMOTDConnection;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class Base {
|
public class Base {
|
||||||
private static LoggerAdapter adapter;
|
private static LoggerAdapter adapter;
|
||||||
@@ -34,50 +45,108 @@ public class Base {
|
|||||||
void error(String msg);
|
void error(String msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void handleConnection(IEaglercraftInitializePlayerEvent e) {
|
public static void handleConnection(IEaglercraftLoginEvent e) {
|
||||||
IEaglerPlayer plr = e.getPlayer();
|
IEaglerLoginConnection conn = e.getLoginConnection();
|
||||||
String origin = plr.getWebSocketHeader(EnumWebSocketHeader.HEADER_ORIGIN);
|
String origin = conn.getWebSocketHeader(EnumWebSocketHeader.HEADER_ORIGIN);
|
||||||
String brand = plr.getEaglerBrandString();
|
String brand = conn.getEaglerBrandString();
|
||||||
if ((origin != "null" || origin != null) && !config.blacklist.missing_origin) {
|
if ((origin != "null" || origin != null) && !config.blacklist.missing_origin) {
|
||||||
for (String origin1 : config.blacklist.origins) {
|
for (String origin1 : config.blacklist.origins) {
|
||||||
if (matches(origin, origin1)) {
|
if (matches(origin, origin1)) {
|
||||||
plr.disconnect(kick("origin", "website", origin));
|
e.setKickMessage(kick("origin", "website", origin));
|
||||||
webhook(plr, origin, brand, "origin");
|
webhook(conn, origin, brand, "origin");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
plr.disconnect(kick("origin", "website", origin));
|
if (origin != "null" || origin != null) {
|
||||||
webhook(plr, "null", brand, "origin");
|
e.setKickMessage(kick("origin", "website", origin));
|
||||||
|
webhook(conn, "null", brand, "origin");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (brand != "null" && brand != null) {
|
if (brand != "null" && brand != null) {
|
||||||
for (String brand1 : config.blacklist.brands) {
|
for (String brand1 : config.blacklist.brands) {
|
||||||
if (matches(brand, brand1)) {
|
if (matches(brand, brand1)) {
|
||||||
plr.disconnect(kick("brand", "client", brand));
|
e.setKickMessage(kick("brand", "client", brand));
|
||||||
webhook(plr, origin, brand, "brand");
|
webhook(conn, origin, brand, "brand");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void handleMOTD(IEaglercraftMOTDEvent e) {
|
||||||
|
if (config.messages.motd.enabled) {
|
||||||
|
IMOTDConnection conn = e.getMOTDConnection();
|
||||||
|
String origin = conn.getWebSocketHeader(EnumWebSocketHeader.HEADER_ORIGIN);
|
||||||
|
List<String> m = List.of(config.messages.motd.text.split("\n")).stream()
|
||||||
|
.map(line -> line
|
||||||
|
.replace("%blocktype%", "origin")
|
||||||
|
.replace("%easyblocktype%", "website")
|
||||||
|
.replace("%blocked%", origin))
|
||||||
|
.map(line -> LegacyComponentSerializer.legacySection().serialize(
|
||||||
|
MiniMessage.miniMessage().deserialize(
|
||||||
|
line
|
||||||
|
)
|
||||||
|
)).collect(Collectors.toList());
|
||||||
|
if ((origin != "null" || origin != null) && !config.blacklist.missing_origin) {
|
||||||
|
for (String origin1 : config.blacklist.origins) {
|
||||||
|
if (matches(origin, origin1)) {
|
||||||
|
setMOTD(conn, m);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (origin != "null" || origin != null) {
|
||||||
|
setMOTD(conn, m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setMOTD(IMOTDConnection conn, List<String> m) {
|
||||||
|
conn.setServerMOTD(m);
|
||||||
|
conn.setPlayerTotal(0);
|
||||||
|
conn.setPlayerMax(0);
|
||||||
|
conn.setPlayerList(List.of());
|
||||||
|
if (config.messages.motd.icon != null && !config.messages.motd.icon.isEmpty())
|
||||||
|
try {
|
||||||
|
BufferedImage img = ImageIO.read(new File(config.messages.motd.icon));
|
||||||
|
if (img.getWidth() != 64 || img.getHeight() != 64) {
|
||||||
|
getLogger().warn("Icon must be 64x64");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
byte[] bytes = new byte[64 * 64 * 4];
|
||||||
|
for (int y = 0; y < 64; y++) {
|
||||||
|
for (int x = 0; x < 64; x++) {
|
||||||
|
int pixel = img.getRGB(x, y);
|
||||||
|
int i = (y * 64 + x) * 4;
|
||||||
|
bytes[i] = (byte) ((pixel >> 16) & 0xFF);
|
||||||
|
bytes[i + 1] = (byte) ((pixel >> 8) & 0xFF);
|
||||||
|
bytes[i + 2] = (byte) (pixel & 0xFF);
|
||||||
|
bytes[i + 3] = (byte) ((pixel >> 24) & 0xFF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
conn.setServerIcon(bytes);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
getLogger().error(ex.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean matches(String text1, String text2) {
|
public static boolean matches(String text1, String text2) {
|
||||||
return text1.toLowerCase().matches(text2.replace(".", "\\.").replaceAll("\\*", ".*").toLowerCase());
|
return text1.toLowerCase().matches(text2.replace(".", "\\.").replaceAll("\\*", ".*").toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String kick(String type, String easytype, String value) {
|
public static Component kick(String type, String easytype, String value) {
|
||||||
return LegacyComponentSerializer.legacySection().serialize(
|
return MiniMessage.miniMessage().deserialize(
|
||||||
MiniMessage.miniMessage().deserialize(
|
|
||||||
config.messages.kick
|
config.messages.kick
|
||||||
.replace("%blocktype%", type)
|
.replace("%blocktype%", type)
|
||||||
.replace("%easyblocktype%", easytype)
|
.replace("%easyblocktype%", easytype)
|
||||||
.replace("%blocked%", value)
|
.replace("%blocked%", value)
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void webhook(IEaglerPendingConnection plr, String origin, String brand, String type) {
|
||||||
public static void webhook(IEaglerPlayer plr, String origin, String brand, String type) {
|
|
||||||
String webhook = config.discord.webhook;
|
String webhook = config.discord.webhook;
|
||||||
if (webhook == null || webhook.isBlank()) return;
|
if (webhook == null || webhook.isBlank()) return;
|
||||||
|
|
||||||
@@ -99,7 +168,7 @@ public class Base {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
""", type, plr.getUsername(), addr, protocol, origin, brand, userAgent, rewind);
|
""", type, plr.getAuthUsername(), addr, protocol, origin, brand, userAgent, rewind);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
HttpURLConnection conn = (HttpURLConnection) new URL(webhook).openConnection();
|
HttpURLConnection conn = (HttpURLConnection) new URL(webhook).openConnection();
|
||||||
@@ -119,6 +188,19 @@ public class Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void init() {
|
||||||
|
File motdIcon = new File(config.messages.motd.icon);
|
||||||
|
if (!motdIcon.exists()) {
|
||||||
|
try (InputStream in = ConfigManager.class.getResourceAsStream("/server-blocked.png")) {
|
||||||
|
if (in != null) {
|
||||||
|
Files.copy(in, motdIcon.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
getLogger().warn(e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void reloadConfig() {
|
public static void reloadConfig() {
|
||||||
config = ConfigManager.loadConfig(adapter);
|
config = ConfigManager.loadConfig(adapter);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,8 +44,6 @@ public class ConfigManager {
|
|||||||
public List<String> brands;
|
public List<String> brands;
|
||||||
public List<String> players;
|
public List<String> players;
|
||||||
public boolean missing_origin;
|
public boolean missing_origin;
|
||||||
|
|
||||||
public Blacklist() {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Discord {
|
public static class Discord {
|
||||||
@@ -54,5 +52,12 @@ public class ConfigManager {
|
|||||||
|
|
||||||
public static class Messages {
|
public static class Messages {
|
||||||
public String kick;
|
public String kick;
|
||||||
|
public MOTD motd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class MOTD {
|
||||||
|
public boolean enabled;
|
||||||
|
public String text;
|
||||||
|
public String icon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ package dev.colbster937.originblacklist.bukkit;
|
|||||||
|
|
||||||
import dev.colbster937.originblacklist.base.Base;
|
import dev.colbster937.originblacklist.base.Base;
|
||||||
import net.lax1dude.eaglercraft.backend.server.api.bukkit.EaglerXServerAPI;
|
import net.lax1dude.eaglercraft.backend.server.api.bukkit.EaglerXServerAPI;
|
||||||
import net.lax1dude.eaglercraft.backend.server.api.bukkit.event.EaglercraftInitializePlayerEvent;
|
import net.lax1dude.eaglercraft.backend.server.api.bukkit.event.EaglercraftLoginEvent;
|
||||||
|
import net.lax1dude.eaglercraft.backend.server.api.bukkit.event.EaglercraftMOTDEvent;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
@@ -19,6 +20,7 @@ public class OriginBlacklistBukkit extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
Base.setApi(EaglerXServerAPI.instance());
|
Base.setApi(EaglerXServerAPI.instance());
|
||||||
Base.reloadConfig();
|
Base.reloadConfig();
|
||||||
|
Base.init();
|
||||||
|
|
||||||
getCommand("originblacklist").setExecutor(new CommandBukkit());
|
getCommand("originblacklist").setExecutor(new CommandBukkit());
|
||||||
getServer().getPluginManager().registerEvents(this, this);
|
getServer().getPluginManager().registerEvents(this, this);
|
||||||
@@ -27,7 +29,12 @@ public class OriginBlacklistBukkit extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onLogin(EaglercraftInitializePlayerEvent event) {
|
public void onLogin(EaglercraftLoginEvent event) {
|
||||||
Base.handleConnection(event);
|
Base.handleConnection(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onMOTD(EaglercraftMOTDEvent event) {
|
||||||
|
Base.handleMOTD(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ package dev.colbster937.originblacklist.bungee;
|
|||||||
|
|
||||||
import dev.colbster937.originblacklist.base.Base;
|
import dev.colbster937.originblacklist.base.Base;
|
||||||
import net.lax1dude.eaglercraft.backend.server.api.bungee.EaglerXServerAPI;
|
import net.lax1dude.eaglercraft.backend.server.api.bungee.EaglerXServerAPI;
|
||||||
import net.lax1dude.eaglercraft.backend.server.api.bungee.event.EaglercraftInitializePlayerEvent;
|
import net.lax1dude.eaglercraft.backend.server.api.bungee.event.EaglercraftLoginEvent;
|
||||||
|
import net.lax1dude.eaglercraft.backend.server.api.bungee.event.EaglercraftMOTDEvent;
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
import net.md_5.bungee.api.plugin.Listener;
|
import net.md_5.bungee.api.plugin.Listener;
|
||||||
import net.md_5.bungee.event.EventHandler;
|
import net.md_5.bungee.event.EventHandler;
|
||||||
@@ -19,6 +20,7 @@ public class OriginBlacklistBungee extends Plugin implements Listener {
|
|||||||
|
|
||||||
Base.setApi(EaglerXServerAPI.instance());
|
Base.setApi(EaglerXServerAPI.instance());
|
||||||
Base.reloadConfig();
|
Base.reloadConfig();
|
||||||
|
Base.init();
|
||||||
|
|
||||||
getProxy().getPluginManager().registerCommand(this, new CommandBungee());
|
getProxy().getPluginManager().registerCommand(this, new CommandBungee());
|
||||||
getProxy().getPluginManager().registerListener(this, this);
|
getProxy().getPluginManager().registerListener(this, this);
|
||||||
@@ -27,7 +29,12 @@ public class OriginBlacklistBungee extends Plugin implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onLogin(EaglercraftInitializePlayerEvent event) {
|
public void onLogin(EaglercraftLoginEvent event) {
|
||||||
Base.handleConnection(event);
|
Base.handleConnection(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onMOTD(EaglercraftMOTDEvent event) {
|
||||||
|
Base.handleMOTD(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,22 +3,13 @@ package dev.colbster937.originblacklist.velocity;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
||||||
import com.velocitypowered.api.event.Subscribe;
|
import com.velocitypowered.api.event.Subscribe;
|
||||||
import com.velocitypowered.api.plugin.Plugin;
|
|
||||||
import com.velocitypowered.api.plugin.Dependency;
|
|
||||||
import com.velocitypowered.api.proxy.ProxyServer;
|
import com.velocitypowered.api.proxy.ProxyServer;
|
||||||
import dev.colbster937.originblacklist.base.Base;
|
import dev.colbster937.originblacklist.base.Base;
|
||||||
import net.lax1dude.eaglercraft.backend.server.api.velocity.EaglerXServerAPI;
|
import net.lax1dude.eaglercraft.backend.server.api.velocity.EaglerXServerAPI;
|
||||||
import net.lax1dude.eaglercraft.backend.server.api.velocity.event.EaglercraftInitializePlayerEvent;
|
import net.lax1dude.eaglercraft.backend.server.api.velocity.event.EaglercraftLoginEvent;
|
||||||
|
import net.lax1dude.eaglercraft.backend.server.api.velocity.event.EaglercraftMOTDEvent;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
@Plugin(
|
|
||||||
id = "originblacklist",
|
|
||||||
name = "OriginBlacklist",
|
|
||||||
version = "1.0.0",
|
|
||||||
authors = {"Colbster937"},
|
|
||||||
description = "A reimplementation of OriginBlacklist for EaglerXServer",
|
|
||||||
dependencies = {@Dependency(id = "eaglerxserver")}
|
|
||||||
)
|
|
||||||
public class OriginBlacklistVelocity {
|
public class OriginBlacklistVelocity {
|
||||||
|
|
||||||
private final ProxyServer proxy;
|
private final ProxyServer proxy;
|
||||||
@@ -39,12 +30,18 @@ public class OriginBlacklistVelocity {
|
|||||||
public void onProxyInitialization(ProxyInitializeEvent event) {
|
public void onProxyInitialization(ProxyInitializeEvent event) {
|
||||||
Base.setApi(EaglerXServerAPI.instance());
|
Base.setApi(EaglerXServerAPI.instance());
|
||||||
Base.reloadConfig();
|
Base.reloadConfig();
|
||||||
|
Base.init();
|
||||||
proxy.getCommandManager().register("originblacklist", new CommandVelocity());
|
proxy.getCommandManager().register("originblacklist", new CommandVelocity());
|
||||||
logger.info("Loaded Velocity plugin");
|
logger.info("Loaded Velocity plugin");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onLogin(EaglercraftInitializePlayerEvent event) {
|
public void onLogin(EaglercraftLoginEvent event) {
|
||||||
Base.handleConnection(event);
|
Base.handleConnection(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onMOTD(EaglercraftMOTDEvent event) {
|
||||||
|
Base.handleMOTD(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: OriginBlacklist
|
name: OriginBlacklist
|
||||||
version: 1.0.0
|
version: ${version}
|
||||||
main: dev.colbster937.originblacklist.bungee.OriginBlacklistBungee
|
main: dev.colbster937.originblacklist.bungee.OriginBlacklistBungee
|
||||||
description: A reimplementation of OriginBlacklist for EaglerXServer
|
description: ${description}
|
||||||
author: Colbster937
|
author: Colbster937
|
||||||
depends:
|
depends:
|
||||||
- EaglercraftXServer
|
- EaglercraftXServer
|
||||||
@@ -11,6 +11,13 @@ messages:
|
|||||||
<gray>Think this is a mistake? Join our discord:</gray>
|
<gray>Think this is a mistake? Join our discord:</gray>
|
||||||
<blue>discord.gg/changethisintheconfig</blue>
|
<blue>discord.gg/changethisintheconfig</blue>
|
||||||
|
|
||||||
|
motd:
|
||||||
|
enabled: true
|
||||||
|
text: |
|
||||||
|
<red>This %easyblocktype% is not allowed!</red>
|
||||||
|
<dark_gray>»</dark_gray> <gray>%blocked%</gray> <dark_gray>«</dark_gray>
|
||||||
|
icon: "blacklisted.png"
|
||||||
|
|
||||||
# Origin + Brand blacklist supports wildcards
|
# Origin + Brand blacklist supports wildcards
|
||||||
# Everything should be lowercase
|
# Everything should be lowercase
|
||||||
blacklist:
|
blacklist:
|
||||||
@@ -51,13 +58,6 @@ discord:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: OriginBlacklist
|
name: OriginBlacklist
|
||||||
version: 1.0.0
|
version: ${version}
|
||||||
main: dev.colbster937.originblacklist.bukkit.OriginBlacklistBukkit
|
main: dev.colbster937.originblacklist.bukkit.OriginBlacklistBukkit
|
||||||
description: A reimplementation of OriginBlacklist for EaglerXServer
|
description: ${description}
|
||||||
author: Colbster937
|
author: Colbster937
|
||||||
depend:
|
depend:
|
||||||
- EaglercraftXServer
|
- EaglercraftXServer
|
||||||
|
|||||||
BIN
src/main/resources/server-blocked.png
Normal file
BIN
src/main/resources/server-blocked.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
14
src/main/resources/velocity-plugin.json
Normal file
14
src/main/resources/velocity-plugin.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"id": "originblacklist",
|
||||||
|
"name": "OriginBlacklist",
|
||||||
|
"version": "${version}",
|
||||||
|
"description": "${description}",
|
||||||
|
"main": "dev.colbster937.originblacklist.velocity.OriginBlacklistVelocity",
|
||||||
|
"authors": ["Colbster937"],
|
||||||
|
"dependencies": [
|
||||||
|
{
|
||||||
|
"id": "eaglerxserver",
|
||||||
|
"optional": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user