summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2012-10-15 22:42:48 +0200
committersnowleo <schneeleo@gmail.com>2012-10-15 22:42:48 +0200
commit10f47ed7a55e2c385bfff4de99c0e3c17ab02091 (patch)
treeb2ba0e7d15ecb25c8bb8a25083420ac0431bc17b
parent7c8f7ba3ed428ea3779e3edfaeeb131e47d3e27d (diff)
downloadEssentials-10f47ed7a55e2c385bfff4de99c0e3c17ab02091.tar
Essentials-10f47ed7a55e2c385bfff4de99c0e3c17ab02091.tar.gz
Essentials-10f47ed7a55e2c385bfff4de99c0e3c17ab02091.tar.lz
Essentials-10f47ed7a55e2c385bfff4de99c0e3c17ab02091.tar.xz
Essentials-10f47ed7a55e2c385bfff4de99c0e3c17ab02091.zip
World permissions for /time command
-rw-r--r--Essentials/src/net/ess3/commands/Commandtime.java12
-rw-r--r--Essentials/src/net/ess3/permissions/Permissions.java1
2 files changed, 12 insertions, 1 deletions
diff --git a/Essentials/src/net/ess3/commands/Commandtime.java b/Essentials/src/net/ess3/commands/Commandtime.java
index 0b64be99b..c76d8850a 100644
--- a/Essentials/src/net/ess3/commands/Commandtime.java
+++ b/Essentials/src/net/ess3/commands/Commandtime.java
@@ -88,8 +88,15 @@ public class Commandtime extends EssentialsCommand
private void setWorldsTime(final CommandSender sender, final Collection<World> worlds, final long ticks, final boolean add)
{
// Update the time
- for (World world : worlds)
+ Iterator<World> iterator = worlds.iterator();
+ while (iterator.hasNext())
{
+ World world = iterator.next();
+ if (!Permissions.TIME_WORLDS.isAuthorized(sender, world.getName())) {
+ iterator.remove();
+ sender.sendMessage("You are not allowed to set the time in world "+world.getName()); //TODO:I18n
+ continue;
+ }
long time = world.getTime();
if (!add)
{
@@ -98,6 +105,9 @@ public class Commandtime extends EssentialsCommand
world.setTime(time + (add ? 0 : 24000) + ticks);
}
+ if (worlds.isEmpty()) {
+ return;
+ }
final StringBuilder output = new StringBuilder();
for (World world : worlds)
{
diff --git a/Essentials/src/net/ess3/permissions/Permissions.java b/Essentials/src/net/ess3/permissions/Permissions.java
index 59bd21e9e..3baa39678 100644
--- a/Essentials/src/net/ess3/permissions/Permissions.java
+++ b/Essentials/src/net/ess3/permissions/Permissions.java
@@ -157,4 +157,5 @@ public enum Permissions implements IPermission
public static DotStarPermission NICK = new DotStarPermission("essentials.nick");
public static DotStarPermission SIGNS = new DotStarPermission("essentials.signs");
public static DotStarPermission CHAT = new DotStarPermission("essentials.chat");
+ public static DotStarPermission TIME_WORLDS = new DotStarPermission("essentials.time.worlds", PermissionDefault.TRUE);
}