1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00
Fixed the issue #825
This commit is contained in:
SoSeDiK 2019-02-23 22:45:06 +02:00
parent fab821742d
commit ad2ebaddc9

View File

@ -7,7 +7,6 @@ import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BrewingStand; import org.bukkit.block.BrewingStand;
import org.bukkit.block.Hopper; import org.bukkit.block.Hopper;
import org.bukkit.block.Skull; import org.bukkit.block.Skull;
@ -161,13 +160,12 @@ public class ItemListener implements Listener {
final Player p = e.getPlayer(); final Player p = e.getPlayer();
ItemStack item = e.getItem(); ItemStack item = e.getItem();
// water place under head bug fix // Fix for placing water on head
if (e != null && e.getPlayer() != null && e.getParentEvent().getAction() != null && e.getParentEvent().getAction() == Action.RIGHT_CLICK_BLOCK && e.getParentEvent().getBlockFace() != null && e.getPlayer().getInventory() != null && e.getPlayer().getInventory().getItemInMainHand() != null && e.getPlayer().getInventory().getItemInMainHand().getType() == Material.WATER_BUCKET) { if (e.getParentEvent().getAction() == Action.RIGHT_CLICK_BLOCK && item != null && item.getType() == Material.WATER_BUCKET) {
Location clicked = e.getClickedBlock().getLocation(); Location water = e.getClickedBlock().getRelative(e.getParentEvent().getBlockFace()).getLocation();
BlockFace f = e.getParentEvent().getBlockFace(); if ((p.getWorld().getBlockAt(water).getType() == Material.PLAYER_HEAD || p.getWorld().getBlockAt(water).getType() == Material.PLAYER_WALL_HEAD) && BlockStorage.hasBlockInfo(water)) {
Location water = new Location(clicked.getWorld(), clicked.getX() + f.getModX(), clicked.getY() + f.getModY(), clicked.getZ() + f.getModZ());
if (e.getPlayer().getLocation().getWorld().getBlockAt(water) != null && e.getPlayer().getLocation().getWorld().getBlockAt(water).getType() == Material.PLAYER_HEAD) {
e.setCancelled(true); e.setCancelled(true);
p.getWorld().getBlockAt(water).getState().update(true, false);
return; return;
} }
} }