Thread: nullpointer exception

Results 1 to 7 of 7
  1. #1 nullpointer exception 
    Banned
    Join Date
    Sep 2010
    Posts
    883
    Thanks given
    20
    Thanks received
    6
    Rep Power
    0
    using dagenhams new skilling system:

    Code:
    [8/29/11 8:58 AM]: java.lang.NullPointerException
    [8/29/11 8:58 AM]:      at server.model.items.ItemAssistant.createGroundItem(Ite
    mAssistant.java:2529)
    [8/29/11 8:58 AM]:      at server.world.ItemHandler.createGroundItem(ItemHandler
    .java:142)
    [8/29/11 8:58 AM]:      at server.model.players.skills.Firemaking$3.execute(Fire
    making.java:149)
    [8/29/11 8:58 AM]:      at server.event.CycleEventContainer.execute(CycleEventCo
    ntainer.java:58)
    [8/29/11 8:58 AM]:      at server.event.CycleEventHandler.process(CycleEventHand
    ler.java:63)
    [8/29/11 8:58 AM]:      at server.Server.main(Server.java:144)

    line 142:
    Code:
    c.getItems().createGroundItem(itemId, itemX, itemY,	1);

    line 149:
    Code:
    					CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    						@Override
    						public void execute(CycleEventContainer container) {
    							Server.objectHandler.createAnObject(c, -1, coords[0], coords[1], coords[2]);
    							Server.itemHandler.createGroundItem(c, 592, coords[0], coords[1], coords[2], 1, c.getId());
    							
    							container.stop();
    						}
    						@Override
    						public void stop() {
    
    						}
    					}, 100);
    this shuts down the whole server.

    any help is appreciated
    Reply With Quote  
     

  2. #2  
    Respected Member


    Join Date
    Jan 2009
    Posts
    5,743
    Thanks given
    1,162
    Thanks received
    3,603
    Rep Power
    5000
    c is null, your doing something extremely wrong if its still being fired when the player is null.
    Reply With Quote  
     

  3. #3  
    Banned
    Join Date
    Sep 2010
    Posts
    883
    Thanks given
    20
    Thanks received
    6
    Rep Power
    0
    Quote Originally Posted by thispixel View Post
    c is null
    wait what? so what do i change to fix this?
    Reply With Quote  
     

  4. #4  
    Respected Member


    Join Date
    Jan 2009
    Posts
    5,743
    Thanks given
    1,162
    Thanks received
    3,603
    Rep Power
    5000
    Quote Originally Posted by Jamesfrost View Post
    wait what? so what do i change to fix this?
    make it not null?
    Reply With Quote  
     

  5. #5  
    Banned
    Join Date
    Sep 2010
    Posts
    883
    Thanks given
    20
    Thanks received
    6
    Rep Power
    0
    Quote Originally Posted by thispixel View Post
    make it not null?
    how do i do so?
    Reply With Quote  
     

  6. #6  
    Banned
    Join Date
    Sep 2010
    Posts
    883
    Thanks given
    20
    Thanks received
    6
    Rep Power
    0
    Quote Originally Posted by thispixel View Post
    c is null, your doing something extremely wrong if its still being fired when the player is null.
    so whats wrong

    dagenhams class, second reality uses the same class and he said they never had this issue. so i must of missed something (?)

    Code:
    package server.model.players.skills;
    
    import server.model.players.Client;
    import server.event.CycleEventHandler;
    import server.event.CycleEvent;
    import server.event.CycleEventContainer;
    import server.model.objects.Objects;
    import server.world.map.VirtualWorld;
    import server.*;
    import server.world.*;
    
    public class Firemaking extends SkillHandler {
    
    	private static Tiles currentTile;
    
    	private static int[][] data = {
    		{1511, 1,  40,  2732},		//	LOG
    		{7406, 1,  250, 11406},		//	RED LOG
    		{7405, 1,  250, 11405},		//	BLUE LOG
    		{7404, 1,  250, 11404},		//	RED LOG
    		{2862, 1,  40,  2732},		//	ACHEY
    		{1521, 15, 60,  2732},		//	OAK
    		{1519, 30, 105, 2732},		//	WILLOW
    		{6333, 35, 105, 2732},		//	TEAK
    		{1517, 45, 135, 2732},		//	MAPLE
    		{10810,45, 135, 2732},		//	ARTIC PINE
    		{6332, 50, 158, 2732},		//	MAHOGANY
    		{1515, 60, 203, 2732},		//	YEW
    		{1513, 75, 304, 2732},		//	MAGIC
    	};
    
    	public static boolean playerLogs(Client c, int i, int l) {
    		boolean flag = false;
    		for(int kl = 0; kl < data.length; kl++) {
    			if((i == data[kl][0] && requiredItem(c, l)) || (requiredItem(c, i) && l == data[kl][0])) {
    				flag = true;
    			}
    		}
    		return flag;
    	}
    
    	private static int getAnimation(Client c, int item, int item1) {
    		int[][] data = {
    			{841, 6714}, {843, 6715}, {849, 6716}, {853, 6717},
    			{857, 6718}, {861, 6719},
    		};
    		for(int i = 0; i < data.length; i++) {
    			if(item == data[i][0] || item1 == data[i][0]) {
    				return data[i][1];
    			}
    		}
    		return 733;
    	}
    
    	private static boolean requiredItem(Client c, int i) {
    		int[] data = {
    			841, 843, 849, 853, 857, 861, 590
    		};
    		for(int l = 0; l < data.length; l++) {
    			if(i == data[l]) {
    				return true;
    			}
    		}
    		return false;
    	}
    
    	public static void grabData(final Client c, final int useWith, final int withUse) {
    		final int[] coords = new int[2];
    		coords[0] = c.absX;
    		coords[1] = c.absY;
    		if(c.playerIsWoodcutting) {
    			Woodcutting.resetWoodcutting(c);
    		}
    		for(int i = 0; i < data.length; i++) {
    			if((requiredItem(c, useWith) && withUse == data[i][0] || useWith == data[i][0] && requiredItem(c, withUse))) {
    				if(c.playerLevel[11] < data[i][1]) {
    					c.sendMessage("You don't have the correct Firemaking level to light this log!");
    					c.sendMessage("You need the Firemaking level of at least "+ data[i][1] +".");
    					return;
    				}
    				if (System.currentTimeMillis() - c.lastFire > 1200) {
    
    					if(c.playerIsFiremaking) {
    						return;
    					}
    
    					final int[] time = new int[3];
    					final int log = data[i][0];
    					final int fire = data[i][3];
    					if(System.currentTimeMillis() - c.lastFire > 3000) {
     						c.startAnimation(getAnimation(c, useWith, withUse));
    						time[0] = 4;
    						time[1] = 3;
    					} else {
    						time[0] = 1;
    						time[1] = 2;
    					}
    
    					c.playerIsFiremaking = true;
    
    					Server.itemHandler.createGroundItem(c, log, coords[0], coords[1], 1, c.getId());
    
    					CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    						@Override
    						public void execute(CycleEventContainer container) {
    							Server.objectHandler.createAnObject(c, fire, coords[0], coords[1]);
    							Server.itemHandler.removeGroundItem(c, log, coords[0], coords[1], false);
    							c.playerIsFiremaking = false;
    							container.stop();
    						}
    						@Override
    						public void stop() {
    
    						}
    					}, time[0]);
    
    					if(VirtualWorld.I(c.heightLevel, c.absX, c.absY, c.absX-1, c.absY, 0)) {
    						c.getPA().walkTo(-1, 0);
    					} else {
    						c.getPA().walkTo(1, 0);
    					}
    
    					currentTile = new Tiles(c.absX - 1, c.absY, c.heightLevel);
    
    					if(!WalkingCheck.tiles.containsKey(currentTile.getH() << 28 | currentTile.getX() << 14 | currentTile.getY())){
    						c.getPA().walkTo(-1, 0);
    					} else {
    						c.getPA().walkTo(1, 0);
    					}
    
    					c.sendMessage("You light the logs.");
    
       					CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    						@Override
    						public void execute(CycleEventContainer container) {
    							c.startAnimation(65535);
    							container.stop();
    						}
    						@Override
    						public void stop() {
    
    						}
    					}, time[1]);
    
    					CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
    						@Override
    						public void execute(CycleEventContainer container) {
    							Server.objectHandler.createAnObject(c, -1, coords[0], coords[1]);
    							Server.itemHandler.createGroundItem(c, 592, coords[0], coords[1], 1, c.getId());
    							container.stop();
    						}
    						@Override
    						public void stop() {
    
    						}
    					}, 100);
    
    					c.getPA().addSkillXP(data[i][2] * FIREMAKING_XP, 11);
    					c.turnPlayerTo(c.absX+1, c.absY);
    					c.getItems().deleteItem(data[i][0], c.getItems().getItemSlot(data[i][0]), 1);
    					c.lastFire = System.currentTimeMillis();
    				}
    			}
    		}
    	}
    }
    Reply With Quote  
     

  7. #7  
    Donator

    Arithium's Avatar
    Join Date
    May 2010
    Age
    31
    Posts
    4,721
    Thanks given
    199
    Thanks received
    1,256
    Rep Power
    1114
    i think its because people are lighting fires on objects by noclipping and its causing this issue. i had this problem myself.
    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. NullPointer
    By CTucker in forum Help
    Replies: 1
    Last Post: 03-16-2011, 07:55 PM
  2. Nullpointer exception
    By Kamiel in forum Help
    Replies: 0
    Last Post: 12-20-2010, 11:48 PM
  3. Replies: 7
    Last Post: 04-23-2010, 04:01 AM
  4. nullpointer[$2][rep++]
    By Robin Spud in forum Help
    Replies: 0
    Last Post: 08-30-2009, 06:18 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •