summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands/Commandpay.java
blob: 085f8febe9e5a731b7bf5bee2572b30f8857c218 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.earth2me.essentials.commands;

import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import com.earth2me.essentials.Essentials;
import org.bukkit.entity.Player;
import com.earth2me.essentials.User;
import com.earth2me.essentials.commands.EssentialsCommand;


public class Commandpay extends EssentialsCommand
{
	public Commandpay()
	{
		super("pay");
	}

	@Override
	public void run(Server server, Essentials parent, User user, String commandLabel, String[] args) throws Exception
	{

		int amount;
		try
		{
			amount = Integer.parseInt(args[1].replaceAll("[^0-9]", ""));
		}
		catch (Exception ex)
		{
			user.sendMessage("§cUsage: /" + commandLabel + " [player] [money]");
			return;
		}

		for (Player p : server.matchPlayer(args[0]))
		{
			User u = User.get(p);
			user.payUser(u, amount);
		}
	}


	
}