-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommandListOps.java
59 lines (45 loc) · 1.44 KB
/
CommandListOps.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
53
54
55
56
57
58
59
package kdx7214.necessities;
import java.util.Iterator;
import java.util.Set;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.src.ModLoader;
public class CommandListOps extends CommandBaseNecessities {
public CommandListOps() {
}
@Override
public String getCommandName()
{
return "listops";
}
@Override
public String getCommandUsage(ICommandSender par1ICommandSender)
{
return "/" + getCommandName() ;
}
@Override
public void processCommand(ICommandSender sender, String[] par2ArrayOfStr)
{
Set ops = ModLoader.getMinecraftServerInstance().getConfigurationManager().getOps();
if (ops.isEmpty()) {
sender.sendChatToPlayer("There are no ops in the set.") ;
return ;
}
String msg = "" ;
sender.sendChatToPlayer("Current OPs:") ;
Iterator i = ops.iterator() ;
while (i.hasNext()) {
msg += i.next() + " " ;
if (msg.length() > 100) {
sender.sendChatToPlayer(msg) ;
msg = "" ;
}
} // while(...)
sender.sendChatToPlayer(msg) ;
} // public void processCommand(...)
@Override
public boolean canCommandSenderUseCommand(ICommandSender sender) {
return hasPermission(sender, "necessities.listops", false, true) ;
} // public boolean canCommandSenderUseCommand(...)
} // public class CommandWhoAmI