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:42 -06:00
parent a999f50966
commit d7f5ee581e
4 changed files with 17 additions and 2 deletions

View File

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

View File

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

View File

@ -170,6 +170,12 @@ public abstract class MPlugin extends JavaPlugin
// 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)
{
boolean noSlash = true;

View File

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