Cleaning and Fix #1108

This commit is contained in:
MattBDev
2016-05-12 18:00:38 -04:00
parent 0958b57e46
commit d47eeff23b
8 changed files with 37 additions and 64 deletions

View File

@ -10,7 +10,6 @@ import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.CommandDeclaration;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
@ -27,16 +26,6 @@ import java.util.UUID;
category = CommandCategory.TELEPORT)
public class Visit extends SubCommand {
public List<Plot> getPlots(UUID uuid) {
List<Plot> plots = new ArrayList<>();
for (Plot p : PS.get().getPlots()) {
if (p.hasOwner() && p.isOwner(uuid)) {
plots.add(p);
}
}
return plots;
}
@Override
public boolean onCommand(PlotPlayer player, String[] args) {
if (args.length == 1 && args[0].contains(":")) {

View File

@ -5,11 +5,15 @@ import java.util.UUID;
public class PlotHandler {
public static boolean sameOwners(final Plot plot1, final Plot plot2) {
if ((plot1.owner == null) || (plot2.owner == null)) {
if (plot1.owner == null || plot2.owner == null) {
return false;
}
final Set<UUID> owners = plot1.getOwners();
owners.retainAll(plot2.getOwners());
return !owners.isEmpty();
for (UUID owner : owners) {
if (plot2.isOwner(owner)) {
return true;
}
}
return false;
}
}