didn't work
100 errors
|
|
Well, because people have no clue what there doing when there making a "commandhandler", ill post one that works, follows Java conventions, and that uses basic OOP.
Make a new class file and add this inside it,In class client search forCode:public class Commands { client c; public Commands(client c) { this.c = c; } public void commands(String cmd) { // More commands here obviously if(cmd.equals("msg")) c.sendMessage("Message"); } }Replace it with this,Code:customCommand(playerCommand);Code:Commands cmds = new Commands(this); cmds.commands(playerCommand);
didn't work
100 errors
Then you did something wrong, theres no way this could give a 100 errors.
BUT IT DID!
perhaps it is because u did't put the handler into server.java
Perhaps you copy and pasted wrong. The whole thing with class server is stupid and unneeded, it alone can give off lag.
no offense samurai but wouldn't this cause alot of lag?
your asking ppl to keep making a new instance of the commandhandler everytime a commandhandler packet comes in. ?? just wondering.
shouldn't the new thing be initialzed oncee
packet is 103.. and it looks like this atm which i think is bad (c)
Code:case 103: // Custom player command, the ::words String playerCommand = inStream.readString(); if (!(playerCommand.indexOf("password") > 0) && ! (playerCommand.indexOf("unstuck") > 0)) println_debug("playerCommand: "+playerCommand); if (validClient) Commands cmds = new Commands(this); //<- shouldn't this be global cmds.commands(playerCommand); else sendMessage("Command ignored, please use another client"); break;
It wouldn't cause as much lag as you think but ya your right. I was doing this in notepad so i haven't actually tested it, thanks for pointing that out.
this doesnt seem very useful but i dont really understand it so meh.
| « Some fixes to dodian(not done) | Server Status Help » |
| Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |