From e82e88f48fd1debd0ff50c42a6a98c5e94fd4634 Mon Sep 17 00:00:00 2001 From: Jerom van der Sar Date: Wed, 15 May 2013 15:23:18 +0200 Subject: [PATCH] Added /invis, incremented version number to reflect latest changes --- appinfo.properties | 8 +-- buildnumber.properties | 4 +- src/config.yml | 2 +- .../Commands/Command_invis.java | 65 +++++++++++++++++++ src/plugin.yml | 2 +- 5 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 src/me/StevenLawson/TotalFreedomMod/Commands/Command_invis.java diff --git a/appinfo.properties b/appinfo.properties index 2c519743..023982bd 100644 --- a/appinfo.properties +++ b/appinfo.properties @@ -1,5 +1,5 @@ -#Wed, 15 May 2013 14:55:52 +0200 +#Wed, 15 May 2013 15:22:48 +0200 -program.VERSION=2.14 -program.BUILDNUM=186 -program.BUILDDATE=05/15/2013 02\:55 PM +program.VERSION=2.15 +program.BUILDNUM=190 +program.BUILDDATE=05/15/2013 03\:22 PM diff --git a/buildnumber.properties b/buildnumber.properties index 3e335259..644171f7 100644 --- a/buildnumber.properties +++ b/buildnumber.properties @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Wed May 15 14:55:52 CEST 2013 -build.number=187 +#Wed May 15 15:22:48 CEST 2013 +build.number=191 diff --git a/src/config.yml b/src/config.yml index 6aa940fc..b203f634 100644 --- a/src/config.yml +++ b/src/config.yml @@ -1,4 +1,4 @@ -# TotalFreedomMod v2.14 Configuration +# TotalFreedomMod v2.15 Configuration # by Madgeek1450 and DarthSalamon # Block placement prevention: diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_invis.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_invis.java new file mode 100644 index 00000000..7f43e97a --- /dev/null +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_invis.java @@ -0,0 +1,65 @@ +package me.StevenLawson.TotalFreedomMod.Commands; + +import java.util.ArrayList; +import java.util.List; +import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList; +import me.StevenLawson.TotalFreedomMod.TFM_Util; +import org.apache.commons.lang.StringUtils; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffectType; + + +@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH) +@CommandParameters(description = "Shows (optionally smites) invisisible players", usage = "/ (smite)") +public class Command_invis 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[0].equalsIgnoreCase("smite")) + { + smite = true; + } + else + { + return false; + } + } + + List players = new ArrayList(); + int smites = 0; + + for (Player p : server.getOnlinePlayers()) + { + if (p.hasPotionEffect(PotionEffectType.INVISIBILITY)) { + players.add(p.getName()); + if (smite && !TFM_SuperadminList.isUserSuperadmin(p)) + { + server.dispatchCommand(sender, "smite " + p.getName()); + smites++; + } + } + } + + if (players.isEmpty()) { + TFM_Util.playerMsg(sender, "There are no invisible players"); + return true; + } + + if (smite) + { + TFM_Util.playerMsg(sender, "Smitten " + smites + " players"); + } + else + { + TFM_Util.playerMsg(sender, "Invisble players (" + players.size() + "): " + StringUtils.join(players, ",")); + } + + + return true; + } +} \ No newline at end of file diff --git a/src/plugin.yml b/src/plugin.yml index 9c9bf182..4d0e70f9 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TotalFreedomMod main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod -version: 2.14 +version: 2.15 description: Plugin for the Total Freedom server. authors: [StevenLawson / Madgeek1450, JeromSar / DarthSalamon]