Jump to content

FusselFace

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by FusselFace

  1. sorry forgot to show the error it is pulling but here
  2. I am trying to make a search function that finds a change in a text and then finds a string that matched the hint from a word bank and narrows down your searches. Here is the one method that is causing the error and the line that it is putting I will make but I think it is just the general area. public String[] wordSearchHint(String[] choices, int chars, String hint) { if (choices.length > 0) { String lasthint = ""; for (int i = 0; i < chars; i++) { lasthint = lasthint + "_"; } hint.replaceAll(" ", "_"); int loc = 0; char letter = ' '; boolean change = false; boolean found = false; String[] newchoices = new String[100]; for (int i = 0; i < hint.length(); i++) { if (!(hint.charAt(i) == lasthint.charAt(i))) { loc = i; letter = hint.charAt(i); change = true; break; } } if (change && choices.length > 0) { for (int i = 0; i < choices.length; i++) { if (!choices[i].isEmpty()) { //<<<<<<<<<<<<<<<<<<<<<<< <this is the exact line if (choices[i].charAt(loc) == letter) { newchoices[i] = choices[i]; found = true; } } } } else { if (hint == lasthint) { return choices; } } if (found) { return newchoices; } else { return choices; } } else { return choices; } }
  3. never mind I am stupid you sent a link.
  4. So how can I find these SRG codes is there a list somewhere.
  5. Well, I am using the field name recordPlaying, I am just making my variable called actionBar because it is called that in bukkit. And how would you recommend handling the exception?
  6. I am getting information that is placed in the "action bar" or record name slot from a bukkit server and can seem to find a way to get the string associated with this text field. try { actionBar = (String) ReflectionHelper.findField(GuiIngame.class, "recordPlaying").get(Minecraft.getMinecraft().ingameGUI); } catch (IllegalAccessException ex) { ex.getStackTrace(); System.out.println("error"); }
  7. Thank you very much, I got it to work now.
  8. forgot to mention but this needs to be able to live between sessions.
  9. I need to save a list of strings that gets added to every time a chat event is met, I am wanting this to be done with like a txt file but can't find a way for this to work, I had made this work in my development but it does not work in the real game. public class onChatEvent { @SubscribeEvent public void onChatMessage(ClientChatReceivedEvent event){ String word = event.message.getUnformattedText(); if(word.contains("The theme was: ")) { String file = "C:\\Users\\natha\\AppData\\Roaming\\.minecraft\\words.txt"; file = file.substring(1); String fileCopy = "C:\\Users\\natha\\AppData\\Roaming\\.minecraft\\wordscopy.txt"; fileCopy = fileCopy.substring(1); Scanner reader; PrintWriter writer; try { reader = new Scanner(new File(file)); writer = new PrintWriter(new FileWriter(fileCopy)); while (reader.hasNextLine()) { writer.println(reader.nextLine()); } writer.println(word.substring(15, word.length()-1)); reader.close(); writer.close(); } catch (IOException ex) { ex.getStackTrace(); } try { reader = new Scanner(new File(fileCopy)); writer = new PrintWriter(new FileWriter(file)); while (reader.hasNextLine()) { writer.println(reader.nextLine()); } reader.close(); writer.close(); } catch (IOException ex) { ex.getStackTrace(); } } } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.