Thread: [PI] "A fatal exception has been thrown!"

Results 1 to 6 of 6
  1. #1 [PI] "A fatal exception has been thrown!" 
    Donator


    Join Date
    Sep 2011
    Posts
    2,730
    Thanks given
    1,150
    Thanks received
    907
    Rep Power
    668
    Error in server:
    Code:
    [6/12/12 7:32 PM]: java.lang.NullPointerException
    [6/12/12 7:32 PM]:      at server.rs2.entity.npcs.NPCHandler.handleChaosEleDeath
    (NPCHandler.java:1232)
    [6/12/12 7:32 PM]:      at server.rs2.entity.npcs.NPCHandler.process(NPCHandler.
    java:1095)
    [6/12/12 7:32 PM]:      at server.Server.main(Server.java:159)
    [6/12/12 7:32 PM]: A fatal exception has been thrown!
    Line 1232:
    Code:
    public void handleChaosEleDeath(int i) {
    		Client c = (Client)PlayerHandler.players[npcs[i].spawnedBy];
    		c.sendMessage("You killed the Chaos Elemental..");
    		c.sendMessage("You have received 5 DRP for this.");
    		c.pcPoints += 5;
    		PlayerHandler.yell("The Chaos Elemental has been slain by "+c.playerName);
    	}
    Line 1095:
    Code:
    if (npcs[i].npcType == 3200) {
    							handleChaosEleDeath(i);
    						}
    Line 159:
    Code:
    try {
    			while (!Server.shutdownServer) {
    				if (sleepTime >= 0)
    					Thread.sleep(sleepTime);
    				else
    					Thread.sleep(600);
    				engineTimer.reset();
    				CycleEventHandler.getSingleton().process();
    				itemHandler.process();
    				playerHandler.process();	
    	                        npcHandler.process();
    				shopHandler.process();
    				objectManager.process();
    				fightPits.process();
    				pestControl.process();
    				cycleTime = engineTimer.elapsed();
    				sleepTime = cycleRate - cycleTime;
    				totalCycleTime += cycleTime;
    				cycles++;
    				debug();
    			}
    		} catch (Exception ex) {
    			ex.printStackTrace();
    			System.out.println("A fatal exception has been thrown!");
    			for(Player p : PlayerHandler.players) {
    				if(p == null)
    					continue;						
    				PlayerSave.saveGame((Client)p);
    				System.out.println("Saved game for " + p.playerName + "."); 
    			}
    		}
    How do I fix this?
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Apr 2011
    Posts
    279
    Thanks given
    5
    Thanks received
    20
    Rep Power
    3
    It's not the c.sendMessage() you're having issues with.
    The line above it is recieving a null.

    You're getting a null, because I assume you didn't spawn the Chaos Ele, it was in spawn.cfg.
    That is trying to find out who spawned it, which is feeding you a null.

    This should work, so post errors. This was made assuming handleChaosEleDeath() is in NPCHandler.
    Code:
    Client c2 = (Client)PlayerHandler.players[getNpcKillerId(npcs[i].npcId)];

    Don't say thanks, there is a button for that..
    Quote Originally Posted by Pk2day View Post
    I added my no-ip to this line
    System.out.println("Server listening on port: wemissedu.no-ip.biz" + serverlistenerPort);
    Reply With Quote  
     

  3. #3  
    Donator


    Join Date
    Sep 2011
    Posts
    2,730
    Thanks given
    1,150
    Thanks received
    907
    Rep Power
    668
    Quote Originally Posted by RSAfterLife View Post
    It's not the c.sendMessage() you're having issues with.
    The line above it is recieving a null.

    You're getting a null, because I assume you didn't spawn the Chaos Ele, it was in spawn.cfg.
    That is trying to find out who spawned it, which is feeding you a null.

    This should work, so post errors. This was made assuming handleChaosEleDeath() is in NPCHandler.
    Code:
    Client c2 = (Client)PlayerHandler.players[getNpcKillerId(npcs[i].npcId)];
    Put that in, but it still didn't work. Same error.
    Reply With Quote  
     

  4. #4  
    Registered Member RuneWings317's Avatar
    Join Date
    Aug 2010
    Posts
    223
    Thanks given
    24
    Thanks received
    30
    Rep Power
    11
    I actually just dealt with this today. Around the part where it yells it, I put this:
    Code:
    for(int i = 0; i < Config.MAX_PLAYERS; i++) {
    if(Server.playerHandler.players[i] != null) {
    YOUR_CODE_HERE
    }
    }
    And that fixed it.

    i see u...
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Apr 2011
    Posts
    279
    Thanks given
    5
    Thanks received
    20
    Rep Power
    3
    Quote Originally Posted by Lystuya View Post
    Put that in, but it still didn't work. Same error.
    Change npcId to NpcType

    Don't say thanks, there is a button for that..
    Quote Originally Posted by Pk2day View Post
    I added my no-ip to this line
    System.out.println("Server listening on port: wemissedu.no-ip.biz" + serverlistenerPort);
    Reply With Quote  
     

  6. #6  
    Donator


    Join Date
    Sep 2011
    Posts
    2,730
    Thanks given
    1,150
    Thanks received
    907
    Rep Power
    668
    Quote Originally Posted by RSAfterLife View Post
    Change npcId to NpcType
    Still didn't work.
    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

Similar Threads

  1. Replies: 1
    Last Post: 03-07-2012, 01:41 AM
  2. Replies: 13
    Last Post: 01-02-2012, 01:32 PM
  3. Replies: 8
    Last Post: 07-03-2011, 09:05 PM
  4. "hed","head","headicon" command like ::emote Rep++
    By «I Gf I» ©£ in forum Help
    Replies: 12
    Last Post: 10-06-2009, 05:30 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •