introduction of CommandInfo

This commit is contained in:
Tobias Ottenweller 2012-03-04 21:34:24 +01:00
parent 7af7e42d38
commit 3e44450a7a
3 changed files with 37 additions and 0 deletions

View File

@ -21,6 +21,7 @@ import org.mcteam.ancientgates.commands.CommandCreate;
import org.mcteam.ancientgates.commands.CommandCreateSetFrom;
import org.mcteam.ancientgates.commands.CommandDelete;
import org.mcteam.ancientgates.commands.CommandHelp;
import org.mcteam.ancientgates.commands.CommandInfo;
import org.mcteam.ancientgates.commands.CommandList;
import org.mcteam.ancientgates.commands.CommandOpen;
import org.mcteam.ancientgates.commands.CommandRename;
@ -74,6 +75,7 @@ public class Plugin extends JavaPlugin {
commands.add(new CommandRename());
commands.add(new CommandClose());
commands.add(new CommandList());
commands.add(new CommandInfo());
// Ensure basefolder exists!
this.getDataFolder().mkdirs();

View File

@ -75,6 +75,7 @@ public class CommandHelp extends BaseCommand {
pageLines.add( new CommandRename().getUseageTemplate(true, true) );
pageLines.add( new CommandClose().getUseageTemplate(true, true) );
pageLines.add( new CommandList().getUseageTemplate(true, true) );
pageLines.add( new CommandInfo().getUseageTemplate(true, true) );
helpPages.add(pageLines);
}

View File

@ -0,0 +1,34 @@
package org.mcteam.ancientgates.commands;
import org.bukkit.ChatColor;
public class CommandInfo extends BaseCommand
{
public CommandInfo()
{
aliases.add("info");
aliases.add("details");
requiredParameters.add("id");
helpDescription = "Prints information about a gate";
}
public void perform()
{
sendMessage(ChatColor.LIGHT_PURPLE + "Information about " + ChatColor.WHITE + gate.getId() + ChatColor.LIGHT_PURPLE + ":");
if (gate.getFrom() != null)
sendMessage(ChatColor.GREEN + "'from' location: " + ChatColor.YELLOW + "( " + gate.getFrom().getBlockX() + " | " + gate.getFrom().getBlockY() + " | " + gate.getFrom().getBlockZ() + " )");
else
sendMessage(ChatColor.GREEN + "this gate has no 'from' location");
if (gate.getTo() != null)
sendMessage(ChatColor.GREEN + "'to' location: " + ChatColor.YELLOW + "( " + gate.getTo().getBlockX() + " | " + gate.getTo().getBlockY() + " | " + gate.getTo().getBlockZ() + " )");
else
sendMessage(ChatColor.GREEN + "this gate has no 'to' location");
}
}