Ajout d'un système de censure pour le chat (insultes, pub pour un autre serveur)
This commit is contained in:
parent
22916afa05
commit
3de34319b5
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<jardesc>
|
<jardesc>
|
||||||
<jar path="PandacraftUtils/jar_export/PandacraftUtils-2.2.1.jar"/>
|
<jar path="PandacraftUtils/jar_export/PandacraftUtils-2.3.jar"/>
|
||||||
<options buildIfNeeded="true" compress="true" descriptionLocation="/PandacraftUtils/make_jar.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
|
<options buildIfNeeded="true" compress="true" descriptionLocation="/PandacraftUtils/make_jar.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
|
||||||
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
|
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
|
||||||
<selectedProjects/>
|
<selectedProjects/>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: PandacraftUtils
|
name: PandacraftUtils
|
||||||
main: net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils
|
main: net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils
|
||||||
version: 2.2.1
|
version: 2.3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,20 +22,80 @@ public class ConfigManager {
|
|||||||
instance = this;
|
instance = this;
|
||||||
|
|
||||||
|
|
||||||
|
initChatAnalysisBadWord();
|
||||||
initCommandAlias();
|
initCommandAlias();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Configuration AFK
|
||||||
|
*/
|
||||||
|
|
||||||
public int AFK_timeoutAutoAfkMessage = 60*5; // 5 min
|
public int AFK_timeoutAutoAfkMessage = 60*5; // 5 min
|
||||||
public int AFK_timeoutAutoAfkKick = 60*10; // 10 min
|
public int AFK_timeoutAutoAfkKick = 60*10; // 10 min
|
||||||
|
|
||||||
|
|
||||||
public long AntiSpam_timeBeforeResendSameMessage = 30000;// 30 sec
|
|
||||||
public long AntiSpam_timeBeforeResendSameCommand = 30000;// 30 sec
|
|
||||||
public long AntiSpam_timePerCaracterForNewMessage = 100;// 0.1 sec
|
/*
|
||||||
public int AntiSpam_maxViolationLevel = 20;
|
* Configuration analyse du chat et des messages privés
|
||||||
public int AntiSpam_nbSecondForOneVLDown = 10;
|
* (antispam, insultes, publicité)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public long ChatAnalysis_timeBeforeResendSameMessage = 30000;// 30 sec
|
||||||
|
public long ChatAnalysis_timeBeforeResendSameCommand = 30000;// 30 sec
|
||||||
|
public long ChatAnalysis_timePerCaracterForNewMessage = 100;// 0.1 sec
|
||||||
|
public int ChatAnalysis_maxViolationLevel = 20;
|
||||||
|
public int ChatAnalysis_nbSecondForOneVLDown = 10;
|
||||||
|
|
||||||
|
public List<String> ChatAnalysis_badWords; // les insultes
|
||||||
|
|
||||||
|
private void initChatAnalysisBadWord() {
|
||||||
|
ChatAnalysis_badWords = new ArrayList<String>();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Insultes
|
||||||
|
*/
|
||||||
|
ChatAnalysis_badWords.add("putes?");
|
||||||
|
ChatAnalysis_badWords.add("conn?a(rd?|ss?e?)");
|
||||||
|
ChatAnalysis_badWords.add("sal(o|au)pe?s?");
|
||||||
|
ChatAnalysis_badWords.add("[ea]ncul(é|e|er|ai(s|t|))");
|
||||||
|
ChatAnalysis_badWords.add("merdes?");
|
||||||
|
ChatAnalysis_badWords.add("ni(qu|k)e? ta m(è|e|é)re?");
|
||||||
|
ChatAnalysis_badWords.add("fil?s de putes?");
|
||||||
|
ChatAnalysis_badWords.add("ta m(è|e|é)re? l(a|e) putes?");
|
||||||
|
ChatAnalysis_badWords.add("ta m(è|e|é)re?");
|
||||||
|
ChatAnalysis_badWords.add("tafiole?s?");
|
||||||
|
ChatAnalysis_badWords.add("vas? te pendre");
|
||||||
|
ChatAnalysis_badWords.add("fuck");
|
||||||
|
ChatAnalysis_badWords.add("mother ?fuc?ker");
|
||||||
|
ChatAnalysis_badWords.add("dick");
|
||||||
|
ChatAnalysis_badWords.add("ass");
|
||||||
|
ChatAnalysis_badWords.add("bitch");
|
||||||
|
//ChatAnalysis_badWords.add("");
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Pub pour des serveurs (avec sous domaines type *.mtxserv.fr ou nom de serveur connu genre Minefield)
|
||||||
|
*/
|
||||||
|
ChatAnalysis_badWords.add("minefield");
|
||||||
|
ChatAnalysis_badWords.add("mineplex");
|
||||||
|
ChatAnalysis_badWords.add("hypixel");
|
||||||
|
//ChatAnalysis_badWords.add("");
|
||||||
|
//ChatAnalysis_badWords.add("");
|
||||||
|
//ChatAnalysis_badWords.add("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Alias pour les commandes
|
||||||
|
*/
|
||||||
|
|
||||||
public List<Map<String, String>> CommandAlias_alias;
|
public List<Map<String, String>> CommandAlias_alias;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
|||||||
|
|
||||||
public class ChatAnalysisManager implements Listener {
|
public class ChatAnalysisManager implements Listener {
|
||||||
|
|
||||||
private ChatAnalysisPlayer[] aPlayers;
|
private ChatAnalysisPlayer[] CAPlayers;
|
||||||
|
|
||||||
private PandacraftUtils plugin;
|
private PandacraftUtils plugin;
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ public class ChatAnalysisManager implements Listener {
|
|||||||
|
|
||||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||||
|
|
||||||
aPlayers = new ChatAnalysisPlayer[plugin.getServer().getMaxPlayers()];
|
CAPlayers = new ChatAnalysisPlayer[plugin.getServer().getMaxPlayers()];
|
||||||
|
|
||||||
|
|
||||||
// analyse des joueurs déjà en ligne (/reload)
|
// analyse des joueurs déjà en ligne (/reload)
|
||||||
@ -35,7 +35,7 @@ public class ChatAnalysisManager implements Listener {
|
|||||||
public void onAsyncPlayerChat(AsyncPlayerChatEvent event)
|
public void onAsyncPlayerChat(AsyncPlayerChatEvent event)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
getAPlayer(event.getPlayer()).onAsyncPlayerChat(event);
|
getCAPlayer(event.getPlayer()).onAsyncPlayerChat(event);
|
||||||
} catch (NullPointerException e) { }
|
} catch (NullPointerException e) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,18 +43,18 @@ public class ChatAnalysisManager implements Listener {
|
|||||||
public void onPlayerCommandPreprocess (PlayerCommandPreprocessEvent event)
|
public void onPlayerCommandPreprocess (PlayerCommandPreprocessEvent event)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
getAPlayer(event.getPlayer()).onPlayerCommandPreprocess(event);
|
getCAPlayer(event.getPlayer()).onPlayerCommandPreprocess(event);
|
||||||
} catch (NullPointerException e) { }
|
} catch (NullPointerException e) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ChatAnalysisPlayer getAPlayer(Player p)
|
public ChatAnalysisPlayer getCAPlayer(Player p)
|
||||||
{
|
{
|
||||||
if (p == null || !p.isOnline())
|
if (p == null || !p.isOnline())
|
||||||
return null;
|
return null;
|
||||||
for (ChatAnalysisPlayer ap : aPlayers)
|
for (ChatAnalysisPlayer ap : CAPlayers)
|
||||||
{
|
{
|
||||||
if (ap != null && ap.getPlayer() == p)
|
if (ap != null && ap.getPlayer() == p)
|
||||||
return ap;
|
return ap;
|
||||||
@ -68,8 +68,8 @@ public class ChatAnalysisManager implements Listener {
|
|||||||
public void onPlayerJoin (PlayerJoinEvent event)
|
public void onPlayerJoin (PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
int i=0;
|
int i=0;
|
||||||
while (i<aPlayers.length && aPlayers[i] != null) i++;
|
while (i<CAPlayers.length && CAPlayers[i] != null) i++;
|
||||||
if (aPlayers[i] == null) aPlayers[i] = new ChatAnalysisPlayer(plugin, event.getPlayer());
|
if (CAPlayers[i] == null) CAPlayers[i] = new ChatAnalysisPlayer(plugin, event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -77,12 +77,12 @@ public class ChatAnalysisManager implements Listener {
|
|||||||
public void onPlayerQuit (PlayerQuitEvent event)
|
public void onPlayerQuit (PlayerQuitEvent event)
|
||||||
{
|
{
|
||||||
|
|
||||||
for (int i=0; i<aPlayers.length; i++)
|
for (int i=0; i<CAPlayers.length; i++)
|
||||||
{
|
{
|
||||||
if (aPlayers[i] == null)
|
if (CAPlayers[i] == null)
|
||||||
continue;
|
continue;
|
||||||
if (aPlayers[i].getPlayer() == event.getPlayer())
|
if (CAPlayers[i].getPlayer() == event.getPlayer())
|
||||||
aPlayers[i] = null;
|
CAPlayers[i] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,18 +11,18 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
|||||||
import org.bukkit.util.NumberConversions;
|
import org.bukkit.util.NumberConversions;
|
||||||
|
|
||||||
public class ChatAnalysisPlayer {
|
public class ChatAnalysisPlayer {
|
||||||
private long time_before_resend_same_message = ConfigManager.getInstance().AntiSpam_timeBeforeResendSameMessage;// 30 sec
|
private long time_before_resend_same_message = ConfigManager.getInstance().ChatAnalysis_timeBeforeResendSameMessage;// 30 sec
|
||||||
private long time_before_resend_same_command = ConfigManager.getInstance().AntiSpam_timeBeforeResendSameCommand;// 30 sec
|
private long time_before_resend_same_command = ConfigManager.getInstance().ChatAnalysis_timeBeforeResendSameCommand;// 30 sec
|
||||||
|
|
||||||
// définit si un message a été tapé super vite ou non
|
// définit si un message a été tapé super vite ou non
|
||||||
/* pour un message reçu, on prends la durée depuis le message précédent,
|
/* pour un message reçu, on prends la durée depuis le message précédent,
|
||||||
* et on le compare au produit de cette variable par le nombre de caractère du nouveau message
|
* et on le compare au produit de cette variable par le nombre de caractère du nouveau message
|
||||||
* */
|
* */
|
||||||
private long time_per_caracter_for_new_message = ConfigManager.getInstance().AntiSpam_timePerCaracterForNewMessage;// 0.1 sec
|
private long time_per_caracter_for_new_message = ConfigManager.getInstance().ChatAnalysis_timePerCaracterForNewMessage;// 0.1 sec
|
||||||
|
|
||||||
private int max_violation_level = ConfigManager.getInstance().AntiSpam_maxViolationLevel;
|
private int max_violation_level = ConfigManager.getInstance().ChatAnalysis_maxViolationLevel;
|
||||||
|
|
||||||
private int nb_second_for_1_vl_down = ConfigManager.getInstance().AntiSpam_nbSecondForOneVLDown;
|
private int nb_second_for_1_vl_down = ConfigManager.getInstance().ChatAnalysis_nbSecondForOneVLDown;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -52,11 +52,12 @@ public class ChatAnalysisPlayer {
|
|||||||
private void addVL(int nb)
|
private void addVL(int nb)
|
||||||
{
|
{
|
||||||
violation_level += nb;
|
violation_level += nb;
|
||||||
|
plugin.getLogger().info("ViolationLevel for player "+player.getDisplayName()+"§r : +"+nb+" -> "+violation_level);
|
||||||
if (violation_level >= max_violation_level)
|
if (violation_level >= max_violation_level)
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
|
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
player.kickPlayer("Ralentissez la cadance, les spams sont interdits !");
|
player.kickPlayer("Les spams/insultes/publicités sont interdits !");
|
||||||
}
|
}
|
||||||
}, 1L);
|
}, 1L);
|
||||||
|
|
||||||
@ -95,6 +96,8 @@ public class ChatAnalysisPlayer {
|
|||||||
event.getPlayer().sendMessage(ChatColor.RED+"Evitez de renvoyer le même message !");
|
event.getPlayer().sendMessage(ChatColor.RED+"Evitez de renvoyer le même message !");
|
||||||
if (violation_level >= max_violation_level/2)
|
if (violation_level >= max_violation_level/2)
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
else
|
||||||
|
event.setMessage(analyseString(message));
|
||||||
addVL(5);
|
addVL(5);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -107,6 +110,7 @@ public class ChatAnalysisPlayer {
|
|||||||
|
|
||||||
event.getPlayer().sendMessage(ChatColor.RED+"Vous parlez un peu trop vite, ralentissez x)");
|
event.getPlayer().sendMessage(ChatColor.RED+"Vous parlez un peu trop vite, ralentissez x)");
|
||||||
addVL(4);
|
addVL(4);
|
||||||
|
event.setMessage(analyseString(message));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,47 +133,112 @@ public class ChatAnalysisPlayer {
|
|||||||
return;
|
return;
|
||||||
if (event.getPlayer().hasPermission("pandacraft.antispam.exempt"))
|
if (event.getPlayer().hasPermission("pandacraft.antispam.exempt"))
|
||||||
return;
|
return;
|
||||||
String[] command_line = event.getMessage().split(" ");
|
String command_line = event.getMessage();
|
||||||
|
String[] command_line_split = event.getMessage().split(" ");
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
String commande = command_line[0].substring(1);
|
String commande = command_line_split[0].substring(1).toLowerCase();
|
||||||
if (commande.equalsIgnoreCase("afk")
|
|
||||||
|| commande.equalsIgnoreCase("away")
|
if (commande.equals("")) return;
|
||||||
|| commande.equalsIgnoreCase("time")
|
|
||||||
|| commande.equalsIgnoreCase("day")
|
// traitement du contenu des messages (si elle existe, comme MP ou /me)
|
||||||
|| commande.equalsIgnoreCase("night")
|
// ici, le message, c'est dès le permier paramètre
|
||||||
|| commande.equalsIgnoreCase("me")
|
if ((commande.equals("me")
|
||||||
|| commande.equalsIgnoreCase("action")
|
|| commande.equals("action")
|
||||||
|| commande.equalsIgnoreCase("describe")
|
|| commande.equals("describe")
|
||||||
|| commande.equalsIgnoreCase("tpa")
|
|| commande.equals("r")
|
||||||
|| commande.equalsIgnoreCase("call")
|
|| commande.equals("reply"))
|
||||||
|| commande.equalsIgnoreCase("tpask")
|
&& command_line_split.length > 1) {
|
||||||
|| commande.equalsIgnoreCase("r")
|
try {
|
||||||
|| commande.equalsIgnoreCase("reply")
|
String message = command_line.substring(1+commande.length()+1); // "/"+commande+" "
|
||||||
|| commande.equalsIgnoreCase("msg")
|
message = analyseString(message);
|
||||||
|| commande.equalsIgnoreCase("m")
|
command_line = "/"+commande+" "+message;
|
||||||
|| commande.equalsIgnoreCase("tell")
|
} catch (IndexOutOfBoundsException e) { }
|
||||||
|| commande.equalsIgnoreCase("t")
|
|
||||||
|| commande.equalsIgnoreCase("whisper")
|
}
|
||||||
|| commande.equalsIgnoreCase("w")
|
// ici, le message, c'est dès le deuxième paramètre
|
||||||
|| commande.equalsIgnoreCase("mail")
|
else if((commande.equals("msg")
|
||||||
|| commande.equalsIgnoreCase("email"))
|
|| commande.equals("m")
|
||||||
|
|| commande.equals("tell")
|
||||||
|
|| commande.equals("t")
|
||||||
|
|| commande.equals("whisper")
|
||||||
|
|| commande.equals("w"))
|
||||||
|
&& command_line_split.length > 2) {
|
||||||
|
try {
|
||||||
|
String message = command_line.substring(1+commande.length()
|
||||||
|
+1+command_line_split[1].length()
|
||||||
|
+1); // "/"+commande+" "+pseudo+" "
|
||||||
|
message = analyseString(message);
|
||||||
|
command_line = "/"+commande+" "+command_line_split[1]+" "+message;
|
||||||
|
} catch (IndexOutOfBoundsException e) { }
|
||||||
|
}
|
||||||
|
// ici, le message, c'est dès le troisième paramètre
|
||||||
|
else if((commande.equals("mail")
|
||||||
|
|| commande.equals("email"))
|
||||||
|
&& command_line_split.length > 3) {
|
||||||
|
try {
|
||||||
|
String message = command_line.substring(1+commande.length()
|
||||||
|
+1+command_line_split[1].length()
|
||||||
|
+1+command_line_split[2].length()
|
||||||
|
+1); // "/"+commande+" "+sub_command+" "+pseudo+" "
|
||||||
|
message = analyseString(message);
|
||||||
|
command_line = "/"+commande+" "+command_line_split[1]+" "+command_line_split[2]+" "+message;
|
||||||
|
} catch (IndexOutOfBoundsException e) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (commande.equals("afk")
|
||||||
|
|| commande.equals("away")
|
||||||
|
|| commande.equals("time")
|
||||||
|
|| commande.equals("day")
|
||||||
|
|| commande.equals("night")
|
||||||
|
|| commande.equals("me")
|
||||||
|
|| commande.equals("action")
|
||||||
|
|| commande.equals("describe")
|
||||||
|
|| commande.equals("tpa")
|
||||||
|
|| commande.equals("call")
|
||||||
|
|| commande.equals("tpask")
|
||||||
|
|| commande.equals("r")
|
||||||
|
|| commande.equals("reply")
|
||||||
|
|| commande.equals("msg")
|
||||||
|
|| commande.equals("m")
|
||||||
|
|| commande.equals("tell")
|
||||||
|
|| commande.equals("t")
|
||||||
|
|| commande.equals("whisper")
|
||||||
|
|| commande.equals("w")
|
||||||
|
|| commande.equals("mail")// reste à traiter pour la censure
|
||||||
|
|| commande.equals("email"))// reste à traiter pour la censure
|
||||||
{
|
{
|
||||||
if (last_command != null)
|
if (last_command != null)
|
||||||
{
|
{
|
||||||
if (last_command.equals(event.getMessage()) && time - last_command_time < time_before_resend_same_command)
|
if (last_command.equals(command_line) && time - last_command_time < time_before_resend_same_command)
|
||||||
{
|
{
|
||||||
event.getPlayer().sendMessage(ChatColor.RED+"Patientez avant de renvoyer cette commande !");
|
event.getPlayer().sendMessage(ChatColor.RED+"Patientez avant de renvoyer cette commande !");
|
||||||
if (violation_level >= max_violation_level/2)
|
if (violation_level >= max_violation_level/2)
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
addVL(5);
|
addVL(5);
|
||||||
|
event.setMessage(command_line);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
removeVL(NumberConversions.floor(((time - last_command_time)/1000)/nb_second_for_1_vl_down));
|
removeVL(NumberConversions.floor(((time - last_command_time)/1000)/nb_second_for_1_vl_down));
|
||||||
|
|
||||||
last_command = event.getMessage();
|
last_command = command_line;
|
||||||
last_command_time = time;
|
last_command_time = time;
|
||||||
|
|
||||||
|
event.setMessage(command_line);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -182,7 +251,7 @@ public class ChatAnalysisPlayer {
|
|||||||
|
|
||||||
// évite les suites d'au moins 4 caractàres à la suite
|
// évite les suites d'au moins 4 caractàres à la suite
|
||||||
char[] cs = s.toCharArray();
|
char[] cs = s.toCharArray();
|
||||||
String ret = s.substring(0, (s.length()>=3)?3:s.length());
|
String r = s.substring(0, (s.length()>=3)?3:s.length());
|
||||||
int nb_duplicated_char = 0;
|
int nb_duplicated_char = 0;
|
||||||
for (int i=3; i<cs.length; i++)
|
for (int i=3; i<cs.length; i++)
|
||||||
{
|
{
|
||||||
@ -192,7 +261,7 @@ public class ChatAnalysisPlayer {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ret.concat(String.valueOf(cs[i]));
|
r = r.concat(String.valueOf(cs[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nb_duplicated_char > 0)
|
if (nb_duplicated_char > 0)
|
||||||
@ -202,13 +271,13 @@ public class ChatAnalysisPlayer {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s = ret;
|
s = r;
|
||||||
char[] sChar = s.toCharArray();
|
char[] sChar = s.toCharArray();
|
||||||
char[] minChar = s.toLowerCase().toCharArray();
|
char[] minChar = s.toLowerCase().toCharArray();
|
||||||
|
|
||||||
|
|
||||||
// vérification des majuscules
|
// vérification des majuscules
|
||||||
if (sChar.length > 10)
|
if (sChar.length > 5)
|
||||||
{
|
{
|
||||||
int nb_caps = 0;
|
int nb_caps = 0;
|
||||||
for (int i=0; i<sChar.length; i++)
|
for (int i=0; i<sChar.length; i++)
|
||||||
@ -220,12 +289,37 @@ public class ChatAnalysisPlayer {
|
|||||||
// si plus de 70% des caractères sont majuscules
|
// si plus de 70% des caractères sont majuscules
|
||||||
// ou plus de 20 majuscules
|
// ou plus de 20 majuscules
|
||||||
addVL(4);
|
addVL(4);
|
||||||
ret = s.toLowerCase();
|
s = s.toLowerCase();
|
||||||
player.sendMessage(ChatColor.RED+"Il y a trop de majuscules dans votre message, faites attention avant d'envoyer votre message ;)");
|
player.sendMessage(ChatColor.RED+"Il y a trop de majuscules dans votre message, faites attention avant d'envoyer votre message ;)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
|
|
||||||
|
// traiter les insultes et masquage Pub ici
|
||||||
|
|
||||||
|
|
||||||
|
// adresse IPv4 basique
|
||||||
|
if (s.matches("(.*)([0-9]{1,3}\\.){3}[0-9]{1,3}(:[0-9]{1,5})?(.*)"))
|
||||||
|
{
|
||||||
|
s = s.replaceAll("[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}", "**.**.**.**");
|
||||||
|
addVL(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// pour chaque insultes présentes dans la configuration du plugin
|
||||||
|
for (String regex : ConfigManager.getInstance().ChatAnalysis_badWords)
|
||||||
|
{
|
||||||
|
if (s.matches("(?i:(.+[^a-zA-Z]|)"+regex+"(|[^a-zA-Z].+))"))
|
||||||
|
{
|
||||||
|
s = s.replaceAll("(?i:"+regex+")", "*****");
|
||||||
|
addVL(5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return s;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,8 +147,8 @@ public class CommandList implements CommandExecutor {
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int vl = plugin.chatAnalysisManager.getAPlayer(p).getVL();
|
int vl = plugin.chatAnalysisManager.getCAPlayer(p).getVL();
|
||||||
int max_vl = plugin.chatAnalysisManager.getAPlayer(p).getMaxVL();
|
int max_vl = plugin.chatAnalysisManager.getCAPlayer(p).getMaxVL();
|
||||||
aff_list.add("§f"+name+"§r - §7"+vl+"/"+max_vl);
|
aff_list.add("§f"+name+"§r - §7"+vl+"/"+max_vl);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user