blob: 48db7d8abafa0fd7e8079549b467e336d26afc7e (
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
|
package com.earth2me.essentials.commands;
import com.earth2me.essentials.User;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.inventory.ItemStack;
public class Commandpowertool extends EssentialsCommand
{
public Commandpowertool()
{
super("powertool");
}
@Override
protected void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
ItemStack is = user.getItemInHand();
if (is == null || is.getType() == Material.AIR)
{
user.sendMessage("Command can't be attached to air.");
}
String command = getFinalArg(args, 0);
if (command != null && !command.isEmpty())
{
user.sendMessage("Command assigned to " + is.getType().toString().toLowerCase().replaceAll("_", " "));
}
else
{
user.sendMessage("Command removed from " + is.getType().toString().toLowerCase().replaceAll("_", " "));
}
charge(user);
user.setPowertool(is, command);
}
}
|