forked from regelneef/necessities
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandWand.java
More file actions
52 lines (38 loc) · 1.38 KB
/
CommandWand.java
File metadata and controls
52 lines (38 loc) · 1.38 KB
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
43
44
45
46
47
48
49
50
51
52
package kdx7214.necessities;
import com.jcraft.jorbis.Block;
import cpw.mods.fml.common.Loader;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class CommandWand extends CommandBaseNecessities {
public CommandWand() {
}
@Override
public String getCommandName()
{
return "wand";
}
@Override
public String getCommandUsage(ICommandSender par1ICommandSender)
{
return "/" + getCommandName() ;
}
@Override
public void processCommand(ICommandSender sender, String[] par2ArrayOfStr)
{
if (!(sender instanceof EntityPlayer || sender instanceof EntityPlayerMP))
return ;
assert(sender instanceof EntityPlayer) ;
EntityPlayer player = getCommandSenderAsPlayer(sender) ;
if (player.inventory.hasItem(NecessitiesMain.instance.WorldEditWandItem))
return ; // Player already has one
ItemStack it = new ItemStack(NecessitiesMain.instance.WorldEditWandItem, 1, 0) ;
player.inventory.addItemStackToInventory(it) ;
}
@Override
public boolean canCommandSenderUseCommand(ICommandSender sender) {
return hasPermission(sender, "necessities.wand", true, false) ;
} // public boolean canCommandSenderUseCommand(...)
} // public class CommandWhoAmI