protected void parsechatcmd(String cmd)
    {
        debug(cmd);
        String rcmd;
        Packet packet = new Packet();
        byte[] bytecmd = cmd.getBytes();
        int i = 0;
        while (bytecmd[i] != 0x20 && i < cmd.length() - 1)
        {
            i++;
        }

        if (i == cmd.length() - 1)
        {
            rcmd = cmd.substring(0, cmd.length());
        }
        else
        {
            rcmd = cmd.substring(0, i);
        }
        debug("rcmd : -" + rcmd + "-");

        if (rcmd.equals("kick") && isGM())
        {
            String chaname = cmd.substring(i + 1);
            if (lobby.kickPlayer(chaname, "Player " + chaname + " has been kicked by " + this.charname) == 0)
            {
                sendChatMsg("Player not found", 2);
            }
        }
        else
        {
            if (rcmd.equals("add") && isGM())
            {
                int anz = Integer.parseInt(cmd.substring(i + 1));
                lobby.createdummy(anz);
            }
            else
            {
                if (rcmd.equals("addroom") && isGM())
                {
                    int anz = Integer.parseInt(cmd.substring(i + 1));
                    lobby.createdummy(anz);
                }
                else
                {
                    if (rcmd.equals("coins"))
                    {
                        int anz = Integer.parseInt(cmd.substring(i + 1));
                        bot.setCoins((bot.getCoins() + anz));
                        sendChatMsg("Current coins : " + bot.getCoins(), 2);
                    }
                    else
                    {
                        if (rcmd.equals("gigas"))
                        {
                            int anz = Integer.parseInt(cmd.substring(i + 1));
                            bot.setGigas((bot.getGigas() + anz));
                            sendChatMsg("Current gigas : " + bot.getGigas(), 2);
                        }
                        else
                        {
                            if (rcmd.equals("delinvent"))
                            {
                                int part = Integer.parseInt(cmd.substring(i + 1));
                                if (part == 0)
                                {
                                    int[] items =
                                    {
                                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0
                                    };
                                    bot.setInventAll(items);
                                    sendChatMsg("Invetory deleted", 2);
                                }
                                else
                                {
                                    String old = item.getItemName(bot.getInvent(part - 1));
                                    bot.setInvent(0, part - 1);
                                    sendChatMsg("Inventory-item " + old + " deleted.", 2);
                                }

                            }
                            else
                            {
                                if (rcmd.equals("item") && isGM())
                                {
                                    int id = 0;
                                    if (cmd.substring(i + 1).matches("\\d*"))
                                    {
                                        id = Integer.parseInt(cmd.substring(i + 1));
                                    }
                                    else
                                    {
                                        id = item.getItemId(cmd.substring(i + 1));
                                    }
                                    if (id != 0)
                                    {
                                        int slot = shop.slotAvaible();
                                        if (slot != -1)
                                        {
                                            bot.setInvent(id, slot);
                                            sendChatMsg("Item " + item.getItemName(id) + " added at slot " + slot, 2);
                                        }
                                        else
                                        {
                                            sendChatMsg("Your inventory is full!", 2);
                                        }
                                    }
                                    else
                                    {
                                        sendChatMsg("Item not found!", 2);
                                    }
                                }
                                else
                                {
                                    if (rcmd.equals("itemname"))
                                    {
                                        int id = Integer.parseInt(cmd.substring(i + 1));
                                        String name = item.getItemName(id);
                                        if (name != null)
                                        {
                                            sendChatMsg("Found :", 2);
                                            sendChatMsg("- " + name, 2);
                                        }
                                        else
                                        {
                                            sendChatMsg("Item not found!", 2);
                                        }
                                    }
                                    else
                                    {
                                        if (rcmd.equals("itemid"))
                                        {
                                            String name = cmd.substring(i + 1);
                                            String id[] = item.getItemIdLike(name);
                                            if (id != null)
                                            {
                                                int found = Integer.parseInt(id[5]);
                                                int display;
                                                if (found > 5)
                                                {
                                                    display = 5;
                                                }
                                                else
                                                {
                                                    display = found;
                                                }
                                                if (display == 1)
                                                {
                                                    sendChatMsg("Found " + found + " item, displaying " + display + " item.", 2);
                                                }
                                                else
                                                {
                                                    sendChatMsg("Found " + found + " items, displaying " + display + " items.", 2);
                                                }
                                                for (int i2 = 0; i2 < display; i2++)
                                                {
                                                    sendChatMsg("- " + id[i2], 2);
                                                }
                                            }
                                            else
                                            {
                                                sendChatMsg("No item found!", 2);
                                            }
                                        }
                                        else
                                        {
                                            if (rcmd.equals("help"))
                                            {
                                                sendChatMsg("@dummy <amount>          - need gm rights", 2);
                                                sendChatMsg("@kick <charactername     - need gm rights>", 2);
                                                sendChatMsg("@coins <amount>", 2);
                                                sendChatMsg("@gigas <amount>", 2);
                                                sendChatMsg("@delinvent <part/0 for all>", 2);
                                                sendChatMsg("@itemname <itemid>", 2);
                                                sendChatMsg("@itemid <itemname>", 2);
                                                sendChatMsg("@item <itemid/itemname>  - need gm rights", 2);
                                            }
                                            else
                                            {
                                                if (rcmd.equals("refresh"))
                                                {
                                                    send(lobby.getlobbypacket());
                                                    sendChatMsg("Userlist refreshed", 2);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }