This commit is contained in:
MattBDev 2016-07-31 20:17:35 -04:00
parent e801c6d7e8
commit ea3306d070
2 changed files with 9 additions and 5 deletions

View File

@ -699,7 +699,7 @@ public class PlayerEvents extends PlotListener implements Listener {
if (this.lastRadius != 0) { if (this.lastRadius != 0) {
List<Entity> nearby = event.getEntity().getNearbyEntities(this.lastRadius, this.lastRadius, this.lastRadius); List<Entity> nearby = event.getEntity().getNearbyEntities(this.lastRadius, this.lastRadius, this.lastRadius);
for (Entity near : nearby) { for (Entity near : nearby) {
if (near instanceof TNTPrimed || near.getType() == EntityType.MINECART_TNT) { if (near instanceof TNTPrimed || near.getType().equals(EntityType.MINECART_TNT)) {
if (!near.hasMetadata("plot")) { if (!near.hasMetadata("plot")) {
near.setMetadata("plot", new FixedMetadataValue((Plugin) PS.get().IMP, plot)); near.setMetadata("plot", new FixedMetadataValue((Plugin) PS.get().IMP, plot));
} }
@ -952,12 +952,12 @@ public class PlayerEvents extends PlotListener implements Listener {
} }
List<Block> blocks = event.getBlocks(); List<Block> blocks = event.getBlocks();
for (Block b : blocks) { for (Block b : blocks) {
Location bloc = BukkitUtil.getLocation(b.getLocation().add(relative)); Location bloc = BukkitUtil.getLocation(b.getLocation());
if (!area.contains(bloc.getX(), bloc.getZ())) { if (!area.contains(bloc.getX(), bloc.getZ()) || !area.contains(bloc.getX() + relative.getBlockX(), bloc.getZ() + relative.getBlockZ())) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
if (!plot.equals(area.getOwnedPlot(bloc))) { if (!plot.equals(area.getOwnedPlot(bloc)) || !plot.equals(area.getOwnedPlot(bloc.add(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ())))) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }

View File

@ -366,7 +366,11 @@ public class EntityWrapper {
} }
private void restoreInventory(InventoryHolder entity) { private void restoreInventory(InventoryHolder entity) {
try {
entity.getInventory().setContents(this.inventory); entity.getInventory().setContents(this.inventory);
} catch (IllegalArgumentException e) {
PS.debug("&c[WARN] Failed to restore inventory.\n Reason: " + e.getMessage());
}
} }
public void storeLiving(LivingEntity lived) { public void storeLiving(LivingEntity lived) {