mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-06 02:51:32 +01:00
Fix NPE in /repair
This commit is contained in:
parent
06900e19f0
commit
313df9988d
@ -30,6 +30,10 @@ public class Commandrepair extends EssentialsCommand
|
|||||||
if (args[0].equalsIgnoreCase("hand"))
|
if (args[0].equalsIgnoreCase("hand"))
|
||||||
{
|
{
|
||||||
final ItemStack item = user.getItemInHand();
|
final ItemStack item = user.getItemInHand();
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
|
throw new Exception(Util.i18n("repairInvalidType"));
|
||||||
|
}
|
||||||
final String itemName = item.getType().toString().toLowerCase();
|
final String itemName = item.getType().toString().toLowerCase();
|
||||||
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess);
|
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess);
|
||||||
|
|
||||||
@ -84,6 +88,10 @@ public class Commandrepair extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
for (ItemStack item : items)
|
for (ItemStack item : items)
|
||||||
{
|
{
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
final String itemName = item.getType().toString().toLowerCase();
|
final String itemName = item.getType().toString().toLowerCase();
|
||||||
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess);
|
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess);
|
||||||
try
|
try
|
||||||
|
Loading…
Reference in New Issue
Block a user