diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-07-13 17:42:57 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2020-07-13 17:42:57 -0400 |
commit | 8ce07f5b4b4c7d8cef95dd613885e5219ce6a6a2 (patch) | |
tree | 4ae7cd5ff26139a3fb0f390cbe359fa210337f7b /me/Danker/commands | |
parent | ec0334bfb60226e5bd0fb987babbe16384bd5ae0 (diff) | |
download | SkyblockMod-8ce07f5b4b4c7d8cef95dd613885e5219ce6a6a2.tar.gz SkyblockMod-8ce07f5b4b4c7d8cef95dd613885e5219ce6a6a2.tar.bz2 SkyblockMod-8ce07f5b4b4c7d8cef95dd613885e5219ce6a6a2.zip |
/move command, colours and slayer fixv1.4.1
Added /move command to move text displays. Add colour to messages and error messages in chat. Fixed slayer drops not being tracked.
Diffstat (limited to 'me/Danker/commands')
-rw-r--r-- | me/Danker/commands/DisplayCommand.java | 7 | ||||
-rw-r--r-- | me/Danker/commands/GetkeyCommand.java | 5 | ||||
-rw-r--r-- | me/Danker/commands/LootCommand.java | 4 | ||||
-rw-r--r-- | me/Danker/commands/MoveCommand.java | 58 | ||||
-rw-r--r-- | me/Danker/commands/SetkeyCommand.java | 5 | ||||
-rw-r--r-- | me/Danker/commands/ToggleCommand.java | 22 |
6 files changed, 77 insertions, 24 deletions
diff --git a/me/Danker/commands/DisplayCommand.java b/me/Danker/commands/DisplayCommand.java index 534ce16..09d7c0f 100644 --- a/me/Danker/commands/DisplayCommand.java +++ b/me/Danker/commands/DisplayCommand.java @@ -6,6 +6,7 @@ import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; public class DisplayCommand extends CommandBase { public static String display; @@ -30,7 +31,7 @@ public class DisplayCommand extends CommandBase { final EntityPlayer player = (EntityPlayer) arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText("Usage: /display [zombie/spider/wolf/off]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /display [zombie/spider/wolf/off]")); return; } @@ -45,10 +46,10 @@ public class DisplayCommand extends CommandBase { } else if (arg1[0].equalsIgnoreCase("off")) { display = "off"; } else { - player.addChatMessage(new ChatComponentText("Usage: /display [zombie/spider/wolf/off]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /display [zombie/spider/wolf/off]")); return; } - player.addChatMessage(new ChatComponentText("Display set to " + display + ".")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Display set to " + EnumChatFormatting.DARK_GREEN + display + EnumChatFormatting.GREEN + ".")); cf.writeStringConfig("misc", "display", display); } diff --git a/me/Danker/commands/GetkeyCommand.java b/me/Danker/commands/GetkeyCommand.java index e8b29e6..80354fe 100644 --- a/me/Danker/commands/GetkeyCommand.java +++ b/me/Danker/commands/GetkeyCommand.java @@ -7,6 +7,7 @@ import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; public class GetkeyCommand extends CommandBase implements ICommand { @@ -31,9 +32,9 @@ public class GetkeyCommand extends CommandBase implements ICommand { final ConfigHandler cf = new ConfigHandler(); if (cf.getString("api", "APIKey").equals("")) { - player.addChatMessage(new ChatComponentText("API key not set. Set your API key using /setkey.")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "API key not set. Set your API key using /setkey.")); } else { - player.addChatMessage(new ChatComponentText("Your set API key is " + cf.getString("api", "APIKey"))); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Your set API key is " + EnumChatFormatting.DARK_GREEN + cf.getString("api", "APIKey"))); } } diff --git a/me/Danker/commands/LootCommand.java b/me/Danker/commands/LootCommand.java index 4b05d25..11382b3 100644 --- a/me/Danker/commands/LootCommand.java +++ b/me/Danker/commands/LootCommand.java @@ -97,7 +97,7 @@ public class LootCommand extends CommandBase { final EntityPlayer player = (EntityPlayer) arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText("Usage: /loot [zombie/spider/wolf]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot [zombie/spider/wolf]")); return; } @@ -184,7 +184,7 @@ public class LootCommand extends CommandBase { EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" + EnumChatFormatting.GREEN + "" + EnumChatFormatting.BOLD + " -------------------")); } else { - player.addChatMessage(new ChatComponentText("Usage: /loot [zombie/spider/wolf]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot [zombie/spider/wolf]")); } } diff --git a/me/Danker/commands/MoveCommand.java b/me/Danker/commands/MoveCommand.java new file mode 100644 index 0000000..d402680 --- /dev/null +++ b/me/Danker/commands/MoveCommand.java @@ -0,0 +1,58 @@ +package me.Danker.commands; + +import me.Danker.handlers.ConfigHandler; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; + +public class MoveCommand extends CommandBase { + + public static int[] coordsXY = {0, 0}; + public static int[] displayXY = {0, 0}; + + @Override + public String getCommandName() { + return "move"; + } + + @Override + public String getCommandUsage(ICommandSender arg0) { + return getCommandName() + " [coords/display] [x] [y]"; + } + + @Override + public int getRequiredPermissionLevel() { + return 0; + } + + @Override + public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { + final EntityPlayer player = (EntityPlayer)arg0; + final ConfigHandler cf = new ConfigHandler(); + + if (arg1.length < 2) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /move [coords/display] [x] [y]")); + return; + } + + if (arg1[0].equalsIgnoreCase("coords")) { + coordsXY[0] = Integer.parseInt(arg1[1]); + coordsXY[1] = Integer.parseInt(arg1[2]); + cf.writeIntConfig("locations", "coordsX", coordsXY[0]); + cf.writeIntConfig("locations", "coordsY", coordsXY[1]); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Coords have been moved to " + EnumChatFormatting.DARK_GREEN + arg1[1] + ", " + arg1[2])); + } else if (arg1[0].equalsIgnoreCase("display")) { + displayXY[0] = Integer.parseInt(arg1[1]); + displayXY[1] = Integer.parseInt(arg1[2]); + cf.writeIntConfig("locations", "displayX", displayXY[0]); + cf.writeIntConfig("locations", "displayY", displayXY[1]); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Tracker display has been moved to " + EnumChatFormatting.DARK_GREEN + arg1[1] + ", " + arg1[2])); + } else { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /move [coords/display] [x] [y]")); + } + } + +} diff --git a/me/Danker/commands/SetkeyCommand.java b/me/Danker/commands/SetkeyCommand.java index 85e9dd7..14f2336 100644 --- a/me/Danker/commands/SetkeyCommand.java +++ b/me/Danker/commands/SetkeyCommand.java @@ -7,6 +7,7 @@ import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; public class SetkeyCommand extends CommandBase implements ICommand { @@ -30,13 +31,13 @@ public class SetkeyCommand extends CommandBase implements ICommand { final EntityPlayer player = (EntityPlayer)arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText("Usage: /setkey [key]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /setkey [key]")); return; } final ConfigHandler cf = new ConfigHandler(); cf.writeStringConfig("api", "APIKey", arg1[0]); - player.addChatMessage(new ChatComponentText("Set API key to " + arg1[0])); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Set API key to " + EnumChatFormatting.DARK_GREEN + arg1[0])); } } diff --git a/me/Danker/commands/ToggleCommand.java b/me/Danker/commands/ToggleCommand.java index 7e1b83a..bbcafc1 100644 --- a/me/Danker/commands/ToggleCommand.java +++ b/me/Danker/commands/ToggleCommand.java @@ -7,19 +7,11 @@ import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; public class ToggleCommand extends CommandBase implements ICommand { public static boolean gpartyToggled; public static boolean coordsToggled; - - public boolean getToggle(String type) { - if (type.equals("gparty")) { - return gpartyToggled; - } else if (type.equals("coords")) { - return coordsToggled; - } - return true; - } @Override public String getCommandName() { @@ -42,23 +34,23 @@ public class ToggleCommand extends CommandBase implements ICommand { final ConfigHandler cf = new ConfigHandler(); if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText("Usage: /toggle [gparty/coords/list]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle [gparty/coords/list]")); return; } if (arg1[0].equalsIgnoreCase("gparty")) { gpartyToggled = !gpartyToggled; cf.writeBooleanConfig("toggles", "GParty", gpartyToggled); - player.addChatMessage(new ChatComponentText("Guild party notifications has been set to " + gpartyToggled + ".")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Guild party notifications has been set to " + EnumChatFormatting.DARK_GREEN + gpartyToggled + EnumChatFormatting.GREEN + ".")); } else if (arg1[0].equalsIgnoreCase("coords")) { coordsToggled = !coordsToggled; cf.writeBooleanConfig("toggles", "Coords", coordsToggled); - player.addChatMessage(new ChatComponentText("Coord/Angle display has been set to " + coordsToggled + ".")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Coord/Angle display has been set to " + EnumChatFormatting.DARK_GREEN + coordsToggled + EnumChatFormatting.GREEN + ".")); } else if (arg1[0].equalsIgnoreCase("list")) { - player.addChatMessage(new ChatComponentText("Guild party notifications: " + gpartyToggled)); - player.addChatMessage(new ChatComponentText("Coord/Angle display: " + coordsToggled)); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Guild party notifications: " + EnumChatFormatting.DARK_GREEN + gpartyToggled + "\n" + + EnumChatFormatting.GREEN + " Coord/Angle display: " + EnumChatFormatting.DARK_GREEN + coordsToggled)); } else { - player.addChatMessage(new ChatComponentText("Usage: /toggle [gparty/coords/list]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle [gparty/coords/list]")); } } } |