From 8aac502ab6517a2d4dcf80c8d1323cacde42b060 Mon Sep 17 00:00:00 2001 From: okamosy Date: Wed, 17 Jul 2013 18:29:46 +0100 Subject: [PATCH] Added horse armor /spawnmob horse:armor --- .../com/earth2me/essentials/Essentials.java | 2 +- .../src/com/earth2me/essentials/Settings.java | 2 +- .../src/com/earth2me/essentials/SpawnMob.java | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index 64e17e196..96ee6fed1 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -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()); diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index a10477e43..f958c10ab 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -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; diff --git a/Essentials/src/com/earth2me/essentials/SpawnMob.java b/Essentials/src/com/earth2me/essentials/SpawnMob.java index 63686f40e..2c40f448f 100644 --- a/Essentials/src/com/earth2me/essentials/SpawnMob.java +++ b/Essentials/src/com/earth2me/essentials/SpawnMob.java @@ -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)