mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Added /whohas
This commit is contained in:
parent
ee87d1147d
commit
93914370a1
@ -1,5 +1,5 @@
|
||||
#Thu, 04 Jul 2013 22:45:10 +0200
|
||||
#Thu, 04 Jul 2013 23:31:51 +0200
|
||||
|
||||
program.VERSION=2.21
|
||||
program.BUILDNUM=262
|
||||
program.BUILDDATE=07/04/2013 10\:45 PM
|
||||
program.BUILDNUM=266
|
||||
program.BUILDDATE=07/04/2013 11\:31 PM
|
||||
|
@ -1,3 +1,3 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Thu Jul 04 12:21:05 EDT 2013
|
||||
build.number=263
|
||||
#Thu Jul 04 23:31:51 CEST 2013
|
||||
build.number=267
|
||||
|
@ -0,0 +1,80 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Spy on commands", usage = "/<command> <item> [smite]", aliases="wh")
|
||||
public class Command_whohas extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
boolean smite = false;
|
||||
|
||||
if (args.length != 1)
|
||||
{
|
||||
if (args.length == 2 && args[1].equals("smite"))
|
||||
{
|
||||
smite = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Material material = Material.matchMaterial(args[0]);
|
||||
|
||||
if (material == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
material = Material.getMaterial(Integer.parseInt(args[0]));
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
}
|
||||
|
||||
if (material == null)
|
||||
{
|
||||
playerMsg("Invalid block: " + args[0], ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
List<String> players = new ArrayList<String>();
|
||||
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if (p.getInventory().contains(material))
|
||||
{
|
||||
players.add(p.getName());
|
||||
if (smite & !TFM_SuperadminList.isUserSuperadmin(p))
|
||||
{
|
||||
Command_smite.smite(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (players.isEmpty())
|
||||
{
|
||||
playerMsg("There are no players with that item");
|
||||
}
|
||||
else
|
||||
{
|
||||
playerMsg("Players with item " + material.name() + ": "+ StringUtils.join(players, ", "));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user