summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-04-21 10:08:44 +0000
committersnowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-04-21 10:08:44 +0000
commit2dc7208b825553501691b8939773fd7495b16207 (patch)
tree69ad19657e1dbf2d3f61bc2ddc0190c8b0d7597a
parent8954dff5d0ac1e7c6b5778d2ff90d8ad33d55e28 (diff)
downloadEssentials-2dc7208b825553501691b8939773fd7495b16207.tar
Essentials-2dc7208b825553501691b8939773fd7495b16207.tar.gz
Essentials-2dc7208b825553501691b8939773fd7495b16207.tar.lz
Essentials-2dc7208b825553501691b8939773fd7495b16207.tar.xz
Essentials-2dc7208b825553501691b8939773fd7495b16207.zip
Prevent to give air.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1249 e251c2fe-e539-e718-e476-b85c1f46cddb
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandgive.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commanditem.java6
2 files changed, 12 insertions, 0 deletions
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);