mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-12 09:35:26 +02: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:
@@ -6,6 +6,7 @@ import com.earth2me.essentials.Essentials;
|
|||||||
import com.earth2me.essentials.ItemDb;
|
import com.earth2me.essentials.ItemDb;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@@ -41,6 +42,11 @@ public class Commandgive extends EssentialsCommand
|
|||||||
stack.setAmount(Integer.parseInt(args[2]));
|
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);
|
User giveTo = getPlayer(server, args, 0);
|
||||||
String itemName = stack.getType().name().toLowerCase().replace('_', ' ');
|
String itemName = stack.getType().name().toLowerCase().replace('_', ' ');
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
|
@@ -5,6 +5,7 @@ import com.earth2me.essentials.Essentials;
|
|||||||
import com.earth2me.essentials.ItemDb;
|
import com.earth2me.essentials.ItemDb;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
@@ -39,6 +40,11 @@ public class Commanditem extends EssentialsCommand
|
|||||||
stack.setAmount(Integer.parseInt(args[1]));
|
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('_', ' ');
|
String itemName = stack.getType().name().toLowerCase().replace('_', ' ');
|
||||||
user.charge(this);
|
user.charge(this);
|
||||||
user.sendMessage("§7Giving " + stack.getAmount() + " of " + itemName + " to " + user.getDisplayName() + ".");
|
user.sendMessage("§7Giving " + stack.getAmount() + " of " + itemName + " to " + user.getDisplayName() + ".");
|
||||||
|
Reference in New Issue
Block a user