Check for null in ItemStacks

Dieser Commit ist enthalten in:
zml2008 2012-03-01 20:31:01 -08:00
Ursprung a62cf3a059
Commit 742b6b61fa

Datei anzeigen

@ -70,7 +70,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Get the world handle. * Get the world handle.
* *
* @return * @return
*/ */
public World getWorld() { public World getWorld() {
@ -79,7 +79,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Get the name of the world * Get the name of the world
* *
* @return * @return
*/ */
@Override @Override
@ -89,7 +89,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Set block type. * Set block type.
* *
* @param pt * @param pt
* @param type * @param type
* @return * @return
@ -101,7 +101,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Set block type. * Set block type.
* *
* @param pt * @param pt
* @param type * @param type
* @return * @return
@ -116,7 +116,7 @@ public class BukkitWorld extends LocalWorld {
* @param pt * @param pt
* @param type * @param type
* @param data * @param data
* @return * @return
*/ */
@Override @Override
public boolean setTypeIdAndData(Vector pt, int type, int data) { public boolean setTypeIdAndData(Vector pt, int type, int data) {
@ -128,7 +128,7 @@ public class BukkitWorld extends LocalWorld {
* @param pt * @param pt
* @param type * @param type
* @param data * @param data
* @return * @return
*/ */
@Override @Override
public boolean setTypeIdAndDataFast(Vector pt, int type, int data) { public boolean setTypeIdAndDataFast(Vector pt, int type, int data) {
@ -137,7 +137,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Get block type. * Get block type.
* *
* @param pt * @param pt
* @return * @return
*/ */
@ -148,7 +148,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Set block data. * Set block data.
* *
* @param pt * @param pt
* @param data * @param data
*/ */
@ -159,7 +159,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Set block data. * Set block data.
* *
* @param pt * @param pt
* @param data * @param data
*/ */
@ -170,7 +170,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Get block data. * Get block data.
* *
* @param pt * @param pt
* @return * @return
*/ */
@ -181,7 +181,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Get block light level. * Get block light level.
* *
* @param pt * @param pt
* @return * @return
*/ */
@ -192,7 +192,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Regenerate an area. * Regenerate an area.
* *
* @param region * @param region
* @param editSession * @param editSession
* @return * @return
@ -221,7 +221,7 @@ public class BukkitWorld extends LocalWorld {
t.printStackTrace(); t.printStackTrace();
} }
// Then restore // Then restore
for (int x = 0; x < 16; ++x) { for (int x = 0; x < 16; ++x) {
for (int y = 0; y < (getMaxY() + 1); ++y) { for (int y = 0; y < (getMaxY() + 1); ++y) {
for (int z = 0; z < 16; ++z) { for (int z = 0; z < 16; ++z) {
@ -245,7 +245,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Attempts to accurately copy a BaseBlock's extra data to the world. * Attempts to accurately copy a BaseBlock's extra data to the world.
* *
* @param pt * @param pt
* @param block * @param block
* @return * @return
@ -306,7 +306,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Attempts to read a BaseBlock's extra data from the world. * Attempts to read a BaseBlock's extra data from the world.
* *
* @param pt * @param pt
* @param block * @param block
* @return * @return
@ -368,7 +368,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Clear a chest's contents. * Clear a chest's contents.
* *
* @param pt * @param pt
*/ */
@Override @Override
@ -390,7 +390,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Generate a tree at a location. * Generate a tree at a location.
* *
* @param pt * @param pt
* @return * @return
*/ */
@ -402,7 +402,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Generate a big tree at a location. * Generate a big tree at a location.
* *
* @param pt * @param pt
* @return * @return
*/ */
@ -414,7 +414,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Generate a birch tree at a location. * Generate a birch tree at a location.
* *
* @param pt * @param pt
* @return * @return
*/ */
@ -426,7 +426,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Generate a redwood tree at a location. * Generate a redwood tree at a location.
* *
* @param pt * @param pt
* @return * @return
*/ */
@ -438,7 +438,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Generate a redwood tree at a location. * Generate a redwood tree at a location.
* *
* @param pt * @param pt
* @return * @return
*/ */
@ -463,7 +463,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Kill mobs in an area. * Kill mobs in an area.
* *
* @param origin The center of the area to kill mobs in. * @param origin The center of the area to kill mobs in.
* @param radius Maximum distance to kill mobs at; radius < 0 means kill all mobs * @param radius Maximum distance to kill mobs at; radius < 0 means kill all mobs
* @param flags various flags that determine what to kill * @param flags various flags that determine what to kill
@ -515,7 +515,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Remove entities in an area. * Remove entities in an area.
* *
* @param origin * @param origin
* @param radius * @param radius
* @return * @return
@ -530,7 +530,7 @@ public class BukkitWorld extends LocalWorld {
&& origin.distanceSq(BukkitUtil.toVector(ent.getLocation())) > radiusSq) { && origin.distanceSq(BukkitUtil.toVector(ent.getLocation())) > radiusSq) {
continue; continue;
} }
if (type == EntityType.ARROWS) { if (type == EntityType.ARROWS) {
if (ent instanceof Arrow) { if (ent instanceof Arrow) {
ent.remove(); ent.remove();
@ -574,7 +574,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Set a sign's text. * Set a sign's text.
* *
* @param pt * @param pt
* @param text * @param text
* @return * @return
@ -595,7 +595,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Get a sign's text. * Get a sign's text.
* *
* @param pt * @param pt
* @return * @return
*/ */
@ -619,7 +619,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Get a container block's contents. * Get a container block's contents.
* *
* @param pt * @param pt
* @return * @return
*/ */
@ -640,7 +640,7 @@ public class BukkitWorld extends LocalWorld {
for (int i = 0; i < size; ++i) { for (int i = 0; i < size; ++i) {
ItemStack bukkitStack = inven.getItem(i); ItemStack bukkitStack = inven.getItem(i);
if (bukkitStack.getTypeId() > 0) { if (bukkitStack != null && bukkitStack.getTypeId() > 0) {
contents[i] = new BaseItemStack( contents[i] = new BaseItemStack(
bukkitStack.getTypeId(), bukkitStack.getTypeId(),
bukkitStack.getAmount(), bukkitStack.getAmount(),
@ -658,7 +658,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Set a container block's contents. * Set a container block's contents.
* *
* @param pt * @param pt
* @param contents * @param contents
* @return * @return
@ -702,7 +702,7 @@ public class BukkitWorld extends LocalWorld {
/** /**
* Returns whether a block has a valid ID. * Returns whether a block has a valid ID.
* *
* @param type * @param type
* @return * @return
*/ */
@ -762,7 +762,7 @@ public class BukkitWorld extends LocalWorld {
return true; return true;
} }
@Override @Override
public void simulateBlockMine(Vector pt) { public void simulateBlockMine(Vector pt) {
world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).breakNaturally(); world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).breakNaturally();