Thread: Weird error

Results 1 to 6 of 6
  1. #1 Weird error 
    Registered Member Hexagon's Avatar
    Join Date
    May 2008
    Posts
    672
    Thanks given
    28
    Thanks received
    18
    Rep Power
    33
    Well guys i'm getting this:
    Code:
    DeltaClean by Jonny J
    Initiating Start Methods.
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 45
            at NPCHandler.loadNPCDrops(NPCHandler.java:2332)
            at NPCHandler.<init>(NPCHandler.java:418)
            at Server.main(Server.java:110)
    after i did this tut:

    http://www.rune-server.org/runescape...ops-rates.html

    in line 2332:
    Code:
    	public boolean loadNPCDrops(String FileName) {
    		String line = "";
    		String token = "";
    		String token2 = "";
    		String token2_2 = "";
    		String[] token3 = new String[10];
    		boolean EndOfFile = false;
    		BufferedReader characterfile = null;
    		try {
    			characterfile = new BufferedReader(new FileReader("config\\"
    					+ FileName));
    		} catch (FileNotFoundException fileex) {
    			Misc.println(FileName + ": file not found.");
    			return false;
    		}
    		try {
    			line = characterfile.readLine();
    		} catch (IOException ioexception) {
    			Misc.println(FileName + ": error loading file.");
    			return false;
    		}
    		while ((EndOfFile == false) && (line != null)) {
    			line = line.trim();
    			int spot = line.indexOf("=");
    			if (spot > -1) {
    				token = line.substring(0, spot);
    				token = token.trim();
    				token2 = line.substring(spot + 1);
    				token2 = token2.trim();
    				token2_2 = token2.replaceAll("\t\t", "\t");
    				token2_2 = token2_2.replaceAll("\t\t", "\t");
    				token2_2 = token2_2.replaceAll("\t\t", "\t");
    				token2_2 = token2_2.replaceAll("\t\t", "\t");
    				token2_2 = token2_2.replaceAll("\t\t", "\t");
    				token3 = token2_2.split("\t");
    				if (token.equals("npcdrop")) {
    					if (Integer.parseInt(token3[0]) <= -1)
    						continue;
    					drops[Integer.parseInt(token3[0])][dropCount[Integer
    							.parseInt(token3[0])]] = Integer
    							.parseInt(token3[1]);
    					drops[Integer.parseInt(token3[0])][dropCount[Integer
    							.parseInt(token3[0])] + 1] = Integer
    							.parseInt(token3[2]);
    					drops[Integer.parseInt(token3[0])][dropCount[Integer
    							.parseInt(token3[0])] + 2] = Integer
    							.parseInt(token3[3]);
    					dropCount[Integer.parseInt(token3[0])] += 3;
    				}
    			} else {
    				if (line.equals("[ENDOFNPCDROPLIST]")) {
    					try {
    						characterfile.close();
    					} catch (IOException ioexception) {
    					}
    					return true;
    				}
    			}
    			try {
    				line = characterfile.readLine();
    			} catch (IOException ioexception1) {
    				EndOfFile = true;
    			}
    		}
    		try {
    			characterfile.close();
    		} catch (IOException ioexception) {
    		}
    		return false;
    	}
    Reply With Quote  
     

  2. #2  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    Which of those lines is line 2332, we don't have your whole NPCHandler class.
    Reply With Quote  
     

  3. #3  
    Registered Member Hexagon's Avatar
    Join Date
    May 2008
    Posts
    672
    Thanks given
    28
    Thanks received
    18
    Rep Power
    33
    something arround
    token2 = line.substring(spot + 1);
    Reply With Quote  
     

  4. #4  
    Registered Member shoopdawhoop's Avatar
    Join Date
    Apr 2009
    Posts
    685
    Thanks given
    10
    Thanks received
    19
    Rep Power
    57
    public double[][] drops = new double[3851][45]
    should be
    public double[][] drops = new double[3851][3851]
    if(WomanLocation != Kitchen)
    {
    DivideByZero();
    }
    Reply With Quote  
     

  5. #5  
    Registered Member Hexagon's Avatar
    Join Date
    May 2008
    Posts
    672
    Thanks given
    28
    Thanks received
    18
    Rep Power
    33
    Quote Originally Posted by shoopdawhoop View Post
    public double[][] drops = new double[3851][45]
    should be
    public double[][] drops = new double[3851][3851]
    thanks repped
    Reply With Quote  
     

  6. #6  
    Registered Member shoopdawhoop's Avatar
    Join Date
    Apr 2009
    Posts
    685
    Thanks given
    10
    Thanks received
    19
    Rep Power
    57
    Quote Originally Posted by sn4k3d View Post
    thanks repped
    np sneaked
    if(WomanLocation != Kitchen)
    {
    DivideByZero();
    }
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •