Skip to content

Commit

Permalink
Clear the world override if the selector is called on another world.
Browse files Browse the repository at this point in the history
  • Loading branch information
me4502 committed Aug 12, 2019
1 parent 21f0e73 commit 3c737e2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Expand Up @@ -326,6 +326,9 @@ public RegionSelector getRegionSelector(World world) {
if (selector.getWorld() == null || !selector.getWorld().equals(world)) {
selector.setWorld(world);
selector.clear();
if (hasWorldOverride() && !world.equals(getWorldOverride())) {
setWorldOverride(null);
}
}
return selector;
}
Expand All @@ -341,6 +344,9 @@ public void setRegionSelector(World world, RegionSelector selector) {
checkNotNull(selector);
selector.setWorld(world);
this.selector = selector;
if (hasWorldOverride() && !world.equals(getWorldOverride())) {
setWorldOverride(null);
}
}

/**
Expand Down
Expand Up @@ -34,8 +34,8 @@ public class SelectionWand implements DoubleActionBlockTool {
@Override
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
RegionSelector selector = session.getRegionSelector(player.getWorld());

BlockVector3 blockPoint = clicked.toVector().toBlockPoint();

if (selector.selectPrimary(blockPoint, ActorSelectorLimits.forActor(player))) {
selector.explainPrimarySelection(player, session, blockPoint);
}
Expand All @@ -46,6 +46,7 @@ public boolean actSecondary(Platform server, LocalConfiguration config, Player p
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
RegionSelector selector = session.getRegionSelector(player.getWorld());
BlockVector3 blockPoint = clicked.toVector().toBlockPoint();

if (selector.selectSecondary(blockPoint, ActorSelectorLimits.forActor(player))) {
selector.explainSecondarySelection(player, session, blockPoint);
}
Expand Down

0 comments on commit 3c737e2

Please sign in to comment.