@@ -47,12 +47,12 @@ public class Spam implements Runnable, Listener, CommandExecutor {
return false ;
}
if ( lt + plugin . getConfig ( ) . getLong ( " Spam.ChatWait " , 1 ) > nt ) {
AntiMsg = " 请不要短时间内发送大量消息! " ;
AntiMsg = plugin . getmessage ( " Spam.TooMuchChat " ) ;
return true ;
}
if ( lm . equals ( s ) ) {
if ( lt + plugin . getConfig ( ) . getLong ( " Spam.SameChatWait " , 5 ) > nt ) {
AntiMsg = " 请不要短时间内发送重复的消息! " ;
AntiMsg = plugin . getmessage ( " Spam.TooMuchSameChat " ) ;
return true ;
}
}
@@ -71,12 +71,12 @@ public class Spam implements Runnable, Listener, CommandExecutor {
return false ;
}
if ( lt + plugin . getConfig ( ) . getLong ( " Spam.CommandWait " , 1 ) > nt ) {
AntiMsg = " 请不要短时间内发送大量命令 " ;
AntiMsg = plugin . getmessage ( " Spam.TooMuchCommand " ) ;
return true ;
}
if ( lm . equals ( s ) ) {
if ( lt + plugin . getConfig ( ) . getLong ( " Spam.SameCommandWait " , 3 ) > nt ) {
AntiMsg = " 请不要短时间内发送相同的命令 " ;
AntiMsg = plugin . getmessage ( " Spam.TooMuchSameCommand " ) ;
return true ;
}
}
@@ -86,40 +86,36 @@ public class Spam implements Runnable, Listener, CommandExecutor {
@Override
public boolean onCommand ( CommandSender sender , Command command , String label , String [ ] args ) {
if ( command . getName ( ) . equalsIgnoreCase ( " spam " ) ) {
if ( ! sender . hasPermission ( " spam.admin " ) ) {
sender . sendMessage ( plugin . servername + " " + plugin . getmessage ( " no-permission " ) ) ;
return true ;
}
if ( command . getName ( ) . equalsIgnoreCase ( " sp " ) ) {
if ( args . length = = 2 ) {
Player p = Bukkit . getPlayer ( args [ 1 ] ) ;
if ( args [ 0 ] . equalsIgnoreCase ( " add " ) ) {
if ( p ! = null ) {
cc . put ( p , p ) ;
sender . sendMessage ( plugin . servername + " §c已禁止玩家 " + p . getDisplayName ( )
+ " §c聊天! " ) ;
sender . sendMessage ( plugin . getfullmsg ( " Spam.MuteOn " ) . replace ( " %player% " ,
p . getDisplayName ( ) ) ) ;
} else {
sender . sendMessage ( plugin . servername + " §c玩家不存在或不在线! " ) ;
sender . sendMessage ( plugin . getfullmsg ( " Spam.OffLine " ) ) ;
}
}
if ( args [ 0 ] . equalsIgnoreCase ( " del " ) ) {
if ( p ! = null & & cc . containsKey ( p ) ) {
cc . remove ( p ) ;
sender . sendMessage ( plugin . servername + " §a已允许玩家 " + p . getDisplayName ( )
+ " §a聊天! " ) ;
sender . sendMessage ( plugin . getfullmsg ( " Spam.MuteOff " ) . replace ( " %player% " ,
p . getDisplayName ( ) ) ) ;
} else {
sender . sendMessage ( plugin . servername + " §c玩家未被禁言或不存在! " ) ;
sender . sendMessage ( plugin . getfullmsg ( " Spam.NotMute " ) ) ;
}
}
if ( args [ 0 ] . equalsIgnoreCase ( " admin " ) ) {
if ( args [ 1 ] . equalsIgnoreCase ( " on " ) ) {
adminchat = true ;
sender . sendMessage ( plugin . servername + " §a服务器已开启管理员聊天! " ) ;
sender . sendMessage ( plugin . getfullmsg ( " Spam.AdminChatOn " ) ) ;
return true ;
}
if ( args [ 1 ] . equalsIgnoreCase ( " off " ) ) {
adminchat = false ;
sender . sendMessage ( plugin . servername + " §c服务器已关闭管理员聊天! " ) ;
sender . sendMessage ( plugin . getfullmsg ( " Spam.AdminChatOff " ) ) ;
return true ;
}
}
@@ -135,20 +131,20 @@ public class Spam implements Runnable, Listener, CommandExecutor {
Player p = e . getPlayer ( ) ;
String n = p . getName ( ) ;
String s = e . getMessage ( ) ;
if ( p . hasPermission ( " fc p.ignore.spam" ) )
if ( p . hasPermission ( " s p.ignore.spam" ) )
return ;
if ( adminchat ) {
p . sendMessage ( plugin . servername + " §c服务器已开启管理员聊天! " ) ;
p . sendMessage ( plugin . getfullmsg ( " Spam.AdminChat " ) ) ;
e . setCancelled ( true ) ;
return ;
}
if ( cc . containsKey ( p ) ) {
p . sendMessage ( plugin . servername + " §c您已被禁言, 请联系管理员解禁! " ) ;
p . sendMessage ( plugin . getfullmsg ( " Spam.MuteMsg " ) ) ;
e . setCancelled ( true ) ;
return ;
}
if ( AntiChat ( n , s ) ) {
p . sendMessage ( plugin . servername + " §6[§4刷屏检测§6] §c " + AntiMsg ) ;
p . sendMessage ( plugin . servername + plugin . pluginname + AntiMsg ) ;
e . setCancelled ( true ) ;
put ( p ) ;
}
@@ -159,11 +155,10 @@ public class Spam implements Runnable, Listener, CommandExecutor {
Player p = e . getPlayer ( ) ;
String n = p . getName ( ) ;
String s = e . getMessage ( ) ;
if ( p . hasPermission ( " fc p.ignore.spam" ) )
if ( p . hasPermission ( " s p.ignore.spam" ) )
return ;
if ( CommandWait ( n , s ) ) {
put ( p ) ;
p . sendMessage ( plugin . servername + " §6[§4命令检测§6] §c " + AntiMsg ) ;
p. sendMessage ( plugin . servername + plugin . pluginname + AntiMsg ) ;
e . setCancelled ( true ) ;
}
}
@@ -171,8 +166,8 @@ public class Spam implements Runnable, Listener, CommandExecutor {
public void put ( Player p ) {
if ( tc . containsKey ( p ) ) {
int t = tc . get ( p ) ;
if ( t > plugin . getConfig ( ) . getLong ( " Spam.Kick Check " , 3 ) ) {
p . sendMessage ( plugin . servername + " §c您由于多次刷屏已被禁言, 请联系管理解禁! " ) ;
if ( t > plugin . getConfig ( ) . getLong ( " Spam.Mute Check " , 3 ) ) {
p . sendMessage ( plugin . getfullmsg ( " Spam.MuteMsg " ) ) ;
cc . put ( p , p ) ;
} else {
tc . put ( p , t + 1 ) ;