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