mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2024-12-23 00:15:06 +00:00
Some claiming fixes
This commit is contained in:
parent
47915b8b86
commit
bfe98f3285
5 changed files with 14 additions and 15 deletions
|
@ -141,7 +141,7 @@ public class Auto extends SubCommand {
|
|||
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||
@Override
|
||||
public void run(Object ignore) {
|
||||
if (value == null) {
|
||||
if (plot == null) {
|
||||
MainUtil.sendMessage(player, C.NO_FREE_PLOTS);
|
||||
} else {
|
||||
plot.claim(player, true, finalSchematic, false);
|
||||
|
@ -184,17 +184,15 @@ public class Auto extends SubCommand {
|
|||
PlotId center;
|
||||
center = new PlotId(0, 0);
|
||||
plots = Integer.MAX_VALUE;
|
||||
PlotId currentId = new PlotId(0, 0);
|
||||
PlotId currentId;
|
||||
for (int i = 0; i < plots; i++) {
|
||||
if (start == null) {
|
||||
start = new PlotId(0, 0);
|
||||
} else {
|
||||
start = start.getNextId(1);
|
||||
}
|
||||
currentId.x = center.x + start.x;
|
||||
currentId.y = center.y + start.y;
|
||||
currentId.recalculateHash();
|
||||
return start;
|
||||
currentId = new PlotId(center.x + start.x, center.y + start.y);
|
||||
return currentId;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -84,8 +84,8 @@ public class Claim extends SubCommand {
|
|||
}
|
||||
sendMessage(player, C.REMOVED_GRANTED_PLOT, "1", "" + (grants - 1));
|
||||
}
|
||||
plot.owner = player.getUUID();
|
||||
if (plot.canClaim(player)) {
|
||||
plot.owner = player.getUUID();
|
||||
final String finalSchematic = schematic;
|
||||
DBFunc.createPlotSafe(plot, new Runnable() {
|
||||
@Override
|
||||
|
|
|
@ -336,14 +336,17 @@ public class SQLManager implements AbstractDB {
|
|||
PreparedStatement statement = null;
|
||||
UniqueStatement task = null;
|
||||
UniqueStatement lastTask = null;
|
||||
for (Entry<Plot, Queue<UniqueStatement>> entry : this.plotTasks.entrySet()) {
|
||||
Iterator<Entry<Plot, Queue<UniqueStatement>>> iter = this.plotTasks.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
try {
|
||||
Entry<Plot, Queue<UniqueStatement>> entry = iter.next();
|
||||
Plot plot = entry.getKey();
|
||||
if (this.plotTasks.get(plot).isEmpty()) {
|
||||
this.plotTasks.remove(plot);
|
||||
Queue<UniqueStatement> tasks = entry.getValue();
|
||||
if (tasks.isEmpty()) {
|
||||
iter.remove();
|
||||
continue;
|
||||
}
|
||||
task = this.plotTasks.get(plot).remove();
|
||||
task = tasks.remove();
|
||||
count++;
|
||||
if (task != null) {
|
||||
if (task.method == null || !task.method.equals(method)) {
|
||||
|
|
|
@ -2032,10 +2032,10 @@ public class Plot {
|
|||
}
|
||||
try {
|
||||
final Location loc = this.getManager().getSignLoc(this.area, this);
|
||||
ChunkManager.manager.loadChunk(loc.getWorld(), loc.getChunkLoc(), false);
|
||||
String[] lines = TaskManager.IMP.sync(new RunnableVal<String[]>() {
|
||||
@Override
|
||||
public void run(String[] value) {
|
||||
ChunkManager.manager.loadChunk(loc.getWorld(), loc.getChunkLoc(), false);
|
||||
this.value = WorldUtil.IMP.getSign(loc);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -683,9 +683,7 @@ public abstract class PlotArea {
|
|||
} else {
|
||||
start = start.getNextId(1);
|
||||
}
|
||||
currentId.x = center.x + start.x;
|
||||
currentId.y = center.y + start.y;
|
||||
currentId.recalculateHash();
|
||||
currentId = new PlotId(center.x + start.x, center.y + start.y);
|
||||
Plot plot = getPlotAbs(currentId);
|
||||
if (plot != null && plot.canClaim(player)) {
|
||||
setMeta("lastPlot", currentId);
|
||||
|
|
Loading…
Reference in a new issue