summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands/Commandpowertooltoggle.java
diff options
context:
space:
mode:
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands/Commandpowertooltoggle.java')
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandpowertooltoggle.java16
1 files changed, 6 insertions, 10 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandpowertooltoggle.java b/Essentials/src/com/earth2me/essentials/commands/Commandpowertooltoggle.java
index c8b737dfa..24481bcec 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandpowertooltoggle.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandpowertooltoggle.java
@@ -1,26 +1,22 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
-import com.earth2me.essentials.User;
-import org.bukkit.Server;
+import com.earth2me.essentials.api.IUser;
public class Commandpowertooltoggle extends EssentialsCommand
{
- public Commandpowertooltoggle()
- {
- super("powertooltoggle");
- }
-
@Override
- protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
+ protected void run(final IUser user, final String commandLabel, final String[] args) throws Exception
{
- if (!user.hasPowerTools())
+ if (!user.getData().hasPowerTools())
{
user.sendMessage(_("noPowerTools"));
return;
}
- user.sendMessage(user.togglePowerToolsEnabled()
+ user.acquireWriteLock();
+ user.getData().setPowerToolsEnabled(!user.getData().isPowerToolsEnabled());
+ user.sendMessage(user.getData().isPowerToolsEnabled()
? _("powerToolsEnabled")
: _("powerToolsDisabled"));
}