mirror of
https://github.com/colbster937/originblacklist.git
synced 2026-02-04 02:57:41 +00:00
Compare commits
8 Commits
8f1fd3f1f4
...
v2.0.5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb71befe78 | ||
|
|
49f4e249e5 | ||
|
|
5491efa79a | ||
|
|
5e29f7f74a | ||
|
|
ffdbcfa3b4 | ||
|
|
58123dddd7 | ||
|
|
91adbd5526 | ||
|
|
2b1ccd018d |
13
.github/workflows/gradle.yml
vendored
13
.github/workflows/gradle.yml
vendored
@@ -58,22 +58,23 @@ jobs:
|
||||
run: |
|
||||
echo "TAG_NAME=${{ format('v{0}{1}', steps.vars.outputs.VERS, steps.ghck.outputs.EXISTS == 'true' && format('+{0}', steps.vars.outputs.COMMIT_HASH) || '') }}" >> "$GITHUB_OUTPUT"
|
||||
echo "REL_NAME=${{ format('{0}{1}', steps.ghck.outputs.EXISTS == 'true' && 'Snapshot ' || 'v', steps.ghck.outputs.EXISTS == 'true' && steps.vars.outputs.COMMIT_HASH || steps.vars.outputs.VERS) }}" >> "$GITHUB_OUTPUT"
|
||||
echo "ART_NAME=${{ format('{0}{1}.jar', steps.vars.outputs.AFCT, steps.ghck.outputs.EXISTS == 'true' && format('+{0}', steps.vars.outputs.COMMIT_HASH) || '') }}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- run: |
|
||||
mkdir -p dist
|
||||
cp "./build/libs/${{ steps.vars.outputs.AFCT }}" ./dist
|
||||
cp "./build/libs/${{ steps.vars.outputs.AFCT }}.jar" ./dist/${{ steps.dist.outputs.ART_NAME }}
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
path: dist/${{ steps.vars.outputs.AFCT }}
|
||||
name: ${{ steps.vars.outputs.AFCT }}
|
||||
path: dist/${{ steps.dist.outputs.ART_NAME }}
|
||||
name: ${{ steps.dist.outputs.ART_NAME }}
|
||||
|
||||
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ steps.dist.outputs.TAG_NAME }}
|
||||
name: ${{ steps.dist.outputs.REL_NAME }}
|
||||
files: dist/${{ steps.vars.outputs.AFCT }}
|
||||
files: dist/${{ steps.dist.outputs.ART_NAME }}
|
||||
prerelease: ${{ steps.ghck.outputs.EXISTS == 'true' }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -86,8 +87,8 @@ jobs:
|
||||
version: ${{ steps.dist.outputs.TAG_NAME }}
|
||||
loaders: '["bukkit", "bungeecord", "paper", "purpur", "spigot", "velocity", "waterfall"]'
|
||||
game-versions: '["1.8.x", "1.9.x", "1.10.x", "1.11.x", "1.12.x", "1.13.x", "1.14.x", "1.15.x", "1.16.x", "1.17.x", "1.18.x", "1.19.x", "1.20.x", "1.21.x"]'
|
||||
files: dist/${{ steps.vars.outputs.AFCT }}
|
||||
primary-file: ${{ steps.vars.outputs.AFCT }}
|
||||
files: dist/${{ steps.dist.outputs.ART_NAME }}
|
||||
primary-file: ${{ steps.dist.outputs.ART_NAME }}
|
||||
name: ${{ steps.dist.outputs.REL_NAME }}
|
||||
channel: ${{ steps.ghck.outputs.EXISTS == 'true' && 'beta' || 'release' }}
|
||||
dependencies: |-
|
||||
|
||||
11
README.md
11
README.md
@@ -9,16 +9,19 @@
|
||||
- [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
|
||||
- [x] Plugin update checker
|
||||
- [x] Send blacklist logs to a webhook
|
||||
- [ ] Ingame blacklist management command
|
||||
- [x] Ingame blacklist management commands
|
||||
- [x] Reverse blacklist (whitelist)
|
||||
- [ ] 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>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import groovy.lang.Closure
|
||||
import com.palantir.gradle.gitversion.VersionDetails
|
||||
import org.gradle.api.tasks.compile.JavaCompile
|
||||
import org.gradle.language.jvm.tasks.ProcessResources
|
||||
import xyz.jpenilla.runpaper.task.RunServer
|
||||
@@ -11,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.2"
|
||||
val PLUGIN_VERS = "2.0.5"
|
||||
val PLUGIN_SITE = "https://github.com/WebMCDevelopment/$PLUGIN_IDEN"
|
||||
val PLUGIN_DEPA = listOf("EaglercraftXServer")
|
||||
val PLUGIN_DEPB = listOf("EaglercraftXServer")
|
||||
@@ -26,23 +28,27 @@ val PLUGIN_CTBR = emptyList<String>()
|
||||
|
||||
|
||||
|
||||
val PLUGIN_DEPA_J = getJSONObj(PLUGIN_DEPA)
|
||||
val PLUGIN_DEPB_J = getJSONObj(PLUGIN_DEPB)
|
||||
val PLUGIN_DEPC_J = getJSONObjMerge(PLUGIN_DEPC, PLUGIN_SDPC)
|
||||
val PLUGIN_SDPA_J = getJSONObj(PLUGIN_SDPA)
|
||||
val PLUGIN_SDPB_J = getJSONObj(PLUGIN_SDPB)
|
||||
val PLUGIN_PROV_J = getJSONObj(PLUGIN_PROV)
|
||||
val PLUGIN_ATHR_J = getJSONObj(PLUGIN_ATHR)
|
||||
val PLUGIN_CTBR_J = getJSONObj(PLUGIN_CTBR)
|
||||
val PLUGIN_DEPA_J = getBukkitBungeeDeps(PLUGIN_DEPA)
|
||||
val PLUGIN_DEPB_J = getBukkitBungeeDeps(PLUGIN_DEPB)
|
||||
val PLUGIN_DEPC_J = getVelocityDeps(PLUGIN_DEPC, PLUGIN_SDPC)
|
||||
val PLUGIN_SDPA_J = getBukkitBungeeDeps(PLUGIN_SDPA)
|
||||
val PLUGIN_SDPB_J = getBukkitBungeeDeps(PLUGIN_SDPB)
|
||||
val PLUGIN_PROV_J = getBukkitBungeeDeps(PLUGIN_PROV)
|
||||
val PLUGIN_ATHR_J = getBukkitBungeeDeps(PLUGIN_ATHR)
|
||||
val PLUGIN_CTBR_J = getBukkitBungeeDeps(PLUGIN_CTBR)
|
||||
|
||||
plugins {
|
||||
id("java")
|
||||
id("com.gradleup.shadow") version "9.3.0"
|
||||
id("com.palantir.git-version") version "4.2.0"
|
||||
id("xyz.jpenilla.run-paper") version "3.0.2"
|
||||
id("xyz.jpenilla.run-waterfall") version "3.0.2"
|
||||
id("xyz.jpenilla.run-velocity") version "3.0.2"
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val GIT_INFO = (extra["versionDetails"] as Closure<VersionDetails>)()
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
@@ -85,6 +91,23 @@ java {
|
||||
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
|
||||
}
|
||||
|
||||
val BUILD_PROPS = mapOf(
|
||||
"plugin_name" to PLUGIN_NAME,
|
||||
"plugin_iden" to PLUGIN_IDEN,
|
||||
"plugin_desc" to PLUGIN_DESC,
|
||||
"plugin_vers" to PLUGIN_VERS,
|
||||
"plugin_site" to PLUGIN_SITE,
|
||||
"plugin_depa" to PLUGIN_DEPA_J,
|
||||
"plugin_depb" to PLUGIN_DEPB_J,
|
||||
"plugin_depc" to PLUGIN_DEPC_J,
|
||||
"plugin_sdpa" to PLUGIN_SDPA_J,
|
||||
"plugin_sdpb" to PLUGIN_SDPB_J,
|
||||
"plugin_prov" to PLUGIN_PROV_J,
|
||||
"plugin_athr" to PLUGIN_ATHR_J,
|
||||
"plugin_ctbr" to PLUGIN_CTBR_J,
|
||||
"git_cm_hash" to GIT_INFO.gitHashFull,
|
||||
)
|
||||
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
options.encoding = "UTF-8"
|
||||
options.release.set(17)
|
||||
@@ -93,26 +116,24 @@ tasks.withType<JavaCompile>().configureEach {
|
||||
tasks.withType<ProcessResources>() {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
outputs.upToDateWhen { false }
|
||||
|
||||
doFirst {
|
||||
filesMatching(listOf("plugin.yml", "bungee.yml", "velocity-plugin.json")) {
|
||||
expand(mapOf(
|
||||
"plugin_name" to PLUGIN_NAME,
|
||||
"plugin_iden" to PLUGIN_IDEN,
|
||||
"plugin_desc" to PLUGIN_DESC,
|
||||
"plugin_vers" to PLUGIN_VERS,
|
||||
"plugin_site" to PLUGIN_SITE,
|
||||
"plugin_depa" to PLUGIN_DEPA_J,
|
||||
"plugin_depb" to PLUGIN_DEPB_J,
|
||||
"plugin_depc" to PLUGIN_DEPC_J,
|
||||
"plugin_sdpa" to PLUGIN_SDPA_J,
|
||||
"plugin_sdpb" to PLUGIN_SDPB_J,
|
||||
"plugin_prov" to PLUGIN_PROV_J,
|
||||
"plugin_athr" to PLUGIN_ATHR_J,
|
||||
"plugin_ctbr" to PLUGIN_CTBR_J,
|
||||
))
|
||||
expand(BUILD_PROPS)
|
||||
}
|
||||
}
|
||||
|
||||
doLast {
|
||||
val file = destinationDir.resolve("build.properties")
|
||||
file.parentFile.mkdirs()
|
||||
|
||||
file.writeText(
|
||||
BUILD_PROPS.entries.joinToString("\n") { (k, v) ->
|
||||
"$k = $v"
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
inputs.files(tasks.named<JavaCompile>("compileJava").map { it.outputs.files })
|
||||
}
|
||||
|
||||
@@ -158,24 +179,19 @@ tasks.register("printVars") {
|
||||
group = "help"
|
||||
doLast {
|
||||
println("VERS = " + PLUGIN_VERS)
|
||||
println("AFCT = " + tasks.named("shadowJar").get().outputs.files.singleFile.name)
|
||||
println("AFCT = " + tasks.named("shadowJar").get().outputs.files.singleFile.name.removeSuffix(".jar"))
|
||||
}
|
||||
}
|
||||
|
||||
fun getJSONObj(list: List<String>): String {
|
||||
return if (list.isNotEmpty()) {
|
||||
list.joinToString(
|
||||
separator = "\", \"",
|
||||
prefix = "\"",
|
||||
postfix = "\""
|
||||
)
|
||||
} else {
|
||||
""
|
||||
}
|
||||
fun getBukkitBungeeDeps(list: List<String>): String {
|
||||
return list.joinToString(
|
||||
prefix = "[",
|
||||
postfix = "]"
|
||||
) { "\"$it\"" }
|
||||
}
|
||||
|
||||
fun getJSONObjMerge(a: List<String>, b: List<String>): String {
|
||||
fun getVelocityDeps(a: List<String>, b: List<String>): String {
|
||||
val c = a.joinToString(", ") { "{\"id\":\"$it\",\"optional\":false}" }
|
||||
val d = b.joinToString(", ") { "{\"id\":\"$it\",\"optional\":true}" }
|
||||
return listOf(c, d).filter { it.isNotEmpty() }.joinToString(",")
|
||||
return "[" + listOf(c, d).filter { it.isNotEmpty() }.joinToString(",") + "]"
|
||||
}
|
||||
|
||||
@@ -6,17 +6,24 @@ import xyz.webmc.originblacklist.base.enums.EnumConnectionType;
|
||||
import xyz.webmc.originblacklist.base.enums.EnumLogLevel;
|
||||
import xyz.webmc.originblacklist.base.events.OriginBlacklistLoginEvent;
|
||||
import xyz.webmc.originblacklist.base.events.OriginBlacklistMOTDEvent;
|
||||
import xyz.webmc.originblacklist.base.util.BuildInfo;
|
||||
import xyz.webmc.originblacklist.base.util.IOriginBlacklistPlugin;
|
||||
import xyz.webmc.originblacklist.base.util.OPlayer;
|
||||
import xyz.webmc.originblacklist.base.util.UpdateChecker;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import de.marhali.json5.Json5Array;
|
||||
@@ -40,15 +47,19 @@ public final class OriginBlacklist {
|
||||
|
||||
private final IOriginBlacklistPlugin plugin;
|
||||
private final OriginBlacklistConfig config;
|
||||
private boolean updateAvailable;
|
||||
private String updateURL;
|
||||
|
||||
public OriginBlacklist(final IOriginBlacklistPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
this.config = new OriginBlacklistConfig(plugin);
|
||||
this.checkForUpdate();
|
||||
plugin.scheduleRepeat(() -> {
|
||||
this.checkForUpdate();
|
||||
}, 60, TimeUnit.MINUTES);
|
||||
this.checkForUpdates();
|
||||
}, this.config.getInteger("update_checker.check_timer"), TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public final void init() {
|
||||
this.plugin.log(EnumLogLevel.INFO, "Initialized Plugin");
|
||||
this.plugin.log(EnumLogLevel.DEBUG, "Commit " + BuildInfo.get("git_cm_hash"));
|
||||
}
|
||||
|
||||
public final void handleLogin(final OriginBlacklistLoginEvent event) {
|
||||
@@ -97,11 +108,11 @@ public final class OriginBlacklist {
|
||||
}
|
||||
|
||||
public final boolean isDebugEnabled() {
|
||||
return this.config.get("debug").getAsBoolean();
|
||||
return this.config.getBoolean("debug");
|
||||
}
|
||||
|
||||
public final boolean isMetricsEnabled() {
|
||||
return this.config.get("bStats").getAsBoolean();
|
||||
return this.config.getBoolean("bStats");
|
||||
}
|
||||
|
||||
public final OriginBlacklistConfig getConfig() {
|
||||
@@ -123,57 +134,132 @@ public final class OriginBlacklist {
|
||||
conn.disconnect();
|
||||
}
|
||||
|
||||
private final EnumBlacklistType testBlacklist(final OPlayer player) {
|
||||
public final void checkForUpdates(Runnable action1, Runnable action2) {
|
||||
if (this.config.getBoolean("update_checker.enabled")) {
|
||||
this.plugin.runAsync(() -> {
|
||||
this.updateURL = UpdateChecker.checkForUpdates(PLUGIN_REPO, this.plugin.getPluginVersion(),
|
||||
this.config.getBoolean("update_checker.allow_snapshots"));
|
||||
if (isNonNull((this.updateURL))) {
|
||||
action1.run();
|
||||
return;
|
||||
}
|
||||
action2.run();
|
||||
});
|
||||
} else {
|
||||
action2.run();
|
||||
}
|
||||
}
|
||||
|
||||
public final void updatePlugin(Runnable action1, Runnable action2) {
|
||||
try {
|
||||
final URL url = new URL(this.updateURL);
|
||||
final Path jar = this.plugin.getPluginJarPath();
|
||||
final Path bak = jar.resolveSibling(jar.getFileName().toString() + ".bak");
|
||||
final Path upd = jar.resolveSibling(Paths.get(URLDecoder.decode(url.getPath(), StandardCharsets.UTF_8)).getFileName());
|
||||
|
||||
try {
|
||||
Files.copy(jar, bak, StandardCopyOption.REPLACE_EXISTING);
|
||||
} catch (final Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
final HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("GET");
|
||||
conn.setConnectTimeout(15000);
|
||||
conn.setReadTimeout(15000);
|
||||
conn.setRequestProperty("User-Agent", OriginBlacklist.getUserAgent());
|
||||
conn.connect();
|
||||
try (final InputStream in = conn.getInputStream()) {
|
||||
Files.copy(in, upd, StandardCopyOption.REPLACE_EXISTING);
|
||||
} finally {
|
||||
conn.disconnect();
|
||||
}
|
||||
Files.delete(jar);
|
||||
Files.delete(bak);
|
||||
action1.run();
|
||||
return;
|
||||
} catch (final Throwable t) {
|
||||
t.printStackTrace();
|
||||
Files.move(bak, jar, StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
} catch (final Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
action2.run();
|
||||
}
|
||||
|
||||
public final void updatePlugin() {
|
||||
this.updatePlugin(() -> {}, () -> {});
|
||||
}
|
||||
|
||||
public final EnumBlacklistType testBlacklist(final OPlayer player) {
|
||||
final String name = player.getName();
|
||||
final String addr = player.getAddr();
|
||||
final String origin = player.getOrigin();
|
||||
final String brand = player.getBrand();
|
||||
|
||||
final boolean whitelist = this.config.getBoolean("blacklist_to_whitelist");
|
||||
EnumBlacklistType type = EnumBlacklistType.NONE;
|
||||
|
||||
if (isNonNull(origin)) {
|
||||
for (final Json5Element element : this.config.get("blacklist.origins").getAsJson5Array()) {
|
||||
if (whitelist && !type.isBlacklisted()) type = EnumBlacklistType.ORIGIN;
|
||||
for (final Json5Element element : this.config.getArray("blacklist.origins").getAsJson5Array()) {
|
||||
if (origin.matches(element.getAsString())) {
|
||||
return EnumBlacklistType.ORIGIN;
|
||||
if (whitelist) type = EnumBlacklistType.NONE;
|
||||
else if (!type.isBlacklisted()) type = EnumBlacklistType.ORIGIN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (this.config.getBoolean("block_undefined_origin")) {
|
||||
return whitelist ? EnumBlacklistType.NONE : EnumBlacklistType.ORIGIN;
|
||||
}
|
||||
|
||||
if (isNonNull(brand)) {
|
||||
for (final Json5Element element : this.config.get("blacklist.brands").getAsJson5Array()) {
|
||||
if (whitelist && !type.isBlacklisted()) type = EnumBlacklistType.BRAND;
|
||||
for (final Json5Element element : this.config.getArray("blacklist.brands")) {
|
||||
if (brand.matches(element.getAsString())) {
|
||||
return EnumBlacklistType.BRAND;
|
||||
if (whitelist) type = EnumBlacklistType.NONE;
|
||||
else if (!type.isBlacklisted()) type = EnumBlacklistType.BRAND;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isNonNull(name)) {
|
||||
for (final Json5Element element : this.config.get("blacklist.player_names").getAsJson5Array()) {
|
||||
this.plugin.log(EnumLogLevel.DEBUG, element.getAsString());
|
||||
if (whitelist && !type.isBlacklisted()) type = EnumBlacklistType.NAME;
|
||||
for (final Json5Element element : this.config.getArray("blacklist.player_names")) {
|
||||
if (name.matches(element.getAsString())) {
|
||||
return EnumBlacklistType.NAME;
|
||||
if (whitelist) type = EnumBlacklistType.NONE;
|
||||
else if (!type.isBlacklisted()) type = EnumBlacklistType.NAME;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isNonNull(addr)) {
|
||||
for (final Json5Element element : this.config.get("blacklist.ip_addresses").getAsJson5Array()) {
|
||||
if (whitelist && !type.isBlacklisted()) type = EnumBlacklistType.ADDR;
|
||||
for (final Json5Element element : this.config.getArray("blacklist.ip_addresses")) {
|
||||
try {
|
||||
if ((new IPAddressString(element.getAsString()).toAddress())
|
||||
.contains((new IPAddressString(addr)).toAddress())) {
|
||||
return EnumBlacklistType.ADDR;
|
||||
if (whitelist) type = EnumBlacklistType.NONE;
|
||||
else if (!type.isBlacklisted()) type = EnumBlacklistType.ADDR;
|
||||
break;
|
||||
}
|
||||
} catch (final AddressStringException exception) {
|
||||
exception.printStackTrace();
|
||||
if (this.isDebugEnabled()) exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return EnumBlacklistType.NONE;
|
||||
return type;
|
||||
}
|
||||
|
||||
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 action) {
|
||||
final Json5Array arr = this.config.get("messages." + type).getAsJson5Array();
|
||||
final Json5Array arr = this.config.getArray("messages." + type);
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
if (i > 0)
|
||||
@@ -181,7 +267,7 @@ public final class OriginBlacklist {
|
||||
sb.append(arr.get(i).getAsString());
|
||||
}
|
||||
final String str = sb.toString()
|
||||
.replaceAll("%action%", this.config.get("messages.actions." + action).getAsString())
|
||||
.replaceAll("%action%", this.config.getString("messages.actions." + action))
|
||||
.replaceAll("%block_type%", blockType)
|
||||
.replaceAll("%block_type%", blockType)
|
||||
.replaceAll("%not_allowed%", notAllowed)
|
||||
@@ -191,8 +277,7 @@ public final class OriginBlacklist {
|
||||
}
|
||||
|
||||
private final void sendWebhooks(final OriginBlacklistLoginEvent event, final EnumBlacklistType type) {
|
||||
Json5Element element = this.config.get("discord.enabled");
|
||||
if (element.getAsBoolean()) {
|
||||
if (this.config.getBoolean("discord.enabled")) {
|
||||
final OPlayer player = event.getPlayer();
|
||||
final EnumConnectionType connType = event.getConnectionType();
|
||||
final String userAgent;
|
||||
@@ -240,7 +325,7 @@ public final class OriginBlacklist {
|
||||
player.getName().replaceAll("_", "\\_"),
|
||||
player.getOrigin(),
|
||||
player.getBrand(),
|
||||
this.config.get("discord.send_ips").getAsBoolean() ? player.getAddr() : "*\\*CENSORED\\**",
|
||||
this.config.getBoolean("discord.send_ips") ? player.getAddr() : "*\\*CENSORED\\**",
|
||||
player.getPVN(),
|
||||
userAgent,
|
||||
player.isRewind() ? "YES" : "NO",
|
||||
@@ -249,46 +334,44 @@ public final class OriginBlacklist {
|
||||
PLUGIN_REPO,
|
||||
PLUGIN_REPO
|
||||
).getBytes();
|
||||
element = this.config.get("discord.webhook_urls");
|
||||
if (element instanceof Json5Array) {
|
||||
for (final Json5Element _element : element.getAsJson5Array()) {
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
final URL url = new URL(_element.getAsString());
|
||||
final HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setRequestProperty("Content-Type", "application/json");
|
||||
conn.setDoOutput(true);
|
||||
conn.setConnectTimeout(5000);
|
||||
conn.setReadTimeout(5000);
|
||||
conn.connect();
|
||||
final OutputStream os = conn.getOutputStream();
|
||||
os.write(payload);
|
||||
os.close();
|
||||
final Json5Array arr = this.config.get("discord.webhook_urls").getAsJson5Array();
|
||||
for (final Json5Element element : arr) {
|
||||
this.plugin.runAsync(() -> {
|
||||
try {
|
||||
final URL url = new URL(element.getAsString());
|
||||
final HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("POST");
|
||||
conn.setRequestProperty("Content-Type", "application/json");
|
||||
conn.setDoOutput(true);
|
||||
conn.setConnectTimeout(5000);
|
||||
conn.setReadTimeout(5000);
|
||||
conn.connect();
|
||||
final OutputStream os = conn.getOutputStream();
|
||||
os.write(payload);
|
||||
os.close();
|
||||
|
||||
final int code = conn.getResponseCode();
|
||||
if (code < 200 || code >= 300) {
|
||||
this.plugin.log(EnumLogLevel.WARN, "Webhook failed (HTTP " + code + ")");
|
||||
}
|
||||
|
||||
conn.disconnect();
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
final int code = conn.getResponseCode();
|
||||
if (code < 200 || code >= 300) {
|
||||
this.plugin.log(EnumLogLevel.WARN, "Webhook failed (HTTP " + code + ")");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
conn.disconnect();
|
||||
} catch (final Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final void checkForUpdate() {
|
||||
CompletableFuture.runAsync(() -> {
|
||||
this.updateAvailable = UpdateChecker.checkForUpdate(PLUGIN_REPO, this.plugin.getPluginVersion(),
|
||||
this.config.get("update_checker.allow_snapshots").getAsBoolean());
|
||||
if (this.updateAvailable) {
|
||||
this.plugin.log(EnumLogLevel.INFO, "An update is available! Download it at https://github.com/" + PLUGIN_REPO + ".git");
|
||||
private final void checkForUpdates() {
|
||||
this.checkForUpdates(() -> {
|
||||
if (!this.config.getBoolean("update_checker.auto_update")) {
|
||||
this.plugin.log(EnumLogLevel.INFO, "An update is available! Download it at " + this.updateURL);
|
||||
} else {
|
||||
this.updatePlugin();
|
||||
}
|
||||
});
|
||||
}, () -> {});
|
||||
}
|
||||
|
||||
public static final String getComponentString(final Component comp) {
|
||||
@@ -303,6 +386,10 @@ public final class OriginBlacklist {
|
||||
return "data:image/png;base64," + Base64.getEncoder().encodeToString(bytes);
|
||||
}
|
||||
|
||||
public static final String getUserAgent() {
|
||||
return BuildInfo.get("plugin_name") + "/" + BuildInfo.get("plugin_vers") + "+" + BuildInfo.get("git_cm_hash");
|
||||
}
|
||||
|
||||
public static final boolean isNonNull(final String str) {
|
||||
return str != null && !str.isEmpty() && !str.isBlank() && !str.equals("null");
|
||||
}
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
package xyz.webmc.originblacklist.base.command;
|
||||
|
||||
import xyz.webmc.originblacklist.base.OriginBlacklist;
|
||||
|
||||
public interface CommandContext {
|
||||
String getPlayerName();
|
||||
void reply(final String message);
|
||||
boolean hasPermission(final String permission);
|
||||
String[] getArgs();
|
||||
public OriginBlacklist getPlugin();
|
||||
|
||||
public String getPlayerName();
|
||||
|
||||
public void reply(final String message);
|
||||
|
||||
public boolean hasPermission(final String permission);
|
||||
|
||||
public String[] getArgs();
|
||||
}
|
||||
|
||||
@@ -3,8 +3,11 @@ package xyz.webmc.originblacklist.base.command;
|
||||
import java.util.List;
|
||||
|
||||
public interface ICommand {
|
||||
static final String NO_PERMISSION = "<red>You don't have permission to use this command.</red>";
|
||||
boolean execute(final CommandContext ctx);
|
||||
List<String> suggest(final CommandContext ctx);
|
||||
void usage(final CommandContext ctx);
|
||||
public static final String NO_PERMISSION = "<red>You don't have permission to use this command.</red>";
|
||||
|
||||
public boolean execute(final CommandContext ctx);
|
||||
|
||||
public List<String> suggest(final CommandContext ctx);
|
||||
|
||||
public void usage(final CommandContext ctx);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
package xyz.webmc.originblacklist.base.command;
|
||||
|
||||
import xyz.webmc.originblacklist.base.OriginBlacklist;
|
||||
import xyz.webmc.originblacklist.base.config.OriginBlacklistConfig;
|
||||
import xyz.webmc.originblacklist.base.enums.EnumBlacklistType;
|
||||
import xyz.webmc.originblacklist.base.util.OPlayer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.marhali.json5.Json5Array;
|
||||
import de.marhali.json5.Json5Element;
|
||||
import de.marhali.json5.Json5Primitive;
|
||||
|
||||
public class OriginBlacklistCommand implements ICommand {
|
||||
private final OriginBlacklist plugin;
|
||||
@@ -18,31 +23,104 @@ public class OriginBlacklistCommand implements ICommand {
|
||||
final String[] args = ctx.getArgs();
|
||||
if (ctx.hasPermission("originblacklist.command")) {
|
||||
if (args.length > 0) {
|
||||
final OriginBlacklistConfig config = this.plugin.getConfig();
|
||||
final String command = args[0].toLowerCase();
|
||||
final String argA = args.length > 1 ? args[1].toLowerCase() : null;
|
||||
;
|
||||
final String argB = args.length > 2 ? args[2] : null;
|
||||
final boolean add = "add".equals(command);
|
||||
final boolean remove = "remove".equals(command);
|
||||
if ("reload".equals(command)) {
|
||||
if (ctx.hasPermission("originblacklist.command.reload")) {
|
||||
this.plugin.getConfig().reloadConfig();
|
||||
config.reloadConfig();
|
||||
ctx.reply("<green>Configuration Reloaded</green>");
|
||||
} else {
|
||||
ctx.reply(NO_PERMISSION);
|
||||
}
|
||||
} else if ("update".equals(command)) {
|
||||
if (ctx.hasPermission("originblacklist.command.update")) {
|
||||
ctx.reply("<aqua>Checking for updates...</aqua>");
|
||||
this.plugin.checkForUpdates(() -> {
|
||||
ctx.reply("<yellow>Updating plugin...</yellow>");
|
||||
this.plugin.updatePlugin(() -> {
|
||||
ctx.reply("<green>Successfully updated plugin.</green>");
|
||||
}, () -> {
|
||||
ctx.reply("<red>Failed to update plugin.</red>");
|
||||
});
|
||||
}, () -> {
|
||||
ctx.reply("<green>Plugin is up to date.</green>");
|
||||
});
|
||||
} else {
|
||||
ctx.reply(NO_PERMISSION);
|
||||
}
|
||||
} else if ((add || remove) && OriginBlacklist.isNonNull(argB)) {
|
||||
if ((add && ctx.hasPermission("originblacklist.command.add"))
|
||||
|| (remove && ctx.hasPermission("originblacklist.command.add"))) {
|
||||
final String arrName;
|
||||
if ("origin".equals(argA)) {
|
||||
arrName = "origins";
|
||||
} else if ("brand".equals(argA)) {
|
||||
arrName = "brands";
|
||||
} else if ("name".equals(argA)) {
|
||||
arrName = "player_names";
|
||||
} else if ("ip".equals(argA)) {
|
||||
arrName = "ip_addresses";
|
||||
} else {
|
||||
arrName = null;
|
||||
}
|
||||
if (OriginBlacklist.isNonNull(arrName)) {
|
||||
final String arrPath = "blacklist." + arrName;
|
||||
final Json5Array arr = config.getArray(arrPath);
|
||||
if (add) {
|
||||
if (!arr.contains(Json5Primitive.fromString(argB))) {
|
||||
arr.add(argB);
|
||||
config.set(arrPath, arr);
|
||||
ctx.reply("<green>Added " + argB + " to the " + argA + " blacklist</green>");
|
||||
} else {
|
||||
ctx.reply("<red>" + argB + " is already on the " + argA + " blacklist</red>");
|
||||
}
|
||||
} else if (remove) {
|
||||
if (arr.contains(Json5Primitive.fromString(argB))) {
|
||||
arr.remove(Json5Primitive.fromString(argB));
|
||||
config.set(arrPath, arr);
|
||||
ctx.reply("<green>Removed " + argB + " from the " + argA + " blacklist</green>");
|
||||
} else {
|
||||
ctx.reply("<red>" + argB + " not on the " + argA + " blacklist</red>");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.usage(ctx);
|
||||
}
|
||||
} else {
|
||||
ctx.reply(NO_PERMISSION);
|
||||
}
|
||||
} else if ("test".equals(command) && OriginBlacklist.isNonNull(argA)) {
|
||||
if (ctx.hasPermission("originblacklist.command.test")) {
|
||||
if (this.isBlacklisted(argA)) {
|
||||
ctx.reply("<green>" + argA + " is on the blacklist.</green>");
|
||||
} else {
|
||||
ctx.reply("<red>" + argA + " is not on the blacklist.</red>");
|
||||
}
|
||||
} else {
|
||||
ctx.reply(NO_PERMISSION);
|
||||
}
|
||||
} else if ("list".equals(command)) {
|
||||
if (ctx.hasPermission("originblacklist.command.reload")) {
|
||||
if (ctx.hasPermission("originblacklist.command.list")) {
|
||||
ctx.reply("<aqua>Blacklist:</aqua>");
|
||||
ctx.reply("<gold> - Origins:</gold>");
|
||||
for (final Json5Element element : this.plugin.getConfig().get("blacklist.origins").getAsJson5Array()) {
|
||||
for (final Json5Element element : config.getArray("blacklist.origins")) {
|
||||
ctx.reply("<gray> - " + element.getAsString() + "</gray>");
|
||||
}
|
||||
ctx.reply("<gold> - Brands:</gold>");
|
||||
for (final Json5Element element : this.plugin.getConfig().get("blacklist.brands").getAsJson5Array()) {
|
||||
for (final Json5Element element : config.getArray("blacklist.brands")) {
|
||||
ctx.reply("<gray> - " + element.getAsString() + "</gray>");
|
||||
}
|
||||
ctx.reply("<gold> - Players:</gold>");
|
||||
for (final Json5Element element : this.plugin.getConfig().get("blacklist.player_names").getAsJson5Array()) {
|
||||
for (final Json5Element element : config.getArray("blacklist.player_names")) {
|
||||
ctx.reply("<gray> - " + element.getAsString() + "</gray>");
|
||||
}
|
||||
ctx.reply("<gold> - IPs:</gold>");
|
||||
for (final Json5Element element : this.plugin.getConfig().get("blacklist.ip_addresses").getAsJson5Array()) {
|
||||
for (final Json5Element element : config.getArray("blacklist.ip_addresses")) {
|
||||
ctx.reply("<gray> - " + element.getAsString() + "</gray>");
|
||||
}
|
||||
} else {
|
||||
@@ -61,16 +139,23 @@ public class OriginBlacklistCommand implements ICommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> suggest(final CommandContext ctx) {
|
||||
public final List<String> suggest(final CommandContext ctx) {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void usage(CommandContext ctx) {
|
||||
public final void usage(CommandContext ctx) {
|
||||
ctx.reply("<aqua>Commands:</aqua>");
|
||||
ctx.reply("<gray> - /originblacklist reload</gray>");
|
||||
// ctx.reply("<gray> - /originblacklist add <brand/origin/name/ip> <value></gray>");
|
||||
// ctx.reply("<gray> - /originblacklist remove <brand/origin/name/ip> <value></gray>");
|
||||
ctx.reply("<gray> - /originblacklist update</gray>");
|
||||
ctx.reply("<gray> - /originblacklist add <origin/brand/name/ip> <argB></gray>");
|
||||
ctx.reply("<gray> - /originblacklist remove <origin/brand/name/ip> <argB></gray>");
|
||||
ctx.reply("<gray> - /originblacklist test <argB></gray>");
|
||||
ctx.reply("<gray> - /originblacklist list</gray>");
|
||||
}
|
||||
|
||||
private final boolean isBlacklisted(final String str) {
|
||||
final OPlayer player = new OPlayer(null, str, null, str, str, -1);
|
||||
return this.plugin.testBlacklist(player) != EnumBlacklistType.NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public final class OriginBlacklistConfig {
|
||||
private byte[] icon;
|
||||
private String icon64;
|
||||
|
||||
public OriginBlacklistConfig(IOriginBlacklistPlugin plugin) {
|
||||
public OriginBlacklistConfig(final IOriginBlacklistPlugin plugin) {
|
||||
this.json5 = Json5.builder(builder -> builder
|
||||
.quoteless()
|
||||
.quoteSingle()
|
||||
@@ -132,7 +132,7 @@ public final class OriginBlacklistConfig {
|
||||
|
||||
if (this.config != null && OriginBlacklist.isNonNull(key)) {
|
||||
element = this.config;
|
||||
final String[] parts = key.split("\\.");
|
||||
final String[] parts = splitPath(key);
|
||||
|
||||
for (final String part : parts) {
|
||||
if (element instanceof Json5Object) {
|
||||
@@ -155,6 +155,95 @@ public final class OriginBlacklistConfig {
|
||||
return element;
|
||||
}
|
||||
|
||||
public final boolean set(final String key, final Json5Element value) {
|
||||
boolean ret = false;
|
||||
|
||||
if (this.config != null && value != null) {
|
||||
final String[] parts = splitPath(key);
|
||||
|
||||
if (parts.length > 0) {
|
||||
Json5Object obj = this.config;
|
||||
|
||||
for (int i = 0; i < parts.length - 1; i++) {
|
||||
final String part = parts[i];
|
||||
final Json5Element cur = obj.has(part) ? obj.get(part) : null;
|
||||
|
||||
if (cur instanceof Json5Object next) {
|
||||
obj = next;
|
||||
} else {
|
||||
final Json5Object next = new Json5Object();
|
||||
obj.add(part, next);
|
||||
obj = next;
|
||||
}
|
||||
}
|
||||
|
||||
obj.add(parts[parts.length - 1], value.deepCopy());
|
||||
this.saveConfig();
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public final boolean remove(final String key) {
|
||||
boolean ret = false;
|
||||
|
||||
if (this.config != null) {
|
||||
final String[] parts = splitPath(key);
|
||||
|
||||
if (parts.length > 0) {
|
||||
Json5Object obj = this.config;
|
||||
Json5Element element = obj;
|
||||
|
||||
for (int i = 0; i < parts.length - 1; i++) {
|
||||
if (element instanceof Json5Object cur && cur.has(parts[i])) {
|
||||
element = cur.get(parts[i]);
|
||||
if (element instanceof Json5Object) {
|
||||
obj = (Json5Object) element;
|
||||
} else {
|
||||
element = null;
|
||||
}
|
||||
} else {
|
||||
element = null;
|
||||
}
|
||||
|
||||
if (element == null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (element != null && obj.has(parts[parts.length - 1])) {
|
||||
obj.remove(parts[parts.length - 1]);
|
||||
this.saveConfig();
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public final String getString(final String key) {
|
||||
return this.get(key).getAsString();
|
||||
}
|
||||
|
||||
public final boolean getBoolean(final String key) {
|
||||
return this.get(key).getAsBoolean();
|
||||
}
|
||||
|
||||
public final int getInteger(final String key) {
|
||||
return this.get(key).getAsInt();
|
||||
}
|
||||
|
||||
public final Json5Array getArray(final String key) {
|
||||
return this.get(key).getAsJson5Array();
|
||||
}
|
||||
|
||||
public final Json5Object getObject(final String key) {
|
||||
return this.get(key).getAsJson5Object();
|
||||
}
|
||||
|
||||
public final byte[] getIconBytes() {
|
||||
return this.icon;
|
||||
}
|
||||
@@ -221,9 +310,13 @@ public final class OriginBlacklistConfig {
|
||||
final Json5Object uobj = new Json5Object();
|
||||
addJSONObj(uobj, "enabled", Json5Primitive.fromBoolean(true), null);
|
||||
addJSONObj(uobj, "allow_snapshots", Json5Primitive.fromBoolean(false), null);
|
||||
addJSONObj(uobj, "auto_update", Json5Primitive.fromBoolean(false), null);
|
||||
addJSONObj(uobj, "check_timer", Json5Primitive.fromNumber(3600), null);
|
||||
addJSONObj(uobj, "auto_update", Json5Primitive.fromBoolean(true), null);
|
||||
addJSONObj(obj, "update_checker", uobj, null);
|
||||
addJSONObj(obj, "blacklist_to_whitelist", Json5Primitive.fromBoolean(false), null);
|
||||
addJSONObj(obj, "block_undefined_origin", Json5Primitive.fromBoolean(false), null);
|
||||
addJSONObj(obj, "bStats", Json5Primitive.fromBoolean(true), null);
|
||||
addJSONObj(obj, "config_version", Json5Primitive.fromNumber(1), "DO NOT CHANGE");
|
||||
return obj;
|
||||
}
|
||||
|
||||
@@ -255,4 +348,16 @@ public final class OriginBlacklistConfig {
|
||||
}
|
||||
obj.add(key, value);
|
||||
}
|
||||
|
||||
private static final String[] splitPath(final String key) {
|
||||
final String[] ret;
|
||||
|
||||
if (OriginBlacklist.isNonNull(key)) {
|
||||
ret = key.split("\\.");
|
||||
} else {
|
||||
ret = new String[0];
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,4 +36,8 @@ public enum EnumBlacklistType {
|
||||
public final String getActionString() {
|
||||
return this.act;
|
||||
}
|
||||
|
||||
public final boolean isBlacklisted() {
|
||||
return this != NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package xyz.webmc.originblacklist.base.util;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
public final class BuildInfo {
|
||||
private static final Properties properties;
|
||||
|
||||
public static final String get(final String key) {
|
||||
return properties.getProperty(key).trim();
|
||||
}
|
||||
|
||||
static {
|
||||
properties = new Properties();
|
||||
try (final InputStream in = BuildInfo.class.getClassLoader().getResourceAsStream("build.properties")) {
|
||||
properties.load(in);
|
||||
} catch (final Throwable t) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import xyz.webmc.originblacklist.base.enums.EnumLogLevel;
|
||||
import xyz.webmc.originblacklist.base.events.OriginBlacklistLoginEvent;
|
||||
import xyz.webmc.originblacklist.base.events.OriginBlacklistMOTDEvent;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
@@ -11,11 +12,22 @@ import org.semver4j.Semver;
|
||||
|
||||
public interface IOriginBlacklistPlugin {
|
||||
public String getPluginId();
|
||||
|
||||
public Semver getPluginVersion();
|
||||
|
||||
public Path getPluginJarPath();
|
||||
|
||||
public void log(final EnumLogLevel level, final String txt);
|
||||
|
||||
public void kickPlayer(final Component txt, final OriginBlacklistLoginEvent event);
|
||||
|
||||
public void setMOTD(final Component txt, final OriginBlacklistMOTDEvent event);
|
||||
|
||||
public String parsePlaceholders(final OPlayer player, final String str);
|
||||
|
||||
public void scheduleRepeat(final Runnable task, final int period, final TimeUnit unit);
|
||||
|
||||
public void runAsync(final Runnable task);
|
||||
|
||||
public void shutdown();
|
||||
}
|
||||
|
||||
@@ -78,9 +78,7 @@ public final class OPlayer {
|
||||
}
|
||||
|
||||
private static final String formatIPAddress(String addr) {
|
||||
if (addr == null) {
|
||||
addr = OriginBlacklist.UNKNOWN_STR;
|
||||
} else {
|
||||
if (OriginBlacklist.isNonNull(addr)) {
|
||||
if (addr.startsWith("/")) {
|
||||
addr = addr.substring(1);
|
||||
}
|
||||
@@ -132,6 +130,8 @@ public final class OPlayer {
|
||||
if (hex && c == 6 && addr.indexOf("::") == -1) {
|
||||
addr = addr + "::";
|
||||
}
|
||||
} else {
|
||||
addr = OriginBlacklist.UNKNOWN_STR;
|
||||
}
|
||||
|
||||
return addr;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package xyz.webmc.originblacklist.base.util;
|
||||
|
||||
import xyz.webmc.originblacklist.base.OriginBlacklist;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
@@ -12,38 +14,88 @@ import de.marhali.json5.Json5Object;
|
||||
import org.semver4j.Semver;
|
||||
import org.semver4j.Semver.VersionDiff;
|
||||
|
||||
public class UpdateChecker {
|
||||
public final class UpdateChecker {
|
||||
private static final Json5 json5 = Json5.builder(builder -> builder.build());
|
||||
|
||||
public static final boolean checkForUpdate(final String repo, final Semver currentVersion, final boolean allowPreRelease) {
|
||||
public static final String checkForUpdates(final String repo, final Semver currentVersion,
|
||||
final boolean allowSnapshots) {
|
||||
try {
|
||||
final URL url = new URL("https://api.github.com/repos/" + repo + "/releases");
|
||||
final HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("GET");
|
||||
conn.setConnectTimeout(5000);
|
||||
conn.setReadTimeout(5000);
|
||||
conn.setRequestProperty("User-Agent", OriginBlacklist.getUserAgent());
|
||||
conn.setRequestProperty("Accept", "application/vnd.github+json");
|
||||
conn.connect();
|
||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||
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) {
|
||||
element = arr.get(0);
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
element = arr.get(i);
|
||||
if (element instanceof Json5Object) {
|
||||
final Json5Object obj = element.getAsJson5Object();
|
||||
final String tag = obj.get("tag_name").getAsString();
|
||||
final Semver ver = new Semver(tag.substring(1));
|
||||
if (ver.isGreaterThan(currentVersion) && (allowPreRelease || currentVersion.diff(ver) != VersionDiff.BUILD)) {
|
||||
return true;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
conn.disconnect();
|
||||
return false;
|
||||
return ret;
|
||||
} catch (final Throwable t) {
|
||||
t.printStackTrace();
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import xyz.webmc.originblacklist.bukkit.command.OriginBlacklistCommandBukkit;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -74,7 +76,7 @@ public final class OriginBlacklistBukkit extends JavaPlugin implements Listener,
|
||||
this.eaglerAPI = EaglerXServerAPI.instance();
|
||||
this.getCommand("originblacklist").setExecutor(new OriginBlacklistCommandBukkit(this.blacklist));
|
||||
this.getServer().getPluginManager().registerEvents(this, this);
|
||||
this.log(EnumLogLevel.INFO, "Initialized Plugin");
|
||||
this.blacklist.init();
|
||||
if (this.blacklist.isMetricsEnabled()) {
|
||||
this.metrics = new Metrics(this, OriginBlacklist.BSTATS_ID);
|
||||
this.metrics.addCustomChart(new AdvancedPie("player_types", () -> {
|
||||
@@ -127,6 +129,11 @@ public final class OriginBlacklistBukkit extends JavaPlugin implements Listener,
|
||||
return new Semver(this.getDescription().getVersion());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Path getPluginJarPath() {
|
||||
return Paths.get(this.getFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void log(final EnumLogLevel level, final String txt) {
|
||||
if (level == EnumLogLevel.WARN) {
|
||||
@@ -224,7 +231,12 @@ public final class OriginBlacklistBukkit extends JavaPlugin implements Listener,
|
||||
public final void scheduleRepeat(final Runnable task, final int period, final TimeUnit unit) {
|
||||
long ms = unit.toMillis((long) period);
|
||||
long ticks = Math.max(1L, ms / 50L);
|
||||
Bukkit.getScheduler().runTaskTimer(this, task, ticks, ticks);
|
||||
Bukkit.getScheduler().runTaskTimer(this, task, 0, ticks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void runAsync(final Runnable task) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(this, task);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,32 +5,39 @@ import xyz.webmc.originblacklist.base.command.CommandContext;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class BKTCommandContext implements CommandContext {
|
||||
public final class BKTCommandContext implements CommandContext {
|
||||
private final OriginBlacklist plugin;
|
||||
private final CommandSender sender;
|
||||
private final String[] args;
|
||||
|
||||
public BKTCommandContext(final CommandSender sender, final String[] args) {
|
||||
public BKTCommandContext(final OriginBlacklist plugin, final CommandSender sender, final String[] args) {
|
||||
this.plugin = plugin;
|
||||
this.sender = sender;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerName() {
|
||||
public final OriginBlacklist getPlugin() {
|
||||
return this.plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getPlayerName() {
|
||||
return this.sender.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reply(final String message) {
|
||||
public final void reply(final String message) {
|
||||
this.sender.sendMessage(OriginBlacklist.getLegacyFromMiniMessage(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(final String permission) {
|
||||
public final boolean hasPermission(final String permission) {
|
||||
return this.sender.hasPermission(permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getArgs() {
|
||||
public final String[] getArgs() {
|
||||
return this.args;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,18 +9,22 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
|
||||
public class OriginBlacklistCommandBukkit extends OriginBlacklistCommand implements TabExecutor {
|
||||
public final class OriginBlacklistCommandBukkit extends OriginBlacklistCommand implements TabExecutor {
|
||||
private final OriginBlacklist plugin;
|
||||
|
||||
public OriginBlacklistCommandBukkit(OriginBlacklist plugin) {
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
|
||||
return super.execute(new BKTCommandContext(sender, args));
|
||||
return super.execute(new BKTCommandContext(this.plugin, sender, args));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) {
|
||||
return super.suggest(new BKTCommandContext(sender, args));
|
||||
public List<String> onTabComplete(final CommandSender sender, final Command command, final String label,
|
||||
final String[] args) {
|
||||
return super.suggest(new BKTCommandContext(this.plugin, sender, args));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ import xyz.webmc.originblacklist.base.util.IncompatibleDependencyException;
|
||||
import xyz.webmc.originblacklist.base.util.OPlayer;
|
||||
import xyz.webmc.originblacklist.bungee.command.OriginBlacklistCommandBungee;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -70,7 +72,7 @@ public final class OriginBlacklistBungee extends Plugin implements Listener, IOr
|
||||
this.eaglerAPI = EaglerXServerAPI.instance();
|
||||
this.getProxy().getPluginManager().registerCommand(this, new OriginBlacklistCommandBungee(this, this.blacklist, "originblacklist"));
|
||||
this.getProxy().getPluginManager().registerListener(this, this);
|
||||
this.log(EnumLogLevel.INFO, "Initialized Plugin");
|
||||
this.blacklist.init();
|
||||
if (this.blacklist.isMetricsEnabled()) {
|
||||
this.metrics = new Metrics(this, OriginBlacklist.BSTATS_ID);
|
||||
this.metrics.addCustomChart(new AdvancedPie("player_types", () -> {
|
||||
@@ -129,6 +131,11 @@ public final class OriginBlacklistBungee extends Plugin implements Listener, IOr
|
||||
return new Semver(this.getDescription().getVersion());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Path getPluginJarPath() {
|
||||
return Paths.get(this.getFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void log(final EnumLogLevel level, final String txt) {
|
||||
if (level == EnumLogLevel.WARN) {
|
||||
@@ -188,7 +195,12 @@ public final class OriginBlacklistBungee extends Plugin implements Listener, IOr
|
||||
|
||||
@Override
|
||||
public final void scheduleRepeat(final Runnable task, final int period, final TimeUnit unit) {
|
||||
this.proxy.getScheduler().schedule(this, task, period, period, unit);
|
||||
this.proxy.getScheduler().schedule(this, task, 0, period, unit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void runAsync(final Runnable task) {
|
||||
this.proxy.getScheduler().runAsync(this, task);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,32 +6,39 @@ import xyz.webmc.originblacklist.base.command.CommandContext;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
|
||||
public class BNGCommandContext implements CommandContext {
|
||||
public final class BNGCommandContext implements CommandContext {
|
||||
private final OriginBlacklist plugin;
|
||||
private final CommandSender sender;
|
||||
private final String[] args;
|
||||
|
||||
public BNGCommandContext(final CommandSender sender, final String[] args) {
|
||||
public BNGCommandContext(final OriginBlacklist plugin, final CommandSender sender, final String[] args) {
|
||||
this.plugin = plugin;
|
||||
this.sender = sender;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerName() {
|
||||
public final OriginBlacklist getPlugin() {
|
||||
return this.plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getPlayerName() {
|
||||
return this.sender.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reply(final String message) {
|
||||
public final void reply(final String message) {
|
||||
this.sender.sendMessage(TextComponent.fromLegacy(OriginBlacklist.getLegacyFromMiniMessage(message)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(final String permission) {
|
||||
public final boolean hasPermission(final String permission) {
|
||||
return this.sender.hasPermission(permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getArgs() {
|
||||
public final String[] getArgs() {
|
||||
return this.args;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,21 +10,24 @@ import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
import net.md_5.bungee.api.plugin.TabExecutor;
|
||||
|
||||
public class OriginBlacklistCommandBungee extends Command implements TabExecutor {
|
||||
public final class OriginBlacklistCommandBungee extends Command implements TabExecutor {
|
||||
private final OriginBlacklistCommand cmd;
|
||||
private final OriginBlacklist blacklist;
|
||||
|
||||
public OriginBlacklistCommandBungee(final OriginBlacklistBungee plugin, final OriginBlacklist blacklist, final String command) {
|
||||
public OriginBlacklistCommandBungee(final OriginBlacklistBungee plugin, final OriginBlacklist blacklist,
|
||||
final String command) {
|
||||
super(command);
|
||||
this.cmd = new OriginBlacklistCommand(blacklist);
|
||||
this.blacklist = blacklist;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(final CommandSender sender, final String[] args) {
|
||||
this.cmd.execute(new BNGCommandContext(sender, args));
|
||||
public final void execute(final CommandSender sender, final String[] args) {
|
||||
this.cmd.execute(new BNGCommandContext(this.blacklist, sender, args));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(final CommandSender sender, final String[] args) {
|
||||
return this.cmd.suggest(new BNGCommandContext(sender, args));
|
||||
public final List<String> onTabComplete(final CommandSender sender, final String[] args) {
|
||||
return this.cmd.suggest(new BNGCommandContext(this.blacklist, sender, args));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ import xyz.webmc.originblacklist.base.util.IncompatibleDependencyException;
|
||||
import xyz.webmc.originblacklist.base.util.OPlayer;
|
||||
import xyz.webmc.originblacklist.velocity.command.OriginBlacklistCommandVelocity;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -62,7 +64,7 @@ public final class OriginBlacklistVelocity implements IOriginBlacklistPlugin {
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onProxyInitialization(ProxyInitializeEvent event) {
|
||||
public final void onProxyInitialization(ProxyInitializeEvent event) {
|
||||
this.proxy.getPluginManager().getPlugin("eaglerxserver").ifPresentOrElse(plugin -> {
|
||||
final Semver version = new Semver(plugin.getDescription().getVersion().orElse("1.0.0"));
|
||||
if (version.isLowerThan(OriginBlacklist.REQUIRED_API_VER)) {
|
||||
@@ -86,7 +88,7 @@ public final class OriginBlacklistVelocity implements IOriginBlacklistPlugin {
|
||||
this.blacklist = new OriginBlacklist(this);
|
||||
this.eaglerAPI = EaglerXServerAPI.instance();
|
||||
this.proxy.getCommandManager().register("originblacklist", new OriginBlacklistCommandVelocity(this.blacklist));
|
||||
this.log(EnumLogLevel.INFO, "Initialized Plugin");
|
||||
this.blacklist.init();
|
||||
if (this.blacklist.isMetricsEnabled()) {
|
||||
this.metrics = this.metricsFactory.make(this, OriginBlacklist.BSTATS_ID);
|
||||
this.metrics.addCustomChart(new AdvancedPie("player_types", () -> {
|
||||
@@ -118,7 +120,8 @@ public final class OriginBlacklistVelocity implements IOriginBlacklistPlugin {
|
||||
@Subscribe(order = PostOrder.FIRST)
|
||||
public final void onJavaLogin(final PreLoginEvent event) {
|
||||
final OPlayer player = new OPlayer(null, event.getUsername(), event.getUniqueId(),
|
||||
event.getConnection().getRemoteAddress().toString(), OriginBlacklist.UNKNOWN_STR, event.getConnection().getProtocolVersion().getProtocol());
|
||||
event.getConnection().getRemoteAddress().toString(), OriginBlacklist.UNKNOWN_STR,
|
||||
event.getConnection().getProtocolVersion().getProtocol());
|
||||
this.blacklist.handleLogin(new OriginBlacklistLoginEvent(null, event, EnumConnectionType.JAVA, player));
|
||||
}
|
||||
|
||||
@@ -126,7 +129,8 @@ public final class OriginBlacklistVelocity implements IOriginBlacklistPlugin {
|
||||
public final void onJavaHandshake(final PlayerClientBrandEvent event) {
|
||||
final Player aPlayer = (Player) event.getPlayer();
|
||||
final OPlayer bPlayer = new OPlayer(null, aPlayer.getUsername(), aPlayer.getUniqueId(),
|
||||
aPlayer.getRemoteAddress().getAddress().toString(), event.getBrand(), event.getPlayer().getProtocolVersion().getProtocol());
|
||||
aPlayer.getRemoteAddress().getAddress().toString(), event.getBrand(),
|
||||
event.getPlayer().getProtocolVersion().getProtocol());
|
||||
this.blacklist.handleLogin(new OriginBlacklistLoginEvent(null, event, EnumConnectionType.JAVA, bPlayer));
|
||||
}
|
||||
|
||||
@@ -147,6 +151,15 @@ public final class OriginBlacklistVelocity implements IOriginBlacklistPlugin {
|
||||
return new Semver(this.plugin.getDescription().getVersion().get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Path getPluginJarPath() {
|
||||
try {
|
||||
return Paths.get(this.getClass().getProtectionDomain().getCodeSource().getLocation().toURI()).toAbsolutePath();
|
||||
} catch (final Throwable t) {
|
||||
throw new RuntimeException("Unable to determine plugin JAR path");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void log(final EnumLogLevel level, final String txt) {
|
||||
if (level == EnumLogLevel.WARN) {
|
||||
@@ -155,7 +168,7 @@ public final class OriginBlacklistVelocity implements IOriginBlacklistPlugin {
|
||||
this.logger.error(txt);
|
||||
} else if (level == EnumLogLevel.DEBUG) {
|
||||
if (this.blacklist.isDebugEnabled()) {
|
||||
this.logger.debug(txt);
|
||||
this.logger.info(txt);
|
||||
}
|
||||
} else {
|
||||
this.logger.info(txt);
|
||||
@@ -214,6 +227,13 @@ public final class OriginBlacklistVelocity implements IOriginBlacklistPlugin {
|
||||
.schedule();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void runAsync(final Runnable task) {
|
||||
this.proxy.getScheduler()
|
||||
.buildTask(this, task)
|
||||
.schedule();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void shutdown() {
|
||||
this.metrics.shutdown();
|
||||
|
||||
@@ -7,18 +7,21 @@ import java.util.List;
|
||||
|
||||
import com.velocitypowered.api.command.SimpleCommand;
|
||||
|
||||
public class OriginBlacklistCommandVelocity extends OriginBlacklistCommand implements SimpleCommand {
|
||||
public final class OriginBlacklistCommandVelocity extends OriginBlacklistCommand implements SimpleCommand {
|
||||
private final OriginBlacklist plugin;
|
||||
|
||||
public OriginBlacklistCommandVelocity(OriginBlacklist plugin) {
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(final Invocation invocation) {
|
||||
super.execute(new VCommandContext(invocation));
|
||||
public final void execute(final Invocation invocation) {
|
||||
super.execute(new VCommandContext(this.plugin, invocation));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> suggest(final Invocation invocation) {
|
||||
return super.suggest(new VCommandContext(invocation));
|
||||
public final List<String> suggest(final Invocation invocation) {
|
||||
return super.suggest(new VCommandContext(this.plugin, invocation));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,34 +1,42 @@
|
||||
package xyz.webmc.originblacklist.velocity.command;
|
||||
|
||||
import xyz.webmc.originblacklist.base.OriginBlacklist;
|
||||
import xyz.webmc.originblacklist.base.command.CommandContext;
|
||||
|
||||
import com.velocitypowered.api.command.SimpleCommand.Invocation;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
|
||||
public class VCommandContext implements CommandContext {
|
||||
public final class VCommandContext implements CommandContext {
|
||||
private final OriginBlacklist plugin;
|
||||
private final Invocation invocation;
|
||||
|
||||
public VCommandContext(final Invocation invocation) {
|
||||
public VCommandContext(final OriginBlacklist plugin, final Invocation invocation) {
|
||||
this.plugin = plugin;
|
||||
this.invocation = invocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerName() {
|
||||
public final OriginBlacklist getPlugin() {
|
||||
return this.plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getPlayerName() {
|
||||
return this.invocation.source().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reply(final String message) {
|
||||
this.invocation.source().sendMessage(MiniMessage.miniMessage().deserialize(message));
|
||||
public final void reply(final String message) {
|
||||
this.invocation.source().sendMessage(MiniMessage.miniMessage().deserialize(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(final String permission) {
|
||||
public final boolean hasPermission(final String permission) {
|
||||
return this.invocation.source().hasPermission(permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getArgs() {
|
||||
public final String[] getArgs() {
|
||||
return this.invocation.arguments();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ version: ${plugin_vers}
|
||||
main: xyz.webmc.${plugin_iden}.bungee.${plugin_name}Bungee
|
||||
description: ${plugin_desc}
|
||||
website: ${plugin_site}
|
||||
author: [${plugin_athr}]
|
||||
contributors: [${plugin_ctbr}]
|
||||
depends: [${plugin_depb}]
|
||||
provides: [${plugin_prov}]
|
||||
softdepend: [${plugin_sdpb}]
|
||||
author: ${plugin_athr}
|
||||
contributors: ${plugin_ctbr}
|
||||
depends: ${plugin_depb}
|
||||
provides: ${plugin_prov}
|
||||
softdepend: ${plugin_sdpb}
|
||||
@@ -3,10 +3,10 @@ version: ${plugin_vers}
|
||||
main: xyz.webmc.${plugin_iden}.bukkit.${plugin_name}Bukkit
|
||||
description: ${plugin_desc}
|
||||
website: ${plugin_site}
|
||||
authors: [${plugin_athr}]
|
||||
contributors: [${plugin_ctbr}]
|
||||
depend: [${plugin_depa}]
|
||||
provides: [${plugin_prov}]
|
||||
softdepend: [${plugin_sdpa}]
|
||||
authors: ${plugin_athr}
|
||||
contributors: ${plugin_ctbr}
|
||||
depend: ${plugin_depa}
|
||||
provides: ${plugin_prov}
|
||||
softdepend: ${plugin_sdpa}
|
||||
commands:
|
||||
originblacklist:
|
||||
${plugin_iden}:
|
||||
@@ -5,6 +5,6 @@
|
||||
"description": "${plugin_desc}",
|
||||
"website": "${plugin_site}",
|
||||
"main": "xyz.webmc.${plugin_iden}.velocity.${plugin_name}Velocity",
|
||||
"authors": [${plugin_athr}],
|
||||
"dependencies": [${plugin_depc}]
|
||||
"authors": ${plugin_athr},
|
||||
"dependencies": ${plugin_depc}
|
||||
}
|
||||
Reference in New Issue
Block a user