From a709e9c7b3b9285754b84cdc4bfea2183338ca72 Mon Sep 17 00:00:00 2001 From: Andy Buchholz Date: Tue, 10 May 2011 19:18:35 +0200 Subject: [PATCH] * commit forgotten files --- .../factions/commands/FCommandLock.java | 33 ++++++++++++++++ .../factions/commands/FCommandReload.java | 38 +++++++++++++++++++ .../factions/commands/FCommandSaveAll.java | 26 +++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 src/org/mcteam/factions/commands/FCommandLock.java create mode 100644 src/org/mcteam/factions/commands/FCommandReload.java create mode 100644 src/org/mcteam/factions/commands/FCommandSaveAll.java diff --git a/src/org/mcteam/factions/commands/FCommandLock.java b/src/org/mcteam/factions/commands/FCommandLock.java new file mode 100644 index 00000000..9e50aada --- /dev/null +++ b/src/org/mcteam/factions/commands/FCommandLock.java @@ -0,0 +1,33 @@ +package org.mcteam.factions.commands; + +import org.bukkit.command.CommandSender; +import org.mcteam.factions.Factions; + +public class FCommandLock extends FBaseCommand { + + public FCommandLock() { + aliases.add("lock"); + + optionalParameters.add("on|off"); + + helpDescription = "lock all write stuff"; + } + + @Override + public boolean hasPermission(CommandSender sender) { + return Factions.hasPermLock(sender); + } + + public void perform() { + if( parameters.size() > 0 ) { + setLock( parseBool( parameters.get(0) )); + } else { + if( isLocked() ) { + me.sendMessage("Factions is locked"); + } else { + me.sendMessage("Factions is not locked"); + } + } + } + +} diff --git a/src/org/mcteam/factions/commands/FCommandReload.java b/src/org/mcteam/factions/commands/FCommandReload.java new file mode 100644 index 00000000..05e84ca0 --- /dev/null +++ b/src/org/mcteam/factions/commands/FCommandReload.java @@ -0,0 +1,38 @@ +package org.mcteam.factions.commands; + +import org.bukkit.command.CommandSender; +import org.mcteam.factions.Board; +import org.mcteam.factions.Conf; +import org.mcteam.factions.FPlayer; +import org.mcteam.factions.Faction; +import org.mcteam.factions.Factions; + +public class FCommandReload extends FBaseCommand { + + public FCommandReload() { + aliases.add("reload"); + + helpDescription = "reloads the config"; + } + + @Override + public boolean hasPermission(CommandSender sender) { + return Factions.hasPermReload(sender); + } + + public void perform() { + Factions.log("=== RELOAD START ==="); + long timeInitStart = System.currentTimeMillis(); + + Conf.load(); + FPlayer.load(); + Faction.load(); + Board.load(); + + long timeReload = (System.currentTimeMillis()-timeInitStart); + Factions.log("=== RELOAD DONE (Took "+timeReload+"ms) ==="); + + me.sendMessage("FACTIONS RELOAD DONE IN " + timeReload + "ms"); + } + +} diff --git a/src/org/mcteam/factions/commands/FCommandSaveAll.java b/src/org/mcteam/factions/commands/FCommandSaveAll.java new file mode 100644 index 00000000..6aefce31 --- /dev/null +++ b/src/org/mcteam/factions/commands/FCommandSaveAll.java @@ -0,0 +1,26 @@ +package org.mcteam.factions.commands; + +import org.bukkit.command.CommandSender; +import org.mcteam.factions.Factions; + +public class FCommandSaveAll extends FBaseCommand { + + public FCommandSaveAll() { + aliases.add("saveall"); + aliases.add("save"); + + helpDescription = "save factions to disk"; + } + + @Override + public boolean hasPermission(CommandSender sender) { + return Factions.hasPermSaveAll(sender); + } + + public void perform() { + Factions.saveAll(); + + me.sendMessage("Factions saved to disk!"); + } + +}