Commands refactoring
This commit is contained in:
parent
107de7551c
commit
7be2f02e03
@ -73,15 +73,15 @@ public class Plugin extends JavaPlugin
|
|||||||
commands.add(new CommandHelp());
|
commands.add(new CommandHelp());
|
||||||
commands.add(new CommandCreate());
|
commands.add(new CommandCreate());
|
||||||
commands.add(new CommandDelete());
|
commands.add(new CommandDelete());
|
||||||
commands.add(new CommandSetFrom());
|
commands.add(new CommandSetLocation());
|
||||||
commands.add(new CommandSetTo());
|
commands.add(new CommandSetExit());
|
||||||
commands.add(new CommandOpen());
|
commands.add(new CommandOpen());
|
||||||
commands.add(new CommandRename());
|
commands.add(new CommandRename());
|
||||||
commands.add(new CommandClose());
|
commands.add(new CommandClose());
|
||||||
commands.add(new CommandList());
|
commands.add(new CommandList());
|
||||||
commands.add(new CommandInfo());
|
commands.add(new CommandInfo());
|
||||||
commands.add(new CommandHide());
|
commands.add(new CommandSetHidden());
|
||||||
commands.add(new CommandUnhide());
|
commands.add(new CommandSetVisible());
|
||||||
|
|
||||||
|
|
||||||
// Register events
|
// Register events
|
||||||
|
@ -8,8 +8,11 @@ public class CommandClose extends BaseCommand
|
|||||||
public CommandClose()
|
public CommandClose()
|
||||||
{
|
{
|
||||||
aliases.add("close");
|
aliases.add("close");
|
||||||
|
|
||||||
requiredParameters.add("id");
|
requiredParameters.add("id");
|
||||||
helpDescription = "Close that gate";
|
|
||||||
|
helpDescription = "Closes a gate to prevent players from using it.";
|
||||||
|
|
||||||
requiredPermission = Plugin.permissionManage;
|
requiredPermission = Plugin.permissionManage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,7 +20,12 @@ public class CommandClose extends BaseCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
gate.setOpen(false);
|
try {
|
||||||
|
gate.setOpen(false);
|
||||||
|
}
|
||||||
|
catch(Exception e) {
|
||||||
|
}
|
||||||
|
|
||||||
sendMessage("The gate was closed.");
|
sendMessage("The gate was closed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,10 @@ public class CommandCreate extends BaseLocationCommand
|
|||||||
|
|
||||||
requiredParameters.add("id");
|
requiredParameters.add("id");
|
||||||
|
|
||||||
senderMustBePlayer = false;
|
senderMustBePlayer = true;
|
||||||
hasGateParam = false;
|
hasGateParam = false;
|
||||||
|
|
||||||
helpDescription = "Create a gate";
|
helpDescription = "Create a gate at the current location of the player.";
|
||||||
|
|
||||||
requiredPermission = Plugin.permissionManage;
|
requiredPermission = Plugin.permissionManage;
|
||||||
}
|
}
|
||||||
@ -26,24 +26,30 @@ public class CommandCreate extends BaseLocationCommand
|
|||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
String id = parameters.get(0);
|
String id = parameters.get(0);
|
||||||
if (Gate.exists(id))
|
|
||||||
{
|
|
||||||
sendMessage("There gate \"" + id + "\" already exists.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gate = Gate.create(id);
|
try {
|
||||||
|
gate = Gate.create(id);
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
Location playerLocation = getValidPlayerLocation();
|
Location playerLocation = getValidPlayerLocation();
|
||||||
|
|
||||||
if (playerLocation != null) {
|
if (playerLocation != null) {
|
||||||
gate.setLocation(playerLocation);
|
try {
|
||||||
|
gate.setLocation(playerLocation);
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
}
|
||||||
|
|
||||||
sendMessage("Gate with id \"" + id + "\" was created.\n The gates location has been set to your current location.");
|
sendMessage("Gate with id \"" + id + "\" was created.");
|
||||||
|
sendMessage("The gates location has been set to your current location.");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sendMessage("Gate with id \"" + id + "\" was created.\n Now you should build a frame and:");
|
sendMessage("Gate with id \"" + id + "\" was created.");
|
||||||
sendMessage(new CommandSetFrom().getUsageTemplate(true, true));
|
sendMessage("Now you should build a frame and:");
|
||||||
|
sendMessage(new CommandSetLocation().getUsageTemplate(true, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ import org.mcteam.ancientgates.Plugin;
|
|||||||
|
|
||||||
public class CommandDelete extends BaseCommand
|
public class CommandDelete extends BaseCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
public CommandDelete()
|
public CommandDelete()
|
||||||
{
|
{
|
||||||
aliases.add("delete");
|
aliases.add("delete");
|
||||||
@ -17,7 +16,7 @@ public class CommandDelete extends BaseCommand
|
|||||||
requiredParameters.add("id");
|
requiredParameters.add("id");
|
||||||
|
|
||||||
senderMustBePlayer = false;
|
senderMustBePlayer = false;
|
||||||
helpDescription = "Delete a gate";
|
helpDescription = "Removes the gate from the game.";
|
||||||
|
|
||||||
requiredPermission = Plugin.permissionManage;
|
requiredPermission = Plugin.permissionManage;
|
||||||
}
|
}
|
||||||
@ -25,10 +24,8 @@ public class CommandDelete extends BaseCommand
|
|||||||
|
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
gate.setOpen(false);
|
|
||||||
Gate.delete(gate.getId());
|
Gate.delete(gate.getId());
|
||||||
|
sendMessage("Gate with id '" + gate.getId() + "' was deleted.");
|
||||||
sendMessage("Gate with id \"" + gate.getId() + "\" was deleted.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ public class CommandHelp extends BaseCommand
|
|||||||
optionalParameters.add("page");
|
optionalParameters.add("page");
|
||||||
hasGateParam = false;
|
hasGateParam = false;
|
||||||
|
|
||||||
helpDescription = "Display a help page";
|
helpDescription = "Prints a list of all availible commands.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -72,8 +72,8 @@ public class CommandHelp extends BaseCommand
|
|||||||
pageLines.add( new CommandHelp().getUsageTemplate(true, true) );
|
pageLines.add( new CommandHelp().getUsageTemplate(true, true) );
|
||||||
pageLines.add( new CommandCreate().getUsageTemplate(true, true) );
|
pageLines.add( new CommandCreate().getUsageTemplate(true, true) );
|
||||||
pageLines.add( new CommandDelete().getUsageTemplate(true, true) );
|
pageLines.add( new CommandDelete().getUsageTemplate(true, true) );
|
||||||
pageLines.add( new CommandSetFrom().getUsageTemplate(true, true) );
|
pageLines.add( new CommandSetLocation().getUsageTemplate(true, true) );
|
||||||
pageLines.add( new CommandSetTo().getUsageTemplate(true, true) );
|
pageLines.add( new CommandSetExit().getUsageTemplate(true, true) );
|
||||||
pageLines.add( new CommandOpen().getUsageTemplate(true, true) );
|
pageLines.add( new CommandOpen().getUsageTemplate(true, true) );
|
||||||
|
|
||||||
helpPages.add(pageLines);
|
helpPages.add(pageLines);
|
||||||
@ -83,8 +83,8 @@ public class CommandHelp extends BaseCommand
|
|||||||
pageLines.add( new CommandClose().getUsageTemplate(true, true) );
|
pageLines.add( new CommandClose().getUsageTemplate(true, true) );
|
||||||
pageLines.add( new CommandList().getUsageTemplate(true, true) );
|
pageLines.add( new CommandList().getUsageTemplate(true, true) );
|
||||||
pageLines.add( new CommandInfo().getUsageTemplate(true, true) );
|
pageLines.add( new CommandInfo().getUsageTemplate(true, true) );
|
||||||
pageLines.add( new CommandHide().getUsageTemplate(true, true) );
|
pageLines.add( new CommandSetHidden().getUsageTemplate(true, true) );
|
||||||
pageLines.add( new CommandUnhide().getUsageTemplate(true, true) );
|
pageLines.add( new CommandSetVisible().getUsageTemplate(true, true) );
|
||||||
|
|
||||||
helpPages.add(pageLines);
|
helpPages.add(pageLines);
|
||||||
}
|
}
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
package org.mcteam.ancientgates.commands;
|
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
public class CommandHide extends BaseCommand
|
|
||||||
{
|
|
||||||
|
|
||||||
public CommandHide()
|
|
||||||
{
|
|
||||||
aliases.add("hide");
|
|
||||||
|
|
||||||
requiredParameters.add("id");
|
|
||||||
|
|
||||||
helpDescription = "Hide that gate";
|
|
||||||
}
|
|
||||||
|
|
||||||
public void perform()
|
|
||||||
{
|
|
||||||
gate.setHidden(true);
|
|
||||||
sendMessage("The gate " + gate.getId() + " is now hidden.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasPermission(CommandSender sender)
|
|
||||||
{
|
|
||||||
return sender.hasPermission(permissionManage);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,7 @@
|
|||||||
package org.mcteam.ancientgates.commands;
|
package org.mcteam.ancientgates.commands;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.mcteam.ancientgates.Plugin;
|
||||||
|
|
||||||
|
|
||||||
public class CommandInfo extends BaseCommand
|
public class CommandInfo extends BaseCommand
|
||||||
@ -13,7 +13,7 @@ public class CommandInfo extends BaseCommand
|
|||||||
|
|
||||||
requiredParameters.add("id");
|
requiredParameters.add("id");
|
||||||
|
|
||||||
helpDescription = "Prints information about a gate";
|
helpDescription = "Prints detailed informations about a certain gate.";
|
||||||
|
|
||||||
requiredPermission = Plugin.permissionInfo;
|
requiredPermission = Plugin.permissionInfo;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ public class CommandList extends BaseCommand
|
|||||||
optionalParameters.add("page");
|
optionalParameters.add("page");
|
||||||
hasGateParam = false;
|
hasGateParam = false;
|
||||||
|
|
||||||
helpDescription = "Display a list of the gates";
|
helpDescription = "Prints a list of all availible gates.";
|
||||||
|
|
||||||
requiredPermission = Plugin.permissionInfo;
|
requiredPermission = Plugin.permissionInfo;
|
||||||
}
|
}
|
||||||
|
@ -1,50 +1,34 @@
|
|||||||
package org.mcteam.ancientgates.commands;
|
package org.mcteam.ancientgates.commands;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.mcteam.ancientgates.Plugin;
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
public class CommandOpen extends BaseCommand {
|
|
||||||
|
|
||||||
public CommandOpen() {
|
public class CommandOpen extends BaseCommand
|
||||||
|
{
|
||||||
|
|
||||||
|
public CommandOpen()
|
||||||
|
{
|
||||||
aliases.add("open");
|
aliases.add("open");
|
||||||
|
|
||||||
requiredParameters.add("id");
|
requiredParameters.add("id");
|
||||||
|
|
||||||
helpDescription = "Open that gate";
|
helpDescription = "Open a gate so players can use it.";
|
||||||
}
|
|
||||||
|
|
||||||
public void perform() {
|
requiredPermission = Plugin.permissionManage;
|
||||||
if (gate.getLocation() == null) {
|
|
||||||
sendMessage("You must set the from location first. To fix that:");
|
|
||||||
sendMessage(new CommandSetFrom().getUsageTemplate(true, true));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gate.getExit() == null) {
|
|
||||||
sendMessage("Sure, but note that this gate does not point anywhere :P");
|
|
||||||
sendMessage("To fix that: " + new CommandSetTo().getUsageTemplate(true, true));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gate.getLocation().getBlock().getType() != Material.AIR) {
|
|
||||||
sendMessage("The gate could not open. The from location is not air.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gate.setOpen(true);
|
|
||||||
|
|
||||||
if (gate.isOpen()) {
|
|
||||||
sendMessage("The gate was opened.");
|
|
||||||
} else {
|
|
||||||
sendMessage("Failed to open the gate. Have you built a frame?");
|
|
||||||
sendMessage("More info here: " + new CommandHelp().getUsageTemplate(true, true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
public void perform()
|
||||||
public boolean hasPermission(CommandSender sender)
|
|
||||||
{
|
{
|
||||||
return sender.hasPermission(permissionManage);
|
try {
|
||||||
|
gate.setOpen(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
sendMessage(e.getMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sendMessage("The gate was opened.");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
package org.mcteam.ancientgates.commands;
|
package org.mcteam.ancientgates.commands;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.mcteam.ancientgates.Gate;
|
import org.mcteam.ancientgates.Gate;
|
||||||
|
import org.mcteam.ancientgates.Plugin;
|
||||||
|
|
||||||
|
|
||||||
public class CommandRename extends BaseCommand
|
public class CommandRename extends BaseCommand
|
||||||
@ -19,7 +18,9 @@ public class CommandRename extends BaseCommand
|
|||||||
requiredParameters.add("current name");
|
requiredParameters.add("current name");
|
||||||
requiredParameters.add("new name");
|
requiredParameters.add("new name");
|
||||||
|
|
||||||
helpDescription = "Change the name of a gate";
|
helpDescription = "Changes the id of a gate.";
|
||||||
|
|
||||||
|
requiredPermission = Plugin.permissionManage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ public class CommandRename extends BaseCommand
|
|||||||
String newId = parameters.get(1);
|
String newId = parameters.get(1);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Gate.rename(gate, newId);
|
Gate.rename(gate.getId(), newId);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
sendMessage("Cannot rename " + gate.getId() + ". There is already a gate named " + newId + ".");
|
sendMessage("Cannot rename " + gate.getId() + ". There is already a gate named " + newId + ".");
|
||||||
@ -37,10 +38,4 @@ public class CommandRename extends BaseCommand
|
|||||||
sendMessage("Gate " + gate.getId() + " is now known as " + newId + ".");
|
sendMessage("Gate " + gate.getId() + " is now known as " + newId + ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasPermission(CommandSender sender)
|
|
||||||
{
|
|
||||||
return sender.hasPermission(permissionManage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
34
src/org/mcteam/ancientgates/commands/CommandSetExit.java
Normal file
34
src/org/mcteam/ancientgates/commands/CommandSetExit.java
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package org.mcteam.ancientgates.commands;
|
||||||
|
|
||||||
|
import org.mcteam.ancientgates.Plugin;
|
||||||
|
|
||||||
|
|
||||||
|
public class CommandSetExit extends BaseCommand
|
||||||
|
{
|
||||||
|
|
||||||
|
public CommandSetExit()
|
||||||
|
{
|
||||||
|
aliases.add("setto");
|
||||||
|
aliases.add("st");
|
||||||
|
|
||||||
|
requiredParameters.add("id");
|
||||||
|
|
||||||
|
helpDescription = "Changes the location where the gate will teleport players to your current location.";
|
||||||
|
|
||||||
|
requiredPermission = Plugin.permissionManage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void perform()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
gate.setExit(player.getLocation());
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
sendMessage(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
sendMessage("The exit of gate '" + gate.getId() + "' is now where you stand.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,74 +0,0 @@
|
|||||||
package org.mcteam.ancientgates.commands;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
import org.mcteam.ancientgates.util.FloodUtil;
|
|
||||||
|
|
||||||
|
|
||||||
public class CommandSetFrom extends BaseCommand
|
|
||||||
{
|
|
||||||
|
|
||||||
public CommandSetFrom()
|
|
||||||
{
|
|
||||||
aliases.add("setfrom");
|
|
||||||
aliases.add("sf");
|
|
||||||
|
|
||||||
requiredParameters.add("id");
|
|
||||||
|
|
||||||
helpDescription = "Set \"from\" to your location.";
|
|
||||||
}
|
|
||||||
|
|
||||||
public void perform()
|
|
||||||
{
|
|
||||||
// The player might stand in a halfblock or a sign or whatever
|
|
||||||
// Therefore we load som extra locations and blocks
|
|
||||||
Block playerBlock = player.getLocation().getBlock();
|
|
||||||
Block upBlock = playerBlock.getRelative(BlockFace.UP);
|
|
||||||
Location playerUpLocation = new Location(player.getLocation().getWorld(),
|
|
||||||
player.getLocation().getX(),
|
|
||||||
player.getLocation().getY() + 1,
|
|
||||||
player.getLocation().getZ(),
|
|
||||||
player.getLocation().getYaw(),
|
|
||||||
player.getLocation().getPitch());
|
|
||||||
|
|
||||||
Set<Block> gateBlocks = FloodUtil.getGateFrameBlocks(player.getLocation().getBlock());
|
|
||||||
|
|
||||||
if (gateBlocks == null)
|
|
||||||
{
|
|
||||||
sendMessage("There is no portal here, or your portal is too large.\nMax size is: " /*+ Conf.getGateMaxArea()*/ + " Blocks.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (playerBlock.getType() == Material.AIR)
|
|
||||||
{
|
|
||||||
gate.setLocation(player.getLocation());
|
|
||||||
}
|
|
||||||
else if (upBlock.getType() == Material.AIR)
|
|
||||||
{
|
|
||||||
gate.setLocation(playerUpLocation);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sendMessage("There is not enough room for a gate to open here");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sendMessage("From location for gate \""+gate.getId()+"\" is now where you stand.");
|
|
||||||
sendMessage("Your gate includes " + gateBlocks.size() + " Blocks.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasPermission(CommandSender sender)
|
|
||||||
{
|
|
||||||
return sender.hasPermission(permissionManage);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
32
src/org/mcteam/ancientgates/commands/CommandSetHidden.java
Normal file
32
src/org/mcteam/ancientgates/commands/CommandSetHidden.java
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package org.mcteam.ancientgates.commands;
|
||||||
|
|
||||||
|
import org.mcteam.ancientgates.Plugin;
|
||||||
|
|
||||||
|
|
||||||
|
public class CommandSetHidden extends BaseCommand
|
||||||
|
{
|
||||||
|
public CommandSetHidden()
|
||||||
|
{
|
||||||
|
aliases.add("setHidden");
|
||||||
|
aliases.add("sh");
|
||||||
|
|
||||||
|
requiredParameters.add("id");
|
||||||
|
|
||||||
|
helpDescription = "Makes a gate NOT consist of gate blocks while open.";
|
||||||
|
|
||||||
|
requiredPermission = Plugin.permissionManage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void perform()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
gate.setHidden(true);
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
sendMessage(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
sendMessage("The gate '" + gate.getId() + "' is now hidden.");
|
||||||
|
}
|
||||||
|
}
|
44
src/org/mcteam/ancientgates/commands/CommandSetLocation.java
Normal file
44
src/org/mcteam/ancientgates/commands/CommandSetLocation.java
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package org.mcteam.ancientgates.commands;
|
||||||
|
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.mcteam.ancientgates.Plugin;
|
||||||
|
|
||||||
|
|
||||||
|
public class CommandSetLocation extends BaseLocationCommand
|
||||||
|
{
|
||||||
|
|
||||||
|
public CommandSetLocation()
|
||||||
|
{
|
||||||
|
aliases.add("setlocation");
|
||||||
|
aliases.add("sl");
|
||||||
|
|
||||||
|
requiredParameters.add("id");
|
||||||
|
|
||||||
|
helpDescription = "Set the entrance of the gate to your current location.";
|
||||||
|
|
||||||
|
requiredPermission = Plugin.permissionManage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void perform()
|
||||||
|
{
|
||||||
|
Location playerLocation = getValidPlayerLocation();
|
||||||
|
|
||||||
|
if (playerLocation == null) {
|
||||||
|
sendMessage("There is not enough room for a gate to open here");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
gate.setLocation(playerLocation);
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
sendMessage(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
sendMessage("The location of '" + gate.getId() + "' is now at your current location.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
package org.mcteam.ancientgates.commands;
|
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
public class CommandSetTo extends BaseCommand {
|
|
||||||
|
|
||||||
public CommandSetTo() {
|
|
||||||
aliases.add("setto");
|
|
||||||
aliases.add("st");
|
|
||||||
|
|
||||||
requiredParameters.add("id");
|
|
||||||
|
|
||||||
helpDescription = "Set \"to\" to your location.";
|
|
||||||
}
|
|
||||||
|
|
||||||
public void perform() {
|
|
||||||
gate.setExit(player.getLocation());
|
|
||||||
sendMessage("To location for gate \""+gate.getId()+"\" is now where you stand.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasPermission(CommandSender sender)
|
|
||||||
{
|
|
||||||
return sender.hasPermission(permissionManage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user