From e518b58b23019a193176685df81e13942fdc99b8 Mon Sep 17 00:00:00 2001 From: GJ Date: Mon, 15 Jul 2013 09:48:14 -0400 Subject: [PATCH] Better way to do locale strings there. --- .../datatypes/party/ItemShareType.java | 6 +++++ .../gmail/nossr50/datatypes/party/Party.java | 23 ++++--------------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/datatypes/party/ItemShareType.java b/src/main/java/com/gmail/nossr50/datatypes/party/ItemShareType.java index 1f04e41e1..9cef89737 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/party/ItemShareType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/party/ItemShareType.java @@ -2,7 +2,9 @@ package com.gmail.nossr50.datatypes.party; import org.bukkit.inventory.ItemStack; +import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.ItemUtils; +import com.gmail.nossr50.util.StringUtils; public enum ItemShareType { LOOT, @@ -30,4 +32,8 @@ public enum ItemShareType { return null; } + + public String getLocaleString() { + return LocaleLoader.getString("Party.ItemShare.Category." + StringUtils.getCapitalized(this.toString())); + } } diff --git a/src/main/java/com/gmail/nossr50/datatypes/party/Party.java b/src/main/java/com/gmail/nossr50/datatypes/party/Party.java index 3a449ba99..acad8b7fb 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/party/Party.java +++ b/src/main/java/com/gmail/nossr50/datatypes/party/Party.java @@ -7,7 +7,6 @@ import java.util.List; import org.bukkit.entity.Player; import com.gmail.nossr50.mcMMO; -import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.party.ShareHandler.ShareMode; public class Party { @@ -88,24 +87,10 @@ public class Party { public List getItemShareCategories() { List shareCategories = new ArrayList(); - if (shareLootDrops) { - shareCategories.add(LocaleLoader.getString("Party.ItemShare.Category.Loot")); - } - - if (shareMiningDrops) { - shareCategories.add(LocaleLoader.getString("Party.ItemShare.Category.Mining")); - } - - if (shareHerbalismDrops) { - shareCategories.add(LocaleLoader.getString("Party.ItemShare.Category.Herbalism")); - } - - if (shareWoodcuttingDrops) { - shareCategories.add(LocaleLoader.getString("Party.ItemShare.Category.Woodcutting")); - } - - if (shareMiscDrops) { - shareCategories.add(LocaleLoader.getString("Party.ItemShare.Category.Misc")); + for (ItemShareType shareType : ItemShareType.values()) { + if (sharingDrops(shareType)) { + shareCategories.add(shareType.getLocaleString()); + } } return shareCategories;