Thread: error: non-static variable ?

Results 1 to 2 of 2
  1. #1 error: non-static variable ? 
    Member
    Join Date
    Jun 2012
    Posts
    155
    Thanks given
    23
    Thanks received
    7
    Rep Power
    0
    Code:
    src\server\model\minigames\CastleWars.java:80: error: non-static variable player
    Hat cannot be referenced from a static context
            } else if (player.playerEquipment[Client.playerHat] > 0 || player.player
    Equipment[Client.playerCape] > 0) {
                                                    ^
    src\server\model\minigames\CastleWars.java:80: error: non-static variable player
    Cape cannot be referenced from a static context
            } else if (player.playerEquipment[Client.playerHat] > 0 || player.player
    Equipment[Client.playerCape] > 0) {
    
                    ^
    src\server\model\minigames\CastleWars.java:171: error: non-static variable playe
    rWeapon cannot be referenced from a static context
            player.playerEquipment[Client.playerWeapon] = -1;
                                         ^
    src\server\model\minigames\CastleWars.java:172: error: non-static variable playe
    rWeapon cannot be referenced from a static context
            player.playerEquipmentN[Client.playerWeapon] = 0;
                                          ^
    src\server\model\minigames\CastleWars.java:174: error: appearanceUpdateRequired
    has private access in Player
            player.appearanceUpdateRequired = true;
                  ^
    src\server\model\minigames\CastleWars.java:185: error: non-static variable playe
    rWeapon cannot be referenced from a static context
            if (player.playerEquipment[Client.playerWeapon] > 0) {
                                             ^
    src\server\model\minigames\CastleWars.java:210: error: non-static variable playe
    rWeapon cannot be referenced from a static context
            player.playerEquipment[Client.playerWeapon] = flagId;
                                         ^
    src\server\model\minigames\CastleWars.java:211: error: non-static variable playe
    rWeapon cannot be referenced from a static context
            player.playerEquipmentN[Client.playerWeapon] = 1;
                                          ^
    src\server\model\minigames\CastleWars.java:212: error: non-static variable playe
    rWeapon cannot be referenced from a static context
            player.getItems().updateSlot(Client.playerWeapon);
                                               ^
    src\server\model\minigames\CastleWars.java:213: error: appearanceUpdateRequired
    has private access in Player
            player.appearanceUpdateRequired = true;
                  ^
    src\server\model\minigames\CastleWars.java:521: error: non-static variable playe
    rCape cannot be referenced from a static context
            player.playerEquipment[Client.playerCape] = capeId;
                                         ^
    src\server\model\minigames\CastleWars.java:522: error: non-static variable playe
    rCape cannot be referenced from a static context
            player.playerEquipmentN[Client.playerCape] = 1;
                                          ^
    src\server\model\minigames\CastleWars.java:523: error: non-static variable playe
    rCape cannot be referenced from a static context
            player.getItems().updateSlot(Client.playerCape);
                                               ^
    src\server\model\minigames\CastleWars.java:524: error: appearanceUpdateRequired
    has private access in Player
            player.appearanceUpdateRequired = true;
                  ^
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    14 errors
    Press any key to continue . . .
    Im trying to add Cw but ive never had this error before. any ideas on how to fix?
    Thanks in advanced if you try.
    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
    It means that you're trying to access a variable statically, when it's clearly initialized as non-static. Some of the variables I see above should NOT be static, i.e "appearanceUpdateRequired, if you declared this as static you would be severely limiting it's use, I suggest not using this CW base, it was clearly designed by fucking waldo.
    Reply With Quote  
     

  3. Thankful user:



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. [PI] Non-static variable
    By Wonkster in forum Help
    Replies: 5
    Last Post: 06-20-2012, 12:51 AM
  2. Replies: 5
    Last Post: 09-18-2010, 12:08 AM
  3. [Rep++] non-static method error help
    By Slay No More in forum Help
    Replies: 1
    Last Post: 04-13-2010, 04:39 AM
  4. Replies: 5
    Last Post: 01-15-2009, 11:57 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
  •