Jump to content
  • 0
Sign in to follow this  
Asylum317

Error with commands

Question

A friend of mine sent me a source and when i got it, it had errors involving the commands, i can't figure it out and i asked him about it but he doesnt know where they came from either.

i am stupid and suck at servers so i could really use the help.


here is the error

[url]http://prntscr.com/5glqe9[/url]


and here is my commands if you need it

[url]http://up.ht/13luF11[/url]

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0
It's most likely caused by nesting issues (You either have too many or not enough of these: '}' ).

you should check the method above the moderatorCommands() method to see if your nesting is done properly.
It's likely that you just need to add another closing brace.

Share this post


Link to post
Share on other sites
  • 0
thanks for the reply, i have fixed some of the errors think now im stuck with this.

[url]http://prntscr.com/5gm71l[/url]


here is what that area of the code looks like


for(int i = 0; i < Config.MAX_PLAYERS; i++) {
if(PlayerHandler.players[i] != null) {
if(PlayerHandler.players

[i].playerName.equalsIgnoreCase(playerToTele)) {
Client c2 =

(Client)PlayerHandler.players[i];
c2.sendMessage("You have been

teleported to " + c.playerName);
c2.getPA().movePlayer(c.getX(),

c.getY(), c.heightLevel);
break;
}
}
}
} catch(Exception e) {
c.sendMessage("Player Must Be Offline.");
}
}
}
public void administratorCommands(Client c, String playerCommand) {
if (playerCommand.equalsIgnoreCase("bank")) {
c.getPA().openUpBank(c.bankingTab);
}
if (playerCommand.startsWith("endeven")) {
EventCheck.endEvent();
}

if (playerCommand.startsWith("currentevent")) {
String[] args = playerCommand.split(" ", 2);
if (args[1] != null)
EventCheck.currentEvent = Integer.parseInt(args

[1]);
}

Share this post


Link to post
Share on other sites
  • 0
Same deal again by the look of it. It thinks administratorCommands() is a part of your previous method, most likely due to improper nesting.

Slightly off topic but the java file you posted above looks quite messy,(I'm assuming it was like this when you downloaded it). I would recommend reformatting it to look cleaner and cut down the amount of lines it takes up(not to mention get rid of all the duplicate commands :P). Edited by A Duck Tale

Share this post


Link to post
Share on other sites
Sign in to follow this  

×