Small fixes and formatting

This commit is contained in:
Norbi Peti 2016-11-19 23:45:35 +01:00
parent 96daaf032d
commit 1748bc0461

View file

@ -21,22 +21,26 @@ public class DebugPotatoAPI {
potato.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 10); potato.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 10);
return potato; return potato;
} }
public static ItemStack CreateDebugPotato(String message) { public static ItemStack CreateDebugPotato(String message) {
return CreateDebugPotato(Arrays.asList(message)); return CreateDebugPotato(WordWrap(message));
} }
public static void SendDebugPotato(Player player, List<String> message) { public static void SendDebugPotato(Player player, List<String> message) {
player.getInventory().addItem(CreateDebugPotato(message)); player.getInventory().addItem(CreateDebugPotato(message));
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_SLIME_SQUISH, 0, 0); player.getWorld().playSound(player.getLocation(), Sound.ENTITY_SLIME_SQUISH, 0, 0);
return; return;
} }
public static void SendDebugPotato(Player player, String[] message) { public static void SendDebugPotato(Player player, String[] message) {
SendDebugPotato(player, Arrays.asList(message)); SendDebugPotato(player, Arrays.asList(message));
} }
public static void SendDebugPotato(Player player, String message){
SendDebugPotato(player, StringToMessage(message)); public static void SendDebugPotato(Player player, String message) {
SendDebugPotato(player, WordWrap(message));
} }
public static List<String> StringToMessage(String message){
public 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 = "";