Skip to content

Commit

Permalink
Grammar fixes and mistypes
Browse files Browse the repository at this point in the history
  • Loading branch information
coltonk9043 committed Dec 5, 2024
1 parent 7c8eb00 commit 6b1a4b0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 29 deletions.
58 changes: 30 additions & 28 deletions src/main/java/net/aoba/macros/Macro.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,35 @@ public class Macro {
private String name;
private String filePath;
private LinkedList<MacroEvent> events;

public Macro(File file) {
this.name = file.getName();
this.filePath = file.getPath();
this.events = new LinkedList<MacroEvent>();
try {
DataInputStream in = new DataInputStream(new FileInputStream(filePath));

String className = null;
while((className = in.readUTF()) != null) {
while ((className = in.readUTF()) != null) {
// Read Macros
// TODO: I HATTEE writing stuff out in plaintext, but I also hate files that cant be modified externally.
// I can't think of a way to make these macros something that can be easily modified in Notepad without
// making a giant file. If possible, any chance we can write into xml format???
// TODO: I HATTEE writing stuff out in plaintext, but I also hate files that
// cant be modified externally.
// I can't think of a way to make these macros something that can be easily
// modified in Notepad without
// making a giant file. If possible, any chance we can write into xml format???
MacroEvent event = null;
System.out.println(className);
if(className.equals(KeyClickMacroEvent.class.getName())) {
if (className.equals(KeyClickMacroEvent.class.getName())) {
event = new KeyClickMacroEvent();
}else if (className.equals(MouseClickMacroEvent.class.getName())) {
} else if (className.equals(MouseClickMacroEvent.class.getName())) {
event = new MouseClickMacroEvent();
}else if (className.equals(MouseMoveMacroEvent.class.getName())) {
} else if (className.equals(MouseMoveMacroEvent.class.getName())) {
event = new MouseMoveMacroEvent();
}else if (className.equals(MouseScrollMacroEvent.class.getName())) {
} else if (className.equals(MouseScrollMacroEvent.class.getName())) {
event = new MouseScrollMacroEvent();
}else
System.out.println("could nto find");
if(event != null) {
} else
System.out.println("Could not find Macro type.");

if (event != null) {
event.read(in);
events.add(event);
}
Expand All @@ -57,43 +58,44 @@ public Macro(File file) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally {
} finally {
// Read all of the data.
}
}

public Macro(LinkedList<MacroEvent> events) {
this.events = events;
}

public String getName() {
return name;
}

public String getFilePath() {
return filePath;
}
public LinkedList<MacroEvent> getEvents(){

public LinkedList<MacroEvent> getEvents() {
return events;
}

public void setName(String name) {
this.name = name;
MinecraftClient MC = MinecraftClient.getInstance();
this.filePath = MC.runDirectory + File.separator + "aoba" + File.separator + "macros" + File.separator + name + ".macro";
this.filePath = MC.runDirectory + File.separator + "aoba" + File.separator + "macros" + File.separator + name
+ ".macro";
}

public void save() {
try {
File macroFile = new File(filePath);
if (!macroFile.exists() && !macroFile.createNewFile()) {
throw new IOException("Failed to create config file: " + macroFile.getAbsolutePath());
}
if (!macroFile.exists() && !macroFile.createNewFile()) {
throw new IOException("Failed to create config file: " + macroFile.getAbsolutePath());
}

DataOutputStream out = new DataOutputStream(new FileOutputStream(macroFile));
MacroEvent event = events.poll();
while(event != null) {
while (event != null) {
event.write(out);
event = events.poll();
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/net/aoba/settings/SettingManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ public static void refreshSettingFiles() {

if (files != null) {
for (File file : files) {
configNames.add(file.getName().replace(".ttf", ""));
String name = file.getName().replace(".xml", "");
if (!name.equals("globals"))
configNames.add(name);
}
}
}
Expand Down

0 comments on commit 6b1a4b0

Please sign in to comment.