From 2dc7208b825553501691b8939773fd7495b16207 Mon Sep 17 00:00:00 2001 From: snowleo Date: Thu, 21 Apr 2011 10:08:44 +0000 Subject: [PATCH] Prevent to give air. git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1249 e251c2fe-e539-e718-e476-b85c1f46cddb --- .../src/com/earth2me/essentials/commands/Commandgive.java | 6 ++++++ .../src/com/earth2me/essentials/commands/Commanditem.java | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java index 534fe8641..569cf4481 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java @@ -6,6 +6,7 @@ import com.earth2me.essentials.Essentials; import com.earth2me.essentials.ItemDb; import com.earth2me.essentials.User; import org.bukkit.ChatColor; +import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -40,6 +41,11 @@ public class Commandgive extends EssentialsCommand if (args.length > 2 && Integer.parseInt(args[2]) > 0) { stack.setAmount(Integer.parseInt(args[2])); } + + if (stack.getType() == Material.AIR) { + sender.sendMessage(ChatColor.RED + "You can't give air."); + return; + } User giveTo = getPlayer(server, args, 0); String itemName = stack.getType().name().toLowerCase().replace('_', ' '); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java index 3331a8985..0a577892d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java @@ -5,6 +5,7 @@ import com.earth2me.essentials.Essentials; import com.earth2me.essentials.ItemDb; import com.earth2me.essentials.User; import org.bukkit.ChatColor; +import org.bukkit.Material; import org.bukkit.inventory.ItemStack; @@ -38,6 +39,11 @@ public class Commanditem extends EssentialsCommand if (args.length > 1 && Integer.parseInt(args[1]) > 0) { stack.setAmount(Integer.parseInt(args[1])); } + + if (stack.getType() == Material.AIR) { + user.sendMessage(ChatColor.RED + "You can't get air."); + return; + } String itemName = stack.getType().name().toLowerCase().replace('_', ' '); user.charge(this);