Null checks for the sake of nullchecks
This commit is contained in:
parent
e0ad90304f
commit
1fd79fc87e
1 changed files with 5 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
From 461dd70b9d40f1e410a05fae349799406a3402f4 Mon Sep 17 00:00:00 2001
|
From ba6bfe5a1b4eac8a2700b40870ffb2f0faad617e 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 f07982d..db5c3c3 100644
|
index f07982d..a9a0a90 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
|
||||||
@@ -887,31 +887,21 @@ public class CraftWorld implements World {
|
@@ -887,31 +887,21 @@ public class CraftWorld implements World {
|
||||||
|
@ -53,7 +53,7 @@ index f07982d..db5c3c3 100644
|
||||||
-
|
-
|
||||||
- int datavalue = data == null ? 0 : CraftEffect.getDataValue(effect, data);
|
- int datavalue = data == null ? 0 : CraftEffect.getDataValue(effect, data);
|
||||||
- playEffect(loc, effect, datavalue, radius);
|
- playEffect(loc, effect, datavalue, radius);
|
||||||
+ if (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);
|
||||||
|
@ -152,7 +152,7 @@ index f07982d..db5c3c3 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 3d39d07..140b06f 100644
|
index 3d39d07..8ee2c3b 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
|
||||||
@@ -266,13 +266,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
@@ -266,13 +266,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
|
@ -180,7 +180,7 @@ index 3d39d07..140b06f 100644
|
||||||
-
|
-
|
||||||
- int datavalue = data == null ? 0 : CraftEffect.getDataValue(effect, data);
|
- int datavalue = data == null ? 0 : CraftEffect.getDataValue(effect, data);
|
||||||
- playEffect(loc, effect, datavalue);
|
- playEffect(loc, effect, datavalue);
|
||||||
+ if (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, 64);
|
+ spigot().playEffect(loc, effect, materialData.getItemType().getId(), materialData.getData(), 0, 0, 0, 1, 1, 64);
|
||||||
|
|
Loading…
Reference in a new issue