mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-29 16:46:45 +01:00
parent
8c245b4f21
commit
c7f5e3061d
@ -25,8 +25,10 @@ import java.net.URL;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -418,6 +420,66 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the trusted users for this plot
|
||||||
|
* @param uuids
|
||||||
|
*/
|
||||||
|
public void setTrusted(Set<UUID> uuids) {
|
||||||
|
if (uuids.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (trusted != null && trusted.size() > 0) {
|
||||||
|
trusted.removeAll(uuids);
|
||||||
|
for (UUID uuid : trusted) {
|
||||||
|
DBFunc.removeTrusted(this, uuid);
|
||||||
|
}
|
||||||
|
trusted.clear();
|
||||||
|
}
|
||||||
|
for (UUID uuid : uuids) {
|
||||||
|
addTrusted(uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the members for this plot
|
||||||
|
* @param uuids
|
||||||
|
*/
|
||||||
|
public void setMembers(Set<UUID> uuids) {
|
||||||
|
if (uuids.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (members != null && members.size() > 0) {
|
||||||
|
members.removeAll(uuids);
|
||||||
|
for (UUID uuid : members) {
|
||||||
|
DBFunc.removeMember(this, uuid);
|
||||||
|
}
|
||||||
|
members.clear();
|
||||||
|
}
|
||||||
|
for (UUID uuid : uuids) {
|
||||||
|
addMember(uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the denied users for this plot
|
||||||
|
* @param uuids
|
||||||
|
*/
|
||||||
|
public void setDenied(Set<UUID> uuids) {
|
||||||
|
if (uuids.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (denied != null && denied.size() > 0) {
|
||||||
|
denied.removeAll(uuids);
|
||||||
|
for (UUID uuid : denied) {
|
||||||
|
DBFunc.removeDenied(this, uuid);
|
||||||
|
}
|
||||||
|
denied.clear();
|
||||||
|
}
|
||||||
|
for (UUID uuid : uuids) {
|
||||||
|
addDenied(uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear a plot
|
* Clear a plot
|
||||||
* @see MainUtil#clear(Plot, boolean, Runnable)
|
* @see MainUtil#clear(Plot, boolean, Runnable)
|
||||||
|
@ -23,6 +23,7 @@ package com.intellectualcrafters.plot.util;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@ -646,22 +647,35 @@ public class MainUtil {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HashSet<UUID> trusted = new HashSet<UUID>();
|
||||||
|
HashSet<UUID> members = new HashSet<UUID>();
|
||||||
|
HashSet<UUID> denied = new HashSet<UUID>();
|
||||||
|
|
||||||
manager.startPlotMerge(plotworld, plotIds);
|
manager.startPlotMerge(plotworld, plotIds);
|
||||||
for (int x = pos1.x; x <= pos2.x; x++) {
|
for (int x = pos1.x; x <= pos2.x; x++) {
|
||||||
for (int y = pos1.y; y <= pos2.y; y++) {
|
for (int y = pos1.y; y <= pos2.y; y++) {
|
||||||
final PlotId id = new PlotId(x, y);
|
final PlotId id = new PlotId(x, y);
|
||||||
final Plot plot = PS.get().getPlot(world, id);
|
final Plot plot = PS.get().getPlot(world, id);
|
||||||
|
trusted.addAll(plot.getTrusted());
|
||||||
|
members.addAll(plot.getMembers());
|
||||||
|
denied.addAll(plot.getDenied());
|
||||||
if (removeRoads) {
|
if (removeRoads) {
|
||||||
removeSign(plot);
|
removeSign(plot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
members.removeAll(trusted);
|
||||||
|
denied.removeAll(trusted);
|
||||||
|
denied.removeAll(members);
|
||||||
for (int x = pos1.x; x <= pos2.x; x++) {
|
for (int x = pos1.x; x <= pos2.x; x++) {
|
||||||
for (int y = pos1.y; y <= pos2.y; y++) {
|
for (int y = pos1.y; y <= pos2.y; y++) {
|
||||||
final boolean lx = x < pos2.x;
|
final boolean lx = x < pos2.x;
|
||||||
final boolean ly = y < pos2.y;
|
final boolean ly = y < pos2.y;
|
||||||
final PlotId id = new PlotId(x, y);
|
final PlotId id = new PlotId(x, y);
|
||||||
final Plot plot = PS.get().getPlot(world, id);
|
final Plot plot = PS.get().getPlot(world, id);
|
||||||
|
plot.setTrusted(trusted);
|
||||||
|
plot.setMembers(members);
|
||||||
|
plot.setDenied(denied);
|
||||||
Plot plot2 = null;
|
Plot plot2 = null;
|
||||||
if (lx) {
|
if (lx) {
|
||||||
if (ly) {
|
if (ly) {
|
||||||
|
Loading…
Reference in New Issue
Block a user