CB#1501 B#1037

New spawnmob options: cow:baby sheep:baby chicken:baby pig:baby
This commit is contained in:
snowleo 2011-11-25 05:49:57 +01:00
parent 31b9e792bd
commit 613cb57fdb
7 changed files with 49 additions and 14 deletions

View File

@ -56,7 +56,7 @@ import org.bukkit.scheduler.BukkitScheduler;
public class Essentials extends JavaPlugin implements IEssentials 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 static final Logger LOGGER = Logger.getLogger("Minecraft");
private transient ISettings settings; private transient ISettings settings;
private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this); private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this);

View File

@ -3,6 +3,8 @@ package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import java.util.List; import java.util.List;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.bukkit.Material;
import org.bukkit.entity.Animals;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; 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()) if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
{ {

View File

@ -1,5 +1,6 @@
package com.earth2me.essentials; package com.earth2me.essentials;
import java.io.File;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.bukkit.*; import org.bukkit.*;
@ -515,4 +516,10 @@ public class FakeWorld implements World
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException("Not supported yet.");
} }
@Override
public File getWorldFolder()
{
throw new UnsupportedOperationException("Not supported yet.");
}
} }

View File

@ -185,6 +185,15 @@ public class Commandspawnmob extends EssentialsCommand
throw new Exception(_("slimeMalformedSize"), e); 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)) if ("Sheep".equalsIgnoreCase(type))
{ {
try try

View File

@ -586,4 +586,10 @@ public class FakeServer implements Server
{ {
return "Essentials Fake-Server"; return "Essentials Fake-Server";
} }
@Override
public File getWorldContainer()
{
throw new UnsupportedOperationException("Not supported yet.");
}
} }

Binary file not shown.

Binary file not shown.