aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/commands/BlockSlayerCommand.java
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2020-11-26 16:10:11 -0500
committerGitHub <noreply@github.com>2020-11-26 16:10:11 -0500
commit016814851e46acdbc7a8fce44746eb67feef5905 (patch)
treeb39ca6496c233efe327dcdff0379f50b5cc6e243 /src/main/java/me/Danker/commands/BlockSlayerCommand.java
parent292f5dde43c3e00b78e1d4e772ae336340b0a834 (diff)
parent16f1cd3c009184e8c8f5c75b9afae9ca531d2fee (diff)
downloadSkyblockMod-016814851e46acdbc7a8fce44746eb67feef5905.tar.gz
SkyblockMod-016814851e46acdbc7a8fce44746eb67feef5905.tar.bz2
SkyblockMod-016814851e46acdbc7a8fce44746eb67feef5905.zip
Merge pull request #30 from bowser0000/development
Diffstat (limited to 'src/main/java/me/Danker/commands/BlockSlayerCommand.java')
-rw-r--r--src/main/java/me/Danker/commands/BlockSlayerCommand.java45
1 files changed, 24 insertions, 21 deletions
diff --git a/src/main/java/me/Danker/commands/BlockSlayerCommand.java b/src/main/java/me/Danker/commands/BlockSlayerCommand.java
index 83a0358..d2144f6 100644
--- a/src/main/java/me/Danker/commands/BlockSlayerCommand.java
+++ b/src/main/java/me/Danker/commands/BlockSlayerCommand.java
@@ -2,6 +2,7 @@ package me.Danker.commands;
import java.util.List;
+import me.Danker.TheMod;
import me.Danker.handlers.ConfigHandler;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
@@ -9,7 +10,6 @@ import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.EnumChatFormatting;
public class BlockSlayerCommand extends CommandBase {
@@ -44,28 +44,31 @@ public class BlockSlayerCommand extends CommandBase {
@Override
public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
final EntityPlayer player = (EntityPlayer)arg0;
- final ConfigHandler cf = new ConfigHandler();
if (arg1.length == 0 || (arg1.length == 1 && !arg1[0].equalsIgnoreCase("off"))) {
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0)));
+ player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0)));
return;
}
- if (arg1[0].equalsIgnoreCase("zombie")) {
- onlySlayerName = "Revenant Horror";
- } else if (arg1[0].equalsIgnoreCase("spider")) {
- onlySlayerName = "Tarantula Broodfather";
- } else if (arg1[0].equalsIgnoreCase("wolf")) {
- onlySlayerName = "Sven Packmaster";
- } else if (arg1[0].equalsIgnoreCase("off")) {
- onlySlayerName = "";
- onlySlayerNumber = "";
- cf.writeStringConfig("toggles", "BlockSlayer", "");
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Slayer blocking turned off."));
- return;
- } else {
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0)));
- return;
+ switch (arg1[0].toLowerCase()) {
+ case "zombie":
+ onlySlayerName = "Revenant Horror";
+ break;
+ case "spider":
+ onlySlayerName = "Tarantula Broodfather";
+ break;
+ case "wolf":
+ onlySlayerName = "Sven Packmaster";
+ break;
+ case "off":
+ onlySlayerName = "";
+ onlySlayerNumber = "";
+ ConfigHandler.writeStringConfig("toggles", "BlockSlayer", "");
+ player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Slayer blocking turned off."));
+ return;
+ default:
+ player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0)));
+ return;
}
int slayerNumber = Integer.parseInt(arg1[1]);
@@ -86,12 +89,12 @@ public class BlockSlayerCommand extends CommandBase {
default:
onlySlayerName = "";
onlySlayerNumber = "";
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0)));
+ player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0)));
return;
}
- cf.writeStringConfig("toggles", "BlockSlayer", onlySlayerName + " " + onlySlayerNumber);
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Slayer blocking set to " + EnumChatFormatting.DARK_GREEN + onlySlayerName + " " + onlySlayerNumber));
+ ConfigHandler.writeStringConfig("toggles", "BlockSlayer", onlySlayerName + " " + onlySlayerNumber);
+ player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Slayer blocking set to " + TheMod.SECONDARY_COLOUR + onlySlayerName + " " + onlySlayerNumber));
}
}