-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommandTPReject.java
52 lines (43 loc) · 1.67 KB
/
CommandTPReject.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
48
49
50
51
52
package kdx7214.necessities;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
public class CommandTPReject extends CommandBaseNecessities {
public CommandTPReject() {
}
@Override
public String getCommandName()
{
return "tpreject";
}
@Override
public String getCommandUsage(ICommandSender par1ICommandSender)
{
return "/" + getCommandName() ;
}
@Override
public void processCommand(ICommandSender sender, String[] par2ArrayOfStr)
{
EntityPlayer player = getCommandSenderAsPlayer(sender) ;
NBTTagCompound playerdata = NecessitiesMain.instance.necessities_data.getCompoundTag(player.username) ;
NecessitiesMain.instance.necessities_data.setCompoundTag(player.username, playerdata) ;
NBTTagCompound tpa = playerdata.getCompoundTag("[Tpa]") ;
playerdata.setCompoundTag("[Tpa]", tpa) ;
String who = tpa.getString("Who") ;
EntityPlayerMP other = func_82359_c(sender, who) ;
other.sendChatToPlayer(player.username + " has rejected your teleport request.") ;
player.sendChatToPlayer("Teleport request from " + who + " rejected.") ;
tpa.removeTag("Who") ;
tpa.removeTag("PosX") ;
tpa.removeTag("PosY") ;
tpa.removeTag("PosZ") ;
tpa.removeTag("Yaw") ;
tpa.removeTag("Pitch") ;
tpa.removeTag("Dim") ;
}
@Override
public boolean canCommandSenderUseCommand(ICommandSender sender) {
return hasPermission(sender, "necessities.tpreject", false, false) ;
} // public boolean canCommandSenderUseCommand(...)
} // public class CommandReject