mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-02 06:28:54 +00:00
Improve filters and fix startup issues
This commit is contained in:
1 parent
50bb994688
commit
e476713b19
7 files changed
+52
-21
No files matched your search
@@ -52,7 +52,6 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocatio
|
||||
task relocateShadowJar(type: ConfigureShadowRelocation) {
|
||||
target = tasks.shadowJar
|
||||
prefix = "net.draycia.carbon.libs" // Default value is "shadow"
|
||||
|
||||
}
|
||||
|
||||
tasks.shadowJar.dependsOn tasks.relocateShadowJar
|
||||
@@ -1,4 +1,5 @@
|
||||
plugins {
|
||||
id 'com.github.johnrengelman.shadow' version '6.0.0'
|
||||
id 'net.minecrell.plugin-yml.bukkit' version '0.3.0'
|
||||
}
|
||||
|
||||
@@ -7,9 +8,9 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.mcMMO-Dev:mcMMO:-SNAPSHOT'
|
||||
compileOnly 'com.github.mcMMO-Dev:mcMMO:-SNAPSHOT'
|
||||
|
||||
api project(':CarbonChat')
|
||||
compileOnly project(':CarbonChat')
|
||||
}
|
||||
|
||||
description = 'CarbonChatMCMMO'
|
||||
@@ -21,4 +22,10 @@ bukkit {
|
||||
apiVersion = '1.13'
|
||||
author = 'Draycia'
|
||||
depend = ['CarbonChat', 'mcMMO']
|
||||
}
|
||||
|
||||
tasks.build.dependsOn tasks.shadowJar
|
||||
|
||||
shadowJar {
|
||||
archiveClassifier = null
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
plugins {
|
||||
id 'com.github.johnrengelman.shadow' version '6.0.0'
|
||||
id 'net.minecrell.plugin-yml.bukkit' version '0.3.0'
|
||||
}
|
||||
|
||||
@@ -8,7 +9,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api project(':CarbonChat')
|
||||
compileOnly project(':CarbonChat')
|
||||
}
|
||||
|
||||
description = 'CarbonChatModeration'
|
||||
@@ -20,4 +21,11 @@ bukkit {
|
||||
apiVersion = '1.13'
|
||||
author = 'Draycia'
|
||||
depend = ['CarbonChat']
|
||||
}
|
||||
|
||||
tasks.build.dependsOn tasks.shadowJar
|
||||
|
||||
shadowJar {
|
||||
archiveClassifier = null
|
||||
relocate "co.aikar.commands", "net.draycia.carbon.libs.co.aikar.commands"
|
||||
}
|
||||
+12
-9
@@ -3,6 +3,8 @@ package net.draycia.carbonmoderation.listeners;
|
||||
import net.draycia.carbon.channels.ChatChannel;
|
||||
import net.draycia.carbon.events.ChatFormatEvent;
|
||||
import net.draycia.carbonmoderation.CarbonChatModeration;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -23,17 +25,18 @@ public class FilterHandler implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
String filterText = moderation.getConfig().getString("filters.filter-text", "****");
|
||||
|
||||
if (channelUsesFilter(event.getChannel())) {
|
||||
for (String entry : moderation.getConfig().getStringList("filters.filtered-words")) {
|
||||
event.setMessage(event.getMessage().replaceAll(entry, filterText));
|
||||
}
|
||||
if (!channelUsesFilter(event.getChannel())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (channelUsesFilter(event.getChannel())) {
|
||||
for (String entry : moderation.getConfig().getStringList("filters.blocked-words")) {
|
||||
event.setMessage(event.getMessage().replaceAll(entry, ""));
|
||||
FileConfiguration config = moderation.getConfig();
|
||||
ConfigurationSection filters = config.getConfigurationSection("filters.filters");
|
||||
|
||||
for (String replacement : filters.getKeys(false)) {
|
||||
List<String> filteredWords = filters.getStringList(replacement);
|
||||
|
||||
for (String word : filteredWords) {
|
||||
event.setMessage(event.getMessage().replaceAll(word, replacement));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@ caps-protection:
|
||||
|
||||
filters:
|
||||
enabled: true
|
||||
filter-text: '****'
|
||||
filtered-words:
|
||||
- 'lag'
|
||||
- 'la[g]+'
|
||||
blocked-words:
|
||||
- 'broccoli sucks'
|
||||
filters:
|
||||
"****":
|
||||
- "lag"
|
||||
- "la[g]+"
|
||||
"":
|
||||
- "broccoli sucks"
|
||||
channels:
|
||||
- '*' # Use '*' to mean all channels
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
plugins {
|
||||
id 'com.github.johnrengelman.shadow' version '6.0.0'
|
||||
id 'net.minecrell.plugin-yml.bukkit' version '0.3.0'
|
||||
}
|
||||
|
||||
@@ -11,7 +12,7 @@ repositories {
|
||||
dependencies {
|
||||
compileOnly 'com.github.TownyAdvanced:Towny:0.96.2.0'
|
||||
|
||||
api project(':CarbonChat')
|
||||
compileOnly project(':CarbonChat')
|
||||
}
|
||||
|
||||
description = 'CarbonChatTowny'
|
||||
@@ -23,4 +24,10 @@ bukkit {
|
||||
apiVersion = '1.13'
|
||||
author = 'Draycia'
|
||||
depend = ['CarbonChat', 'Towny']
|
||||
}
|
||||
|
||||
tasks.build.dependsOn tasks.shadowJar
|
||||
|
||||
shadowJar {
|
||||
archiveClassifier = null
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
plugins {
|
||||
id 'com.github.johnrengelman.shadow' version '6.0.0'
|
||||
id 'net.minecrell.plugin-yml.bukkit' version '0.3.0'
|
||||
}
|
||||
|
||||
@@ -11,7 +12,7 @@ repositories {
|
||||
dependencies {
|
||||
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.4-SNAPSHOT'
|
||||
|
||||
api project(':CarbonChat')
|
||||
compileOnly project(':CarbonChat')
|
||||
}
|
||||
|
||||
description = 'CarbonChatWorldGuard'
|
||||
@@ -23,4 +24,10 @@ bukkit {
|
||||
apiVersion = '1.13'
|
||||
author = 'Draycia'
|
||||
depend = ['CarbonChat', 'WorldGuard']
|
||||
}
|
||||
|
||||
tasks.build.dependsOn tasks.shadowJar
|
||||
|
||||
shadowJar {
|
||||
archiveClassifier = null
|
||||
}
|
||||
Reference in new issue
Block a user