Check config values for exp & item sharing.

This commit is contained in:
GJ 2013-02-12 12:08:04 -05:00
parent bbc2091b77
commit 56056797bc
3 changed files with 14 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.Party; import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.party.ShareHandler; import com.gmail.nossr50.party.ShareHandler;
@ -18,6 +19,11 @@ public class PartyExpShareCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { 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")) { if (!Permissions.hasPermission(sender, "mcmmo.commands.party.expshare")) {
sender.sendMessage(command.getPermissionMessage()); sender.sendMessage(command.getPermissionMessage());
return true; return true;

View File

@ -5,6 +5,7 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.Party; import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.party.ShareHandler; import com.gmail.nossr50.party.ShareHandler;
@ -18,6 +19,11 @@ public class PartyItemShareCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { 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")) { if (!Permissions.hasPermission(sender, "mcmmo.commands.party.itemshare")) {
sender.sendMessage(command.getPermissionMessage()); sender.sendMessage(command.getPermissionMessage());
return true; return true;

View File

@ -554,6 +554,8 @@ Party.ShareType.Item=ITEM
Party.ShareMode.None=NONE Party.ShareMode.None=NONE
Party.ShareMode.Equal=EQUAL Party.ShareMode.Equal=EQUAL
Party.ShareMode.Random=RANDOM Party.ShareMode.Random=RANDOM
Party.ExpShare.Disabled=[[RED]]Party experience sharing is disabled.
Party.ItemShare.Disabled=[[RED]]Party item sharing is disabled.
##xp ##xp
Commands.XPGain.Acrobatics=Falling Commands.XPGain.Acrobatics=Falling