Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
90 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
34 changes: 34 additions & 0 deletions
34
waterfall/src/main/java/me/adrianed/logfilter/bungee/LogFilterBungee.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |