mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 17:18:37 +01:00
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:
parent
8954dff5d0
commit
2dc7208b82
@ -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('_', ' ');
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user