Merge pull request #2829 from DorCoMaNdO/master

Stop duplicate messages from abilities.
This commit is contained in:
t00thpick1 2016-03-17 19:38:55 -05:00
commit d579c9a2af
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.player.UserManager;
import com.gmail.nossr50.util.skills.SkillUtils;
import org.bukkit.inventory.EquipmentSlot;
public class PlayerListener implements Listener {
private final mcMMO plugin;
@ -427,7 +428,7 @@ public class PlayerListener implements Listener {
public void onPlayerInteractLowest(PlayerInteractEvent event) {
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;
}
@ -519,7 +520,7 @@ public class PlayerListener implements Listener {
public void onPlayerInteractMonitor(PlayerInteractEvent event) {
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;
}

View File

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