blob: 730e7cd898b6bb134f88d8e6e9ca3b58d367c8d1 (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
package me.Danker.commands.warp;
import me.Danker.utils.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
public class WarpCommand extends CommandBase {
private boolean custom_command = false;
public String name;
public String destination;
/**
* A Command blueprint extending CommandBase that uses the name and sends the destination as "/warp {@link #destination}"
* @param name the name that the command is called as
* @param destination the location name that is sent
*/
public WarpCommand(String name, String destination) {
this.name = name;
this.destination = destination;
}
/**
* A Command blueprint extending CommandBase that uses the name and sends the destination as "/warp {@link #destination}"
* @param name the name that the command is called as
* @param destination the location name that is sent
* @param custom_command is the custom command should use the /warp format or send a custom command.
* Adds the "/" to the destination.
*/
public WarpCommand(String name, String destination, boolean custom_command) {
this.name = name;
this.destination = destination;
this.custom_command = custom_command;
}
/**
* Returns the commands name that is set in the constructor
*/
@Override
public String getCommandName() {
return name;
}
/**
* Returns the command usage for the builtin help
* @param sender the command sender
* @return "/" + the command name
*/
@Override
public String getCommandUsage(ICommandSender sender) {
return "/" + getCommandName();
}
@Override
public int getRequiredPermissionLevel() {
return 0;
}
/**
* The logic that is called when the command is executed
* Sends a message as the player containing "/warp {@link #destination}"
* @param sender the command sender
* @param args what is written after the command
*/
@Override
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
if (!Utils.inSkyblock) return;
if (custom_command) {
Minecraft.getMinecraft().thePlayer.sendChatMessage("/" + this.destination);
return;
}
Minecraft.getMinecraft().thePlayer.sendChatMessage("/warp " + this.destination);
}
}
|