Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
MEFRREEX authored Oct 31, 2022
1 parent a692244 commit e16bcfd
Show file tree
Hide file tree
Showing 13 changed files with 95 additions and 91 deletions.
64 changes: 35 additions & 29 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,49 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>groupId</groupId>
<artifactId>ChatFilter</artifactId>
<version>2.0-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<repositories>
<repository>
<id>nukkitx-repo</id>
<url>https://repo.nukkitx.com/snapshot/</url>
</repository>
</repositories>

<distributionManagement>
<repository>
<id>releases</id>
<name>nukkitx-releases</name>
<url>https://repo.nukkitx.com/release</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>nukkitx-snapshots</name>
<url>https://repo.nukkitx.com/snapshot</url>
</snapshotRepository>
</distributionManagement>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<groupId>cn.nukkit</groupId>
<artifactId>nukkit</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>

<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
<defaultGoal>clean package</defaultGoal>
<finalName>${project.name}</finalName>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<directory>src/main/resources/</directory>
</resource>
</resources>
</build>


</project>
</project>
17 changes: 7 additions & 10 deletions src/main/java/me/driftay/chatfilter/Main.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
package me.driftay.chatfilter;

import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import cn.nukkit.event.Listener;
import cn.nukkit.plugin.PluginBase;

public class Main extends JavaPlugin {
ConsoleCommandSender Console = Bukkit.getConsoleSender();
public class Main extends PluginBase {

public void onEnable() {
this.Console.sendMessage("ChatFilter Enabled");
this.Console.sendMessage("Author: Driftay");
this.getConfig().options().copyDefaults(true);
this.getLogger().info("ChatFilter Enabled");
this.getLogger().info("Author: Driftay");
this.saveDefaultConfig();
this.getServer().getPluginManager().registerEvents(new WordsFilter(this), this);
this.getCommand("chatfilter").setExecutor(new ReloadCMD(this));

this.getServer().getPluginManager().registerEvents((Listener) new WordsFilter(this), this);
}
}
23 changes: 11 additions & 12 deletions src/main/java/me/driftay/chatfilter/WordsFilter.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package me.driftay.chatfilter;

import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import cn.nukkit.utils.Config;
import cn.nukkit.Player;
import cn.nukkit.event.EventHandler;
import cn.nukkit.event.Listener;
import cn.nukkit.event.player.PlayerChatEvent;

import java.util.Iterator;

Expand All @@ -18,17 +17,17 @@ public WordsFilter(Main main) {


@EventHandler
public void onChat(AsyncPlayerChatEvent e) {
public void onChat(PlayerChatEvent e) {

Player p = e.getPlayer();
String message = e.getMessage();
FileConfiguration config = this.main.getConfig();
Config config = this.main.getConfig();

boolean sendWarning = false;
boolean bypassPerm = p.hasPermission(config.getString("ChatFilter.bypass-permission"));
boolean bypassPerm = p.hasPermission(config.getString("chatfilter.bypass-permission"));

char star = config.getString("Replace-Symbol").charAt(0);
Iterator<String> stuff = config.getStringList("Muted-Words").iterator();
char star = config.getString("replace-symbol").charAt(0);
Iterator<String> stuff = config.getStringList("muted-words").iterator();
while (stuff.hasNext()) {
String str = stuff.next();
if (message.toLowerCase().contains(str.toLowerCase()) && !bypassPerm) {
Expand All @@ -40,7 +39,7 @@ public void onChat(AsyncPlayerChatEvent e) {
}

if (sendWarning)
p.sendMessage(ChatColor.translateAlternateColorCodes('&', config.getString("ChatFilter.Warning-Message")));
p.sendMessage(config.getString("chatFilter.warning-message").replace("&", "§"));
e.setMessage(message);

}
Expand Down
40 changes: 4 additions & 36 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,15 @@
#######################################################################################
#######################################################################################
#######################################################################################
##### #####
##### ChatFilter+ 2.0 #####
##### Created By Driftay #####
##### #####
#######################################################################################
#######################################################################################
#######################################################################################


#<---------------------->NOTES<---------------------->#
#All Color Codes Can Be Used!
#Refer to: https://wiki.ess3.net/mc/
#<---------------------->NOTES<---------------------->#

ChatFilter:
reloaded: '&f[&bChat&cFilter&f] &2Configuration has been successfully reloaded!'
no-perms: '&f[&bChat&cFilter&f] &cYou are not permitted to use &c/chatfilter'
wrong-argument: '&f[&bChat&cFilter&f] &2Command Not Found! Try &c/chatfilter reload&2!'
chatfilter:
bypass-permission: 'chatfilter.bypass'
Warning-Message: '&d&lYOUR SERVER HERE &8» &bWe''ve noticed you''re using &6Profane Language &ba lot. Please keep it to a minimum.'
warning-message: '&d&lYOUR SERVER HERE &8» &bWe''ve noticed you''re using &6Profane Language &ba lot. Please keep it to a minimum.'


#Example: Hello will be replaced with ****
Replace-Symbol: '*'
replace-symbol: '*'


# You can continue this list as long as you want just copy my examples above
# NOTE: I do find these words HIGHLY OFFENSIVE and Recommend you keep them
Muted-Words:
muted-words:
- 'nigger'
- 'beaner'
- 'n1gger'
Expand All @@ -41,15 +21,3 @@ Muted-Words:
- 'whore'
- 'ass'
- 'asshole'


#######################################################################################
#######################################################################################
#######################################################################################
##### #####
##### ChatFilter+ 2.0 #####
##### Created By Driftay #####
##### #####
#######################################################################################
#######################################################################################
#######################################################################################
5 changes: 1 addition & 4 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@ main: me.driftay.chatfilter.Main
name: ChatFilter
author: Driftay
version: ${project.version}
description: The Best Plugin For Managing Offensive Words
commands:
chatfilter:
description: Reload the Config.
description: The Best Plugin For Managing Offensive Words
Binary file added target/ChatFilter.jar
Binary file not shown.
23 changes: 23 additions & 0 deletions target/classes/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
chatfilter:
bypass-permission: 'chatfilter.bypass'
warning-message: '&d&lYOUR SERVER HERE &8» &bWe''ve noticed you''re using &6Profane Language &ba lot. Please keep it to a minimum.'


#Example: Hello will be replaced with ****
replace-symbol: '*'


# You can continue this list as long as you want just copy my examples above
# NOTE: I do find these words HIGHLY OFFENSIVE and Recommend you keep them
muted-words:
- 'nigger'
- 'beaner'
- 'n1gger'
- 'nibba'
- 'fuck'
- 'bitch'
- 'cunt'
- 'slut'
- 'whore'
- 'ass'
- 'asshole'
Binary file added target/classes/me/driftay/chatfilter/Main.class
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions target/classes/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
main: me.driftay.chatfilter.Main
name: ChatFilter
author: Driftay
version: 2.0-SNAPSHOT
description: The Best Plugin For Managing Offensive Words
5 changes: 5 additions & 0 deletions target/maven-archiver/pom.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#Generated by Maven
#Mon Oct 31 15:34:45 EET 2022
groupId=groupId
artifactId=ChatFilter
version=2.0-SNAPSHOT
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
me\driftay\chatfilter\WordsFilter.class
me\driftay\chatfilter\Main.class
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
C:\Users\mefrr\Desktop\ChatFilter-master\src\main\java\me\driftay\chatfilter\WordsFilter.java
C:\Users\mefrr\Desktop\ChatFilter-master\src\main\java\me\driftay\chatfilter\Main.java

0 comments on commit e16bcfd

Please sign in to comment.