summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-11-25 05:49:57 +0100
committersnowleo <schneeleo@gmail.com>2011-11-25 05:49:57 +0100
commit613cb57fdb6701c61878796c17f2fe06f38241f4 (patch)
tree5420eeeb10034316e2be38e9dd6839ee89ee008f
parent31b9e792bda348b9eb815ef5237b290ba195fb0b (diff)
downloadEssentials-613cb57fdb6701c61878796c17f2fe06f38241f4.tar
Essentials-613cb57fdb6701c61878796c17f2fe06f38241f4.tar.gz
Essentials-613cb57fdb6701c61878796c17f2fe06f38241f4.tar.lz
Essentials-613cb57fdb6701c61878796c17f2fe06f38241f4.tar.xz
Essentials-613cb57fdb6701c61878796c17f2fe06f38241f4.zip
CB#1501 B#1037
New spawnmob options: cow:baby sheep:baby chicken:baby pig:baby
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java13
-rw-r--r--Essentials/src/com/earth2me/essentials/FakeWorld.java9
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java33
-rw-r--r--Essentials/test/com/earth2me/essentials/FakeServer.java6
-rw-r--r--lib/bukkit-1.0.0-R1-SNAPSHOT.jarbin4390943 -> 4391224 bytes
-rw-r--r--lib/craftbukkit-1.0.0-SNAPSHOT.jarbin9770067 -> 9770541 bytes
7 files changed, 49 insertions, 14 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index ebdf84af4..c74ce7312 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -56,7 +56,7 @@ import org.bukkit.scheduler.BukkitScheduler;
public class Essentials extends JavaPlugin implements IEssentials
{
- public static final int BUKKIT_VERSION = 1467;
+ public static final int BUKKIT_VERSION = 1501;
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private transient ISettings settings;
private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this);
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
index 37c66d2ef..322d94d8f 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
@@ -3,6 +3,8 @@ package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import java.util.List;
import java.util.logging.Logger;
+import org.bukkit.Material;
+import org.bukkit.entity.Animals;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
@@ -49,6 +51,17 @@ public class EssentialsEntityListener extends EntityListener
}
}
}
+ if (eDefend instanceof Animals && eAttack instanceof Player)
+ {
+ User player = ess.getUser(eAttack);
+ ItemStack hand = player.getItemInHand();
+ if (hand != null && hand.getType() == Material.MILK_BUCKET) {
+ ((Animals)eDefend).setAge(-24000);
+ player.setItemInHand(new ItemStack(Material.BUCKET, hand.getAmount()));
+ player.updateInventory();
+ event.setCancelled(true);
+ }
+ }
}
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
{
diff --git a/Essentials/src/com/earth2me/essentials/FakeWorld.java b/Essentials/src/com/earth2me/essentials/FakeWorld.java
index c22a04c5a..0032b6845 100644
--- a/Essentials/src/com/earth2me/essentials/FakeWorld.java
+++ b/Essentials/src/com/earth2me/essentials/FakeWorld.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials;
+import java.io.File;
import java.util.List;
import java.util.UUID;
import org.bukkit.*;
@@ -514,5 +515,11 @@ public class FakeWorld implements World
public int getSeaLevel()
{
throw new UnsupportedOperationException("Not supported yet.");
- }
+ }
+
+ @Override
+ public File getWorldFolder()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
index f3f5ce2ef..43b0b8ffa 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandspawnmob.java
@@ -20,7 +20,7 @@ public class Commandspawnmob extends EssentialsCommand
{
super("spawnmob");
}
-
+
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
@@ -29,8 +29,8 @@ public class Commandspawnmob extends EssentialsCommand
throw new NotEnoughArgumentsException();
//TODO: user.sendMessage("ยง7Mobs: Zombie PigZombie Skeleton Slime Chicken Pig Monster Spider Creeper Ghast Squid Giant Cow Sheep Wolf");
}
-
-
+
+
String[] mountparts = args[0].split(",");
String[] parts = mountparts[0].split(":");
String mobType = parts[0];
@@ -50,24 +50,24 @@ public class Commandspawnmob extends EssentialsCommand
mountData = parts[1];
}
}
-
-
+
+
Entity spawnedMob = null;
Mob mob = null;
Entity spawnedMount = null;
Mob mobMount = null;
-
+
mob = Mob.fromName(mobType);
if (mob == null)
{
throw new Exception(_("invalidMob"));
}
-
+
if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase(Locale.ENGLISH)))
{
throw new Exception(_("unableToSpawnMob"));
}
-
+
final Block block = Util.getTarget(user).getBlock();
if (block == null)
{
@@ -83,7 +83,7 @@ public class Commandspawnmob extends EssentialsCommand
{
throw new Exception(_("unableToSpawnMob"));
}
-
+
if (mountType != null)
{
mobMount = Mob.fromName(mountType);
@@ -92,7 +92,7 @@ public class Commandspawnmob extends EssentialsCommand
user.sendMessage(_("invalidMob"));
return;
}
-
+
if (ess.getSettings().getProtectPreventSpawn(mobMount.getType().toString().toLowerCase(Locale.ENGLISH)))
{
throw new Exception(_("unableToSpawnMob"));
@@ -124,7 +124,7 @@ public class Commandspawnmob extends EssentialsCommand
mobCount = serverLimit;
user.sendMessage(_("mobSpawnLimit"));
}
-
+
try
{
for (int i = 1; i < mobCount; i++)
@@ -171,7 +171,7 @@ public class Commandspawnmob extends EssentialsCommand
user.sendMessage(mob.name + " " + _("spawned"));
}
}
-
+
private void changeMobData(String type, Entity spawned, String data, User user) throws Exception
{
if ("Slime".equalsIgnoreCase(type))
@@ -185,6 +185,15 @@ public class Commandspawnmob extends EssentialsCommand
throw new Exception(_("slimeMalformedSize"), e);
}
}
+ if (("Sheep".equalsIgnoreCase(type)
+ || "Cow".equalsIgnoreCase(type)
+ || "Chicken".equalsIgnoreCase(type)
+ || "Pig".equalsIgnoreCase(type))
+ && data.equalsIgnoreCase("baby"))
+ {
+ ((Animals)spawned).setAge(-24000);
+ return;
+ }
if ("Sheep".equalsIgnoreCase(type))
{
try
diff --git a/Essentials/test/com/earth2me/essentials/FakeServer.java b/Essentials/test/com/earth2me/essentials/FakeServer.java
index 78b5380a6..22a8f0224 100644
--- a/Essentials/test/com/earth2me/essentials/FakeServer.java
+++ b/Essentials/test/com/earth2me/essentials/FakeServer.java
@@ -586,4 +586,10 @@ public class FakeServer implements Server
{
return "Essentials Fake-Server";
}
+
+ @Override
+ public File getWorldContainer()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
}
diff --git a/lib/bukkit-1.0.0-R1-SNAPSHOT.jar b/lib/bukkit-1.0.0-R1-SNAPSHOT.jar
index 94831e77b..3056d9e59 100644
--- a/lib/bukkit-1.0.0-R1-SNAPSHOT.jar
+++ b/lib/bukkit-1.0.0-R1-SNAPSHOT.jar
Binary files differ
diff --git a/lib/craftbukkit-1.0.0-SNAPSHOT.jar b/lib/craftbukkit-1.0.0-SNAPSHOT.jar
index 208cc9bb3..5e1e9c101 100644
--- a/lib/craftbukkit-1.0.0-SNAPSHOT.jar
+++ b/lib/craftbukkit-1.0.0-SNAPSHOT.jar
Binary files differ