From d40d5b461df87a012484832787294fbe206d59a5 Mon Sep 17 00:00:00 2001 From: Steven Lawson Date: Tue, 2 Jul 2013 19:08:31 -0400 Subject: [PATCH] Cleaned up Command_setl. Don't use server.dispatchCommand for things that can be done with the existing API! Fixed depreciation warnings on compile. --- appinfo.properties | 6 ++-- buildnumber.properties | 4 +-- .../Commands/Command_doom.java | 2 +- .../Commands/Command_setl.java | 31 +++++++++++++++++-- .../Commands/Command_smite.java | 2 +- .../TotalFreedomMod/TFM_PlayerData.java | 2 +- 6 files changed, 36 insertions(+), 11 deletions(-) diff --git a/appinfo.properties b/appinfo.properties index 49560a08..9a644a7e 100644 --- a/appinfo.properties +++ b/appinfo.properties @@ -1,5 +1,5 @@ -#Tue, 02 Jul 2013 22:29:05 +0200 +#Tue, 02 Jul 2013 19:01:31 -0400 program.VERSION=2.20 -program.BUILDNUM=239 -program.BUILDDATE=07/02/2013 10\:29 PM +program.BUILDNUM=242 +program.BUILDDATE=07/02/2013 07\:01 PM diff --git a/buildnumber.properties b/buildnumber.properties index a6f5be01..e8fd8781 100644 --- a/buildnumber.properties +++ b/buildnumber.properties @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Tue Jul 02 22:29:05 CEST 2013 -build.number=240 +#Tue Jul 02 19:01:31 EDT 2013 +build.number=243 diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_doom.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_doom.java index 6948c6fc..28000c87 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_doom.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_doom.java @@ -78,7 +78,7 @@ public class Command_doom extends TFM_Command p.getWorld().strikeLightning(p.getLocation()); // kill (if not done already) - p.setHealth(0); + p.setHealth(0.0); } }, 40L); // 2 seconds diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_setl.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_setl.java index 7c3a858d..ca6212b7 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_setl.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_setl.java @@ -6,14 +6,39 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH) -@CommandParameters(description = "Sets everyone World Edit Limit to 500.", usage = "/") +@CommandParameters(description = "Sets everyone's Worldedit block modification limit to 500.", usage = "/") public class Command_setl extends TFM_Command { @Override public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - server.dispatchCommand(sender, "wildcard gcmd ? /limit 500"); - TFM_Util.adminAction(sender.getName(), "Setting all online players block limit to 500.", true); + //server.dispatchCommand(sender, "wildcard gcmd ? /limit 500"); - Madgeek: No, no, hell no. + + TFM_Util.adminAction(sender.getName(), "Setting everyone's Worldedit block modification limit to 500.", true); + + for (final Player p : server.getOnlinePlayers()) + { + final boolean isOp = p.isOp(); + + if (!isOp) + { + p.setOp(true); + } + + server.dispatchCommand(p, "/limit 500"); + + if (!isOp) + { + server.getScheduler().runTaskLater(plugin, new Runnable() + { + @Override + public void run() + { + p.setOp(false); + } + }, 20L); + } + } return true; } diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_smite.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_smite.java index 320b9c64..595b00e0 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_smite.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_smite.java @@ -56,7 +56,7 @@ public class Command_smite extends TFM_Command } //Kill: - p.setHealth(0); + p.setHealth(0.0); return true; } diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_PlayerData.java b/src/me/StevenLawson/TotalFreedomMod/TFM_PlayerData.java index b54b6c24..0287a37a 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_PlayerData.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_PlayerData.java @@ -322,7 +322,7 @@ public class TFM_PlayerData LivingEntity oldmob = mob_thrower_queue.remove(0); if (oldmob != null) { - oldmob.damage(500); + oldmob.damage(500.0); } } }