diff --git a/PlotSquared/src/com/intellectualcrafters/plot/C.java b/PlotSquared/src/com/intellectualcrafters/plot/C.java index 82562509c..733c4dc34 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/C.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/C.java @@ -23,6 +23,7 @@ public enum C { PASTED("&cThe plot selection was successfully pasted"), PASTE_FAILED("&cFailed to paste the selection. Reason: &c%s"), NO_CLIPBOARD("&cYou don't have a selection in your clipboard"), + CLIPBOARD_INFO("&Current Clipboard - Plot ID: &6%id&c, Width: &6%width&c, Total Blocks: &6%total&c"), /* * Ratings */ diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotSelection.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotSelection.java index 7bc6bc511..3d1875594 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlotSelection.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotSelection.java @@ -17,8 +17,11 @@ public class PlotSelection { private int width; + private Plot plot; + public PlotSelection(int width, World world, Plot plot) { this.width = width; + this.plot = plot; plotBlocks = new PlotBlock[(width * width) * (world.getMaxHeight() - 1)]; @@ -57,6 +60,10 @@ public class PlotSelection { return width; } + public Plot getPlot() { + return plot; + } + public void paste(World world, Plot plot) { Location bot = PlotHelper.getPlotBottomLocAbs(world, plot.getId()), diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Clipboard.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Clipboard.java new file mode 100644 index 000000000..fbe053a3f --- /dev/null +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Clipboard.java @@ -0,0 +1,39 @@ +package com.intellectualcrafters.plot.commands; + +import com.intellectualcrafters.plot.C; +import com.intellectualcrafters.plot.PlayerFunctions; +import com.intellectualcrafters.plot.PlotId; +import com.intellectualcrafters.plot.PlotSelection; +import org.bukkit.entity.Player; + +import static com.intellectualcrafters.plot.PlotSelection.currentSelection; +/** + * Created by Citymonstret on 2014-10-13. + */ +public class Clipboard extends SubCommand { + + public Clipboard() { + super(Command.CLIPBOARD, "View information about your current copy", "clipboard", CommandCategory.INFO); + } + + @Override + public boolean execute(Player plr, String... args) { + if(!currentSelection.containsKey(plr.getName())) { + sendMessage(plr, C.NO_CLIPBOARD); + return true; + } + PlotSelection selection = currentSelection.get(plr.getName()); + + PlotId plotId = selection.getPlot().getId(); + int width = selection.getWidth(); + int total = selection.getBlocks().length; + + String message = C.CLIPBOARD_INFO.s(); + + message = message.replace("%id", plotId.toString()).replace("%width", width + "").replace("%total", total + ""); + + PlayerFunctions.sendMessage(plr, message); + + return true; + } +} diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Command.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Command.java index b21ec6815..3f7bdcf87 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Command.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Command.java @@ -33,6 +33,7 @@ public enum Command { * */ PASTE("paste"), + CLIPBOARD("clipboard", "cboard"), COPY("copy"), /** * diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/MainCommand.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/MainCommand.java index 0803d842d..58f96ef6b 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/MainCommand.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/MainCommand.java @@ -27,7 +27,7 @@ import java.util.Arrays; */ public class MainCommand implements CommandExecutor { - private static SubCommand[] _subCommands = new SubCommand[] { new Claim(), new Paste(), new Copy(), new Auto(), new Home(), new Visit(), + private static SubCommand[] _subCommands = new SubCommand[] { 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 Reload(), new Merge(), new Unlink(), new Kick(), new Setup() };