From 3e44450a7a504df698d76590e0816f727e3d9fee Mon Sep 17 00:00:00 2001 From: Tobias Ottenweller Date: Sun, 4 Mar 2012 21:34:24 +0100 Subject: [PATCH] introduction of CommandInfo --- src/org/mcteam/ancientgates/Plugin.java | 2 ++ .../ancientgates/commands/CommandHelp.java | 1 + .../ancientgates/commands/CommandInfo.java | 34 +++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 src/org/mcteam/ancientgates/commands/CommandInfo.java diff --git a/src/org/mcteam/ancientgates/Plugin.java b/src/org/mcteam/ancientgates/Plugin.java index 3b3546d..db88eaa 100644 --- a/src/org/mcteam/ancientgates/Plugin.java +++ b/src/org/mcteam/ancientgates/Plugin.java @@ -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(); diff --git a/src/org/mcteam/ancientgates/commands/CommandHelp.java b/src/org/mcteam/ancientgates/commands/CommandHelp.java index 53560f4..0ad30b0 100644 --- a/src/org/mcteam/ancientgates/commands/CommandHelp.java +++ b/src/org/mcteam/ancientgates/commands/CommandHelp.java @@ -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); } diff --git a/src/org/mcteam/ancientgates/commands/CommandInfo.java b/src/org/mcteam/ancientgates/commands/CommandInfo.java new file mode 100644 index 0000000..ae14d7d --- /dev/null +++ b/src/org/mcteam/ancientgates/commands/CommandInfo.java @@ -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"); + + } +}