-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommandLimit.java
47 lines (38 loc) · 1.42 KB
/
CommandLimit.java
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
package kdx7214.necessities;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
public class CommandLimit extends CommandBaseNecessities {
public CommandLimit() {
}
@Override
public String getCommandName()
{
return "limit";
}
@Override
public String getCommandUsage(ICommandSender par1ICommandSender)
{
return "/" + getCommandName() + " [n]" ;
}
@Override
public void processCommand(ICommandSender sender, String[] var2)
{
if (var2.length != 1) {
sender.sendChatToPlayer(getCommandUsage(sender)) ;
return ;
}
EntityPlayer player = getCommandSenderAsPlayer(sender) ;
NBTTagCompound playerdata = NecessitiesMain.instance.necessities_data.getCompoundTag(player.username) ;
NecessitiesMain.instance.necessities_data.setCompoundTag(player.username, playerdata) ;
NBTTagCompound we = playerdata.getCompoundTag("[Worldedit]") ;
playerdata.setCompoundTag("[Worldedit]", we) ;
int x = Integer.parseInt(var2[0]) ;
we.setInteger("Limit", x) ;
sender.sendChatToPlayer("\u00a7dOnly " + x + " blocks will be changed.") ;
}
@Override
public boolean canCommandSenderUseCommand(ICommandSender sender) {
return hasPermission(sender, "necessities.limit", false, false) ;
} // public boolean canCommandSenderUseCommand(...)
} // public class CommandWhoAmI