Skip to content

Commit

Permalink
Think I fixed the event crash
Browse files Browse the repository at this point in the history
  • Loading branch information
d4rkfly3r committed Mar 31, 2017
1 parent 52bc279 commit 7d1e4f1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,26 @@ public void handle(ChangeBlockEvent event) throws Exception {
//FoxGuardMain.instance().getLogger().info(player.getName());

List<IHandler> handlerList;
World world = event.getTargetWorld();

// System.err.println(event);
// System.err.println(event.getClass());
// System.err.println(event.getTransactions());
// System.exit(1);

// if (1 == 1) return;

List<Transaction<BlockSnapshot>> transactions = event.getTransactions();
Set<IHandler> handlerSet = new HashSet<>();
if (transactions.size() == 1) {
Vector3i pos = transactions.get(0).getFinal().getLocation().get().getBlockPosition();
final World world = transactions.get(0).getFinal().getLocation().get().getExtent();
final Vector3i pos = transactions.get(0).getFinal().getLocation().get().getBlockPosition();
FGManager.getInstance().getRegionsInChunkAtPos(world, pos).stream()
.filter(region -> region.contains(pos, world))
.forEach(region -> region.getHandlers().stream()
.filter(IFGObject::isEnabled)
.forEach(handlerSet::add));
} else {
final World world = transactions.get(0).getFinal().getLocation().get().getExtent();
FGManager.getInstance().getRegionsAtMultiPosI(
world,
transactions.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void handle(ExplosionEvent event) throws Exception {
} else user = null;
}

World world = event.getTargetWorld();
final World world = event.getExplosion().getLocation().getExtent();
FlagBitSet flags = FLAG_SET.clone();

Set<IHandler> handlerSet = new HashSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ public void handle(SpawnEntityEvent event) throws Exception {
}

List<IHandler> handlerList = new ArrayList<>();
World world = event.getTargetWorld();
// World world = event.getTargetWorld();

for (Entity entity : event.getEntities()) {
Vector3d pos = entity.getLocation().getPosition();
final World world = entity.getLocation().getExtent();
FGManager.getInstance().getRegionsInChunkAtPos(world, pos).stream()
.filter(region -> region.contains(pos, world))
.forEach(region -> region.getHandlers().stream()
Expand Down

0 comments on commit 7d1e4f1

Please sign in to comment.