From 56056797bc983205fdd311c894bc455b692852a5 Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 12 Feb 2013 12:08:04 -0500 Subject: [PATCH] Check config values for exp & item sharing. --- .../gmail/nossr50/party/commands/PartyExpShareCommand.java | 6 ++++++ .../gmail/nossr50/party/commands/PartyItemShareCommand.java | 6 ++++++ src/main/resources/locale/locale_en_US.properties | 2 ++ 3 files changed, 14 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/party/commands/PartyExpShareCommand.java b/src/main/java/com/gmail/nossr50/party/commands/PartyExpShareCommand.java index 68d8a0780..668040483 100644 --- a/src/main/java/com/gmail/nossr50/party/commands/PartyExpShareCommand.java +++ b/src/main/java/com/gmail/nossr50/party/commands/PartyExpShareCommand.java @@ -5,6 +5,7 @@ import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.party.Party; import com.gmail.nossr50.party.ShareHandler; @@ -18,6 +19,11 @@ public class PartyExpShareCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!Config.getInstance().getExpShareEnabled()) { + sender.sendMessage(LocaleLoader.getString("Party.ExpShare.Disabled")); + return true; + } + if (!Permissions.hasPermission(sender, "mcmmo.commands.party.expshare")) { sender.sendMessage(command.getPermissionMessage()); return true; diff --git a/src/main/java/com/gmail/nossr50/party/commands/PartyItemShareCommand.java b/src/main/java/com/gmail/nossr50/party/commands/PartyItemShareCommand.java index d204250c3..310b2d60f 100644 --- a/src/main/java/com/gmail/nossr50/party/commands/PartyItemShareCommand.java +++ b/src/main/java/com/gmail/nossr50/party/commands/PartyItemShareCommand.java @@ -5,6 +5,7 @@ import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import com.gmail.nossr50.config.Config; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.party.Party; import com.gmail.nossr50.party.ShareHandler; @@ -18,6 +19,11 @@ public class PartyItemShareCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!Config.getInstance().getItemShareEnabled()) { + sender.sendMessage(LocaleLoader.getString("Party.ItemShare.Disabled")); + return true; + } + if (!Permissions.hasPermission(sender, "mcmmo.commands.party.itemshare")) { sender.sendMessage(command.getPermissionMessage()); return true; diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index a60ce237b..1f7c11acc 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -554,6 +554,8 @@ Party.ShareType.Item=ITEM Party.ShareMode.None=NONE Party.ShareMode.Equal=EQUAL Party.ShareMode.Random=RANDOM +Party.ExpShare.Disabled=[[RED]]Party experience sharing is disabled. +Party.ItemShare.Disabled=[[RED]]Party item sharing is disabled. ##xp Commands.XPGain.Acrobatics=Falling