Fixes #517 + possibly #519

This commit is contained in:
boy0001 2015-08-08 16:40:43 +10:00
parent d8e7c9805b
commit 64063463ec
2 changed files with 13 additions and 7 deletions

View File

@ -51,6 +51,9 @@ public class PlotInventory {
} }
public PlotItemStack getItem(int index) { public PlotItemStack getItem(int index) {
if (index < 0 || index >= items.length) {
return null;
}
return items[index]; return items[index];
} }

View File

@ -913,6 +913,8 @@ public class BukkitChunkManager extends ChunkManager {
final int tz = pos2.getZ(); final int tz = pos2.getZ();
for (final Entity entity : entities) { for (final Entity entity : entities) {
if (entity instanceof Player) { if (entity instanceof Player) {
org.bukkit.Location loc = entity.getLocation();
if (loc.getX() >= bx && loc.getX() <= tx && loc.getZ() >= bz && loc.getZ() <= tz) {
final Player player = (Player) entity; final Player player = (Player) entity;
final PlotPlayer pp = BukkitUtil.getPlayer(player); final PlotPlayer pp = BukkitUtil.getPlayer(player);
Plot plot = pp.getCurrentPlot(); Plot plot = pp.getCurrentPlot();
@ -923,6 +925,7 @@ public class BukkitChunkManager extends ChunkManager {
} }
} }
} }
}
else { else {
org.bukkit.Location loc = entity.getLocation(); org.bukkit.Location loc = entity.getLocation();
if (loc.getX() >= bx && loc.getX() <= tx && loc.getZ() >= bz && loc.getZ() <= tz) { if (loc.getX() >= bx && loc.getX() <= tx && loc.getZ() >= bz && loc.getZ() <= tz) {