summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/bukkit/craftbukkit/entity/CraftSplashPotion.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/bukkit/craftbukkit/entity/CraftSplashPotion.java')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftSplashPotion.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSplashPotion.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSplashPotion.java
new file mode 100644
index 00000000..863a6c27
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSplashPotion.java
@@ -0,0 +1,42 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.EntityPotion;
+import org.apache.commons.lang.Validate;
+import org.bukkit.Material;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.entity.EntityType;
+import org.bukkit.inventory.ItemStack;
+
+public class CraftSplashPotion extends CraftThrownPotion {
+
+ public CraftSplashPotion(CraftServer server, EntityPotion entity) {
+ super(server, entity);
+ }
+
+ @Override
+ public void setItem(ItemStack item) {
+ // The ItemStack must not be null.
+ Validate.notNull(item, "ItemStack cannot be null.");
+
+ // The ItemStack must be a potion.
+ Validate.isTrue(item.getType() == Material.SPLASH_POTION, "ItemStack must be a splash potion. This item stack was " + item.getType() + ".");
+
+ getHandle().setItem(CraftItemStack.asNMSCopy(item));
+ }
+
+ @Override
+ public EntityPotion getHandle() {
+ return (EntityPotion) entity;
+ }
+
+ @Override
+ public String toString() {
+ return "CraftSplashPotion";
+ }
+
+ @Override
+ public EntityType getType() {
+ return EntityType.SPLASH_POTION;
+ }
+}