added command logging

This commit is contained in:
Boos 2012-03-21 00:30:28 +01:00
parent 6a02ee55ec
commit 74d65f309a
4 changed files with 27 additions and 9 deletions

View File

@ -43,6 +43,7 @@ public class boosConfigManager {
conf.addDefault("options.options.cancel_warmup_on_sprint",
false);
conf.addDefault("options.options.clear_on_restart", false);
conf.addDefault("options.options.command_logging", false);
conf.addDefault("options.units.seconds", "seconds");
conf.addDefault("options.units.minutes", "minutes");
conf.addDefault("options.units.hours", "hours");
@ -332,6 +333,11 @@ public class boosConfigManager {
return conf.getBoolean(
"options.options.cancel_warmup_on_sneak", false);
}
public static boolean getCommandLogging() {
return conf.getBoolean(
"options.options.command_logging", false);
}
public static boolean getBlocked2(Player player, String pre) {
boolean blocked = false;

View File

@ -106,6 +106,11 @@ public class boosCoolDown extends JavaPlugin {
return usingPermissions;
}
public static void commandLogger(String player, String command) {
log.info("[" + "boosLogger" + "] " + player + " used command "
+ command);
}
private boolean setupEconomy() {
if (usingVault) {
RegisteredServiceProvider<Economy> economyProvider = getServer()

View File

@ -34,7 +34,6 @@ public class boosCoolDownListener implements Listener {
String message = event.getMessage();
Player player = event.getPlayer();
boolean on = true;
on = isPluginOnForPlayer(player);
if (on) {
@ -52,7 +51,7 @@ public class boosCoolDownListener implements Listener {
if (!used && messageCommand.length() > 1) {
int j = messageCommand.indexOf(' ', 1);
if (j < 0) {
j = messageCommand.length();
j = messageCommand.length();
}
String preSub = messageCommand.substring(1, j);
@ -60,10 +59,12 @@ public class boosCoolDownListener implements Listener {
messageCommand.length());
preSub = preCommand + ' ' + preSub;
preSubCheck = preSubCheck(player, preSub);
if (preCDCheck(player, preSub) > 0){
preSubCheck = 0;}
if (prePriceCheck(player, preSub) > 0){
preSubCheck = 0;}
if (preCDCheck(player, preSub) > 0) {
preSubCheck = 0;
}
if (prePriceCheck(player, preSub) > 0) {
preSubCheck = 0;
}
if (preSubCheck >= 0) {
blocked = blocked(player, preSub);
this.checkCooldown(event, player, preSub, messageSub);
@ -106,7 +107,7 @@ public class boosCoolDownListener implements Listener {
}
return preSubCheck;
}
private int preCDCheck(Player player, String preSub) {
int preCDCheck;
if (boosCoolDown.isUsingPermissions()) {
@ -130,7 +131,7 @@ public class boosCoolDownListener implements Listener {
}
return preCDCheck;
}
private int prePriceCheck(Player player, String preSub) {
int prePriceCheck;
if (boosCoolDown.isUsingPermissions()) {
@ -283,6 +284,9 @@ public class boosCoolDownListener implements Listener {
.getPrice(player, pre)) {
boosPriceManager
.payForCommand(player, pre, message);
if (boosConfigManager.getCommandLogging()) {
boosCoolDown.commandLogger(player.getName(), message);
}
} else {
boosPriceManager
.payForCommand(player, pre, message);
@ -300,6 +304,9 @@ public class boosCoolDownListener implements Listener {
boosChat.sendMessageToPlayer(player, msg);
return false;
}
if(!event.isCancelled()){
boosCoolDown.commandLogger(player.getName(), pre);
}
return false;
}

View File

@ -1,6 +1,6 @@
name: boosCooldown
main: cz.boosik.boosCooldown.boosCoolDown
version: 2.2.4 beta
version: 2.3.0 beta
author: boosik
softdepend: [Vault,PermissionsEX]
description: >