diff options
-rw-r--r-- | Essentials/src/com/earth2me/essentials/FakeWorld.java | 36 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/OfflinePlayer.java | 32 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/PlayerWrapper.java | 30 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandtime.java | 39 | ||||
-rw-r--r-- | Essentials/test/com/earth2me/essentials/FakeServer.java | 21 | ||||
-rw-r--r-- | EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java | 5 | ||||
-rw-r--r-- | lib/bukkit-0.0.1-SNAPSHOT.jar | bin | 2655977 -> 2680630 bytes | |||
-rw-r--r-- | lib/craftbukkit-0.0.1-SNAPSHOT.jar | bin | 7624904 -> 7671809 bytes |
8 files changed, 155 insertions, 8 deletions
diff --git a/Essentials/src/com/earth2me/essentials/FakeWorld.java b/Essentials/src/com/earth2me/essentials/FakeWorld.java index befe9db8b..30ef75639 100644 --- a/Essentials/src/com/earth2me/essentials/FakeWorld.java +++ b/Essentials/src/com/earth2me/essentials/FakeWorld.java @@ -3,6 +3,7 @@ package com.earth2me.essentials; import java.util.List; import org.bukkit.BlockChangeDelegate; import org.bukkit.Chunk; +import org.bukkit.ChunkSnapshot; import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.TreeType; @@ -355,5 +356,40 @@ public class FakeWorld implements World { throw new UnsupportedOperationException("Not supported yet."); } + + public boolean createExplosion(double d, double d1, double d2, float f, boolean bln) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public boolean createExplosion(Location lctn, float f, boolean bln) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public <T extends Entity> T spawn(Location lctn, Class<T> type) throws IllegalArgumentException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public ChunkSnapshot getEmptyChunkSnapshot(int i, int i1, boolean bln, boolean bln1) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void setSpawnFlags(boolean bln, boolean bln1) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public boolean getAllowAnimals() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public boolean getAllowMonsters() + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java index bd80b057e..8427e2996 100644 --- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java +++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java @@ -6,8 +6,10 @@ import java.util.List; import java.util.UUID; import org.bukkit.Achievement; import org.bukkit.Effect; +import org.bukkit.Instrument; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.Note; import org.bukkit.Server; import org.bukkit.Statistic; import org.bukkit.World; @@ -479,4 +481,34 @@ public class OfflinePlayer implements Player { return uniqueId; } + + public void playNote(Location lctn, Instrument i, Note note) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void setPlayerTime(long l, boolean bln) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public long getPlayerTime() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public long getPlayerTimeOffset() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public boolean isPlayerTimeRelative() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void resetPlayerTime() + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/Essentials/src/com/earth2me/essentials/PlayerWrapper.java b/Essentials/src/com/earth2me/essentials/PlayerWrapper.java index a9666f64b..99ade90ce 100644 --- a/Essentials/src/com/earth2me/essentials/PlayerWrapper.java +++ b/Essentials/src/com/earth2me/essentials/PlayerWrapper.java @@ -530,4 +530,34 @@ public class PlayerWrapper implements Player { return base.getUniqueId(); } + + public void playNote(Location lctn, Instrument i, Note note) + { + base.playNote(lctn, i, note); + } + + public void setPlayerTime(long l, boolean bln) + { + base.setPlayerTime(l, bln); + } + + public long getPlayerTime() + { + return base.getPlayerTime(); + } + + public long getPlayerTimeOffset() + { + return base.getPlayerTimeOffset(); + } + + public boolean isPlayerTimeRelative() + { + return base.isPlayerTimeRelative(); + } + + public void resetPlayerTime() + { + base.resetPlayerTime(); + } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtime.java b/Essentials/src/com/earth2me/essentials/commands/Commandtime.java index 9c4aa8c74..71bfb5965 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtime.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtime.java @@ -15,20 +15,45 @@ public class Commandtime extends EssentialsCommand } @Override - public void run(Server server, User user, String commandLabel, String[] args) throws Exception + public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (args.length < 1) { throw new NotEnoughArgumentsException(); } - World world = user.getWorld(); + if (user.isAuthorized("essentials.time.world")) + { + final World world = user.getWorld(); + + charge(user); + setWorldTime(world, args[0]); + } + else + { + if (user.isAuthorized("essentials.time.player")) + { - charge(user); - setWorldTime(world, args[0]); + long time = user.getPlayerTime(); + time -= time % 24000; + if ("day".equalsIgnoreCase(args[0])) + { + final World world = user.getWorld(); + user.setPlayerTime(time + 24000 - world.getTime(), true); + return; + } + if ("night".equalsIgnoreCase(args[0])) + { + final World world = user.getWorld(); + user.setPlayerTime(time + 37700 - world.getTime(), true); + return; + } + throw new Exception(Util.i18n("onlyDayNight")); + } + } } @Override - public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception + public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception { if (args.length < 1) { @@ -42,10 +67,10 @@ public class Commandtime extends EssentialsCommand sender.sendMessage(Util.i18n("timeSet")); } - private void setWorldTime(World world, String timeString) throws Exception + private void setWorldTime(final World world, final String timeString) throws Exception { long time = world.getTime(); - time = time - time % 24000; + time -= time % 24000; if ("day".equalsIgnoreCase(timeString)) { world.setTime(time + 24000); diff --git a/Essentials/test/com/earth2me/essentials/FakeServer.java b/Essentials/test/com/earth2me/essentials/FakeServer.java index 07483fed7..4cabbb9f8 100644 --- a/Essentials/test/com/earth2me/essentials/FakeServer.java +++ b/Essentials/test/com/earth2me/essentials/FakeServer.java @@ -3,6 +3,7 @@ package com.earth2me.essentials; import com.avaje.ebean.config.ServerConfig; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.logging.Logger; import org.bukkit.Location; import org.bukkit.Server; @@ -218,4 +219,24 @@ public class FakeServer implements Server { throw new UnsupportedOperationException("Not supported yet."); } + + public Map<String, String[]> getCommandAliases() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public int getSpawnRadius() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void setSpawnRadius(int i) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public boolean getOnlineMode() + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java index cd3977b71..42a55c874 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java @@ -290,7 +290,10 @@ public class EssentialsProtectEntityListener extends EntityListener final User user = ess.getUser(event.getTarget());
if ((event.getReason() == TargetReason.CLOSEST_PLAYER
|| event.getReason() == TargetReason.TARGET_ATTACKED_ENTITY
- || event.getReason() == TargetReason.PIG_ZOMBIE_TARGET)
+ || event.getReason() == TargetReason.PIG_ZOMBIE_TARGET
+ || event.getReason() == TargetReason.RANDOM_TARGET
+ || event.getReason() == TargetReason.TARGET_ATTACKED_OWNER
+ || event.getReason() == TargetReason.OWNER_ATTACKED_TARGET)
&& prot.getSettingBool(ProtectConfig.prevent_entitytarget)
&& !user.isAuthorized("essentials.protect.entitytarget.bypass"))
{
diff --git a/lib/bukkit-0.0.1-SNAPSHOT.jar b/lib/bukkit-0.0.1-SNAPSHOT.jar Binary files differindex 27ea01ac7..48dda3405 100644 --- a/lib/bukkit-0.0.1-SNAPSHOT.jar +++ b/lib/bukkit-0.0.1-SNAPSHOT.jar diff --git a/lib/craftbukkit-0.0.1-SNAPSHOT.jar b/lib/craftbukkit-0.0.1-SNAPSHOT.jar Binary files differindex b0a398b75..ab91cd910 100644 --- a/lib/craftbukkit-0.0.1-SNAPSHOT.jar +++ b/lib/craftbukkit-0.0.1-SNAPSHOT.jar |