Skip to content

Commit

Permalink
feat: Implemented Bungee support
Browse files Browse the repository at this point in the history
  • Loading branch information
4drian3d committed Jan 16, 2023
1 parent 2fcfeeb commit 579c9a0
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 5 deletions.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -10,3 +10,6 @@ Filter messages sent to your Velocity, Sponge, Paper and Krypton consoles
- Sponge 8+ Support
- Paper 1.8.8+ Support
- Krypton Support

## Downloads
Download it from [Modrinth](https://modrinth.com/plugin/logfilter)
12 changes: 11 additions & 1 deletion gradle/libs.versions.toml
Expand Up @@ -12,6 +12,8 @@ runtask = "2.0.1"
legacypaper = "1.16.5-R0.1-SNAPSHOT"
sponge = "8.1.0-SNAPSHOT"
sponge-gradle = "2.0.2"
waterfall = "1.19-R0.1-SNAPSHOT"
plugin-yml = "0.5.2"

[libraries]

Expand All @@ -20,6 +22,7 @@ configurate = { group = "org.spongepowered", name = "configurate-hocon", version
velocity = { module = "com.velocitypowered:velocity-api", version.ref = "velocity" }
legacypaper = { group = "com.destroystokyo.paper", name = "paper-api", version.ref = "legacypaper" }
sponge = { module = "org.spongepowered:spongeapi", version.ref = "sponge" }
waterfall = { module = "io.github.waterfallmc:waterfall-api", version.ref = "waterfall" }

#Gradle dependencies
plugin-shadow = { group = "gradle.plugin.com.github.johnrengelman", name = "shadow", version.ref = "shadow" }
Expand All @@ -29,6 +32,13 @@ plugin-shadow = { group = "gradle.plugin.com.github.johnrengelman", name = "shad
blossom = { id = "net.kyori.blossom", version.ref = "blossom" }
extramodule = { id = "org.gradlex.extra-java-module-info", version.ref = "extramodule" }
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
sponge-gradle = { id = "org.spongepowered.gradle.plugin", version.ref = "sponge-gradle"}

# Run Task
runvelocity = { id = "xyz.jpenilla.run-velocity", version.ref = "runtask" }
runpaper = { id = "xyz.jpenilla.run-paper", version.ref = "runtask" }
sponge-gradle = { id = "org.spongepowered.gradle.plugin", version.ref = "sponge-gradle"}
runwaterfall = { id = "xyz.jpenilla.run-waterfall", version.ref = "runtask" }

# Plugin-yml
pluginyml-bungee = { id = "net.minecrell.plugin-yml.bungee", version.ref = "plugin-yml" }
pluginyml-bukkit = { id = "net.minecrell.plugin-yml.bukkit", version.ref = "plugin-yml" }
4 changes: 1 addition & 3 deletions paper/build.gradle.kts
Expand Up @@ -14,7 +14,7 @@ dependencies {
}


tasks{
tasks {
compileJava {
options.encoding = Charsets.UTF_8.name()
}
Expand All @@ -33,9 +33,7 @@ bukkit {
description = project.description as String
name = "LogFilter"
version = project.version as String

apiVersion = "1.13"

author = "4drian3d"
}

Expand Down
3 changes: 2 additions & 1 deletion settings.gradle.kts
@@ -1,6 +1,7 @@
enableFeaturePreview("VERSION_CATALOGS")
rootProject.name = "logfilter-parent"

arrayOf("common", "paper", "velocity", "sponge", "krypton").forEach {
arrayOf("common", "paper", "velocity", "sponge", "krypton", "waterfall").forEach {
include("logfilter-$it")
project(":logfilter-$it").projectDir = file(it)
}
Expand Down
39 changes: 39 additions & 0 deletions waterfall/build.gradle.kts
@@ -0,0 +1,39 @@
plugins {
alias(libs.plugins.pluginyml.bungee)
id("logfilter.shadow.java")
alias(libs.plugins.runwaterfall)
}

repositories {
maven("https://repo.papermc.io/repository/maven-public/")
}

dependencies {
compileOnly(project(":logfilter-common"))
compileOnly(libs.waterfall)
}

tasks{
compileJava {
options.encoding = Charsets.UTF_8.name()
}
jar {
manifest {
attributes("Automatic-Module-Name" to "me.adrianed.logfilter.bungee")
}
}
runWaterfall {
waterfallVersion("1.19")
}
}

bungee {
main = "me.adrianed.logfilter.bungee.LogFilterBungee"
description = project.description as String
name = "LogFilter"
version = project.version as String
author = "4drian3d"
}

java.sourceCompatibility = JavaVersion.VERSION_1_8
java.targetCompatibility = JavaVersion.VERSION_1_8
@@ -0,0 +1,34 @@
package me.adrianed.logfilter.bungee;

import me.adrianed.logfilter.common.configuration.Configuration;
import me.adrianed.logfilter.common.configuration.Loader;
import me.adrianed.logfilter.common.filter.Filters;
import net.md_5.bungee.api.plugin.Plugin;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.nio.file.Path;

@SuppressWarnings("unused")
public class LogFilterBungee extends Plugin {
@Override
public void onEnable() {
Path pluginPath = getDataFolder().toPath();

Logger logger = LogManager.getLogger("LogFilter");
logger.info("Loading filter");

if (!Loader.loadFiles(pluginPath, logger)) {
return;
}

Configuration config = Loader.loadConfig(pluginPath, logger);
if (config == null) {
return;
}

String filter = Filters.applyFilter(config);

logger.info("Correctly loaded {} filter", filter);
}
}

0 comments on commit 579c9a0

Please sign in to comment.