Properly validate blocks in particle api

This commit is contained in:
md_5 2013-10-11 10:17:09 +11:00
parent 8d428932b4
commit 39c6e1be1f

View file

@ -1,4 +1,4 @@
From b23f908193514fa253e4c41dc3db750f66f2f7ec Mon Sep 17 00:00:00 2001 From 922b5a63c71b56026841350a392f429942414d0b Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Sun, 2 Jun 2013 16:14:30 +1000 Date: Sun, 2 Jun 2013 16:14:30 +1000
Subject: [PATCH] Particle API Subject: [PATCH] Particle API
@ -43,7 +43,7 @@ index 7de0de5..7eca388 100644
datavalue = 0; datavalue = 0;
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 7601fb5..6d22e82 100644 index 7601fb5..0faf5bf 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -765,31 +765,21 @@ public class CraftWorld implements World { @@ -765,31 +765,21 @@ public class CraftWorld implements World {
@ -55,7 +55,7 @@ index 7601fb5..6d22e82 100644
- playEffect(loc, effect, datavalue, radius); - playEffect(loc, effect, datavalue, radius);
+ if (data != null && data.getClass().equals(org.bukkit.material.MaterialData.class)) { + if (data != null && data.getClass().equals(org.bukkit.material.MaterialData.class)) {
+ org.bukkit.material.MaterialData materialData = (org.bukkit.material.MaterialData) data; + org.bukkit.material.MaterialData materialData = (org.bukkit.material.MaterialData) data;
+ Validate.isTrue(!materialData.getItemType().isBlock(), "Material must be block"); + Validate.isTrue(materialData.getItemType().isBlock(), "Material must be block");
+ spigot().playEffect(loc, effect, materialData.getItemType().getId(), materialData.getData(), 0, 0, 0, 1, 1, radius); + spigot().playEffect(loc, effect, materialData.getItemType().getId(), materialData.getData(), 0, 0, 0, 1, 1, radius);
+ } else { + } else {
+ int datavalue = data == null ? 0 : CraftEffect.getDataValue(effect, data); + int datavalue = data == null ? 0 : CraftEffect.getDataValue(effect, data);
@ -152,7 +152,7 @@ index 7601fb5..6d22e82 100644
public Spigot spigot() public Spigot spigot()
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index aa49c6c..9da9863 100644 index e242f7d..4bae056 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -277,13 +277,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -277,13 +277,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {