forked from LogBlock/LogBlock
Add the ability to ignore some chat things, namely /register and /login by default
This commit is contained in:
@@ -36,6 +36,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import de.diddiz.LogBlock.config.Config;
|
||||
|
||||
public class Consumer extends TimerTask
|
||||
{
|
||||
@@ -249,6 +250,11 @@ public class Consumer extends TimerTask
|
||||
}
|
||||
|
||||
public void queueChat(String player, String message) {
|
||||
for (String ignored : Config.ignoredChat) {
|
||||
if (message.startsWith(ignored)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
queue.add(new ChatRow(player, message.replace("\\", "\\\\").replace("'", "\\'")));
|
||||
}
|
||||
|
||||
|
@@ -52,6 +52,7 @@ public class Config
|
||||
public static String banPermission;
|
||||
public static Set<Integer> hiddenBlocks;
|
||||
public static Set<String> hiddenPlayers;
|
||||
public static Set<String> ignoredChat;
|
||||
|
||||
public static enum LogKillsLevel
|
||||
{
|
||||
@@ -89,6 +90,7 @@ public class Config
|
||||
def.put("logging.logPlayerInfo", false);
|
||||
def.put("logging.hiddenPlayers", new ArrayList<String>());
|
||||
def.put("logging.hiddenBlocks", Arrays.asList(0));
|
||||
def.put("logging.ignoredChat", Arrays.asList("/register", "/login"));
|
||||
def.put("rollback.dontRollback", Arrays.asList(10, 11, 46, 51));
|
||||
def.put("rollback.replaceAnyway", Arrays.asList(8, 9, 10, 11, 51));
|
||||
def.put("rollback.maxTime", "2 days");
|
||||
@@ -154,6 +156,10 @@ public class Config
|
||||
else
|
||||
throw new DataFormatException("Not a valid material: '" + blocktype + "'");
|
||||
}
|
||||
ignoredChat = new HashSet<String>();
|
||||
for (String chatCommand : config.getStringList("logging.ignoredChat")) {
|
||||
ignoredChat.add(chatCommand);
|
||||
}
|
||||
dontRollback = new HashSet<Integer>(config.getIntegerList("rollback.dontRollback"));
|
||||
replaceAnyway = new HashSet<Integer>(config.getIntegerList("rollback.replaceAnyway"));
|
||||
rollbackMaxTime = parseTimeSpec(config.getString("rollback.maxTime").split(" "));
|
||||
|
@@ -4,7 +4,6 @@ import static de.diddiz.LogBlock.config.Config.isLogging;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.server.ServerCommandEvent;
|
||||
import de.diddiz.LogBlock.LogBlock;
|
||||
|
Reference in New Issue
Block a user