This commit is contained in:
boy0001 2015-02-01 16:32:04 +11:00
parent 53a56b866a
commit 9a81e31cd6
4 changed files with 65 additions and 1 deletions

View File

@ -37,6 +37,7 @@ public enum Command {
// ratings)
// - /plot rate <number out of 10>
FLAG("flag", "f"),
TARGET("target"),
CLUSTER("cluster", "clusters"),
BUY("buy","b"),
CREATEROADSCHEMATIC("createroadschematic"),

View File

@ -49,7 +49,7 @@ public class MainCommand implements CommandExecutor, TabCompleter {
*/
public static final String MAIN_PERMISSION = "plots.use";
private final static SubCommand[] _subCommands = new SubCommand[]{new DebugSaveTest(), new DebugLoadTest(), new CreateRoadSchematic(), new RegenAllRoads(), new DebugClear(), new Ban(), new Unban(), new OP(), new DEOP(), new Claim(), new Paste(), new Copy(), new Clipboard(), new Auto(), new Home(), new Visit(), new TP(), new Set(), new Clear(), new Delete(), new SetOwner(), new Denied(), new Helpers(), new Trusted(), new Info(), new list(), new Help(), new Debug(), new Schematic(), new plugin(), new Inventory(), new Purge(), new Reload(), new Merge(), new Unlink(), new Kick(), new Setup(), new Rate(), new DebugClaimTest(), new Inbox(), new Comment(), new Database(), new Unclaim(), new Swap(), new MusicSubcommand(), new DebugRoadRegen(), new Trim(), new DebugExec(), new FlagCmd()};
private final static SubCommand[] _subCommands = new SubCommand[]{new DebugSaveTest(), new DebugLoadTest(), new CreateRoadSchematic(), new RegenAllRoads(), new DebugClear(), new Ban(), new Unban(), new OP(), new DEOP(), new Claim(), new Paste(), new Copy(), new Clipboard(), new Auto(), new Home(), new Visit(), new TP(), new Set(), new Clear(), new Delete(), new SetOwner(), new Denied(), new Helpers(), new Trusted(), new Info(), new list(), new Help(), new Debug(), new Schematic(), new plugin(), new Inventory(), new Purge(), new Reload(), new Merge(), new Unlink(), new Kick(), new Setup(), new Rate(), new DebugClaimTest(), new Inbox(), new Comment(), new Database(), new Unclaim(), new Swap(), new MusicSubcommand(), new DebugRoadRegen(), new Trim(), new DebugExec(), new FlagCmd(), new Target()};
public final static ArrayList<SubCommand> subCommands = new ArrayList<SubCommand>() {
{

View File

@ -0,0 +1,59 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
// PlotSquared - A plot manager and world generator for the Bukkit API /
// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
// /
// This program is free software; you can redistribute it and/or modify /
// it under the terms of the GNU General Public License as published by /
// the Free Software Foundation; either version 3 of the License, or /
// (at your option) any later version. /
// /
// This program is distributed in the hope that it will be useful, /
// but WITHOUT ANY WARRANTY; without even the implied warranty of /
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
// GNU General Public License for more details. /
// /
// You should have received a copy of the GNU General Public License /
// along with this program; if not, write to the Free Software Foundation, /
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
// /
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.util.PlayerFunctions;
import com.intellectualcrafters.plot.util.PlotHelper;
public class Target extends SubCommand {
public Target() {
super(Command.TARGET, "Target a plot with your compass", "target <X;Z>", CommandCategory.ACTIONS, true);
}
@Override
public boolean execute(final Player plr, final String... args) {
if (!PlotMain.isPlotWorld(plr.getWorld())) {
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
return false;
}
if (args.length == 1) {
PlotId id = PlotHelper.parseId(args[1]);
if (id == null) {
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
return false;
}
Location loc = PlotHelper.getPlotHome(plr.getWorld(), id);
plr.setCompassTarget(loc);
PlayerFunctions.sendMessage(plr, C.COMPASS_TARGET);
return true;
}
PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot target <X;Z>");
return false;
}
}

View File

@ -37,6 +37,10 @@ import com.intellectualsites.translation.bukkit.BukkitTranslation;
* @author Citymonstret
*/
public enum C {
/*
* Compass
*/
COMPASS_TARGET("&6Successfully targeted plot with compass"),
/*
* Cluster
*/