I need help on these errors I get, I don't know how to fix them. Can someone help me please.
errors:
theiving.java:6: <identifier> expected
public void theiving(playerId) {
^
theiving.java:8: illegal start of expression
public int stealtimer;
^
theiving.java:143: illegal start of type
if ((c.objectID == 4462))
^
theiving.java:143: <identifier> expected
if ((c.objectID == 4462))
^
theiving.java:160: illegal start of type
if ((c.objectID == 4463))
^
theiving.java:160: <identifier> expected
if ((c.objectID == 4463))
^
theiving.java:179: illegal start of type
if (c.NPCID == 7) { //THEIVING farmer
^
theiving.java:179: <identifier> expected
if (c.NPCID == 7) { //THEIVING farmer
^
theiving.java:186: illegal start of type
} else if (c.NPCID == 4) { //THEIVING woman
^
theiving.java:186: <identifier> expected
} else if (c.NPCID == 4) { //THEIVING woman
^
theiving.java:193: illegal start of type
} else if (c.NPCID == 15) { //THEIVING warrior gaurd
^
theiving.java:193: <identifier> expected
} else if (c.NPCID == 15) { //THEIVING warrior gaurd
^
theiving.java:200: illegal start of type
} else if (c.NPCID == 20) { //THEIVING pala
^
theiving.java:200: <identifier> expected
} else if (c.NPCID == 20) { //THEIVING pala
^
theiving.java:211: class, interface, or enum expected
}→
^
class:

import java.io.*;
import java.util.*;

public class theiving {

public void theiving(playerId) {
client c  = (client) server.playerHandler.players[playerId];
public int stealtimer;

public void TheifStall2(String stallName, String message, int lvlReq, int XPamount, int item, int itemAmount, int delay, int emote) {

 if(c.playerLevel[17] >= lvlReq) {
   c.setAnimation(emote);
   c.sendMessage(message);
   c.addItem(item, itemAmount);
   c.addSkillXP(XPamount, 17);
   c.actionTimer = delay;
  }
  else if(c.playerLevel[17] < lvlReq) {
  c.sendMessage("You need a theiving level of "+lvlReq+" to theif from this stall.");
  }
}

public void pickpocking() {
                	if(stealtimer <= 0 && c.EntangleDelay <= 0){      
if(misc.random(6) <= 3) {  
robman();
c.EntangleDelay = 4;
stealtimer = 15;
c.setAnimation(881);
c.updateRequired = true; 
c.appearanceupdateRequired = true;
} else if (misc.random(6) >= 4) {
robmanfail();
c.stillgfx(348, c.absY, c.absX, 100);
c.setAnimation(424);
c.sendMessage("you failed to pick-pock him!");
}
} else if(stealtimer >= 1) {
c.sendMessage("Slow down!");
} else if(c.EntangleDelay >= 1) {
c.sendMessage("You can't pick-pock now because you are stunned!");
}
}
public void pickpocking2() {
                	if(stealtimer <= 0 && c.EntangleDelay <= 0){      
if(misc.random(6) <= 3) {  
robfarmer();
c.EntangleDelay = 4;
stealtimer = 20;
c.setAnimation(881);
c.updateRequired = true; 
c.appearanceupdateRequired = true;
} else if (misc.random(6) >= 4) {
robmanfail();
c.stillgfx(348, c.absY, c.absX, 100);
c.setAnimation(424);
c.sendMessage("you failed to pick-pock her!");
}
} else if(stealtimer >= 1) {
c.sendMessage("Slow down!");
} else if(c.EntangleDelay >= 1) {
c.sendMessage("You can't pick-pock now because you are stunned!");
}
}
public void pickpocking3() {
                	if(stealtimer <= 0 && c.EntangleDelay <= 0){      
if(misc.random(6) <= 3) {  
robwoman();
c.EntangleDelay = 4;
stealtimer = 15;
c.setAnimation(881);
c.updateRequired = true; 
c.appearanceupdateRequired = true;
} else if (misc.random(6) >= 4) {
robmanfail();
c.stillgfx(348, c.absY, c.absX, 100);
c.setAnimation(424);
c.sendMessage("you failed to pick-pock her!");
}
} else if(stealtimer >= 1) {
c.sendMessage("Slow down!");
} else if(c.EntangleDelay >= 1) {
c.sendMessage("You can't pick-pock now because you are stunned!");
}
}
public void pickpocking4() {
                	if(stealtimer <= 0 && c.EntangleDelay <= 0){      
if(misc.random(6) <= 3) {  
robpala();
c.EntangleDelay = 4;
stealtimer = 15;
c.setAnimation(881);
c.updateRequired = true; 
c.appearanceupdateRequired = true;
} else if (misc.random(6) >= 4) {
robmanfail();
c.stillgfx(348, c.absY, c.absX, 100);
c.setAnimation(424);
c.sendMessage("you failed to pick-pock him!");
}
} else if(stealtimer >= 1) {
c.sendMessage("Slow down!");
} else if(c.EntangleDelay >= 1) {
c.sendMessage("You can't pick-pock now because you are stunned!");
}
}
    public void robman()
    {    
        c.sendMessage("You pickpocket the farmer");
        c.addItem(995, 100);
        c.addSkillXP(100, 17);
    }
    public void robmanfail()
    {    
        c.EntangleDelay = 30;
    }
    public void thieffail()
    {    
        c.EntangleDelay = 30;
    }
    public void robfarmer()
    {    
        c.sendMessage("You pickpocket the herbalist");
        c.addItem(Item.randomherb(), 1);
        c.addSkillXP(200, 17);

    }
    public void robwoman()
    {    
        c.sendMessage("You pickpocket the warrior woman");
        c.addItem(Item.randomfarm(), misc.random(3));
        c.addSkillXP(350, 17);

    }
    public void robpala()
    {    
        c.sendMessage("You pickpocket the paladin guard");
        c.addItem(Item.randomfly(), misc.random(12));
        c.addSkillXP(550, 17);
    }
//object stuff
if ((c.objectID == 4462))
{ 
if(c.actionTimer <= 0 && c.EntangleDelay <= 0) { 
if(misc.random(4) <= 2) {  
TheifStall2("table", "You Steal 50gp!", 1, 40, Item.randomarmour(), 50, 40, 0x340); // keep off plz ... i loot i
}else if (misc.random(4) >= 3) {
        thieffail();
	c.stillgfx(348, c.absY, c.absX, 100);
        c.setAnimation(424);
        c.sendMessage("you failed to steal from the table!");
}
} else if(c.actionTimer >= 1) {
	//c.sendMessage("Slow down!");
} else if(c.EntangleDelay >= 1) {
	c.sendMessage("You can't thief the table now because you are stunned!");
}
}
if ((c.objectID == 4463))
{ 
if(c.actionTimer <= 0 && c.EntangleDelay <= 0) { 
if(misc.random(4) <= 1) {  
TheifStall2("table", "You Steal 2 Rune Arrows", 1, 50, Item.randompot(), 2, 40, 0x340);
}else if (misc.random(4) >= 2) {
        thieffail();
	c.stillgfx(348, c.absY, c.absX, 100);
        c.setAnimation(424);
        c.sendMessage("you failed to steal from the table!");
	}
} else if(c.actionTimer >= 1) {
	//c.sendMessage("Slow down!");
} else if(c.EntangleDelay >= 1) {
	c.sendMessage("You can't thief the table now because you are stunned!");
}
}
//end of object stuff
//npc stuff
if (c.NPCID == 7) { //THEIVING farmer	
if(c.playerLevel[17] >= 30) {
c.PutNPCCoords = true;
pickpocking();
} else if(c.playerLevel[17] <= 29) {
c.sendMessage("You need a thieving lvl of 30 to pickpock the farmer");
}
} else if (c.NPCID == 4) { //THEIVING woman	
if(c.playerLevel[17] >= 45) {
c.PutNPCCoords = true;
pickpocking2();
} else if(c.playerLevel[17] <= 44) {
c.sendMessage("You need a thieving lvl of 45 to pickpock the woman");
}
} else if (c.NPCID == 15) { //THEIVING warrior gaurd	
if(c.playerLevel[17] >= 55) {
c.PutNPCCoords = true;
pickpocking3();
} else if(c.playerLevel[17] <= 54) {
c.sendMessage("You need a thieving lvl of 55 to pickpock the warrior woman");
}
} else if (c.NPCID == 20) { //THEIVING pala	
if(c.playerLevel[17] >= 65) {
c.PutNPCCoords = true;
pickpocking4();
} else if(c.playerLevel[17] <= 64) {
c.sendMessage("You need a thieving lvl of 65 to pickpock the paladin guard");
}
//end of npc stuff

}
}
}

Recommended Answers

All 4 Replies

To start with the class's constructor is wrong declared:
Right way:

class SomeClass {
  public SomeClass() {
  
  }
}

Wrong way:

class SomeClass {
  public [B]void [/B] SomeClass() {
  
  }
}

You're also trying to declare your methods inside that incorrect constructor. You cannot declare methods within methods.

I have fixed the errors and the handler works correctly. Thank you for those who tried to help, but a friend of mine helped me.

I take it he handed you just the same sollution as the answers as JavaAddict and Ezzaral?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.