From 4fcf3fff0f3df7bf5461d09e95bba55ae2d3d2f0 Mon Sep 17 00:00:00 2001 From: Ghost_chu <2908803755@qq.com> Date: Sat, 21 Mar 2020 07:45:50 +0800 Subject: [PATCH] Apply IDEA IDE advice Former-commit-id: 07970ce620660350edfd70a4235de0abb42e9f82 --- .../org/maxgamer/quickshop/Shop/ContainerShop.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java b/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java index e02ebe28c..e58dc9ec9 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java @@ -197,8 +197,8 @@ public class ContainerShop implements Shop { if (amount1 < 0) { this.sell(p, -amount1); } + ItemStack[] contents = p.getInventory().getContents(); if (this.isUnlimited()) { - ItemStack[] contents = p.getInventory().getContents(); for (int i = 0; amount1 > 0 && i < contents.length; i++) { ItemStack stack = contents[i]; if (stack == null || stack.getType() == Material.AIR) { @@ -228,10 +228,9 @@ public class ContainerShop implements Shop { + "!"); } } else { - ItemStack[] playerContents = p.getInventory().getContents(); Inventory chestInv = this.getInventory(); - for (int i = 0; amount1 > 0 && i < playerContents.length; i++) { - ItemStack item = playerContents[i]; + for (int i = 0; amount1 > 0 && i < contents.length; i++) { + ItemStack item = contents[i]; if (item != null && this.matches(item)) { // Copy it, we don't want to interfere item = new ItemStack(item); @@ -241,7 +240,7 @@ public class ContainerShop implements Shop { // If Amount is item.getAmount(), then this sets the amount // to 0 // Else it sets it to the remainder - playerContents[i].setAmount(playerContents[i].getAmount() - stackSize); + contents[i].setAmount(contents[i].getAmount() - stackSize); // We can modify this, it is a copy. item.setAmount(stackSize); // Add the items to the players inventory @@ -250,7 +249,7 @@ public class ContainerShop implements Shop { } } // Now update the players inventory. - p.getInventory().setContents(playerContents); + p.getInventory().setContents(contents); this.setSignText(); } }