Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Sid Shakal 2016-03-17 19:53:03 -05:00
commit eb3f7568f2
2 changed files with 9 additions and 8 deletions

View File

@ -65,6 +65,7 @@ import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.adapter.SoundAdapter; import com.gmail.nossr50.util.adapter.SoundAdapter;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.skills.SkillUtils;
import org.bukkit.inventory.EquipmentSlot;
public class PlayerListener implements Listener { public class PlayerListener implements Listener {
private final mcMMO plugin; private final mcMMO plugin;
@ -427,7 +428,7 @@ public class PlayerListener implements Listener {
public void onPlayerInteractLowest(PlayerInteractEvent event) { public void onPlayerInteractLowest(PlayerInteractEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) { if (event.getHand() != EquipmentSlot.HAND || !UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) {
return; return;
} }
@ -519,7 +520,7 @@ public class PlayerListener implements Listener {
public void onPlayerInteractMonitor(PlayerInteractEvent event) { public void onPlayerInteractMonitor(PlayerInteractEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) { if (event.getHand() != EquipmentSlot.HAND || !UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) {
return; return;
} }

View File

@ -303,23 +303,23 @@ public class HerbalismManager extends SkillManager {
private void processGreenThumbPlants(BlockState blockState, boolean greenTerra) { private void processGreenThumbPlants(BlockState blockState, boolean greenTerra) {
Player player = getPlayer(); Player player = getPlayer();
PlayerInventory playerInventory = player.getInventory(); PlayerInventory playerInventory = player.getInventory();
ItemStack seed = null; Material seed = null;
switch (blockState.getType()) { switch (blockState.getType()) {
case CARROT: case CARROT:
seed = new ItemStack(Material.CARROT_ITEM); seed = Material.CARROT_ITEM;
break; break;
case CROPS: case CROPS:
seed = new ItemStack(Material.SEEDS); seed = Material.SEEDS;
break; break;
case NETHER_WARTS: case NETHER_WARTS:
seed = new ItemStack(Material.NETHER_STALK); seed = Material.NETHER_STALK;
break; break;
case POTATO: case POTATO:
seed = new ItemStack(Material.POTATO_ITEM); seed = Material.POTATO_ITEM;
break; break;
default: default:
@ -338,7 +338,7 @@ public class HerbalismManager extends SkillManager {
return; return;
} }
playerInventory.removeItem(seed); playerInventory.removeItem(new ItemStack(seed));
player.updateInventory(); // Needed until replacement available player.updateInventory(); // Needed until replacement available
new HerbalismBlockUpdaterTask(blockState).runTaskLater(mcMMO.p, 0); new HerbalismBlockUpdaterTask(blockState).runTaskLater(mcMMO.p, 0);
} }