Hello everybody i have a little problem with making a java command for program i have some code but i do not know how to continue i stuck in one place BTW the command i want to make is

/sendcash [username] [money] // how it looks like

I have this code

if (cmd.equals(AdminCommands[1])) {
            String player = scanner.next();
            String money = scanner.next();
            File folder = new File(player);
            File pFile = new File(folder, player + ".txt");
            File bFile = new File(folder, money + ".txt");
            if (pFile.exists() && bFile.exists()) {
                try {
                    Account playerAccount = new Account(player, money);
                    // Sending money code here ... how to transfer it ?
                } catch (Exception e) {
                    JOptionPane.showMessageDialog(null, "Username doesn't exist!");
                }
            }
        } else {
            LabelInfo.setText("Command doesn't exist!");
        }

So after the Account playerAccount ... i don't know how to continue to transfer the money...
Thanks for your time :)

use an instance of Scanner to read a line of Strings, and use these to choose between/perform your next actions.

I have change it to this but nothing happens when i run it ...

if (cmd.equals(AdminCommands[1])) {
            String player = scanner.next();
            int money = scanner.nextInt();
            File folder = new File(player);
            File pFile = new File(folder, player + ".txt");
            File bFile = new File(folder, money + ".txt");
            if (pFile.exists() && bFile.exists()) {
                try {
                    Account pAcc = new Account(player, money);
                    if(pAcc.admin != 1) {
                        try {
                            writer = new BufferedWriter(new FileWriter(bFile));
                            writer.write(player);
                        } catch (Exception e) {
                            e.printStackTrace();
                        } finally {
                            try {
                                writer.close();
                            } catch (Exception e) {
                            }
                        }
                        LabelInfo.setText("Money transfer complited ! ( " + money + " ) to ( " + pAcc.name + " )");
                    } else {
                        LabelInfo.setText("You can't transfer money to an admin!");
                    }
                } catch (Exception e) {
                    JOptionPane.showMessageDialog(null, "Username doesn't exist!");
                }
            }
        }

you are showing us a bit of code, that uses variables and it's members while we don't even have an idea what they represent, let alone whether there is a value, you even have this:

catch (Exception e) {
                            }

and you think we'll be much help to you?

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.