Skip to content

Commit

Permalink
Critical bug - selecting between worlds gives access to inventories
Browse files Browse the repository at this point in the history
  • Loading branch information
Brianetta committed Apr 2, 2016
1 parent b1348f3 commit 05ff1bb
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void onPlayerInteract(PlayerInteractEvent event) {
Protection protection = db.getProtection(target);
if (protection.getType() != null) {
String selected = "";
if (stickylocks.SelectedBlock.get(player) == null || !(stickylocks.SelectedBlock.get(player).distanceSquared(target.getLocation()) < 1)) {
if (stickylocks.SelectedBlock.get(player) == null || (stickylocks.SelectedBlock.get(player).getWorld().equals(target.getLocation().getWorld()) && !(stickylocks.SelectedBlock.get(player).distanceSquared(target.getLocation()) < 1))) {
// Block is not one previously selected
stickylocks.SelectedBlock.put(player, target.getLocation());
selected = " " + ChatColor.RED + "(selected)";
Expand Down Expand Up @@ -94,7 +94,7 @@ public void onPlayerInteract(PlayerInteractEvent event) {
// Left-clicks are either with a stick, or not
if (player.getInventory().getItemInMainHand().getType() == tool) {
// Stick used - check if it's the selected block, and lock/unlock if appropriate
if (stickylocks.SelectedBlock.get(player) != null && stickylocks.SelectedBlock.get(player).distanceSquared(target.getLocation()) < 1) {
if (stickylocks.SelectedBlock.get(player) != null && (stickylocks.SelectedBlock.get(player).getWorld().equals(target.getLocation().getWorld()) && stickylocks.SelectedBlock.get(player).distanceSquared(target.getLocation()) < 1)) {
// Just left-clicked the selected block with a stick!
if (player.hasPermission("stickylocks.lock")) {
Protection protection = db.getProtection(target);
Expand Down

0 comments on commit 05ff1bb

Please sign in to comment.