From f1378013c182228f8a0b5d3e4213b0ec6753581e Mon Sep 17 00:00:00 2001 From: Sauilitired Date: Wed, 26 Dec 2018 01:39:49 +0100 Subject: [PATCH] Fix plot home --- .../plotsquared/plot/commands/Visit.java | 24 ++++++------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Visit.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Visit.java index 958133332..cc8740725 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Visit.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Visit.java @@ -94,12 +94,8 @@ import java.util.*; C.FOUND_NO_PLOTS.send(player); return; } - Iterator iterator = unsorted.iterator(); - while (iterator.hasNext()) { - if (!iterator.next().isBasePlot()) { - iterator.remove(); - } - } + unsorted = new ArrayList<>(unsorted); + unsorted.removeIf(plot -> !plot.isBasePlot()); if (page < 1 || page > unsorted.size()) { C.NOT_VALID_NUMBER.send(player, "(1, " + unsorted.size() + ")"); return; @@ -134,19 +130,13 @@ import java.util.*; return; } } - confirm.run(this, new Runnable() { - @Override public void run() { - if (plot.teleportPlayer(player)) { - whenDone.run(Visit.this, CommandResult.SUCCESS); - } else { - whenDone.run(Visit.this, CommandResult.FAILURE); - } - } - }, new Runnable() { - @Override public void run() { + confirm.run(this, () -> { + if (plot.teleportPlayer(player)) { + whenDone.run(Visit.this, CommandResult.SUCCESS); + } else { whenDone.run(Visit.this, CommandResult.FAILURE); } - }); + }, () -> whenDone.run(Visit.this, CommandResult.FAILURE)); } }