There is the possibility this will cause issues with sponge

Signed-off-by: MattBDev <mattbdev@outlook.com>
This commit is contained in:
MattBDev 2016-09-14 19:27:30 -04:00
parent 8e7e5dcb25
commit a4363bdb27

View File

@ -376,7 +376,7 @@ public class MainListener {
} }
Optional<Explosive> source = event.getExplosion().getSourceExplosive(); Optional<Explosive> source = event.getExplosion().getSourceExplosive();
if (!source.isPresent()) { if (!source.isPresent()) {
event.filterAll(); event.setCancelled(true);
return; return;
} }
Explosive tnt = source.get(); Explosive tnt = source.get();
@ -385,21 +385,22 @@ public class MainListener {
Plot currentPlot = current.getPlot(); Plot currentPlot = current.getPlot();
if (currentPlot == null) { if (currentPlot == null) {
if (current.isPlotArea()) { if (current.isPlotArea()) {
event.filterAll(); event.setCancelled(true);
} }
return; return;
} }
if (creator != null) { if (creator != null) {
if (!currentPlot.isAdded(creator)) { if (!currentPlot.isAdded(creator)) {
event.filterAll(); event.setCancelled(true);
return; return;
} }
} }
if (!currentPlot.getFlag(Flags.EXPLOSION).or(false)) { if (!currentPlot.getFlag(Flags.EXPLOSION).or(false)) {
event.filterAll(); event.setCancelled(true);
return; return;
} }
event.filter(loc -> currentPlot.equals(SpongeUtil.getLocation(loc.getExtent().getName(), loc).getPlot()));
event.getAffectedLocations().removeIf(worldLocation -> currentPlot.equals(SpongeUtil.getLocation(worldLocation.getExtent().getName(), worldLocation).getPlot()));
event.filterEntities(entity -> currentPlot.equals(SpongeUtil.getLocation(entity).getPlot())); event.filterEntities(entity -> currentPlot.equals(SpongeUtil.getLocation(entity).getPlot()));
} }
} }