New setting "logPlayerCommands" (default true) which can be disabled to prevent player commands from being logged.

This commit is contained in:
Brettflan 2012-03-09 19:26:40 -06:00
parent 1ca93948a3
commit a5bb25eb44
4 changed files with 17 additions and 2 deletions

View File

@ -100,6 +100,7 @@ public class Conf
public static boolean logLandClaims = true; public static boolean logLandClaims = true;
public static boolean logLandUnclaims = true; public static boolean logLandUnclaims = true;
public static boolean logMoneyTransactions = true; public static boolean logMoneyTransactions = true;
public static boolean logPlayerCommands = true;
public static boolean homesEnabled = true; public static boolean homesEnabled = true;
public static boolean homesMustBeInClaimedTerritory = true; public static boolean homesMustBeInClaimedTerritory = true;

View File

@ -172,6 +172,12 @@ public class P extends MPlugin
Conf.save(); Conf.save();
} }
@Override
public boolean logPlayerCommands()
{
return Conf.logPlayerCommands;
}
@Override @Override
public boolean handleCommand(CommandSender sender, String commandString, boolean testOnly) public boolean handleCommand(CommandSender sender, String commandString, boolean testOnly)
{ {

View File

@ -167,6 +167,12 @@ public abstract class MPlugin extends JavaPlugin
// COMMAND HANDLING // COMMAND HANDLING
// -------------------------------------------- // // -------------------------------------------- //
// can be overridden by P method, to provide option
public boolean logPlayerCommands()
{
return true;
}
public boolean handleCommand(CommandSender sender, String commandString, boolean testOnly) public boolean handleCommand(CommandSender sender, String commandString, boolean testOnly)
{ {
boolean noSlash = true; boolean noSlash = true;

View File

@ -28,6 +28,7 @@ public class MPluginSecretPlayerListener implements Listener
if (p.handleCommand(event.getPlayer(), event.getMessage())) if (p.handleCommand(event.getPlayer(), event.getMessage()))
{ {
if (p.logPlayerCommands())
Bukkit.getLogger().info("[PLAYER_COMMAND] "+event.getPlayer().getName()+": "+event.getMessage()); Bukkit.getLogger().info("[PLAYER_COMMAND] "+event.getPlayer().getName()+": "+event.getMessage());
event.setCancelled(true); event.setCancelled(true);
} }
@ -40,6 +41,7 @@ public class MPluginSecretPlayerListener implements Listener
if (p.handleCommand(event.getPlayer(), event.getMessage())) if (p.handleCommand(event.getPlayer(), event.getMessage()))
{ {
if (p.logPlayerCommands())
Bukkit.getLogger().info("[PLAYER_COMMAND] "+event.getPlayer().getName()+": "+event.getMessage()); Bukkit.getLogger().info("[PLAYER_COMMAND] "+event.getPlayer().getName()+": "+event.getMessage());
event.setCancelled(true); event.setCancelled(true);
} }