From 2e1d7da50fac51cde0960b2e0ae83cd925c11d0e Mon Sep 17 00:00:00 2001 From: Brettflan Date: Fri, 10 Jun 2011 14:22:29 -0500 Subject: [PATCH] /f lock command can now be used through console; fix for /f reload command causing NPE if run from console --- src/org/mcteam/factions/commands/FBaseCommand.java | 4 ++-- src/org/mcteam/factions/commands/FCommandLock.java | 6 ++++-- src/org/mcteam/factions/commands/FCommandReload.java | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/org/mcteam/factions/commands/FBaseCommand.java b/src/org/mcteam/factions/commands/FBaseCommand.java index 3b42d89c..860c5fa8 100644 --- a/src/org/mcteam/factions/commands/FBaseCommand.java +++ b/src/org/mcteam/factions/commands/FBaseCommand.java @@ -236,9 +236,9 @@ public class FBaseCommand { public void setLock(boolean newLock) { if( newLock ) { - me.sendMessage("Factions is now locked"); + sendMessage("Factions is now locked"); } else { - me.sendMessage("Factions in now unlocked"); + sendMessage("Factions in now unlocked"); } lock = newLock; diff --git a/src/org/mcteam/factions/commands/FCommandLock.java b/src/org/mcteam/factions/commands/FCommandLock.java index 9e50aada..5274acae 100644 --- a/src/org/mcteam/factions/commands/FCommandLock.java +++ b/src/org/mcteam/factions/commands/FCommandLock.java @@ -8,6 +8,8 @@ public class FCommandLock extends FBaseCommand { public FCommandLock() { aliases.add("lock"); + senderMustBePlayer = false; + optionalParameters.add("on|off"); helpDescription = "lock all write stuff"; @@ -23,9 +25,9 @@ public class FCommandLock extends FBaseCommand { setLock( parseBool( parameters.get(0) )); } else { if( isLocked() ) { - me.sendMessage("Factions is locked"); + sendMessage("Factions is locked"); } else { - me.sendMessage("Factions is not locked"); + sendMessage("Factions is not locked"); } } } diff --git a/src/org/mcteam/factions/commands/FCommandReload.java b/src/org/mcteam/factions/commands/FCommandReload.java index 23c9615b..2999458f 100644 --- a/src/org/mcteam/factions/commands/FCommandReload.java +++ b/src/org/mcteam/factions/commands/FCommandReload.java @@ -54,7 +54,7 @@ public class FCommandReload extends FBaseCommand { } else { Factions.log("RELOAD CANCELLED - SPECIFIED FILE INVALID"); - me.sendMessage("Invalid file specified. Valid files: conf, board, factions, players."); + sendMessage("Invalid file specified. Valid files: conf, board, factions, players."); return; } } @@ -69,7 +69,7 @@ public class FCommandReload extends FBaseCommand { long timeReload = (System.currentTimeMillis()-timeInitStart); Factions.log("=== RELOAD DONE (Took "+timeReload+"ms) ==="); - me.sendMessage("Factions file" + fileName + " reloaded from disk, took " + timeReload + "ms"); + sendMessage("Factions file" + fileName + " reloaded from disk, took " + timeReload + "ms"); } }