summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands/Commandafk.java
blob: eb1ade4cda1f942370d2707183ae10147e2c95a0 (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
package com.earth2me.essentials.commands;

import org.bukkit.Server;
import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.User;


public class Commandafk extends EssentialsCommand
{
	public Commandafk()
	{
		super("afk");
	}

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

		if (parent.away.contains(user))
		{
			user.sendMessage("§7You are no longer marked as away.");
			server.broadcastMessage("§7" + user.getDisplayName() + " is no longer AFK");
			parent.away.remove(user);
			return;
		}

		user.sendMessage("§7You are now marked as away.");
		server.broadcastMessage("§7" + user.getDisplayName() + " is now AFK");
		parent.away.add(user);
	}
}