diff options
author | ementalo <ementalodev@gmx.co.uk> | 2012-05-28 00:37:28 +0100 |
---|---|---|
committer | ementalo <ementalodev@gmx.co.uk> | 2012-05-28 00:37:28 +0100 |
commit | 373a48da5412c6005f7ad2fe4bec41c68d4eb2a2 (patch) | |
tree | 3ebc11bffcb1dde3f3bd338fca97656d03511e70 /Essentials/src/com/earth2me/essentials/commands/Commandtime.java | |
parent | 45c1e347b0698318ebd3772c540a9a52b6509daf (diff) | |
parent | b69a16bcf0abac1ebd2ca3d35520cfcb5b433e88 (diff) | |
download | Essentials-373a48da5412c6005f7ad2fe4bec41c68d4eb2a2.tar Essentials-373a48da5412c6005f7ad2fe4bec41c68d4eb2a2.tar.gz Essentials-373a48da5412c6005f7ad2fe4bec41c68d4eb2a2.tar.lz Essentials-373a48da5412c6005f7ad2fe4bec41c68d4eb2a2.tar.xz Essentials-373a48da5412c6005f7ad2fe4bec41c68d4eb2a2.zip |
Master -> 3.0
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands/Commandtime.java')
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandtime.java | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtime.java b/Essentials/src/com/earth2me/essentials/commands/Commandtime.java index 8e5b7c017..9b28f5d6c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtime.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtime.java @@ -1,24 +1,20 @@ package com.earth2me.essentials.commands; -import com.earth2me.essentials.DescParseTickFormat; +import com.earth2me.essentials.utils.DescParseTickFormat; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.User; +import com.earth2me.essentials.api.IUser; +import com.earth2me.essentials.permissions.Permissions; import com.earth2me.essentials.Util; import java.util.*; -import org.bukkit.Server; import org.bukkit.World; import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; public class Commandtime extends EssentialsCommand { - public Commandtime() - { - super("time"); - } - @Override - public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception + public void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception { final List<String> argList = new ArrayList<String>(Arrays.asList(args)); if ((argList.remove("set") || argList.remove("add")) && Util.isInt(argList.get(0))) @@ -33,7 +29,7 @@ public class Commandtime extends EssentialsCommand { worldSelector = validArgs[1]; } - final Set<World> worlds = getWorlds(server, sender, worldSelector); + final Set<World> worlds = getWorlds(sender, worldSelector); // If no arguments we are reading the time if (validArgs.length == 0) @@ -42,10 +38,9 @@ public class Commandtime extends EssentialsCommand return; } - final User user = ess.getUser(sender); - if (user != null && !user.isAuthorized("essentials.time.set")) + if (Permissions.TIME_SET.isAuthorized(sender)) { - user.sendMessage(_("timeSetPermission")); + sender.sendMessage(_("timeSetPermission")); return; } @@ -111,14 +106,14 @@ public class Commandtime extends EssentialsCommand /** * Used to parse an argument of the type "world(s) selector" */ - private Set<World> getWorlds(final Server server, final CommandSender sender, final String selector) throws Exception + private Set<World> getWorlds(final CommandSender sender, final String selector) throws Exception { final Set<World> worlds = new TreeSet<World>(new WorldNameComparator()); // If there is no selector we want the world the user is currently in. Or all worlds if it isn't a user. if (selector == null) { - final User user = ess.getUser(sender); + final IUser user = sender instanceof Player ? ess.getUser((Player)sender) : null; if (user == null) { worlds.addAll(server.getWorlds()); |