Skip to content

Commit f309bda

Browse files
Merge pull request #88 from SLNE-Development/feat/add-default-denylist-actions-and-entries
Feat/add default denylist actions and entries
2 parents 541889c + 8d5a091 commit f309bda

File tree

22 files changed

+579
-20
lines changed

22 files changed

+579
-20
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
kotlin.code.style=official
22
kotlin.stdlib.default.dependency=false
33
org.gradle.parallel=true
4-
version=1.21.8-4.0.2-SNAPSHOT
4+
version=1.21.8-4.0.3-SNAPSHOT

surf-chat-api/src/main/kotlin/dev/slne/surf/chat/api/entry/DenylistActionType.kt

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,16 @@ enum class DenylistActionType {
1414
* based on the denylist conditions. It is part of the `DenylistActionType` enumeration
1515
* and is typically utilized in systems for moderating and managing user behavior.
1616
*/
17-
BAN,
17+
EXPIREABLE_BAN,
18+
19+
/**
20+
* Represents a permanent ban action type within the denylist system.
21+
*
22+
* This action type is used to permanently prevent a user from accessing certain features
23+
* or areas of the system based on the denylist conditions. Unlike temporary bans, this
24+
* action has no expiration and is intended for severe or repeated violations of the system's policies.
25+
*/
26+
PERMANENT_BAN,
1827

1928
/**
2029
* Represents the action of kicking a user from a chat or server.
@@ -39,5 +48,16 @@ enum class DenylistActionType {
3948
* without enforcing stricter actions such as banning or muting. Warnings are generally
4049
* used as a preliminary measure in moderation workflows.
4150
*/
42-
WARN
51+
WARN,
52+
53+
/**
54+
* Represents a community ban action type.
55+
*
56+
* This action type is used to enforce a ban across an entire community or platform,
57+
* rather than just a single server or chat instance. It is typically applied for severe
58+
* violations of community guidelines or rules.
59+
*
60+
* Note: Triggering a community ban can broadcast a message to discord
61+
*/
62+
COMMUNITY_BAN
4363
}

surf-chat-bukkit/build.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import dev.slne.surf.surfapi.gradle.util.registerSoft
2+
13
plugins {
24
id("dev.slne.surf.surfapi.gradle.paper-plugin")
35
}
@@ -19,9 +21,10 @@ surfPaperPluginApi {
1921
mainClass("dev.slne.surf.chat.bukkit.BukkitMain")
2022
foliaSupported(true)
2123
generateLibraryLoader(false)
24+
withCloudCommon()
2225

2326
serverDependencies {
24-
register("MiniPlaceholders")
27+
registerSoft("MiniPlaceholders")
2528
}
2629

2730
authors.add("red")

surf-chat-bukkit/src/main/kotlin/dev/slne/surf/chat/bukkit/BukkitMain.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package dev.slne.surf.chat.bukkit
33
import com.github.shynixn.mccoroutine.folia.SuspendingJavaPlugin
44
import com.github.shynixn.mccoroutine.folia.launch
55
import dev.slne.surf.chat.api.server.ChatServer
6+
import dev.slne.surf.chat.bukkit.config.DiscordConfigProvider
67
import dev.slne.surf.chat.bukkit.config.SurfChatConfigProvider
78
import dev.slne.surf.chat.core.service.databaseService
89
import dev.slne.surf.chat.core.service.denylistActionService
@@ -44,6 +45,7 @@ class BukkitMain : SuspendingJavaPlugin() {
4445
}
4546

4647
val surfChatConfig = SurfChatConfigProvider()
48+
val discordConfig = DiscordConfigProvider()
4749
val connectionMessageConfig get() = surfChatConfig.config.connectionMessageConfig
4850
val chatMotdConfig get() = surfChatConfig.config.chatMotdConfig
4951
val chatServerConfig get() = surfChatConfig.config.chatServerConfig

surf-chat-bukkit/src/main/kotlin/dev/slne/surf/chat/bukkit/command/argument/DenylistActionTypeArgument.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ class DenylistActionTypeArgument(nodeName: String) :
1212
CustomArgument<DenylistActionType, String>(StringArgument(nodeName), { info ->
1313
when (info.input()) {
1414
"kick" -> DenylistActionType.KICK
15-
"ban" -> DenylistActionType.BAN
15+
"ban" -> DenylistActionType.EXPIREABLE_BAN
1616
"mute" -> DenylistActionType.MUTE
1717
"warn" -> DenylistActionType.WARN
18+
"communityban" -> DenylistActionType.COMMUNITY_BAN
19+
"ban-permanent" -> DenylistActionType.PERMANENT_BAN
1820
else -> throw CustomArgumentException.fromAdventureComponent {
1921
buildText {
2022
appendPrefix()
21-
error("Der Aktionstyp '${info.input()}' ist ungültig. Gültige Typen sind: kick, ban, mute, warn")
23+
error("Der Aktionstyp '${info.input()}' ist ungültig. Gültige Typen sind: kick, ban, mute, warn, communityban, ban-permanent.")
2224
}
2325
}
2426
}
@@ -29,7 +31,9 @@ class DenylistActionTypeArgument(nodeName: String) :
2931
"kick",
3032
"ban",
3133
"mute",
32-
"warn"
34+
"warn",
35+
"communityban",
36+
"ban-permanent"
3337
)
3438
)
3539
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package dev.slne.surf.chat.bukkit.command.denylist
2+
3+
import com.github.shynixn.mccoroutine.folia.launch
4+
import dev.jorel.commandapi.CommandAPICommand
5+
import dev.jorel.commandapi.kotlindsl.anyExecutor
6+
import dev.jorel.commandapi.kotlindsl.subcommand
7+
import dev.slne.surf.chat.bukkit.permission.SurfChatPermissionRegistry
8+
import dev.slne.surf.chat.bukkit.plugin
9+
import dev.slne.surf.chat.core.service.denylistService
10+
import dev.slne.surf.surfapi.core.api.messages.adventure.sendText
11+
import net.kyori.adventure.text.event.ClickEvent
12+
import org.bukkit.entity.Player
13+
14+
fun CommandAPICommand.denylistClearCommand() = subcommand("clear") {
15+
withPermission(SurfChatPermissionRegistry.COMMAND_DENYLIST_CLEAR)
16+
anyExecutor { executor, _ ->
17+
if (executor is Player) {
18+
executor.sendText {
19+
appendPrefix()
20+
info("Möchtest du die Denylist wirklich leeren? ")
21+
append {
22+
spacer("[")
23+
success("Bestätigen")
24+
spacer("]")
25+
clickEvent(ClickEvent.callback {
26+
plugin.launch {
27+
denylistService.clearEntries()
28+
denylistService.clearLocalEntries()
29+
executor.sendText {
30+
appendPrefix()
31+
success("Die Denylist wurde geleert.")
32+
}
33+
}
34+
})
35+
}
36+
}
37+
return@anyExecutor
38+
}
39+
40+
plugin.launch {
41+
denylistService.clearEntries()
42+
executor.sendText {
43+
appendPrefix()
44+
success("Die Denylist wurde geleert.")
45+
}
46+
}
47+
}
48+
}

surf-chat-bukkit/src/main/kotlin/dev/slne/surf/chat/bukkit/command/denylist/DenylistCommand.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ fun denylistCommand() = commandAPICommand("denylist", plugin) {
1010
denylistRemoveCommand()
1111
denylistFetchCommand()
1212
denylistListCommand()
13+
denylistClearCommand()
14+
denylistImportDefaultCommand()
1315
}
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
package dev.slne.surf.chat.bukkit.command.denylist
2+
3+
import com.github.shynixn.mccoroutine.folia.launch
4+
import dev.jorel.commandapi.CommandAPICommand
5+
import dev.jorel.commandapi.kotlindsl.anyExecutor
6+
import dev.jorel.commandapi.kotlindsl.subcommand
7+
import dev.slne.surf.chat.api.entry.DenylistActionType
8+
import dev.slne.surf.chat.bukkit.permission.SurfChatPermissionRegistry
9+
import dev.slne.surf.chat.bukkit.plugin
10+
import dev.slne.surf.chat.core.entry.DenylistBatchEntry
11+
import dev.slne.surf.surfapi.core.api.messages.adventure.sendText
12+
import kotlinx.coroutines.Dispatchers
13+
import kotlin.time.Duration.Companion.days
14+
15+
/**
16+
* ⚠️ DISCLAIMER:
17+
*
18+
* All offensive words, swear words, or potentially sensitive language contained
19+
* in this file exist **solely for the purpose of moderation, testing, and
20+
* functional operation of this plugin**. They are included to ensure that
21+
* the plugin can properly detect, handle, and respond to such language
22+
* where necessary.
23+
*
24+
* Under no circumstances are these words intended to insult, harm, or
25+
* demean any individual, group, or community. Their presence is strictly
26+
* technical and functional, and any resemblance to real-life offensive
27+
* language is purely coincidental.
28+
*
29+
* This file and its contents are designed for controlled and responsible
30+
* usage within the plugin's systems. Any use outside of this intended
31+
* context is **unauthorized and unintended**.
32+
*
33+
* By including these words, the goal is to improve moderation capabilities
34+
* and ensure the plugin behaves correctly in scenarios where offensive
35+
* language might appear—not to promote or normalize inappropriate speech.
36+
*
37+
* ⚠️ Please treat all content in this file as **strictly functional**,
38+
* not personal or offensive.
39+
*/
40+
41+
42+
fun CommandAPICommand.denylistImportDefaultCommand() = subcommand("importdefaults") {
43+
withPermission(SurfChatPermissionRegistry.COMMAND_DENYLIST_DEFAULTS)
44+
anyExecutor { executor, _ ->
45+
executor.sendText {
46+
appendPrefix()
47+
info("Importiere Standard-Wortfilter...")
48+
}
49+
50+
plugin.launch(Dispatchers.IO) {
51+
listOf(
52+
DenylistBatchEntry.builder()
53+
.withReason("Rassismus, Extremismus, Gewalt")
54+
.withStaff("Arty Support")
55+
.withActionType(DenylistActionType.COMMUNITY_BAN)
56+
.withPunishReason("Rassistische oder extremistische Inhalte")
57+
.withWords(
58+
"nigger",
59+
"ngga",
60+
"nigga",
61+
"hh",
62+
"heil hitler"
63+
)
64+
.build(),
65+
DenylistBatchEntry.builder()
66+
.withReason("Gewaltverherrlichende Inhalte")
67+
.withStaff("Arty Support")
68+
.withActionType(DenylistActionType.PERMANENT_BAN)
69+
.withPunishReason("Gewaltverherrlichende Inhalte")
70+
.withWords(
71+
"killyourself",
72+
"kys",
73+
)
74+
.build(),
75+
DenylistBatchEntry.builder()
76+
.withReason("Starke Beleidigungen")
77+
.withStaff("Arty Support")
78+
.withActionType(DenylistActionType.EXPIREABLE_BAN)
79+
.withPunishReason("Inhalte mit abwertender, beleidigender oder diskriminierender Sprache")
80+
.withDuration(14.days)
81+
.withWords(
82+
"hure",
83+
"hurensohn",
84+
"fotze",
85+
"nutte",
86+
"bastard",
87+
"schlampe",
88+
"hs"
89+
).build(),
90+
DenylistBatchEntry.builder()
91+
.withReason("Mittelstarke Beleidigungen")
92+
.withStaff("Arty Support")
93+
.withActionType(DenylistActionType.EXPIREABLE_BAN)
94+
.withPunishReason("Inhalte mit persönlichen Beleidigungen mittlerer Stufe")
95+
.withDuration(7.days)
96+
.withWords(
97+
"ass", "arschloch", "arsch", "opfer", "wichser", "pisser", "pussy"
98+
).build(),
99+
DenylistBatchEntry.builder()
100+
.withReason("Leichte Beleidigungen")
101+
.withStaff("Arty Support")
102+
.withActionType(DenylistActionType.MUTE)
103+
.withPunishReason("Beleidigende Inhalte")
104+
.withDuration(3.days)
105+
.withWords(
106+
"dummkopf",
107+
"idiot",
108+
"miststück",
109+
"blödmann",
110+
"verpiss dich",
111+
"verpissdich",
112+
"loser",
113+
"noob",
114+
"n00b",
115+
"leck"
116+
).build()
117+
).forEach { entry ->
118+
entry.execute()
119+
}
120+
121+
executor.sendText {
122+
appendPrefix()
123+
success("Import der Standard-Wortfilter abgeschlossen.")
124+
}
125+
}
126+
}
127+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package dev.slne.surf.chat.bukkit.command.denylist.action
2+
3+
import com.github.shynixn.mccoroutine.folia.launch
4+
import dev.jorel.commandapi.CommandAPICommand
5+
import dev.jorel.commandapi.kotlindsl.anyExecutor
6+
import dev.jorel.commandapi.kotlindsl.subcommand
7+
import dev.slne.surf.chat.bukkit.permission.SurfChatPermissionRegistry
8+
import dev.slne.surf.chat.bukkit.plugin
9+
import dev.slne.surf.chat.core.service.denylistActionService
10+
import dev.slne.surf.chat.core.service.denylistService
11+
import dev.slne.surf.surfapi.core.api.messages.adventure.sendText
12+
import net.kyori.adventure.text.event.ClickEvent
13+
import org.bukkit.entity.Player
14+
15+
fun CommandAPICommand.denylistActionClearCommand() = subcommand("clear") {
16+
withPermission(SurfChatPermissionRegistry.COMMAND_DENYLIST_ACTION_CLEAR)
17+
anyExecutor { executor, _ ->
18+
if (executor is Player) {
19+
executor.sendText {
20+
appendPrefix()
21+
info("Möchtest du die Denylist Aktionen wirklich leeren? ")
22+
append {
23+
spacer("[")
24+
success("Bestätigen")
25+
spacer("]")
26+
clickEvent(ClickEvent.callback {
27+
plugin.launch {
28+
denylistActionService.clearActions()
29+
denylistActionService.clearLocalActions()
30+
executor.sendText {
31+
appendPrefix()
32+
success("Die Denylist Aktionen wurde geleert.")
33+
}
34+
}
35+
})
36+
}
37+
}
38+
return@anyExecutor
39+
}
40+
41+
plugin.launch {
42+
denylistActionService.clearActions()
43+
executor.sendText {
44+
appendPrefix()
45+
success("Die Denylist Aktionen wurde geleert.")
46+
}
47+
}
48+
}
49+
}

surf-chat-bukkit/src/main/kotlin/dev/slne/surf/chat/bukkit/command/denylist/action/DenylistActionCommand.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ fun denylistActionCommand() = commandAPICommand("denylistaction") {
1010
denylistActionRemoveCommand()
1111
denylistActionFetchCommand()
1212
denylistActionListCommand()
13+
denylistActionClearCommand()
1314
}

0 commit comments

Comments
 (0)