public static MULTIbalancer.Speed[] ParseSpeedArray(MULTIbalancer plugin, String s)
{
MULTIbalancer.Speed[] speeds = new MULTIbalancer.Speed[3] {
MULTIbalancer.Speed.Adaptive,
MULTIbalancer.Speed.Adaptive,
MULTIbalancer.Speed.Adaptive
};
if (String.IsNullOrEmpty(s) || !s.Contains(",")) {
if (s == null) s = "(null)";
plugin.ConsoleWarn("Bad balance speed setting: " + s);
return speeds;
}
String[] strs = s.Split(new Char[] {','});
if (strs.Length != 3) {
plugin.ConsoleWarn("Wrong number of speeds, should be 3, separated by commas: " + s);
return speeds;
}
for (int i = 0; i < speeds.Length; ++i) {
try {
speeds[i] = (MULTIbalancer.Speed)Enum.Parse(typeof(MULTIbalancer.Speed), strs[i]);
} catch (Exception) {
plugin.ConsoleWarn("Bad balance speed value: " + strs[i]);
speeds[i] = MULTIbalancer.Speed.Adaptive;
}
}
return speeds;
}