Added documentation and Gary

This commit is contained in:
Norbi Peti 2016-11-20 02:26:43 +01:00
parent a713fb987e
commit 995f40c9ab
2 changed files with 79 additions and 1 deletions

View file

@ -10,39 +10,83 @@ public class DebugPotato {
private List<String> message; private List<String> message;
private String type; private String type;
/**
* Send the debug potato to a player
*
* @param player
* The player
*/
public void Send(Player player) { public void Send(Player player) {
DebugPotatoAPI.SendDebugPotato(this, player); DebugPotatoAPI.SendDebugPotato(this, player);
} }
/**
* Get the message (lore of the potato).
*
* @return The message
*/
public List<String> getMessage() { public List<String> getMessage() {
return message; return message;
} }
/**
* Sets the message (lore of the potato).
*
* @param message
* The message
* @return This potato
*/
public DebugPotato setMessage(List<String> message) { public DebugPotato setMessage(List<String> message) {
this.message = message; this.message = message;
return this; 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) { public DebugPotato setMessage(String message) {
this.message = WordWrap(message); this.message = WordWrap(message);
return this; return this;
} }
/**
* Sets the message (lore of the potato).
*
* @param message
* The message
* @return This potato
*/
public DebugPotato setMessage(String[] message) { public DebugPotato setMessage(String[] message) {
this.message = Arrays.asList(message); this.message = Arrays.asList(message);
return this; return this;
} }
/**
* Gets the type (potato name).
*
* @return The type
*/
public String getType() { public String getType() {
return type; return type;
} }
/**
* Sets the type (potato name).
*
* @param type
* The type
* @return This potato
*/
public DebugPotato setType(String type) { public DebugPotato setType(String type) {
this.type = type; this.type = type;
return this; return this;
} }
public static List<String> WordWrap(String message) { private static List<String> WordWrap(String message) {
String[] splitString = message.split("\\s+"); String[] splitString = message.split("\\s+");
List<String> newMessage = new ArrayList<String>(); List<String> newMessage = new ArrayList<String>();
String currentLine = ""; String currentLine = "";

View file

@ -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<String> 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;
}
}