summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java
diff options
context:
space:
mode:
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java')
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java23
1 files changed, 9 insertions, 14 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java
index 5fdc69d68..83a2577d6 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandgamemode.java
@@ -1,38 +1,33 @@
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
-import com.earth2me.essentials.User;
+import com.earth2me.essentials.api.IUser;
+import com.earth2me.essentials.permissions.Permissions;
import java.util.Locale;
import org.bukkit.GameMode;
-import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandgamemode extends EssentialsCommand
{
- public Commandgamemode()
- {
- super("gamemode");
- }
-
@Override
- protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
+ protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
- gamemodeOtherPlayers(server, sender, args);
+ gamemodeOtherPlayers(sender, args);
}
@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 (args.length > 0 && args[0].trim().length() > 2 && user.isAuthorized("essentials.gamemode.others"))
+ if (args.length > 0 && !args[0].trim().isEmpty() && Permissions.GAMEMODE_OTHERS.isAuthorized(user))
{
- gamemodeOtherPlayers(server, user, args);
+ gamemodeOtherPlayers(user, args);
return;
}
@@ -40,11 +35,11 @@ public class Commandgamemode extends EssentialsCommand
user.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName()));
}
- private void gamemodeOtherPlayers(final Server server, final CommandSender sender, final String[] args)
+ private void gamemodeOtherPlayers(final CommandSender sender, final String args[])
{
for (Player matchPlayer : server.matchPlayer(args[0]))
{
- final User player = ess.getUser(matchPlayer);
+ final IUser player = ess.getUser(matchPlayer);
if (player.isHidden())
{
continue;