mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-21 05:50:18 +08:00
Adds the setting to not log commands that are unknown
This commit is contained in:
parent
bf47ca79a7
commit
0e8b1b2f1c
@ -23,6 +23,7 @@ public enum Settings {
|
||||
GATHERKILLS("Settings.Data.GatherKillData"),
|
||||
GATHERGMTIMES("Settings.Data.GamemodeChangeListener"),
|
||||
GATHERCOMMANDS("Settings.Data.GatherCommandUsage"),
|
||||
DO_NOT_LOG_UNKNOWN_COMMANDS("Customization.Data.DoNotLogUnknownCommands"),
|
||||
SECURITY_IP_UUID("Settings.WebServer.Security.DisplayIPsAndUUIDs"),
|
||||
GRAPH_PLAYERS_USEMAXPLAYERS_SCALE("Customization.Graphs.PlayersOnlineGraph.UseMaxPlayersAsScale"),
|
||||
PLAYERLIST_SHOW_IMAGES("Customization.SmallHeadImagesOnAnalysisPlayerlist"),
|
||||
|
@ -78,7 +78,9 @@ public class TPS {
|
||||
return false;
|
||||
}
|
||||
final TPS other = (TPS) obj;
|
||||
return this.date == other.date && Double.doubleToLongBits(this.tps) == Double.doubleToLongBits(other.tps) && this.players == other.players;
|
||||
return this.date == other.date
|
||||
&& Double.doubleToLongBits(this.tps) == Double.doubleToLongBits(other.tps)
|
||||
&& this.players == other.players;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,12 +3,14 @@ package main.java.com.djrapitops.plan.data.listeners;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.Permissions;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.Settings;
|
||||
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.help.HelpMap;
|
||||
|
||||
/**
|
||||
* Event Listener for PlayerCommandPreprocessEvents.
|
||||
@ -40,12 +42,23 @@ public class PlanCommandPreprocessListener implements Listener {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String cmd = event.getMessage().split(" ")[0].toLowerCase();
|
||||
|
||||
if (Settings.DO_NOT_LOG_UNKNOWN_COMMANDS.isTrue()) {
|
||||
HelpMap helpMap = plugin.getServer().getHelpMap();
|
||||
if (helpMap.getHelpTopic(cmd) == null) {
|
||||
Log.debug("Ignored command, command is unknown");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (player.hasPermission(Permissions.IGNORE_COMMANDUSE.getPermission())) {
|
||||
Log.debug("Ignored command, player had ignore permission.");
|
||||
return;
|
||||
}
|
||||
handler.handleCommand(event.getMessage().split(" ")[0].toLowerCase());
|
||||
handler.handleCommand(cmd);
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,8 @@ Settings:
|
||||
Customization:
|
||||
ServerName: 'Plan'
|
||||
SmallHeadImagesOnAnalysisPlayerlist: true
|
||||
Data:
|
||||
DoNotLogUnknownCommands: false
|
||||
Graphs:
|
||||
PlayersOnlineGraph:
|
||||
UseMaxPlayersAsScale: true
|
||||
|
Loading…
Reference in New Issue
Block a user