diff options
author | RoseGoldIsntGay <yoavkau@gmail.com> | 2021-11-22 09:12:31 +0200 |
---|---|---|
committer | RoseGoldIsntGay <yoavkau@gmail.com> | 2021-11-22 09:12:31 +0200 |
commit | 19de3c3ee0582f25d8e127492d791f81a410b70a (patch) | |
tree | 5ac734875a7da4fc6ffd9521f880d6292c909ed7 /src/main/java/rosegoldaddons/commands | |
parent | 9ec7ca5e828f33122818a51215bbec5e68a84db2 (diff) | |
download | RGA-19de3c3ee0582f25d8e127492d791f81a410b70a.tar.gz RGA-19de3c3ee0582f25d8e127492d791f81a410b70a.tar.bz2 RGA-19de3c3ee0582f25d8e127492d791f81a410b70a.zip |
2.3.0
Diffstat (limited to 'src/main/java/rosegoldaddons/commands')
-rw-r--r-- | src/main/java/rosegoldaddons/commands/AllEntities.java (renamed from src/main/java/rosegoldaddons/commands/WartSetup.java) | 38 | ||||
-rw-r--r-- | src/main/java/rosegoldaddons/commands/Rosedrobe.java | 1 | ||||
-rw-r--r-- | src/main/java/rosegoldaddons/commands/Rosepet.java | 65 | ||||
-rw-r--r-- | src/main/java/rosegoldaddons/commands/UseCooldown.java | 105 |
4 files changed, 174 insertions, 35 deletions
diff --git a/src/main/java/rosegoldaddons/commands/WartSetup.java b/src/main/java/rosegoldaddons/commands/AllEntities.java index a143349..ce0117b 100644 --- a/src/main/java/rosegoldaddons/commands/WartSetup.java +++ b/src/main/java/rosegoldaddons/commands/AllEntities.java @@ -1,24 +1,22 @@ package rosegoldaddons.commands; import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.command.CommandException; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; +import net.minecraft.entity.Entity; import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; import org.jetbrains.annotations.NotNull; import rosegoldaddons.utils.ChatUtils; import java.util.ArrayList; import java.util.List; -public class WartSetup implements ICommand { - public static int wartEnd = 99999; - public static String cardinal = "west"; - +public class AllEntities implements ICommand { @Override public String getCommandName() { - return "wartsetup"; + return "allentities"; } @Override @@ -33,22 +31,8 @@ public class WartSetup implements ICommand { @Override public void processCommand(ICommandSender sender, String[] args) throws CommandException { - if(args.length == 2) { - if(args[0].equals("west")) { - cardinal = "west"; - } else if(args[0].equals("north")) { - cardinal = "north"; - } else if(args[0].equals("east")) { - cardinal = "east"; - } else if(args[0].equals("south")) { - cardinal = "south"; - } - - if(isNumeric(args[1])) { - wartEnd = (int) Math.floor(Double.parseDouble(args[1])); - } - } else { - ChatUtils.sendMessage("§cInvalid Arguments."); + for (Entity entity1 : (Minecraft.getMinecraft().theWorld.loadedEntityList)) { + ChatUtils.sendMessage(""+entity1); } } @@ -67,11 +51,6 @@ public class WartSetup implements ICommand { return false; } - @Override - public int compareTo(@NotNull ICommand o) { - return 0; - } - private boolean isNumeric(String str) { try { Double.parseDouble(str); @@ -80,4 +59,9 @@ public class WartSetup implements ICommand { return false; } } + + @Override + public int compareTo(@NotNull ICommand o) { + return 0; + } } diff --git a/src/main/java/rosegoldaddons/commands/Rosedrobe.java b/src/main/java/rosegoldaddons/commands/Rosedrobe.java index d05c6be..55024df 100644 --- a/src/main/java/rosegoldaddons/commands/Rosedrobe.java +++ b/src/main/java/rosegoldaddons/commands/Rosedrobe.java @@ -25,7 +25,6 @@ import java.util.List; public class Rosedrobe implements ICommand { public static boolean openWardrobe = false; public static int slot = 0; - int windowId; @Override public String getCommandName() { diff --git a/src/main/java/rosegoldaddons/commands/Rosepet.java b/src/main/java/rosegoldaddons/commands/Rosepet.java new file mode 100644 index 0000000..800098f --- /dev/null +++ b/src/main/java/rosegoldaddons/commands/Rosepet.java @@ -0,0 +1,65 @@ +package rosegoldaddons.commands; + +import net.minecraft.client.Minecraft; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandSender; +import net.minecraft.util.BlockPos; +import org.jetbrains.annotations.NotNull; +import rosegoldaddons.utils.ChatUtils; + +import java.util.ArrayList; +import java.util.List; + +public class Rosepet implements ICommand { + public static boolean openPetS = false; + public static String name = ""; + + @Override + public String getCommandName() { + return "rosepet"; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return "/" + getCommandName(); + } + + @Override + public List<String> getCommandAliases() { + return new ArrayList<>(); + } + + @Override + public void processCommand(ICommandSender sender, String[] args) throws CommandException { + if (args.length == 0) { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/pets"); + openPetS = true; + } else { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/pets"); + openPetS = true; + name = args[0]; + + } + } + + @Override + public boolean canCommandSenderUseCommand(ICommandSender sender) { + return true; + } + + @Override + public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { + return new ArrayList<>(); + } + + @Override + public boolean isUsernameIndex(String[] args, int index) { + return false; + } + + @Override + public int compareTo(@NotNull ICommand o) { + return 0; + } +} diff --git a/src/main/java/rosegoldaddons/commands/UseCooldown.java b/src/main/java/rosegoldaddons/commands/UseCooldown.java index 45d78b0..351df9a 100644 --- a/src/main/java/rosegoldaddons/commands/UseCooldown.java +++ b/src/main/java/rosegoldaddons/commands/UseCooldown.java @@ -1,5 +1,6 @@ package rosegoldaddons.commands; +import com.google.gson.Gson; import net.minecraft.client.Minecraft; import net.minecraft.command.CommandException; import net.minecraft.command.ICommand; @@ -7,16 +8,24 @@ import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; import org.jetbrains.annotations.NotNull; import rosegoldaddons.utils.ChatUtils; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; import java.util.List; + public class UseCooldown implements ICommand { - public static HashMap<String, Integer> items = new HashMap<String, Integer>(); + public static HashMap<String, Integer> RCitems = new HashMap<String, Integer>(); + public static HashMap<String, Integer> LCitems = new HashMap<String, Integer>(); @Override public String getCommandName() { @@ -35,6 +44,16 @@ public class UseCooldown implements ICommand { @Override public void processCommand(ICommandSender sender, String[] args) throws CommandException { + if (args.length == 0) { + for (String i : RCitems.keySet()) { + ChatUtils.sendMessage("§7Right click macro set on " + i + " §7with cooldown of " + RCitems.get(i) + " ms."); + } + for (String i : LCitems.keySet()) { + ChatUtils.sendMessage("§7Left click macro set on " + i + " §7with cooldown of " + LCitems.get(i) + " ms."); + } + saveMacros(); + return; + } if (args.length == 1 && isNumeric(args[0])) { InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; @@ -42,16 +61,42 @@ public class UseCooldown implements ICommand { if (curStack != null) { int cd = Integer.parseInt(args[0]); if (cd == 0) { - items.remove(curStack.getDisplayName()); + RCitems.remove(curStack.getDisplayName()); ChatUtils.sendMessage("§aSuccessfully Removed " + curStack.getDisplayName() + "§a."); + saveMacros(); return; } - if (cd < 1) { - ChatUtils.sendMessage("§cInvalid Miliseconds, Minimum delay 1 Milisecond."); + if (cd < 100) { + ChatUtils.sendMessage("§cInvalid Miliseconds, Minimum delay 100 Milisecond."); + saveMacros(); return; } - ChatUtils.sendMessage("§aSuccessfully Added " + curStack.getDisplayName() + "§a with delay of " + cd + " ms."); - items.put(curStack.getDisplayName(), cd); + RCitems.put(curStack.getDisplayName(), cd); + ChatUtils.sendMessage("§aSuccessfully Added " + curStack.getDisplayName() + "§a to right click with a delay of " + cd + " ms."); + saveMacros(); + } else { + ChatUtils.sendMessage("§cError getting current held item."); + } + } else if (args.length == 2 && isNumeric(args[0]) && args[1].equalsIgnoreCase("left")) { + InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory; + + ItemStack curStack = inv.getStackInSlot(Minecraft.getMinecraft().thePlayer.inventory.currentItem); + if (curStack != null) { + int cd = Integer.parseInt(args[0]); + if (cd == 0) { + LCitems.remove(curStack.getDisplayName()); + ChatUtils.sendMessage("§aSuccessfully Removed " + curStack.getDisplayName() + "§a."); + saveMacros(); + return; + } + if (cd < 100) { + ChatUtils.sendMessage("§cInvalid Miliseconds, Minimum delay 100 Milisecond."); + saveMacros(); + return; + } + ChatUtils.sendMessage("§aSuccessfully Added " + curStack.getDisplayName() + "§a to left click with a delay of " + cd + " ms."); + LCitems.put(curStack.getDisplayName(), cd); + saveMacros(); } else { ChatUtils.sendMessage("§cError getting current held item."); } @@ -84,6 +129,52 @@ public class UseCooldown implements ICommand { } } + private void saveMacros() { + try { + String rcjson = new Gson().toJson(RCitems); + Files.write(Paths.get("./config/rosegoldaddons/rcmacros.json"), rcjson.getBytes(StandardCharsets.UTF_8)); + String lcjson = new Gson().toJson(LCitems); + Files.write(Paths.get("./config/rosegoldaddons/lcmacros.json"), lcjson.getBytes(StandardCharsets.UTF_8)); + } catch(Exception error) { + System.out.println("Error saving config file"); + error.printStackTrace(); + } + /*File rcfile = new File("./config/rosegoldaddons/rcmacro.txt"); + BufferedWriter bf = null; + try { + bf = new BufferedWriter(new FileWriter(rcfile)); + for (HashMap.Entry<String, Integer> entry : RCitems.entrySet()) { + bf.write(entry.getKey() + ":" + entry.getValue()); + bf.newLine(); + } + bf.flush(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + bf.close(); + } catch (Exception e) { + } + } + File lcfile = new File("./config/rosegoldaddons/lcmacro.txt"); + BufferedWriter bf2 = null; + try { + bf2 = new BufferedWriter(new FileWriter(lcfile)); + for (HashMap.Entry<String, Integer> entry : LCitems.entrySet()) { + bf2.write(entry.getKey() + ":" + entry.getValue()); + bf2.newLine(); + } + bf2.flush(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + bf2.close(); + } catch (Exception e) { + } + }*/ + } + @Override public int compareTo(@NotNull ICommand o) { return 0; |