2013-01-04 03:17:49 +01:00
|
|
|
package com.pahimar.ee3.command;
|
|
|
|
|
2013-01-05 00:53:34 +01:00
|
|
|
import static com.pahimar.ee3.core.helper.LocalizationHelper.getLocalizedString;
|
|
|
|
import static com.pahimar.ee3.lib.Strings.*;
|
|
|
|
|
2013-01-04 03:17:49 +01:00
|
|
|
import net.minecraft.command.ICommandSender;
|
|
|
|
import net.minecraft.command.WrongUsageException;
|
|
|
|
|
|
|
|
import com.pahimar.ee3.configuration.ConfigurationHandler;
|
|
|
|
import com.pahimar.ee3.configuration.ConfigurationSettings;
|
|
|
|
|
|
|
|
public class CommandSounds {
|
|
|
|
|
|
|
|
public static void processCommand(ICommandSender commandSender, String[] args) {
|
|
|
|
|
|
|
|
String subCommand;
|
|
|
|
|
|
|
|
if (args.length > 0) {
|
|
|
|
subCommand = args[0];
|
|
|
|
|
2013-01-05 00:53:34 +01:00
|
|
|
if (subCommand.toLowerCase().equals(getLocalizedString(COMMAND_ALL))) {
|
2013-01-04 03:17:49 +01:00
|
|
|
processAllCommand(commandSender);
|
|
|
|
}
|
2013-01-05 00:53:34 +01:00
|
|
|
else if (subCommand.toLowerCase().equals(getLocalizedString(COMMAND_SELF))) {
|
2013-01-04 03:17:49 +01:00
|
|
|
processSelfCommand(commandSender);
|
|
|
|
}
|
2013-01-05 00:53:34 +01:00
|
|
|
else if (subCommand.toLowerCase().equals(getLocalizedString(COMMAND_OFF))) {
|
2013-01-04 03:17:49 +01:00
|
|
|
processOffCommand(commandSender);
|
|
|
|
}
|
|
|
|
else {
|
2013-01-05 00:53:34 +01:00
|
|
|
throw new WrongUsageException(getLocalizedString(COMMAND_SOUNDS_USAGE), new Object[0]);
|
2013-01-04 03:17:49 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2013-01-05 00:53:34 +01:00
|
|
|
throw new WrongUsageException(getLocalizedString(COMMAND_SOUNDS_USAGE), new Object[0]);
|
2013-01-04 03:17:49 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private static void processAllCommand(ICommandSender commandSender) {
|
|
|
|
|
2013-01-05 00:53:34 +01:00
|
|
|
ConfigurationSettings.ENABLE_SOUNDS = ALL;
|
|
|
|
ConfigurationHandler.set(ConfigurationHandler.CATEGORY_AUDIO, ConfigurationSettings.ENABLE_SOUNDS_CONFIGNAME, ALL);
|
|
|
|
commandSender.sendChatToPlayer(getLocalizedString(COMMAND_SOUNDS_SET_TO_ALL));
|
2013-01-04 03:17:49 +01:00
|
|
|
}
|
2013-01-05 00:53:34 +01:00
|
|
|
|
2013-01-04 03:17:49 +01:00
|
|
|
private static void processSelfCommand(ICommandSender commandSender) {
|
|
|
|
|
2013-01-05 00:53:34 +01:00
|
|
|
ConfigurationSettings.ENABLE_SOUNDS = SELF;
|
|
|
|
ConfigurationHandler.set(ConfigurationHandler.CATEGORY_AUDIO, ConfigurationSettings.ENABLE_SOUNDS_CONFIGNAME, SELF);
|
|
|
|
commandSender.sendChatToPlayer(getLocalizedString(COMMAND_SOUNDS_SET_TO_SELF));
|
2013-01-04 03:17:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private static void processOffCommand(ICommandSender commandSender) {
|
|
|
|
|
2013-01-05 00:53:34 +01:00
|
|
|
ConfigurationSettings.ENABLE_SOUNDS = OFF;
|
|
|
|
ConfigurationHandler.set(ConfigurationHandler.CATEGORY_AUDIO, ConfigurationSettings.ENABLE_SOUNDS_CONFIGNAME, OFF);
|
|
|
|
commandSender.sendChatToPlayer(getLocalizedString(COMMAND_SOUNDS_TURNED_OFF));
|
2013-01-04 03:17:49 +01:00
|
|
|
}
|
|
|
|
}
|