Prevent to give air.

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1249 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
snowleo 2011-04-21 10:08:44 +00:00
parent 8954dff5d0
commit 2dc7208b82
2 changed files with 12 additions and 0 deletions

View File

@ -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('_', ' ');

View File

@ -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);