From 995f40c9abc82c0dcd036e31d18469029d81c26f Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sun, 20 Nov 2016 02:26:43 +0100 Subject: [PATCH] Added documentation and Gary --- .../java/buttondevteam/lib/DebugPotato.java | 46 ++++++++++++++++++- src/main/java/buttondevteam/lib/Gary.java | 34 ++++++++++++++ 2 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 src/main/java/buttondevteam/lib/Gary.java diff --git a/src/main/java/buttondevteam/lib/DebugPotato.java b/src/main/java/buttondevteam/lib/DebugPotato.java index 2b68089..d55f124 100644 --- a/src/main/java/buttondevteam/lib/DebugPotato.java +++ b/src/main/java/buttondevteam/lib/DebugPotato.java @@ -10,39 +10,83 @@ public class DebugPotato { private List message; private String type; + /** + * Send the debug potato to a player + * + * @param player + * The player + */ public void Send(Player player) { DebugPotatoAPI.SendDebugPotato(this, player); } + /** + * Get the message (lore of the potato). + * + * @return The message + */ public List getMessage() { return message; } + /** + * Sets the message (lore of the potato). + * + * @param message + * The message + * @return This potato + */ public DebugPotato setMessage(List message) { this.message = message; return this; } + /** + * Sets the message (lore of the potato). It will be word wrapped automatically. + * + * @param message + * The message + * @return This potato + */ public DebugPotato setMessage(String message) { this.message = WordWrap(message); return this; } + /** + * Sets the message (lore of the potato). + * + * @param message + * The message + * @return This potato + */ public DebugPotato setMessage(String[] message) { this.message = Arrays.asList(message); return this; } + /** + * Gets the type (potato name). + * + * @return The type + */ public String getType() { return type; } + /** + * Sets the type (potato name). + * + * @param type + * The type + * @return This potato + */ public DebugPotato setType(String type) { this.type = type; return this; } - public static List WordWrap(String message) { + private static List WordWrap(String message) { String[] splitString = message.split("\\s+"); List newMessage = new ArrayList(); String currentLine = ""; diff --git a/src/main/java/buttondevteam/lib/Gary.java b/src/main/java/buttondevteam/lib/Gary.java new file mode 100644 index 0000000..beed5ca --- /dev/null +++ b/src/main/java/buttondevteam/lib/Gary.java @@ -0,0 +1,34 @@ +package buttondevteam.lib; + +import java.util.List; + +public class Gary extends DebugPotato { + + public Gary() { + super.setMessage("I'M A POTATO"); + } + + /** + * Gary has a fixed message, therefore this method has no effect. + */ + @Override + public DebugPotato setMessage(List message) { + return this; + } + + /** + * Gary has a fixed message, therefore this method has no effect. + */ + @Override + public DebugPotato setMessage(String message) { + return this; + } + + /** + * Gary has a fixed message, therefore this method has no effect. + */ + @Override + public DebugPotato setMessage(String[] message) { + return this; + } +}