mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2025-08-10 06:23:14 +00:00
PlotPlayer
This commit is contained in:
parent
fa6b78f117
commit
16f5cc1f36
47 changed files with 1501 additions and 564 deletions
|
@ -36,7 +36,7 @@ import com.intellectualcrafters.plot.object.PlotCluster;
|
|||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.ClusterManager;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||
import com.intellectualcrafters.plot.util.bukkit.PlayerFunctions;
|
||||
|
||||
|
@ -163,7 +163,7 @@ public class Auto extends SubCommand {
|
|||
final PlotWorld plotworld = PlotSquared.getPlotWorld(worldname);
|
||||
if (plotworld.TYPE == 2) {
|
||||
final Location loc = BukkitUtil.getLocation(plr);
|
||||
final Plot plot = PlotHelper.getCurrentPlot(new com.intellectualcrafters.plot.object.Location(worldname, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
||||
final Plot plot = MainUtil.getCurrentPlot(new com.intellectualcrafters.plot.object.Location(worldname, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
||||
if (plot == null) {
|
||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ public class Auto extends SubCommand {
|
|||
//
|
||||
for (int i = 0; i <= max; i++) {
|
||||
final PlotId currentId = new PlotId(origin.x + id.x, origin.y + id.y);
|
||||
final Plot current = PlotHelper.getPlot(worldname, currentId);
|
||||
final Plot current = MainUtil.getPlot(worldname, currentId);
|
||||
if ((current != null) && (current.hasOwner() == false) && (current.settings.isMerged() == false) && cluster.equals(ClusterManager.getCluster(current))) {
|
||||
Claim.claimPlot(plr, current, true, true);
|
||||
return true;
|
||||
|
@ -196,19 +196,19 @@ public class Auto extends SubCommand {
|
|||
boolean br = false;
|
||||
if ((size_x == 1) && (size_z == 1)) {
|
||||
while (!br) {
|
||||
final Plot plot = PlotHelper.getPlot(worldname, getLastPlot(worldname));
|
||||
final Plot plot = MainUtil.getPlot(worldname, getLastPlot(worldname));
|
||||
if ((plot.owner == null)) {
|
||||
Claim.claimPlot(plr, plot, true, true);
|
||||
br = true;
|
||||
}
|
||||
PlotHelper.lastPlot.put(worldname, getNextPlot(getLastPlot(worldname), 1));
|
||||
MainUtil.lastPlot.put(worldname, getNextPlot(getLastPlot(worldname), 1));
|
||||
}
|
||||
} else {
|
||||
boolean lastPlot = true;
|
||||
while (!br) {
|
||||
final PlotId start = getNextPlot(getLastPlot(worldname), 1);
|
||||
// Checking if the current set of plots is a viable option.
|
||||
PlotHelper.lastPlot.put(worldname, start);
|
||||
MainUtil.lastPlot.put(worldname, start);
|
||||
if (lastPlot) {
|
||||
}
|
||||
if ((PlotSquared.getPlots(worldname).get(start) != null) && (PlotSquared.getPlots(worldname).get(start).owner != null)) {
|
||||
|
@ -217,29 +217,29 @@ public class Auto extends SubCommand {
|
|||
lastPlot = false;
|
||||
}
|
||||
final PlotId end = new PlotId((start.x + size_x) - 1, (start.y + size_z) - 1);
|
||||
if (PlotHelper.isUnowned(worldname, start, end)) {
|
||||
if (MainUtil.isUnowned(worldname, start, end)) {
|
||||
for (int i = start.x; i <= end.x; i++) {
|
||||
for (int j = start.y; j <= end.y; j++) {
|
||||
final Plot plot = PlotHelper.getPlot(worldname, new PlotId(i, j));
|
||||
final Plot plot = MainUtil.getPlot(worldname, new PlotId(i, j));
|
||||
final boolean teleport = ((i == end.x) && (j == end.y));
|
||||
Claim.claimPlot(plr, plot, teleport, true);
|
||||
}
|
||||
}
|
||||
if (!PlotHelper.mergePlots(plr, worldname, PlayerFunctions.getPlotSelectionIds(start, end))) {
|
||||
if (!MainUtil.mergePlots(plr, worldname, PlayerFunctions.getPlotSelectionIds(start, end))) {
|
||||
return false;
|
||||
}
|
||||
br = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
PlotHelper.lastPlot.put(worldname, new PlotId(0, 0));
|
||||
MainUtil.lastPlot.put(worldname, new PlotId(0, 0));
|
||||
return true;
|
||||
}
|
||||
|
||||
public PlotId getLastPlot(final String world) {
|
||||
if ((PlotHelper.lastPlot == null) || !PlotHelper.lastPlot.containsKey(world)) {
|
||||
PlotHelper.lastPlot.put(world, new PlotId(0, 0));
|
||||
if ((MainUtil.lastPlot == null) || !MainUtil.lastPlot.containsKey(world)) {
|
||||
MainUtil.lastPlot.put(world, new PlotId(0, 0));
|
||||
}
|
||||
return PlotHelper.lastPlot.get(world);
|
||||
return MainUtil.lastPlot.get(world);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue