mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 15:16:45 +01:00
parent
56d65ebd1e
commit
f8c543b56c
@ -45,7 +45,7 @@ import java.util.UUID;
|
|||||||
/**
|
/**
|
||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({"unused", "deprecated", "javadoc"}) public class Info extends SubCommand {
|
@SuppressWarnings({"javadoc"}) public class Info extends SubCommand {
|
||||||
|
|
||||||
public Info() {
|
public Info() {
|
||||||
super(Command.INFO, "Display plot info", "info", CommandCategory.INFO, false);
|
super(Command.INFO, "Display plot info", "info", CommandCategory.INFO, false);
|
||||||
|
@ -109,25 +109,40 @@ public class Merge extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final World world = plr.getWorld();
|
final World world = plr.getWorld();
|
||||||
final PlotId bot = PlayerFunctions.getBottomPlot(world, plot).id;
|
PlotId bot = PlayerFunctions.getBottomPlot(world, plot).id;
|
||||||
final PlotId top = PlayerFunctions.getTopPlot(world, plot).id;
|
PlotId top = PlayerFunctions.getTopPlot(world, plot).id;
|
||||||
ArrayList<PlotId> plots;
|
ArrayList<PlotId> plots;
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case 0: // north = -y
|
case 0: // north = -y
|
||||||
plots = PlayerFunctions.getMaxPlotSelectionIds(plr.getWorld(), new PlotId(bot.x, bot.y - 1), new PlotId(top.x, top.y));
|
plots = PlayerFunctions.getMaxPlotSelectionIds(world, new PlotId(bot.x, bot.y - 1), new PlotId(top.x, top.y));
|
||||||
break;
|
break;
|
||||||
case 1: // east = +x
|
case 1: // east = +x
|
||||||
plots = PlayerFunctions.getMaxPlotSelectionIds(plr.getWorld(), new PlotId(bot.x, bot.y), new PlotId(top.x + 1, top.y));
|
plots = PlayerFunctions.getMaxPlotSelectionIds(world, new PlotId(bot.x, bot.y), new PlotId(top.x + 1, top.y));
|
||||||
break;
|
break;
|
||||||
case 2: // south = +y
|
case 2: // south = +y
|
||||||
plots = PlayerFunctions.getMaxPlotSelectionIds(plr.getWorld(), new PlotId(bot.x, bot.y), new PlotId(top.x, top.y + 1));
|
plots = PlayerFunctions.getMaxPlotSelectionIds(world, new PlotId(bot.x, bot.y), new PlotId(top.x, top.y + 1));
|
||||||
break;
|
break;
|
||||||
case 3: // west = -x
|
case 3: // west = -x
|
||||||
plots = PlayerFunctions.getMaxPlotSelectionIds(plr.getWorld(), new PlotId(bot.x - 1, bot.y), new PlotId(top.x, top.y));
|
plots = PlayerFunctions.getMaxPlotSelectionIds(world, new PlotId(bot.x - 1, bot.y), new PlotId(top.x, top.y));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlotId botId = plots.get(0);
|
||||||
|
PlotId topId = plots.get(plots.size() - 1);
|
||||||
|
|
||||||
|
PlotId bot1 = PlayerFunctions.getBottomPlot(world, PlotHelper.getPlot(world, botId)).id;
|
||||||
|
PlotId bot2 = PlayerFunctions.getBottomPlot(world, PlotHelper.getPlot(world, topId)).id;
|
||||||
|
|
||||||
|
PlotId top1 = PlayerFunctions.getTopPlot(world, PlotHelper.getPlot(world, topId)).id;
|
||||||
|
PlotId top2 = PlayerFunctions.getTopPlot(world, PlotHelper.getPlot(world, botId)).id;
|
||||||
|
|
||||||
|
bot = new PlotId(Math.min(bot1.x, bot2.x), Math.min(bot1.y, bot2.y));
|
||||||
|
top = new PlotId(Math.min(top1.x, top2.x), Math.min(top1.y, top2.y));
|
||||||
|
|
||||||
|
plots = PlayerFunctions.getMaxPlotSelectionIds(world, bot, top);
|
||||||
|
|
||||||
for (final PlotId myid : plots) {
|
for (final PlotId myid : plots) {
|
||||||
final Plot myplot = PlotMain.getPlots(world).get(myid);
|
final Plot myplot = PlotMain.getPlots(world).get(myid);
|
||||||
if ((myplot == null) || !myplot.hasOwner() || !(myplot.getOwner().equals(UUIDHandler.getUUID(plr)) || admin)) {
|
if ((myplot == null) || !myplot.hasOwner() || !(myplot.getOwner().equals(UUIDHandler.getUUID(plr)) || admin)) {
|
||||||
|
@ -53,11 +53,11 @@ import java.util.UUID;
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final Player plr, final String... args) {
|
public boolean execute(final Player plr, final String... args) {
|
||||||
if (!PlayerFunctions.isInPlot(plr)) {
|
Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
||||||
|
if (plot == null || plot.owner == null) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NEED_USER);
|
PlayerFunctions.sendMessage(plr, C.NEED_USER);
|
||||||
return true;
|
return true;
|
||||||
|
@ -74,7 +74,7 @@ public class Settings {
|
|||||||
/**
|
/**
|
||||||
* Max allowed plots
|
* Max allowed plots
|
||||||
*/
|
*/
|
||||||
public static int MAX_PLOTS = 20;
|
public static int MAX_PLOTS = 127;
|
||||||
/**
|
/**
|
||||||
* WorldGuard region on claimed plots
|
* WorldGuard region on claimed plots
|
||||||
*/
|
*/
|
||||||
|
@ -175,11 +175,8 @@ import java.util.*;
|
|||||||
if (id == null) {
|
if (id == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final HashMap<PlotId, Plot> plots = PlotMain.getPlots(world);
|
if (PlotMain.getPlots(world).containsKey(id)) {
|
||||||
if (plots != null) {
|
return PlotMain.getPlots(world).get(id);
|
||||||
if (plots.containsKey(id)) {
|
|
||||||
return plots.get(id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return new Plot(id, null, new ArrayList<UUID>(), new ArrayList<UUID>(), world.getName());
|
return new Plot(id, null, new ArrayList<UUID>(), new ArrayList<UUID>(), world.getName());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user