Add a date filter for buycraft's different format

This commit is contained in:
AlexTheCoder 2018-09-13 04:29:05 -05:00
parent 8053b9b90f
commit 805baec25e
1 changed files with 11 additions and 2 deletions

View File

@ -267,13 +267,22 @@ public class Enjin extends MiniPlugin implements CommandExecutor
protected boolean checkForPowerPlayClub(String[] args, final String name, final UUID playerUUID, final CoreClient client)
{
if (args.length < 3 || !args[0].equalsIgnoreCase("powerplayclub"))
if (args.length < 5 || !args[0].equalsIgnoreCase("powerplayclub"))
return false;
if (args[2].equalsIgnoreCase("add"))
{
boolean bc = args.length > 5 && args[5].equalsIgnoreCase("bc");
String[] splitDate = args[3].split("/");
LocalDate date = LocalDate.of(Integer.parseInt(splitDate[2]), Integer.parseInt(splitDate[0]), Integer.parseInt(splitDate[1]));
LocalDate date;
if (bc)
{
date = LocalDate.of(2000 + Integer.parseInt(splitDate[2]), Integer.parseInt(splitDate[1]), Integer.parseInt(splitDate[0]));
}
else
{
date = LocalDate.of(Integer.parseInt(splitDate[2]), Integer.parseInt(splitDate[0]), Integer.parseInt(splitDate[1]));
}
String duration = args[4];