diff --git a/plugin/me/insanj/pride/Pride.java b/plugin/me/insanj/pride/Pride.java index df7ac4b..0ec2b57 100644 --- a/plugin/me/insanj/pride/Pride.java +++ b/plugin/me/insanj/pride/Pride.java @@ -179,24 +179,19 @@ public boolean onCommand(CommandSender sender, Command command, String label, St return false; } - Boolean foundComma = false; - String firstAreaName = ""; - String secondAreaName = ""; + String argString = ""; for (String arg : args) { - if (arg.contains(",") == true) { - String[] splitStrings = arg.split(","); - firstAreaName += splitStrings[0]; - secondAreaName += splitStrings[splitStrings.length-1].trim(); - foundComma = true; - } else if (foundComma == true) { - secondAreaName += arg + " "; - } else { - firstAreaName += arg + " "; - } + argString += arg + " "; + } + + String[] argSplit = argString.split(","); + if (argSplit.length != 2) { + sender.sendMessage(ChatColor.RED + "Use a comma to separate the two Pride areas"); + return false; } - firstAreaName = firstAreaName.trim(); - secondAreaName = secondAreaName.trim(); + String firstAreaName = argSplit[0].trim(); + String secondAreaName = argSplit[1].trim(); Location firstAreaLocation = (Location)saved.get(firstAreaName); if (firstAreaLocation == null) { @@ -206,7 +201,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St Location secondAreaLocation = (Location)saved.get(secondAreaName); if (secondAreaLocation == null) { - sender.sendMessage("Could not find both area: " + ChatColor.RED + secondAreaName); + sender.sendMessage("Could not find area: " + ChatColor.RED + secondAreaName); return false; } diff --git a/plugin/plugin.yml b/plugin/plugin.yml index b35469a..7408271 100644 --- a/plugin/plugin.yml +++ b/plugin/plugin.yml @@ -1,6 +1,6 @@ name: pride main: me.insanj.pride.Pride -version: 0.3.7 +version: 0.3.8 description: keep track of your playmates in minecraft commands: settle: