Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

No more appendString, appendInt, appendShort or appendBoolean. Write only append.

Newbie Spellweaver
Joined
Nov 21, 2011
Messages
67
Reaction score
12
Hello ragezoners!

I was writting my HabboHotel emulator from sctach in java and i was bored, all the time writing appendString, appenX, appendY...

So i develop a snippet of code what do it for you, you only do...

Code:
ServerMessage.append("Hello World!");
ServerMessage.append(121);
ServerMessage.append(true);

Here is the code:
PHP:
    public void append(Object X){
        try {
            if (X instanceof Integer)
                send.writeInt((Integer) X);
            else if (X instanceof Short)
                send.writeShort((Short)X);
            else if (X instanceof String)
                send.writeUTF((String)X);
            else
                send.writeBoolean((Boolean) X);
        } catch(Exception e){
            System.err.println(e.getMessage());
        }
    }

You need to add this on your ServerMessage and edit the send of the name of the var in your servermessage.


THX for read the post x)!
 
Joined
Apr 27, 2008
Messages
446
Reaction score
168
Code:
public void append(int x)
{
     send.writeInt(x);
}
public void append(short x)
{
      send.writeShort(x);
}
public void append(string x)
{
     send.writeUTF(x);
}
public void append(bool x)
{
     send.writeBoolean(x);
}

That's cleaner
 
Back
Top