Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.cypherx</groupId>
<artifactId>ConsoleFilter</artifactId>
<version>1.1.0</version>
<version>1.1.1</version>
<name>ConsoleFilter</name>

<properties>
Expand Down
22 changes: 21 additions & 1 deletion src/main/java/com/cypherx/consolefilter/ConsoleFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import java.util.logging.Level;
import java.util.logging.Logger;

import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public class ConsoleFilter extends JavaPlugin {
Expand All @@ -30,7 +33,7 @@ private void loadConfiguration() {

private ArrayList<FilterInfo> loadFilter() {
ArrayList<FilterInfo> filterList = new ArrayList<FilterInfo>();

filterList.clear();
List<?> list = getConfig().getList("filter");
for (int i = 0; i < list.size(); i++) {
Object o = list.get(i);
Expand Down Expand Up @@ -88,4 +91,21 @@ private ArrayList<FilterInfo> loadFilter() {
private void log(Level level, String message) {
log.log(level, "[ConsoleFilter] " + message);
}
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player player = null;
if ((sender instanceof Player)) {
player = (Player)sender;
}
if ((command.getName().equalsIgnoreCase("cfreload")) && (args.length == 0)) {
if (player != null) {
player.sendMessage("[" + getDescription().getName() + "] This command is for console use only.");
} else {
this.reloadConfig();
log.setFilter(new CFFilter(loadFilter()));
log.info("[" + getDescription().getName() + "] Filters reloaded.");
}
return true;
}
return false;
}
}
9 changes: 7 additions & 2 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: ConsoleFilter
main: com.cypherx.consolefilter.ConsoleFilter
version: 1.1.0
version: 1.1.1
description: Filter or modify any console message
author: CypherX
author: CypherX

commands:
cfreload:
description: <command> will try to reload the filterdefinitions
usage: Please use <command> without arguments