Added bypass permission for filter (chat.bypass-filter.<filter-name>)
This commit is contained in:
@@ -3,6 +3,7 @@ package com.alttd.chat.managers;
|
|||||||
import com.alttd.chat.config.RegexConfig;
|
import com.alttd.chat.config.RegexConfig;
|
||||||
import com.alttd.chat.objects.ChatFilter;
|
import com.alttd.chat.objects.ChatFilter;
|
||||||
import com.alttd.chat.util.ALogger;
|
import com.alttd.chat.util.ALogger;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -24,7 +25,7 @@ public class RegexManager {
|
|||||||
chatFilters.add(filter);
|
chatFilters.add(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String replaceText(String text) { // TODO loop all objects in the list and check if they violate based on the MATCHER
|
public static String replaceText(Player player, String text) { // TODO loop all objects in the list and check if they violate based on the MATCHER
|
||||||
for(ChatFilter chatFilter : chatFilters) {
|
for(ChatFilter chatFilter : chatFilters) {
|
||||||
switch (chatFilter.getType()) {
|
switch (chatFilter.getType()) {
|
||||||
case CHAT:
|
case CHAT:
|
||||||
@@ -33,7 +34,7 @@ public class RegexManager {
|
|||||||
text = chatFilter.replaceText(text);
|
text = chatFilter.replaceText(text);
|
||||||
break;
|
break;
|
||||||
case BLOCK:
|
case BLOCK:
|
||||||
if(chatFilter.matches(text)) { // todo find a better way to do this?
|
if(chatFilter.matches(text) && !player.hasPermission("chat.bypass-filter." + chatFilter.getName())) { // todo find a better way to do this?
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user