mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
.
This commit is contained in:
parent
53a56b866a
commit
9a81e31cd6
@ -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"),
|
||||
|
@ -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>() {
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -37,6 +37,10 @@ import com.intellectualsites.translation.bukkit.BukkitTranslation;
|
||||
* @author Citymonstret
|
||||
*/
|
||||
public enum C {
|
||||
/*
|
||||
* Compass
|
||||
*/
|
||||
COMPASS_TARGET("&6Successfully targeted plot with compass"),
|
||||
/*
|
||||
* Cluster
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user