Adjusted so that error messages fit

This commit is contained in:
alisolarflare 2016-11-19 14:21:01 -05:00
parent ffec075d53
commit 5f9502bf10
4 changed files with 28 additions and 12 deletions

View file

@ -59,7 +59,7 @@ commands:
description: activate every player's power description: activate every player's power
setproximitylocation: setproximitylocation:
description: sets one of two proximity blocks to create a space that players can change their flairs with using flairportals. Ask ali XD description: sets one of two proximity blocks to create a space that players can change their flairs with using flairportals. Ask ali XD
getLoginMetrics: getloginmetrics:
description: Gets metrics description: Gets metrics
getinsurance: getinsurance:
description: Gets insurance description: Gets insurance

View file

@ -1,5 +1,6 @@
package alisolarflare.components; package alisolarflare.components;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -25,14 +26,37 @@ public abstract class BaseCommand extends TBMCCommandBase{
public static ItemStack CreateDebugPotato(String message){ public static ItemStack CreateDebugPotato(String message){
return CreateDebugPotato(Arrays.asList(message)); return CreateDebugPotato(Arrays.asList(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 List<String> StringToMessage(String message){
String[] splitString = message.split("\\s+");
List<String> newMessage = new ArrayList<String>();
String currentLine = "";
int currentLineLength = 0;
int wordlength;
int maxLineLength = 40;
for (String word : splitString){
wordlength = word.length();
if (currentLineLength == 0 || (currentLineLength + wordlength) < maxLineLength){
currentLine += word + " ";
currentLineLength += wordlength +1;
}else{
newMessage.add(currentLine);
currentLine = word + " ";
currentLineLength = word.length();
}
}
return newMessage;
}
} }

View file

@ -16,10 +16,7 @@ public class getInsuranceBar extends ModCommand {
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Ingot, Integer.parseInt(args[0]))); player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Ingot, Integer.parseInt(args[0])));
}else{ }else{
player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Ingot)); player.getInventory().addItem(Insurance.getInsurance(InsuranceType.Ingot));
SendDebugPotato(player, "Hwat the fuck!");
} }
return false; return true;
} }
} }

View file

@ -22,9 +22,4 @@ public class GetLoginMetrics extends ModCommand{
} }
return true; return true;
} }
@Override
public String GetCommandPath(){
return "getLoginMetrics";
}
} }