Added horse armor /spawnmob horse:armor<iron|gold|diamond>

This commit is contained in:
okamosy 2013-07-17 18:29:46 +01:00 committed by KHobbits
parent 3aca9f793b
commit 8aac502ab6
3 changed files with 20 additions and 2 deletions

View file

@ -400,7 +400,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials
}
}
//Print version even if admin command is not available
//Print version even if admin command is not available #easteregg
if (commandLabel.equalsIgnoreCase("essversion"))
{
sender.sendMessage("This server is running Essentials " + getDescription().getVersion());

View file

@ -1106,7 +1106,7 @@ public class Settings implements net.ess3.api.ISettings
return config.getInt("max-nick-length", 30);
}
// #easteregg
public int getMaxUserCacheCount()
{
long count = Runtime.getRuntime().maxMemory() / 1024 / 96;

View file

@ -21,6 +21,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.*;
import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.inventory.EntityEquipment;
import org.bukkit.inventory.HorseInventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.Colorable;
@ -477,6 +478,23 @@ public class SpawnMob
((Horse)spawned).setTamed(true);
((Horse)spawned).getInventory().setSaddle(new ItemStack(Material.SADDLE, 1));
}
if (data.contains("armor"))
{
((Horse)spawned).setTamed(true);
HorseInventory invent = ((Horse)spawned).getInventory();
if (data.contains("gold")) {
invent.setArmor(new ItemStack(Material.GOLD_BARDING, 1));
}
else if (data.contains("diamond"))
{
invent.setArmor(new ItemStack(Material.DIAMOND_BARDING, 1));
}
else
{
invent.setArmor(new ItemStack(Material.IRON_BARDING, 1));
}
}
}
if (type == EntityType.PIG)