From 433c99e2399b5d18d4c610e2a08bfd082b201c92 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Tue, 5 Feb 2013 13:23:12 +0100 Subject: [PATCH] Clean up --- .../nossr50/party/commands/PartyCommand.java | 68 ++++++++++--------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/party/commands/PartyCommand.java b/src/main/java/com/gmail/nossr50/party/commands/PartyCommand.java index 3e8ff6901..58426a328 100644 --- a/src/main/java/com/gmail/nossr50/party/commands/PartyCommand.java +++ b/src/main/java/com/gmail/nossr50/party/commands/PartyCommand.java @@ -216,7 +216,6 @@ public class PartyCommand implements CommandExecutor { return true; // End before any event is fired. } - // TODO: We shoudln't fire the event before checking if the password is correct if (party != null) { McMMOPartyChangeEvent event = new McMMOPartyChangeEvent(player, party.getName(), targetParty.getName(), EventReason.CHANGED_PARTIES); mcMMO.p.getServer().getPluginManager().callEvent(event); @@ -362,7 +361,7 @@ public class PartyCommand implements CommandExecutor { } if (args.length < 2) { - player.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "expshare", "[sharemode]")); + player.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "expshare", "[NONE / EQUAL]")); return true; } @@ -376,13 +375,18 @@ public class PartyCommand implements CommandExecutor { for (Player onlineMembers : party.getOnlineMembers()) { onlineMembers.sendMessage(LocaleLoader.getString("Commands.Party.SetSharing", LocaleLoader.getString("Party.ShareType.Exp"), LocaleLoader.getString("Party.ShareMode.NoShare"))); } - } else if (args[1].equalsIgnoreCase("equal") || args[1].equalsIgnoreCase("even")) { + } + else if (args[1].equalsIgnoreCase("equal") || args[1].equalsIgnoreCase("even")) { party.setXpShareMode(ShareHandler.XpShareMode.EQUAL); for (Player onlineMembers : party.getOnlineMembers()) { onlineMembers.sendMessage(LocaleLoader.getString("Commands.Party.SetSharing", LocaleLoader.getString("Party.ShareType.Exp"), LocaleLoader.getString("Party.ShareMode.Equal"))); } } + else { + player.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "expshare", "[NONE / EQUAL]")); + return true; + } } return true; @@ -565,24 +569,23 @@ public class PartyCommand implements CommandExecutor { String playerName = player.getName(); Party party = mcMMOPlayer.getParty(); - if (party != null) { - if (party.getLeader().equals(playerName)) { - if (party.isLocked()) { - player.sendMessage(LocaleLoader.getString("Party.IsLocked")); - } - else { - party.setLocked(true); - player.sendMessage(LocaleLoader.getString("Party.Locked")); - } - } - else { - player.sendMessage(LocaleLoader.getString("Party.NotOwner")); - } - } - else { + if (party == null) { player.sendMessage("Commands.Party.None"); + return true; } + if (!party.getLeader().equals(playerName)) { + player.sendMessage(LocaleLoader.getString("Party.NotOwner")); + return true; + } + + if (party.isLocked()) { + player.sendMessage(LocaleLoader.getString("Party.IsLocked")); + } + else { + party.setLocked(true); + player.sendMessage(LocaleLoader.getString("Party.Locked")); + } return true; } @@ -597,24 +600,23 @@ public class PartyCommand implements CommandExecutor { String playerName = player.getName(); Party party = mcMMOPlayer.getParty(); - if (party != null) { - if (party.getLeader().equals(playerName)) { - if (!party.isLocked()) { - player.sendMessage(LocaleLoader.getString("Party.IsntLocked")); - } - else { - party.setLocked(false); - player.sendMessage(LocaleLoader.getString("Party.Unlocked")); - } - } - else { - player.sendMessage(LocaleLoader.getString("Party.NotOwner")); - } - } - else { + if (party == null) { player.sendMessage("Commands.Party.None"); + return true; } + if (!party.getLeader().equals(playerName)) { + player.sendMessage(LocaleLoader.getString("Party.NotOwner")); + return true; + } + + if (!party.isLocked()) { + player.sendMessage(LocaleLoader.getString("Party.IsntLocked")); + } + else { + party.setLocked(false); + player.sendMessage(LocaleLoader.getString("Party.Unlocked")); + } return true; }