mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-04 14:38:49 +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) {
|
task relocateShadowJar(type: ConfigureShadowRelocation) {
|
||||||
target = tasks.shadowJar
|
target = tasks.shadowJar
|
||||||
prefix = "net.draycia.carbon.libs" // Default value is "shadow"
|
prefix = "net.draycia.carbon.libs" // Default value is "shadow"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.shadowJar.dependsOn tasks.relocateShadowJar
|
tasks.shadowJar.dependsOn tasks.relocateShadowJar
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
|
id 'com.github.johnrengelman.shadow' version '6.0.0'
|
||||||
id 'net.minecrell.plugin-yml.bukkit' version '0.3.0'
|
id 'net.minecrell.plugin-yml.bukkit' version '0.3.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7,9 +8,9 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.github.mcMMO-Dev:mcMMO:-SNAPSHOT'
|
compileOnly 'com.github.mcMMO-Dev:mcMMO:-SNAPSHOT'
|
||||||
|
|
||||||
api project(':CarbonChat')
|
compileOnly project(':CarbonChat')
|
||||||
}
|
}
|
||||||
|
|
||||||
description = 'CarbonChatMCMMO'
|
description = 'CarbonChatMCMMO'
|
||||||
@@ -22,3 +23,9 @@ bukkit {
|
|||||||
author = 'Draycia'
|
author = 'Draycia'
|
||||||
depend = ['CarbonChat', 'mcMMO']
|
depend = ['CarbonChat', 'mcMMO']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.build.dependsOn tasks.shadowJar
|
||||||
|
|
||||||
|
shadowJar {
|
||||||
|
archiveClassifier = null
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
|
id 'com.github.johnrengelman.shadow' version '6.0.0'
|
||||||
id 'net.minecrell.plugin-yml.bukkit' version '0.3.0'
|
id 'net.minecrell.plugin-yml.bukkit' version '0.3.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8,7 +9,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(':CarbonChat')
|
compileOnly project(':CarbonChat')
|
||||||
}
|
}
|
||||||
|
|
||||||
description = 'CarbonChatModeration'
|
description = 'CarbonChatModeration'
|
||||||
@@ -21,3 +22,10 @@ bukkit {
|
|||||||
author = 'Draycia'
|
author = 'Draycia'
|
||||||
depend = ['CarbonChat']
|
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.channels.ChatChannel;
|
||||||
import net.draycia.carbon.events.ChatFormatEvent;
|
import net.draycia.carbon.events.ChatFormatEvent;
|
||||||
import net.draycia.carbonmoderation.CarbonChatModeration;
|
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.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@@ -23,17 +25,18 @@ public class FilterHandler implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String filterText = moderation.getConfig().getString("filters.filter-text", "****");
|
if (!channelUsesFilter(event.getChannel())) {
|
||||||
|
return;
|
||||||
if (channelUsesFilter(event.getChannel())) {
|
|
||||||
for (String entry : moderation.getConfig().getStringList("filters.filtered-words")) {
|
|
||||||
event.setMessage(event.getMessage().replaceAll(entry, filterText));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channelUsesFilter(event.getChannel())) {
|
FileConfiguration config = moderation.getConfig();
|
||||||
for (String entry : moderation.getConfig().getStringList("filters.blocked-words")) {
|
ConfigurationSection filters = config.getConfigurationSection("filters.filters");
|
||||||
event.setMessage(event.getMessage().replaceAll(entry, ""));
|
|
||||||
|
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:
|
filters:
|
||||||
enabled: true
|
enabled: true
|
||||||
filter-text: '****'
|
filters:
|
||||||
filtered-words:
|
"****":
|
||||||
- 'lag'
|
- "lag"
|
||||||
- 'la[g]+'
|
- "la[g]+"
|
||||||
blocked-words:
|
"":
|
||||||
- 'broccoli sucks'
|
- "broccoli sucks"
|
||||||
channels:
|
channels:
|
||||||
- '*' # Use '*' to mean all channels
|
- '*' # Use '*' to mean all channels
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
|
id 'com.github.johnrengelman.shadow' version '6.0.0'
|
||||||
id 'net.minecrell.plugin-yml.bukkit' version '0.3.0'
|
id 'net.minecrell.plugin-yml.bukkit' version '0.3.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compileOnly 'com.github.TownyAdvanced:Towny:0.96.2.0'
|
compileOnly 'com.github.TownyAdvanced:Towny:0.96.2.0'
|
||||||
|
|
||||||
api project(':CarbonChat')
|
compileOnly project(':CarbonChat')
|
||||||
}
|
}
|
||||||
|
|
||||||
description = 'CarbonChatTowny'
|
description = 'CarbonChatTowny'
|
||||||
@@ -24,3 +25,9 @@ bukkit {
|
|||||||
author = 'Draycia'
|
author = 'Draycia'
|
||||||
depend = ['CarbonChat', 'Towny']
|
depend = ['CarbonChat', 'Towny']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.build.dependsOn tasks.shadowJar
|
||||||
|
|
||||||
|
shadowJar {
|
||||||
|
archiveClassifier = null
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
|
id 'com.github.johnrengelman.shadow' version '6.0.0'
|
||||||
id 'net.minecrell.plugin-yml.bukkit' version '0.3.0'
|
id 'net.minecrell.plugin-yml.bukkit' version '0.3.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.4-SNAPSHOT'
|
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.4-SNAPSHOT'
|
||||||
|
|
||||||
api project(':CarbonChat')
|
compileOnly project(':CarbonChat')
|
||||||
}
|
}
|
||||||
|
|
||||||
description = 'CarbonChatWorldGuard'
|
description = 'CarbonChatWorldGuard'
|
||||||
@@ -24,3 +25,9 @@ bukkit {
|
|||||||
author = 'Draycia'
|
author = 'Draycia'
|
||||||
depend = ['CarbonChat', 'WorldGuard']
|
depend = ['CarbonChat', 'WorldGuard']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.build.dependsOn tasks.shadowJar
|
||||||
|
|
||||||
|
shadowJar {
|
||||||
|
archiveClassifier = null
|
||||||
|
}
|
||||||
Reference in new issue
Block a user