mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-01-19 08:55:25 +01:00
Move is no longer debug
This commit is contained in:
parent
e2878e7ec5
commit
d0d7fb2ae8
@ -20,9 +20,13 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.config.C;
|
||||||
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created 2014-08-01 for PlotSquared
|
* Created 2014-08-01 for PlotSquared
|
||||||
@ -31,38 +35,46 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
|||||||
*/
|
*/
|
||||||
public class Move extends SubCommand {
|
public class Move extends SubCommand {
|
||||||
public Move() {
|
public Move() {
|
||||||
super("debugmove", "plots.admin", "plot moving debug test", "debugmove", "move", CommandCategory.DEBUG, true);
|
super("debugmove", "plots.move", "Move a plot", "move", "", CommandCategory.ACTIONS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (plr == null) {
|
if (args.length < 1) {
|
||||||
MainUtil.sendMessage(plr, "MUST BE EXECUTED BY PLAYER");
|
MainUtil.sendMessage(plr, C.NEED_PLOT_ID);
|
||||||
}
|
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot move <X;Z>");
|
||||||
if (args.length != 2) {
|
|
||||||
MainUtil.sendMessage(plr, "/plot move <pos1> <pos2>");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String world = plr.getLocation().getWorld();
|
final Location loc = plr.getLocation();
|
||||||
final PlotId plot1 = MainUtil.parseId(args[0]);
|
final Plot plot1 = MainUtil.getPlot(loc);
|
||||||
|
if (plot1 == null) {
|
||||||
|
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
|
}
|
||||||
|
if (!plot1.isAdded(plr.getUUID()) && !plr.hasPermission(Permissions.ADMIN)) {
|
||||||
|
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final String world = loc.getWorld();
|
||||||
final PlotId plot2 = MainUtil.parseId(args[1]);
|
final PlotId plot2 = MainUtil.parseId(args[1]);
|
||||||
if ((plot1 == null) || (plot2 == null)) {
|
if ((plot2 == null)) {
|
||||||
MainUtil.sendMessage(plr, "INVALID PLOT ID\n/plot move <pos1> <pos2>");
|
MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID);
|
||||||
|
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot move <X;Z>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot1 == plot2) {
|
if (plot1.id.equals(plot2)) {
|
||||||
MainUtil.sendMessage(plr, "DUPLICATE ID");
|
MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID);
|
||||||
|
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot move <X;Z>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (MainUtil.move(world, plot1, plot2, new Runnable() {
|
if (MainUtil.move(world, plot1.id, plot2, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MainUtil.sendMessage(plr, "MOVE SUCCESS");
|
MainUtil.sendMessage(plr, C.MOVE_SUCCESS);
|
||||||
}
|
}
|
||||||
})) {
|
})) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(plr, "MOVE FAILED");
|
MainUtil.sendMessage(plr, C.REQUIRES_UNOWNED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,11 @@ import com.intellectualsites.translation.bukkit.BukkitTranslation;
|
|||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
*/
|
*/
|
||||||
public enum C {
|
public enum C {
|
||||||
|
/*
|
||||||
|
* Move
|
||||||
|
*/
|
||||||
|
MOVE_SUCCESS("$4Successfully moved plot."),
|
||||||
|
REQUIRES_UNOWNED("$2The location specified is already occupied."),
|
||||||
/*
|
/*
|
||||||
* Compass
|
* Compass
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user